Docs/Sparse Direct Solver (SuperLU)/slu.core.allocateDoubles
Back to Sparse Direct Solver (SuperLU)

slu.core.allocateDoubles

# SuperLUWasm

Syntax

slu.core.allocateDoubles(module, values, size?)

Description

# SuperLUWasm WebAssembly bindings for SuperLU, a library for the direct solution of large, sparse, nonsymmetric systems of linear equations. ## Overview SuperLU uses LU factorization with partial pivoting and triangular solves to compute the solution to sparse linear systems Ax = b. Key features include: - **Sparse LU Factorization**: Efficient factorization of sparse matrices - **Multiple Precisions**: Single (float32), double (float64), and complex variants - **Fill-Reducing Orderings**: Column permutations to minimize fill-in - **Numerical Stability**: Row permutations and equilibration - **Iterative Refinement**: Improve solution accuracy - **ILU Preconditioning**: Incomplete LU for iterative solvers ## Quick Start ```typescript import { loadSuperLUModule, solveSparseCSC } from 'superluwasm'; // 1. Load the WASM module (do this once at startup) await loadSuperLUModule(); // 2. Create a sparse matrix in CSC format const A = { m: 3, n: 3, values: new Float64Array([4, 1, 1, 3, 2, 5]), rowIndices: new Int32Array([0, 1, 1, 2, 0, 2]), colPointers: new Int32Array([0, 2, 4, 6]), dtype: 'float64' as const }; // 3. Solve Ax = b const b = new Float64Array([1, 2, 3]); const { x, statistics } = solveSparseCSC(A, b); console.log('Solution:', x); console.log('Time:', statistics.totalTime, 'ms'); ``` ## Matrix Formats SuperLU uses compressed sparse formats: - **CSC (Compressed Sparse Column)**: Native format, most efficient - **CSR (Compressed Sparse Row)**: Supported via automatic conversion ## High-Level API ### Solvers - - Solve Ax=b with CSC matrix - - Solve Ax=b with CSR matrix - - Solve A^T x = b - - Solve A^H x = b (complex) - - Full control over all options ### Triangular Solvers - - Solve with precomputed LU factors - - Transpose solve with LU - - Direct triangular solve (CSC) - - Direct triangular solve (CSR) ### Factorization - - Compute LU factorization - - Compute incomplete LU for preconditioning ### Module Loading - - Initialize the WASM module - - Get the loaded module - - Check if loaded - - Configure WASM location

Parameters

NameDescription
module- SuperLU WASM module
values- Initial values, or null for uninitialized allocation
size(optional)- Size to allocate (defaults to values.length)

Returns

number