Complex solveยค
We can also solve a system with complex entries. Here we consider the classical case for which the full matrix \(A\) is square, well-posed and materialised in memory.
import jax.numpy as jnp
import jax.random as jr
import lineax as lx
matrix = jr.normal(jr.PRNGKey(0), (3, 3), dtype=jnp.complex64)
vector = jr.normal(jr.PRNGKey(1), (3,), dtype=jnp.complex64)
operator = lx.MatrixLinearOperator(matrix)
solution = lx.linear_solve(operator, vector)
print(f"A=\n{matrix}\nb={vector}\nx={solution.value}")
A=
[[-1.8459436 -0.2744466j 0.02393756-0.03172905j 0.76815367-1.4444253j ]
[-1.0467293 +0.05608991j 1.0891742 -0.03264743j 0.7513123 +0.56285536j]
[ 0.38307396-1.0190808j 0.01203694-1.1971304j 0.19252291-0.26424018j]]
b=[0.23162952+0.3614433j 0.05800135+1.6094692j 0.8979094 +0.16941352j]
x=[-0.07652722-0.34397143j -0.22629777+1.0359733j 0.22135164-0.00880566j]