# NDArray

The NDArray class

## Constructor

#### new NDArray(data, options)

Source:
  - ndarray_core.js, line 34

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | TypedArray | The underlying physical storage.
`options` | Object | ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`shape` | Array | Int32Array |  |  | The dimensions of the array.
`strides` | Array | Int32Array | <optional> |  | The strides, defaults to C-style.
`offset` | number | <optional> | `0` | The view offset.
`dtype` | string | <optional> |  | The data type.

### Classes

NDArray

### Members

#### (static) optimize :NDWasmOptimize

Description:

  - Optimization module for linear programming, non-linear minimization, and linear regression.

Source:
  - ndarray_core.js, line 77

Optimization module for linear programming, non-linear minimization, and linear regression.

##### Type:

- NDWasmOptimize

### Methods

#### abs() → {NDArray}

Description:

  - Returns a new array with the absolute value of each element.

Source:
  - ndarray_core.js, line 470

##### Returns:

Type
  NDArray

#### add(other) → {NDArray}

Description:

  - Element-wise addition. Supports broadcasting.

Source:
  - ndarray_core.js, line 276

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to add.

##### Returns:

A new array containing the results.

Type
  NDArray

#### all() → {boolean}

Description:

  - Checks if all elements in the array are truthy.

Source:
  - ndarray_core.js, line 816

##### Returns:

Type
  boolean

#### any() → {boolean}

Description:

  - Checks if any element in the array is truthy.

Source:
  - ndarray_core.js, line 831

##### Returns:

Type
  boolean

#### argmax() → {number}

Description:

  - Returns the index of the maximum value in a flattened array.

Source:
  - ndarray_core.js, line 780

##### Returns:

Type
  number

#### argmin() → {number}

Description:

  - Returns the index of the minimum value in a flattened array.

Source:
  - ndarray_core.js, line 797

##### Returns:

Type
  number

#### argsort() → {NDArray}

Description:

  - Returns the indices that would sort the array. This is a wrapper around `NDWasmAnalysis.argsort`.

Source:
  - ndarray_core.js, line 1827
See:
  - NDWasmAnalysis.argsort

##### Returns:

An array of indices.

Type
  NDArray

#### asContiguous() → {NDArray}

Description:

  - Ensures the returned array has a contiguous memory layout. If the array is already contiguous, it returns itself. Otherwise, it returns a copy. Often used as a pre-processing step before calling WASM or other libraries.

Source:
  - ndarray_core.js, line 1071

##### Returns:

NDArray view.

Type
  NDArray

#### bitwise_and(other) → {NDArray}

Description:

  - bitwise AND. Returns a new array.

Source:
  - ndarray_core.js, line 399

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### bitwise_lshift(other) → {NDArray}

Description:

  - bitwise lshift. Returns a new array.

Source:
  - ndarray_core.js, line 432

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### bitwise_not() → {NDArray}

Description:

  - bitwise NOT. Returns a new array.

Source:
  - ndarray_core.js, line 453

##### Returns:

Type
  NDArray

#### bitwise_or(other) → {NDArray}

Description:

  - bitwise OR. Returns a new array.

Source:
  - ndarray_core.js, line 410

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### bitwise_rshift(other) → {NDArray}

Description:

  - bitwise (logical) rshift. Returns a new array.

Source:
  - ndarray_core.js, line 443

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### bitwise_xor(other) → {NDArray}

Description:

  - bitwise XOR. Returns a new array.

Source:
  - ndarray_core.js, line 421

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### ceil() → {NDArray}

Description:

  - Returns a new array with the smallest integer greater than or equal to each element.

Source:
  - ndarray_core.js, line 519

##### Returns:

Type
  NDArray

#### cholesky() → {NDArray}

Description:

  - Computes the Cholesky decomposition. This is a wrapper around `NDWasmDecomp.cholesky`.

Source:
  - ndarray_core.js, line 1709
See:
  - NDWasmDecomp.cholesky

##### Returns:

The lower triangular matrix L.

Type
  NDArray

#### colview(j) → {NDArray}

Description:

  - Returns a 1D view of the j-th column. Only applicable to 2D arrays.

Source:
  - ndarray_core.js, line 1017

##### Parameters:

Name | Type | Description
--- | --- | ---
`j` | number | The column index.

##### Returns:

A 1D NDArray view.

