Class NDArray

Multi dimensional array.

Implements

Attributes

conjugate: MethodWrapper<((a) => NDArray), {
    a: ArrOrAny;
}>

Complex conjugate

Type declaration

Type declaration

itemsize: number

Bytes per element

Transpose of the last two axes

nbytes: number

Total bytes consumed by the elements

ndim: number

Number of dimensions

shape: number[]
strides: number[]

Strides in bytes of a C-contiguous array

Binary logical operators

logical_and: Wrapper
logical_or: Wrapper
logical_xor: Wrapper

Binary operators

add: Wrapper
bitwise_and: Wrapper
bitwise_or: Wrapper
bitwise_shift_left: Wrapper
bitwise_shift_right: Wrapper
bitwise_xor: Wrapper
divide: Wrapper
divide_int: Wrapper
maximum: Wrapper
minimum: Wrapper
mod: Wrapper
multiply: Wrapper
pow: Wrapper
subtract: Wrapper

Casting

astype: MethodWrapper<((x, dtype, copy) => NDArray), {
    x: ArrOrAny;
} & {
    dtype: DType;
} & {
    copy: boolean;
}>

Type declaration

byteswap: ((inplace?) => NDArray)

Swaps the bytes of every element

Type declaration

to_device: ((device) => NDArray)

Does nothing (arrays always live on the "cpu")

Type declaration

tobytes: (() => Uint8Array)

Bytes of the array (little endian, C order)

Type declaration

    • (): Uint8Array
    • Returns Uint8Array

tofile: ((fid, sep?, format?) => void)

Writes the array to a file (binary, or text with sep)

Type declaration

    • (fid, sep?, format?): void
    • Parameters

      • fid: any
      • Optional sep: string
      • Optional format: string

      Returns void

tolist: (() => any)

Type declaration

    • (): any
    • Returns any

view: ((dtype?) => NDArray)

A new view of the same data, optionally with another dtype (bytes are reinterpreted, copy for dtype changes)

Type declaration

Comparison operators

allclose: MethodWrapper<((a, b, rtol?, atol?, equal_nan?) => boolean), {
    a: ArrayOrConstant;
} & {
    b: ArrayOrConstant;
} & {
    rtol: number;
} & {
    atol: number;
} & {
    equal_nan: boolean;
}>

Type declaration

    • (a, b, rtol?, atol?, equal_nan?): boolean
    • Parameters

      Returns boolean

equal: Wrapper
greater: Wrapper
greater_equal: Wrapper
isclose: MethodWrapper<((a, b, rtol?, atol?, equal_nan?) => NDArray), {
    a: ArrayOrConstant;
} & {
    b: ArrayOrConstant;
} & {
    rtol: number;
} & {
    atol: number;
} & {
    equal_nan: boolean;
}>

Type declaration

less: Wrapper
less_equal: Wrapper
not_equal: Wrapper

Cumulative

cumprod: MethodWrapper<((a, axis, dtype, out) => NDArray), {
    a: ArrOrAny;
} & {
    axis: number;
} & {
    dtype: DType;
} & {
    out: ArrOrAny;
}>

Type declaration

cumsum: MethodWrapper<((a, axis, dtype, out) => NDArray), {
    a: ArrOrAny;
} & {
    axis: number;
} & {
    dtype: DType;
} & {
    out: ArrOrAny;
}>

Type declaration

Elementwise operators

clip: Wrapper
conj: Wrapper

Indexing

choose: MethodWrapper<((a, choices, out, mode) => NDArray), {
    a: ArrOrAny;
} & {
    choices: NDArray | NDArray[];
} & {
    out: ArrOrAny;
} & {
    mode: IndexMode;
}>

Type declaration

compress: MethodWrapper<((condition, a, axis, out) => NDArray), {
    condition: ArrOrAny;
} & {
    a: ArrOrAny;
} & {
    axis: number;
} & {
    out: ArrOrAny;
}>

Type declaration

put: MethodWrapper<((a, ind, v, mode) => void), {
    a: ArrOrAny;
} & {
    ind: ArrOrAny;
} & {
    v: ArrOrAny;
} & {
    mode: IndexMode;
}>

Type declaration

take: MethodWrapper<((a, indices, axis, out, mode) => NDArray), {
    a: ArrOrAny;
} & {
    indices: ArrOrAny;
} & {
    axis: number;
} & {
    out: ArrOrAny;
} & {
    mode: IndexMode;
}>

Type declaration

Indexing / slicing

index: ((...where) => NDArray)

Type declaration

Linear algebra

dot: MethodWrapper<((a, b, out?) => NDArray), {
    a: ArrOrAny;
} & {
    b: ArrOrAny;
} & {
    out: ArrOrAny;
}>

Type declaration

