PHP 8.2.30
Preview: numeric.py Size: 1.46 KB
/proc/self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/typing/tests/data/pass/numeric.py

"""
Tests for :mod:`numpy.core.numeric`.

Does not include tests which fall under ``array_constructors``.

"""

from __future__ import annotations

import numpy as np

class SubClass(np.ndarray):
    ...

i8 = np.int64(1)

A = np.arange(27).reshape(3, 3, 3)
B: list[list[list[int]]] = A.tolist()
C = np.empty((27, 27)).view(SubClass)

np.count_nonzero(i8)
np.count_nonzero(A)
np.count_nonzero(B)
np.count_nonzero(A, keepdims=True)
np.count_nonzero(A, axis=0)

np.isfortran(i8)
np.isfortran(A)

np.argwhere(i8)
np.argwhere(A)

np.flatnonzero(i8)
np.flatnonzero(A)

np.correlate(B[0][0], A.ravel(), mode="valid")
np.correlate(A.ravel(), A.ravel(), mode="same")

np.convolve(B[0][0], A.ravel(), mode="valid")
np.convolve(A.ravel(), A.ravel(), mode="same")

np.outer(i8, A)
np.outer(B, A)
np.outer(A, A)
np.outer(A, A, out=C)

np.tensordot(B, A)
np.tensordot(A, A)
np.tensordot(A, A, axes=0)
np.tensordot(A, A, axes=(0, 1))

np.isscalar(i8)
np.isscalar(A)
np.isscalar(B)

np.roll(A, 1)
np.roll(A, (1, 2))
np.roll(B, 1)

np.rollaxis(A, 0, 1)

np.moveaxis(A, 0, 1)
np.moveaxis(A, (0, 1), (1, 2))

np.cross(B, A)
np.cross(A, A)

np.indices([0, 1, 2])
np.indices([0, 1, 2], sparse=False)
np.indices([0, 1, 2], sparse=True)

np.binary_repr(1)

np.base_repr(1)

np.allclose(i8, A)
np.allclose(B, A)
np.allclose(A, A)

np.isclose(i8, A)
np.isclose(B, A)
np.isclose(A, A)

np.array_equal(i8, A)
np.array_equal(B, A)
np.array_equal(A, A)

np.array_equiv(i8, A)
np.array_equiv(B, A)
np.array_equiv(A, A)

Directory Contents

Dirs: 1 × Files: 31

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
7.28 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
766 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
393 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.36 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
916 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
970 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.92 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.04 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.34 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
174 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.65 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.46 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
420 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
299 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.30 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.54 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
595 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.30 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.59 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.65 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
640 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.46 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
750 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
60.43 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.40 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.61 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
96 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.01 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
462 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.09 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
150 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).