Type
  NDArray

#### cond(norm) → {number}

Description:

  - Estimates the reciprocal condition number of the matrix. This is a wrapper around `NDWasmAnalysis.cond`.

Source:
  - ndarray_core.js, line 1875
See:
  - NDWasmAnalysis.cond

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`norm` | number | `1` | The norm type.

##### Returns:

The reciprocal condition number.

Type
  number

#### conv2d(kernel, stride, padding) → {NDArray}

Description:

  - Performs 2D spatial convolution. This is a wrapper around `NDWasmSignal.conv2d`.

Source:
  - ndarray_core.js, line 1808
See:
  - NDWasmSignal.conv2d

##### Parameters:

Name | Type | Description
--- | --- | ---
`kernel` | NDArray | The convolution kernel.
`stride` | number | The stride.
`padding` | number | The padding.

##### Returns:

The convolved array.

Type
  NDArray

#### copy(the) → {NDArray}

Description:

  - Returns a new, contiguous array with the same data. O(n) operation. This converts any view (transposed, sliced) into a new array with a standard C-style memory layout.

Source:
  - ndarray_core.js, line 1058

##### Parameters:

Name | Type | Description
--- | --- | ---
`the` | string | undefined | target dtype

##### Returns:

NDArray view.

Type
  NDArray

#### correlate2d(kernel, stride, padding) → {NDArray}

Description:

  - Performs 2D spatial cross-correlation. This is a wrapper around `NDWasmSignal.correlate2d`.

Source:
  - ndarray_core.js, line 1818
See:
  - NDWasmSignal.correlate2d

##### Parameters:

Name | Type | Description
--- | --- | ---
`kernel` | NDArray | The correlation kernel.
`stride` | number | The stride.
`padding` | number | The padding.

##### Returns:

The correlated array.

Type
  NDArray

#### cos() → {NDArray}

Description:

  - Returns a new array with the cosine of each element.

Source:
  - ndarray_core.js, line 498

##### Returns:

Type
  NDArray

#### cov() → {NDArray}

Description:

  - Computes the covariance matrix. This is a wrapper around `NDWasmAnalysis.cov`.

Source:
  - ndarray_core.js, line 1843
See:
  - NDWasmAnalysis.cov

##### Returns:

The covariance matrix.

Type
  NDArray

#### cross(other) → {NDArray}

Description:

  - Cross Product. Only valid for 1D vectors of length 3.

Source:
  - ndarray_core.js, line 1408

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray |

##### Returns:

New NDArray of size 3.

Type
  NDArray

#### cumprod(axisopt) → {NDArray|number}

Description:

  - Computes the cumprod of elements along the specified axis.

