MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / GetSymmetricMatrix

Function GetSymmetricMatrix

linalg/sparsematrix.cpp:1433–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1431 }
1432
1433 shared_ptr<SparseMatrixSymmetric<double,double>>
1434 GetSymmetricMatrix (SparseMatrixTM<double> & mat)
1435 {
1436 Array<int> cnt(mat.Width());
1437 cnt = 0;
1438 for (int i = 0; i < mat.Height(); i++)
1439 for (int c : mat.GetRowIndices(i))
1440 if (c <= i)
1441 cnt[i]++;
1442
1443 auto symm = make_shared<SparseMatrixSymmetric<double>>(cnt);
1444
1445 for (int i = 0; i < mat.Height(); i++)
1446 for (int ci : Range(symm->GetRowIndices(i)))
1447 {
1448 symm -> GetRowIndices(i)[ci] = mat.GetRowIndices(i)[ci];
1449 symm -> GetRowValues(i)[ci] = mat.GetRowValues(i)[ci];
1450 }
1451
1452 return symm;
1453 }
1454
1455
1456 template <typename T>

Callers 1

RestrictMethod · 0.85

Calls 3

RangeFunction · 0.70
WidthMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected