public static Vector operator /(Matrix A, Vector b)
{
if (A.Rows != b.Length)
throw new InvalidOperationException("Matrix row count does not match vector length!");
// LLS
if (A.Rows != A.Cols)
{
Matrix C = A.T * A;
Matrix L = C.Cholesky();
Vector d = (A.T * b).ToVector();
Vector z = Matrix.Forward(L, d);
Vector x = Matrix.Backward(L.T, z);
return x;
}
// regular solve
else
{
// need to be smarter here....
return ((A ^ -1) * b).ToVector();
}
}