You are here: Symbol Reference > Sparse Namespace > Classes > TSparseMtx Class > public > Solve Method > TSparseMtx.Solve Method (TMtx, TMtx, TMtxType)
MtxVec VCL
ContentsIndex
PreviousUpNext
TSparseMtx.Solve Method (TMtx, TMtx, TMtxType)

Direct solve.

Pascal
procedure Solve(const B: TMtx; const X: TMtx; MtxType: TMtxType = mtGeneral); overload;

Solve the system A*X = B, where A is the calling matrix. The actual system being solved is defined by SparseSystem property. A is sparse and unsymmetric. It is based on the Unsymmetric MultiFrontal method, which factorizes PAQ into the product LU, where L and U are lower and upper triangular, respectively, and P are Q are permutation matrices. Both P and Q are chosen to reduce fill-in (new nonzeros in L and U that are not present in A). The permutation P has the dual role of reducing fill-in and maintaining numerical accuracy (via relaxed partial pivoting and row interchanges). 

The Solve method uses BLAS level 3 dgeem matrix multiply routine and takes full advantage of CPU specific optimized code and symmetric multiprocessing.

uses MtxExpr, MtxVecTee, Sparse; procedure Example; var x,b: Vector; SparseA: TSparseMtx; begin // load data SparseA.LoadFromMatrixFile('system.mtx'); b.LoadFromFile('coefficients.Vec'); // set solution size x.Size(b); // solve SparseA.SparseSolver := ssUmfPack; SparseA.Solve(b,x); //view solution ViewValues(x); end;
#include "MtxExpr.hpp" #include "Sparse.hpp" #include "MtxVecTee.hpp" void __fastcall Example() { sVector x,b; TSparseMtx *SparseA = new TSparseMtx(); try { // load data SparseA->LoadFromMatrixFile("system.mtx"); b->LoadFromFile("coefficients.Vec"); // set solution size x->Size(b); // solve SparseA->SparseSolver = ssUmfPack; SparseA->Solve(b,x); //view solution ViewValues(x); } __finally { delete SparseA; } }
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!