void SparseToBanded(TMtx *Dst, int MaxElemCount = 10000000);
Convert sparse matrix to banded matrix.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Dst | TMtx * | |
| 2 | MaxElemCount = 10000000 | int |
Remarks:
Convert calling matrix, stored in HB sparse matrix format, to banded matrix format. The result (banded matrix format) is stored in Dst matrix. The size and complex properties of Dst matrix are adjusted automatically.
Examples
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector SubDiag, SupDiag, MainDiag;
Matrix A;
SubDiag.Size(4);
SupDiag.Size(4);
MainDiag.Size(4);
A.Size(3, 4);
A.SubDiag = 1; // one subdiagonal
A.SuperDiag = 1; // one superdiagonal
SubDiag.SetIt(DewArray<double>{0, 1, 3, 2});
SupDiag.SetIt(DewArray<double>{-1, 2, 7, 0});
MainDiag.SetIt(DewArray<double>{2, 3, 5, 1});
A.SetRow(SupDiag, 0);
A.SetRow(MainDiag, 1);
A.SetRow(SubDiag, 2);
}
#include "MtxExpr.h"
#include "sparse.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector SubDiag, SupDiag, MainDiag;
Matrix A;
TSparseMtx* SparseA = new TSparseMtx();
SubDiag.Size(4);
SupDiag.Size(4);
MainDiag.Size(4);
A.Size(3, 4);
A.SubDiag = 1; // one subdiagonal
A.SuperDiag = 1; // one superdiagonal
SubDiag.SetIt(DewArray<double>{0, 1, 3, 2});
SupDiag.SetIt(DewArray<double>{-1, 2, 7, 0});
MainDiag.SetIt(DewArray<double>{2, 3, 5, 1});
A.SetRow(SupDiag, 0);
A.SetRow(MainDiag, 1);
A.SetRow(SubDiag, 2);
SparseA->BandedToSparse(A);
delete SparseA;
}
See Also: TSparseMtx::BandedToSparse
Declared in Dew::Math::TSparseMtx · Dew.Math/sparse.h · Cross-compiler