# NDWasmAnalysis

## Namespace

#### NDWasmAnalysis

Description:

  - NDWasmAnalysis: Advanced Analysis, Stats, Spatial & Random Handles O(n log n) sorting, O(n*d^2) statistics, O(n^3) matrix properties, spatial clustering, and high-performance random sampling.

Source:
  - ndwasm_analysis.js, line 3

### Methods

#### (static) argsort(a) → {NDArray}

Description:

  - Returns the indices that would sort an array.

Source:
  - ndwasm_analysis.js, line 18

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Input array.

##### Returns:

Indices as Int32 NDArray.

Type
  NDArray

#### (static) cond(a, norm) → {number}

Description:

  - estimates the reciprocal condition number of matrix a.

Source:
  - ndwasm_analysis.js, line 127

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Input matrix.
`norm` | number | norm: 1 (1-norm) or Infinity (Infinity norm).

##### Returns:

result.

Type
  number

#### (static) corr(a) → {NDArray}

Description:

  - Computes the Pearson correlation matrix for a dataset of shape [n_samples, n_features].

Source:
  - ndwasm_analysis.js, line 78

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Data matrix.

##### Returns:

Correlation matrix of shape [d, d].

Type
  NDArray

#### (static) cov(a) → {NDArray}

Description:

  - Computes the covariance matrix for a dataset of shape [n_samples, n_features].

Source:
  - ndwasm_analysis.js, line 64

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Data matrix.

##### Returns:

Covariance matrix of shape [d, d].

Type
  NDArray

#### (static) eigenSym(a, computeVectors) → {Object}

Description:

  - Eigenvalue decomposition for symmetric matrices.

Source:
  - ndwasm_analysis.js, line 144

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Symmetric square matrix.
`computeVectors` | boolean | Whether to return eigenvectors.

##### Returns:

Type
  Object

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

Description:

  - Performs K-Means clustering in WASM memory.

Source:
  - ndwasm_analysis.js, line 187

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | NDArray | Data of shape [n_samples, d_features].
`k` | number | Number of clusters.
`maxIter` | number | Maximum iterations.

##### Returns:

Type
  Object

#### (static) kronecker()

Description:

  - Computes the Kronecker product C = A ⊗ B.

Source:
  - ndwasm_analysis.js, line 211

#### (static) norm(a, type) → {number}

Description:

  - Computes the matrix norm.

Source:
  - ndwasm_analysis.js, line 93

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Input matrix.
`type` | number | 1 (The maximum absolute column sum), 2 (Frobenius), Infinity (The maximum absolute row sum)

##### Returns:

The norm value.

Type
  number

#### (static) pairwiseDist(a, b) → {NDArray}

Description:

  - Computes pairwise Euclidean distances between two sets of vectors.

Source:
  - ndwasm_analysis.js, line 170

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Matrix of shape [m, d].
`b` | NDArray | Matrix of shape [n, d].

##### Returns:

Distance matrix of shape [m, n].

Type
  NDArray

#### (static) rank(a, tol) → {number}

Description:

  - Computes the rank of a matrix using SVD.

Source:
  - ndwasm_analysis.js, line 110

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Input matrix.
`tol` | number | Tolerance for singular values (0 for 1e-14).

##### Returns:

Integer rank of the matrix.

Type
  number

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

Description:

  - Finds the largest or smallest K elements and their indices. Complexity: O(n log k)

Source:
  - ndwasm_analysis.js, line 40

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | NDArray | Input array.
`k` | number | Number of elements to return.
`largest` | boolean | If true, find max elements; else min.

##### Returns:

Type
  Object