Source:
  - ndarray_core.js, line 644

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` |

##### Returns:

Type
  NDArray | number

#### dct() → {NDArray}

Description:

  - Computes the 1D Discrete Cosine Transform. This is a wrapper around `NDWasmSignal.dct`.

Source:
  - ndarray_core.js, line 1798
See:
  - NDWasmSignal.dct

##### Returns:

The result of the DCT.

Type
  NDArray

#### div(other) → {NDArray}

Description:

  - Element-wise division. Supports broadcasting.

Source:
  - ndarray_core.js, line 306

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to divide by.

##### Returns:

A new array containing the results.

Type
  NDArray

#### dot(other) → {number}

Description:

  - Dot Product (Scalar Inner Product). Supports 1D arrays (vectors) only.

Source:
  - ndarray_core.js, line 1375

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray |

##### Returns:

Scalar result.

Type
  number

#### eigen() → {Object}

Description:

  - Computes the eigenvalues and eigenvectors of a general square matrix.

Source:
  - ndarray_core.js, line 1737
See:
  - NDWasmDecomp.eigen

##### Returns:

An object containing eigenvalues and eigenvectors.

Type
  Object

#### eigenSym(vectors) → {Object}

Description:

  - Computes the eigenvalue decomposition for a symmetric matrix. This is a wrapper around `NDWasmAnalysis.eigenSym`.

Source:
  - ndarray_core.js, line 1867
See:
  - NDWasmAnalysis.eigenSym

##### Parameters:

Name | Type | Description
--- | --- | ---
`vectors` | boolean | Whether to compute the eigenvectors.

##### Returns:

An object containing the eigenvalues and eigenvectors.

Type
  Object

#### eq(other) → {NDArray}

Description:

  - Element-wise equality comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 543

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### exp() → {NDArray}

Description:

  - Returns a new array with `e` raised to the power of each element.

Source:
  - ndarray_core.js, line 477

##### Returns:

Type
  NDArray

#### fft() → {NDArray}

Description:

  - Computes the 1D Fast Fourier Transform. This is a wrapper around `NDWasmSignal.fft`.

Source:
  - ndarray_core.js, line 1747
See:
  - NDWasmSignal.fft

##### This:

- {NDArray}

##### Returns:

Complex result with shape [..., 2].

Type
  NDArray

#### fft2() → {NDArray}

Description:

  - Computes the 2D Fast Fourier Transform. The input array must be 3D with shape [rows, cols, 2]. This is a wrapper around `NDWasmSignal.fft2`.

Source:
  - ndarray_core.js, line 1781
See:
  - NDWasmSignal.fft2

##### Returns:

2D Complex result, with the same shape as input.

Type
  NDArray

#### filter(predicateOrMask) → {NDArray}

Description:

  - Responsibility: Implements element-wise filtering. Returns a NEW 1D contiguous NDArray (Copy). Filters elements based on a predicate function or a boolean mask.

Source:
  - ndarray_core.js, line 1282

##### Parameters:

Name | Type | Description
--- | --- | ---
`predicateOrMask` | function | Array | NDArray | A function returning boolean, or an array/NDArray of the same shape/size containing truthy/falsy values.

##### Returns:

A new 1D NDArray containing the matched elements.

Type
  NDArray

#### flatten() → {NDArray}

Source:
  - ndarray_core.js, line 1362

##### Returns:

- new flatten view to the array

Type
  NDArray

#### floor() → {NDArray}

Description:

  - Returns a new array with the largest integer less than or equal to each element.

Source:
  - ndarray_core.js, line 526

##### Returns:

Type
  NDArray

#### ger(other) → {NDArray}

Description:

  - Computes the vector outer product. This is a wrapper around `NDWasmBlas.ger`.

Source:
  - ndarray_core.js, line 1656
See:
  - NDWasmBlas.ger

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | The other vector.

##### Returns:

The resulting matrix.

Type
  NDArray

#### get(…indices) → {number}

Description:

  - Gets a single element from the array. Note: This has higher overhead than batch operations. Use with care in performance-critical code.

Source:
  - ndarray_core.js, line 1082

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`indices` | number | <repeatable> | The indices of the element to get.

##### Returns:

Type
  number

#### gt(other) → {NDArray}

Description:

  - Element-wise greater-than comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 563

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### gte(other) → {NDArray}

Description:

  - Element-wise greater-than-or-equal comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 573

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### iadd(other) → {NDArray}

Description:

  - In-place element-wise addition.

Source:
  - ndarray_core.js, line 338

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to add.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### idiv(other) → {NDArray}

Description:

  - In-place element-wise division.

Source:
  - ndarray_core.js, line 368

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to divide by.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### ifft() → {NDArray}

Description:

  - Computes the 1D Inverse Fast Fourier Transform. This is a wrapper around `NDWasmSignal.ifft`.

Source:
  - ndarray_core.js, line 1755
See:
  - NDWasmSignal.ifft

##### This:

- {NDArray}

##### Returns:

Complex result with shape [..., 2].

Type
  NDArray

#### ifft2() → {NDArray}

Description:

  - 2D Inverse Complex-to-Complex Fast Fourier Transform. The input array must be 3D with shape [rows, cols, 2]. The transform is performed in-place. This is a wrapper around `NDWasmSignal.ifft2`.

Source:
  - ndarray_core.js, line 1791
See:
  - NDWasmSignal.ifft2

##### Returns:

2D Complex result, with the same shape as input.

Type
  NDArray

#### imod(other) → {NDArray}

Description:

  - In-place element-wise modulo.

Source:
  - ndarray_core.js, line 388

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar divisor.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### imul(other) → {NDArray}

Description:

  - In-place element-wise multiplication.

Source:
  - ndarray_core.js, line 358

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to multiply by.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### inv() → {NDArray}

Description:

  - Computes the multiplicative inverse of the matrix. This is a wrapper around `NDWasmDecomp.inv`.

Source:
  - ndarray_core.js, line 1681
See:
  - NDWasmDecomp.inv

##### Returns:

The inverted matrix.

Type
  NDArray

#### ipow(other) → {NDArray}

Description:

  - In-place element-wise exponentiation.

Source:
  - ndarray_core.js, line 378

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar exponent.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### isub(other) → {NDArray}

Description:

  - In-place element-wise subtraction.

Source:
  - ndarray_core.js, line 348

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to subtract.

##### Returns:

The modified array (`this`).

Type
  NDArray

#### iterate(callback)

Description:

  - Generic iterator that handles stride logic. It's slow. use map/reduce if you want to use jit.

Source:
  - ndarray_core.js, line 252
See:
  - NDArray#map

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function | A function called with `(value, index, flatPhysicalIndex)`, return true to exit early

#### jsMatMul(other) → {NDArray}

Description:

  - Matrix Multiplication in js. Operations: (M, K) @ (K, N) -> (M, N)

Source:
  - ndarray_core.js, line 1453

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray |

##### Returns:

New NDArray.

Type
  NDArray

#### jsMatVecMul(vec) → {NDArray}

Description:

  - Matrix-Vector Multiplication in js. Operation: (M, K) @ (K,) -> (M,)

Source:
  - ndarray_core.js, line 1512

##### Parameters:

Name | Type | Description
--- | --- | ---
`vec` | NDArray |

##### Returns:

New NDArray (Vector).

Type
  NDArray

#### kmeans(k, maxIter) → {Object}

Description:

  - Performs K-Means clustering. This is a wrapper around `NDWasmAnalysis.kmeans`.

Source:
  - ndarray_core.js, line 1894
See:
  - NDWasmAnalysis.kmeans

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | The number of clusters.
`maxIter` | number | The maximum number of iterations.

##### Returns:

An object containing the centroids, labels, and number of iterations.

Type
  Object

#### kronecker(other) → {NDArray}

Description:

  - Computes the Kronecker product. This is a wrapper around `NDWasmAnalysis.kronecker`.

Source:
  - ndarray_core.js, line 1664
See:
  - NDWasmAnalysis.kronecker

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | The other matrix.

##### Returns:

The result of the Kronecker product.

Type
  NDArray

#### log() → {NDArray}

Description:

  - Returns a new array with the natural logarithm (base e) of each element.

Source:
  - ndarray_core.js, line 512

##### Returns:

Type
  NDArray

#### logical_and(other) → {NDArray}

Description:

  - Element-wise logical AND. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 604

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### logical_not() → {NDArray}

Description:

  - Element-wise logical NOT. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 623

##### Returns:

Type
  NDArray

#### logical_or(other) → {NDArray}

Description:

  - Element-wise logical OR. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 614

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to perform the operation with.

##### Returns:

Type
  NDArray

#### lt(other) → {NDArray}

Description:

  - Element-wise less-than comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 583

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### lte(other) → {NDArray}

Description:

  - Element-wise less-than-or-equal comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 593

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### lu() → {NDArray}

Description:

  - Computes the LU decomposition. This is a wrapper around `NDWasmDecomp.lu`.

Source:
  - ndarray_core.js, line 1730
See:
  - NDWasmDecomp.lu

##### Returns:

The LU matrix.

Type
  NDArray

#### map(fnOrStr) → {NDArray}

Description:

  - High-performance element-wise mapping with jit compilation.

Source:
  - ndarray_core.js, line 231

##### Parameters:

Name | Type | Description
--- | --- | ---
`fnOrStr` | string | function | The function string to apply to each element, like 'Math.sqrt(${val})', or a lambda expression

##### Returns:

A new array with the results.

Type
  NDArray

#### matMul(other) → {NDArray}

Description:

  - Performs matrix multiplication. This is a wrapper around `NDWasmBlas.matMul`.

Source:
  - ndarray_core.js, line 1617
See:
  - NDWasmBlas.matMul

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | The right-hand side matrix.

##### Returns:

The result of the matrix multiplication.

Type
  NDArray

#### matMulBatch(other) → {NDArray}

Description:

  - Performs batched matrix multiplication. This is a wrapper around `NDWasmBlas.matMulBatch`.

Source:
  - ndarray_core.js, line 1633
See:
  - NDWasmBlas.matMulBatch

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | The right-hand side batch of matrices.

##### Returns:

The result of the batched matrix multiplication.

Type
  NDArray

#### matPow(k) → {NDArray}

Description:

  - Computes the matrix power. This is a wrapper around `NDWasmBlas.matPow`.

Source:
  - ndarray_core.js, line 1625
See:
  - NDWasmBlas.matPow

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | The exponent.

##### Returns:

The result of the matrix power.

Type
  NDArray

#### matVecMul(vec) → {NDArray}

Description:

  - Performs matrix-vector multiplication. This is a wrapper around `NDWasmBlas.matVecMul`.

Source:
  - ndarray_core.js, line 1641
See:
  - NDWasmBlas.matVecMul

##### Parameters:

Name | Type | Description
--- | --- | ---
`vec` | NDArray | The vector to multiply by.

##### Returns:

The resulting vector.

Type
  NDArray

#### max(axisopt) → {NDArray|number}

Description:

  - Returns the maximum value along the specified axis.

Source:
  - ndarray_core.js, line 664

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` |

