# 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 467

##### Returns:

Type
  NDArray

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

Description:

  - Element-wise addition. Supports broadcasting.

Source:
  - ndarray_core.js, line 273

##### 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 799

##### Returns:

Type
  boolean

#### any() → {boolean}

Description:

  - Checks if any element in the array is truthy.

Source:
  - ndarray_core.js, line 809

##### Returns:

Type
  boolean

#### argmax() → {number}

Description:

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

Source:
  - ndarray_core.js, line 777

##### Returns:

Type
  number

#### argmin() → {number}

Description:

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

Source:
  - ndarray_core.js, line 787

##### 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 1612
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 1044

##### Returns:

NDArray view.

Type
  NDArray

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

Description:

  - bitwise AND. Returns a new array.

Source:
  - ndarray_core.js, line 396

##### 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 429

##### 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 450

##### Returns:

Type
  NDArray

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

Description:

  - bitwise OR. Returns a new array.

Source:
  - ndarray_core.js, line 407

##### 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 440

##### 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 418

##### 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 516

##### Returns:

Type
  NDArray

#### cholesky() → {NDArray}

Description:

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

Source:
  - ndarray_core.js, line 1494
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 990

##### 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 1660
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 1593
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 1031

##### 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 1603
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 495

##### Returns:

Type
  NDArray

#### cov() → {NDArray}

Description:

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

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

##### Returns:

The covariance matrix.

Type
  NDArray

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

Description:

  - Computes the cumprod of elements along the specified axis.

Source:
  - ndarray_core.js, line 641

##### 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 1583
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 303

##### Parameters:

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

##### Returns:

A new array containing the results.

Type
  NDArray

#### eigen() → {Object}

Description:

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

Source:
  - ndarray_core.js, line 1522
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 1652
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 540

##### 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 474

##### Returns:

Type
  NDArray

#### fft() → {Object}

Description:

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

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

##### This:

- {{NDArray}}

##### Returns:

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

Type
  Object

#### 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 1566
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 1255

##### 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 1335

##### 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 523

##### Returns:

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 1441
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 1055

##### 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 560

##### 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 570

##### 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 335

##### 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 365

##### Parameters:

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

##### Returns:

The modified array (`this`).

Type
  NDArray

#### ifft() → {Object}

Description:

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

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

##### This:

- {{NDArray}}

##### Returns:

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

Type
  Object

#### 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 1576
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 385

##### 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 355

##### 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 1466
See:
  - NDWasmDecomp.inv

##### Returns:

The inverted matrix.

Type
  NDArray

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

Description:

  - In-place element-wise exponentiation.

Source:
  - ndarray_core.js, line 375

##### 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 345

##### 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 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)`.

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

Description:

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

Source:
  - ndarray_core.js, line 1679
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 1449
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 509

##### Returns:

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 601

##### 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 620

##### Returns:

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 611

##### 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 580

##### 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 590

##### 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 1515
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

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

Description:

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

Source:
  - ndarray_core.js, line 1410
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 1426
See:
  - NDWasmBlas.matVecMul

##### Parameters:

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

##### Returns:

The resulting vector.

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 1402
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 1418
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

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

Description:

  - Returns the maximum value along the specified axis.

Source:
  - ndarray_core.js, line 661

##### 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 651

##### 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 671

##### 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 323

##### 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 293

##### 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 459

##### Returns:

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 550

##### 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 1636
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 1670
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 1168

##### 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 1473
See:
  - NDWasmDecomp.pinv

##### Returns:

The pseudo-inverted matrix.

Type
  NDArray

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

Description:

  - Element-wise exponentiation. Supports broadcasting.

Source:
  - ndarray_core.js, line 313

##### 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 1377

##### Returns:

Type
  NDWasmArray

#### qr() → {Object}

Description:

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

Source:
  - ndarray_core.js, line 1487
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 1644
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 834

##### Parameters:

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

##### Returns:

NDArray view.

Type
  NDArray

#### rfft() → {Object}

Description:

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

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

##### This:

- {{NDArray}}

##### Returns:

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

Type
  Object

#### 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 1558
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 530

##### 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 976

##### 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 1069

##### 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 488

##### 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 900

##### 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 1459
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 481

##### Returns:

Type
  NDArray

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

Description:

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

Source:
  - ndarray_core.js, line 1003

##### 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 709

##### 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 283

##### 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 631

##### 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 1480
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 1433
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 502

##### 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 1351

##### 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 1621
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 1391

##### 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 862

##### 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 684

##### Parameters:

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

##### Returns:

Type
  NDArray | number