Skip to content

solveGeneral

solveGeneral(aIn, bIn): Var

Defined in: linalg.js:210

Solve A X = B for a GENERAL square A, via LU.

solvePSD covers the symmetric positive-definite case more cheaply, but a structural equation model’s Σ(θ) = F(I−A)⁻¹ S (I−A)⁻ᵀ Fᵀ has to invert I−A, which is a matrix of directed paths and is not symmetric. Hence this.

The adjoint follows from X = A⁻¹B, so dX = −A⁻¹ dA X + A⁻¹ dB:

B̄ = A⁻ᵀ X̄, Ā = −B̄ Xᵀ

Parameters

aIn

Var | number[][]

square matrix (n × n)

bIn

Var | number[] | number[][]

(n × k) or (n)

Returns

Var

solution, shaped like b