##### Returns:

Type
  NDArray | number

#### mean(axisopt) → {NDArray|number}

Description:

  - Computes the arithmetic mean along the specified axis.

Source:
  - ndarray_core.js, line 654

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` |

##### Returns:

Type
  NDArray | number

#### min(axisopt) → {NDArray|number}

Description:

  - Returns the minimum value along the specified axis.

Source:
  - ndarray_core.js, line 674

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` |

##### Returns:

Type
  NDArray | number

#### mod(other) → {NDArray}

Description:

  - Element-wise modulo. Supports broadcasting.

Source:
  - ndarray_core.js, line 326

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar divisor.

##### Returns:

A new array containing the results.

Type
  NDArray

#### mul(other) → {NDArray}

Description:

  - Element-wise multiplication. Supports broadcasting.

Source:
  - ndarray_core.js, line 296

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to multiply by.

##### Returns:

A new array containing the results.

Type
  NDArray

#### neg() → {NDArray}

Description:

  - Returns a new array with the numeric negation of each element.

Source:
  - ndarray_core.js, line 462

##### Returns:

Type
  NDArray

#### neq(other) → {NDArray}

Description:

  - Element-wise inequality comparison. Returns a new boolean (uint8) array.

Source:
  - ndarray_core.js, line 553

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to compare with.