trace: MethodWrapper<((a, offset, axis1, axis2, dtype, out) => NDArray), {
    a: ArrOrAny;
} & {
    offset: number;
} & {
    axis1: number;
} & {
    axis2: number;
} & {
    dtype: DType;
} & {
    out: ArrOrAny;
}>

Type declaration

Operators with assignment

add_assign: Wrapper
assign: Wrapper
bitwise_and_assign: Wrapper
bitwise_or_assign: Wrapper
bitwise_shift_left_assign: Wrapper
bitwise_shift_right_assign: Wrapper
divide_assign: Wrapper
divide_int_assign: Wrapper
logical_and_assign: Wrapper
logical_or_assign: Wrapper
maximum_assign: Wrapper
minimum_assign: Wrapper
mod_assign: Wrapper
multiply_assign: Wrapper
pow_assign: Wrapper
subtract_assign: Wrapper

Other

base: NDArray
device: string
flags: {
    aligned: boolean;
    c_contiguous: boolean;
    f_contiguous: boolean;
    owndata: boolean;
    writeable: boolean;
}

Type declaration

  • aligned: boolean
  • c_contiguous: boolean
  • f_contiguous: boolean
  • owndata: boolean
  • writeable: boolean
fromlist: ((A, dtype?) => NDArray)

Type declaration

Generic operator function. See GenericOperatorFunction for details.

setflags: ((...args) => void)

Type declaration

    • (...args): void
    • Parameters

      • Rest ...args: any[]

      Returns void

  • Returns a plain JS value for 0-d arrays, and the array itself otherwise

    Returns any

Reducers

all: Wrapper
any: Wrapper
argmax: Wrapper
argmin: Wrapper
max: Wrapper
mean: Wrapper
min: Wrapper
norm: Wrapper
prod: Wrapper
product: Wrapper
ptp: Wrapper
std: Wrapper
sum: Wrapper
var: Wrapper

Searching

nonzero: MethodWrapper<((a) => NDArray), {
    a: ArrOrAny;
}>

Type declaration

Type declaration

searchsorted: MethodWrapper<((a, v, side, sorter) => NDArray), {
    a: ArrOrAny;
} & {
    v: ArrOrAny;
} & {
    side: "left" | "right";
} & {
    sorter: ArrOrAny;
}>

Type declaration

Sorting

argpartition: MethodWrapper<((a, kth, axis) => NDArray), {
    a: ArrOrAny;
} & {
    kth: number | number[];
} & {
    axis: number;
}>

Type declaration

argsort: ((axis?) => NDArray)

Type declaration

    • (axis?): NDArray
    • Parameters

      • Optional axis: number | {
            axis?: number;
        }

      Returns NDArray

partition: ((kth, axis?) => void)

Partially sorts the array in place (it is a full sort)

Type declaration

    • (kth, axis?): void
    • Parameters

      • kth: number | number[]
      • Optional axis: number

      Returns void

Transformations

copy: (() => NDArray)

Type declaration

diagonal: MethodWrapper<((a, offset, axis1, axis2) => NDArray), {
    a: ArrOrAny;
} & {
    offset: number;
} & {
    axis1: number;
} & {
    axis2: number;
}>

Type declaration

    • (a, offset, axis1, axis2): NDArray
    • Parameters

      • a: NDArray
      • offset: number
      • axis1: number
      • axis2: number

      Returns NDArray

flatten: (() => NDArray)

Type declaration

ravel: (() => NDArray)

Type declaration

repeat: MethodWrapper<((a, repeats, axis) => NDArray), {
    a: ArrOrAny;
} & {
    repeats: number | number[] | NDArray;
} & {
    axis: number;
}>

Type declaration

reshape: ((shape, ...more_shape) => NDArray)

Type declaration

    • (shape, ...more_shape): NDArray
    • Parameters

      • shape: any
      • Rest ...more_shape: any[]

      Returns NDArray

resize: ((...shape) => void)

Changes the shape in place, repeating or dropping data as needed

Type declaration

    • (...shape): void
    • Parameters

      • Rest ...shape: any[]

      Returns void

sort: ((axis?) => NDArray)

Type declaration

    • (axis?): NDArray
    • Parameters

      • Optional axis: number | {
            axis?: number;
        }

      Returns NDArray

squeeze: MethodWrapper<((a, axis) => NDArray), {
    a: ArrOrAny;
} & {
    axis: number | number[];
}>

Type declaration

swapaxes: MethodWrapper<((arr, axisA, axisB) => NDArray), {
    a: ArrOrAny;
} & {
    axis1: number;
} & {
    axis2: number;
}>

Type declaration

transpose: ((...axes) => NDArray)

Type declaration

Transformations Transpose.

Unary logical operators

logical_not: Wrapper

Unary operators

abs: Wrapper
bitwise_not: Wrapper
negative: Wrapper
round: Wrapper

Generated using TypeDoc