koblas

UmfpackFactorization

UMFPACK's numeric factors, behind koblas's SparseFactorization.

This class is the payoff from making that a interface rather than a class. UMFPACK hands back a void *Numeric and will not describe what is inside it, so there is no way to express these factors in the shared packed format the dense side uses — a seam demanding a concrete SparseLu could never have admitted a host solver at all. Here the opaque handle simply is the implementation's state.

Holds its matrix alive on purpose: umfpack_di_solve takes Ap, Ai and Ax alongside the factors, because it performs its own iterative refinement and the residual needs the original A. Dropping the matrix would leave the factorization unable to solve.

Native memory. The factors are UMFPACK's own allocation, so they outlive the JVM's heap accounting and have to be released explicitly. A Cleaner does it when this object becomes unreachable, which keeps SparseFactorization free of a close() that koblas's own portable factorization would have no use for. The trade is that release is not deterministic: a program churning through large factorizations in a tight loop holds native memory until GC notices. If that ever matters, the answer is an explicit close on this class rather than on the interface.

Properties

failedAt

open override val failedAt: Int(source)

The pivot position that had no numerically acceptable candidate, or NOT_SINGULAR when the factorization succeeded.

The same convention com.eignex.koblas.dense.LuDecomposition reports, and the position is the actionable half: a simplex whose basis went singular can use it to choose which column to replace.

n

open override val n: Int(source)

The dimension of the factored matrix.

nnz

open override val nnz: Int(source)

Nonzeros in the factors — the fill. Zero for a singular factorization, which has none.

Link copied to clipboard
open val singular: Boolean

Whether the factorization failed for want of a numerically acceptable pivot. Derived from failedAt, so the two cannot disagree.

Functions

determinant

open override fun determinant(): Double(source)

det(B) from UMFPACK, which reports it as a mantissa and a base-10 exponent to survive the range a sparse determinant can reach — the product of n pivots overflows a double long before n is large.

Recombining them here can still overflow to infinity for a big matrix, which is the honest answer for a value that does not fit; a caller needing more should read the pieces from UMFPACK directly.

solveInto

open override fun solveInto(b: DoubleArray, out: DoubleArray, transpose: Boolean = false, workspace: Workspace? = null): DoubleArray(source)

Solve B x = b, or Bᵀ x = b when transpose, into out, which is returned.

The two directions are a simplex's FTRAN and BTRAN. Allocates nothing when given a workspace, so an iteration that owns its destination runs without touching the collector. out may be b.

Link copied to clipboard
open fun solve(b: DoubleArray, transpose: Boolean = false): DoubleArray

Solve B x = b, or Bᵀ x = b when transpose, into a fresh result.