##### Returns:

Type
  NDArray

#### norm(type) → {number}

Description:

  - Computes the matrix norm. This is a wrapper around `NDWasmAnalysis.norm`.

Source:
  - ndarray_core.js, line 1851
See:
  - NDWasmAnalysis.norm

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | number | The type of norm to compute.

##### Returns:

The norm of the matrix.

Type
  number

#### pairwiseDist(other) → {NDArray}

Description:

  - Computes the pairwise distances between two sets of vectors. This is a wrapper around `NDWasmAnalysis.pairwiseDist`.

Source:
  - ndarray_core.js, line 1885
See:
  - NDWasmAnalysis.pairwiseDist

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | The other set of vectors.

##### Returns:

The distance matrix.

Type
  NDArray

#### pick(…specs)

Description:

  - Advanced Indexing (Fancy Indexing). Returns a physical COPY of the selected data using a JIT-compiled engine. Picks elements along each dimension. Note: unlike numpy, for advanced (fancy) indexing, output shape won't be reordered. Dim for 1-element advanced indexing won't be removed, either.

Source:
  - ndarray_core.js, line 1195

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`specs` | Array.<number> | TypedArray | number | null | undefined | <repeatable> | Index selectors. null/undefined means select all

#### pinv() → {NDArray}

Description:

  - Computes the Moore-Penrose pseudo-inverse of the matrix. This is a wrapper around `NDWasmDecomp.pinv`.

Source:
  - ndarray_core.js, line 1688
See:
  - NDWasmDecomp.pinv

##### Returns:

The pseudo-inverted matrix.

Type
  NDArray

#### pow(other) → {NDArray}

Description:

  - Element-wise exponentiation. Supports broadcasting.

Source:
  - ndarray_core.js, line 316

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar exponent.

##### Returns:

A new array containing the results.

Type
  NDArray

#### push() → {NDWasmArray}

Description:

  - push to wasm

Source:
  - ndarray_core.js, line 1592

##### Returns:

