Solve() public method

Solves a system of linear equation using the given matrix A.
public Solve ( MatrixValue b ) : MatrixValue
b MatrixValue The source vector b, i.e. A * x = b.
return MatrixValue
Beispiel #1
0
        public MatrixValue Function(MatrixValue M, MatrixValue phi)
        {
            if (M.IsSymmetric)
            {
                var cg = new CGSolver(M);
                return cg.Solve(phi);
            }
            else if (M.DimensionX == M.DimensionY && M.DimensionY > 64) // Is there a way to "guess" a good number for this?
            {
                var gmres = new GMRESkSolver(M);
                gmres.Restart = 30;
                return gmres.Solve(phi);
            }

            return M.Inverse() * phi;
        }
Beispiel #2
0
 public MatrixValue Function(MatrixValue A, MatrixValue x, MatrixValue b)
 {
     var cg = new CGSolver(A);
     cg.X0 = x;
     return cg.Solve(b);
 }