Type
  NDWasmArray

#### qr() → {Object}

Description:

  - Computes the QR decomposition. This is a wrapper around `NDWasmDecomp.qr`.

Source:
  - ndarray_core.js, line 1702
See:
  - NDWasmDecomp.qr

##### Returns:

An object containing the Q and R matrices.

Type
  Object

#### rank(tol) → {number}

Description:

  - Computes the rank of the matrix. This is a wrapper around `NDWasmAnalysis.rank`.

Source:
  - ndarray_core.js, line 1859
See:
  - NDWasmAnalysis.rank

##### Parameters:

Name | Type | Description
--- | --- | ---
`tol` | number | The tolerance for singular values.

##### Returns:

The rank of the matrix.

Type
  number

#### reshape(…newShape) → {NDArray}

Description:

  - Returns a new array with a new shape, without changing data. O(1) operation. This only works for contiguous arrays. If the array is not contiguous, you must call .copy() first.

Source:
  - ndarray_core.js, line 861

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`newShape` | number | <repeatable> | The new shape.

##### Returns:

NDArray view.

Type
  NDArray

#### rfft() → {NDArray}

Description:

  - Computes the 1D Real-to-Complex Fast Fourier Transform. This is a wrapper around `NDWasmSignal.rfft`.

Source:
  - ndarray_core.js, line 1763
See:
  - NDWasmSignal.rfft

##### This:

- {NDArray}

##### Returns:

Complex result with shape [..., 2].

Type
  NDArray

#### rifft(n) → {NDArray}

Description:

  - 1D Complex-to-Real Inverse Fast Fourier Transform. The input must be a complex array of shape [k, 2], where k is n/2 + 1. This is a wrapper around `NDWasmSignal.rifft`.

Source:
  - ndarray_core.js, line 1773
See:
  - NDWasmSignal.rifft

##### This:

- {NDArray}

##### Parameters:

Name | Type | Description
--- | --- | ---
`n` | number | Length of the original real signal.

##### Returns:

Real-valued time domain signal.

Type
  NDArray

#### round() → {NDArray}

Description:

  - Returns a new array with the value of each element rounded to the nearest integer.

Source:
  - ndarray_core.js, line 533

##### Returns:

Type
  NDArray

#### rowview(i) → {NDArray}

Description:

  - Returns a 1D view of the i-th row. Only applicable to 2D arrays.

Source:
  - ndarray_core.js, line 1003

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | number | The row index.

##### Returns:

A 1D NDArray view.

Type
  NDArray

#### set(value, …indices) → {NDArray}

Description:

  - Sets value(s) in the array using a unified, JIT-optimized engine. Supports scalar indexing, fancy (array) indexing, and NumPy-style broadcasting.

Source:
  - ndarray_core.js, line 1096

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`value` | number | Array | NDArray |  | The source data to assign.
`indices` | number | Array | null | <repeatable> | Indices for each dimension.

##### Returns:

Type
  NDArray

#### sin() → {NDArray}

Description:

  - Returns a new array with the sine of each element.

Source:
  - ndarray_core.js, line 491

##### Returns:

Type
  NDArray

#### slice(…specs) → {NDArray}

Description:

  - Returns a new view of the array sliced along each dimension. This implementation strictly follows NumPy's basic slicing logic.

Source:
  - ndarray_core.js, line 927

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`specs` | Array | number | null | undefined | <repeatable> | Slice parameters for each dimension. number: Scalar indexing. Picks a single element and reduces dimensionality (e.g., arr[0]). [start, end, step]: Range slicing (e.g., arr[start:end:step]). []/null/undefined: Selects the entire dimension (e.g., arr[:]).

##### Throws:

If a scalar index is out of bounds or step is zero.

Type
  Error

##### Returns:

A new O(1) view of the underlying data.

Type
  NDArray

#### solve(b) → {NDArray}

Description:

  - Solves a system of linear equations. This is a wrapper around `NDWasmDecomp.solve`.

Source:
  - ndarray_core.js, line 1674
See:
  - NDWasmDecomp.solve

##### Parameters:

Name | Type | Description
--- | --- | ---
`b` | NDArray | The right-hand side matrix or vector.

##### Returns:

The solution matrix.

Type
  NDArray

#### sqrt() → {NDArray}

Description:

  - Returns a new array with the square root of each element.

Source:
  - ndarray_core.js, line 484

##### Returns:

Type
  NDArray

#### squeeze(axis) → {NDArray}

Description:

  - Remove axes of length one from the shape. O(1) operation.

Source:
  - ndarray_core.js, line 1030

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`axis` | number | null | `null` | The axis to squeeze. If null, all axes of length 1 are removed.

##### Returns:

NDArray view.

Type
  NDArray

#### std(axisopt) → {NDArray|number}

Description:

  - Computes the standard deviation along the specified axis.

Source:
  - ndarray_core.js, line 712

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` | The axis to reduce.

##### Returns:

Type
  NDArray | number

#### sub(other) → {NDArray}

Description:

  - Element-wise subtraction. Supports broadcasting.

Source:
  - ndarray_core.js, line 286

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDArray | number | The array or scalar to subtract.

##### Returns:

A new array containing the results.

Type
  NDArray

#### sum(axisopt) → {NDArray|number}

Description:

  - Computes the sum of elements along the specified axis.

Source:
  - ndarray_core.js, line 634

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` |

##### Returns:

Type
  NDArray | number

#### svd() → {Object}

Description:

  - Computes the Singular Value Decomposition (SVD). This is a wrapper around `NDWasmDecomp.svd`.

Source:
  - ndarray_core.js, line 1695
See:
  - NDWasmDecomp.svd

##### Returns:

An object containing the U, S, and V matrices.

Type
  Object

#### syrk() → {NDArray}

Description:

  - Performs a symmetric rank-k update. This is a wrapper around `NDWasmBlas.syrk`.

Source:
  - ndarray_core.js, line 1648
See:
  - NDWasmBlas.syrk

##### Returns:

The resulting symmetric matrix.

Type
  NDArray

#### tan() → {NDArray}

Description:

  - Returns a new array with the tangent of each element.

Source:
  - ndarray_core.js, line 505

##### Returns:

Type
  NDArray

#### toArray() → {Array|number}

Description:

  - To JavaScript Array

Source:
  - ndarray_core.js, line 130

##### Returns:

the array

Type
  Array | number

#### toString() → {String}

Description:

  - Returns a string representation of the ndarray. Formats high-dimensional data with proper indentation and line breaks.

Source:
  - ndarray_core.js, line 166

##### Returns:

Type
  String

#### toWasm(runtime) → {WasmBuffer}

Description:

  - Projects the current ndarray to a WASM proxy (WasmBuffer).

Source:
  - ndarray_core.js, line 1566

##### Parameters:

Name | Type | Description
--- | --- | ---
`runtime` | WasmRuntime |

##### Returns:

A WasmBuffer instance representing the NDArray in WASM memory.

Type
  WasmBuffer

#### topk(k, largest) → {Object}

Description:

  - Finds the top K largest or smallest elements. This is a wrapper around `NDWasmAnalysis.topk`.

Source:
  - ndarray_core.js, line 1836
See:
  - NDWasmAnalysis.topk

##### Parameters:

Name | Type | Description
--- | --- | ---
`k` | number | The number of elements to find.
`largest` | boolean | Whether to find the largest or smallest elements.

##### Returns:

An object containing the values and indices of the top K elements.

Type
  Object

#### trace() → {number}

Description:

  - Calculates the trace of a 2D square matrix (sum of diagonal elements). Complexity: O(n)

Source:
  - ndarray_core.js, line 1606

##### Throws:

If the array is not 2D or not a square matrix.

Type
  Error

##### Returns:

The sum of the diagonal elements.

Type
  number

#### transpose(…axes) → {NDArray}

Description:

  - Returns a new view of the array with axes transposed. O(1) operation.

Source:
  - ndarray_core.js, line 889

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`axes` | number | <repeatable> | The new order of axes, e.g., [1, 0] for a matrix transpose. If not specified, reverses the order of the axes.

##### Returns:

NDArray view.

Type
  NDArray

#### var(axisopt) → {NDArray|number}

Description:

  - Computes the variance along the specified axis. Note: This implementation uses a two-pass approach (mean first, then squared differences). Ensure that the `sub` method supports broadcasting if `axis` is not null.

Source:
  - ndarray_core.js, line 687

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`axis` | number | null | <optional> | `null` | The axis to reduce.

##### Returns:

Type
  NDArray | number