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

Method Factor

linalg/sparsecholesky.cpp:629–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

627
628 template <class TM>
629 void SparseCholeskyTM<TM> :: Factor ()
630 {
631 static Timer factor_timer("SparseCholesky::Factor");
632
633 static Timer timerb("SparseCholesky::Factor - B", NoTracing, NoTiming);
634 static Timer timerc("SparseCholesky::Factor - C", NoTracing, NoTiming);
635
636 RegionTimer reg (factor_timer);
637
638
639 int n = nused; // Height();
640 if (n > 2000){
641 cout << IM(4) << " factor " << flush;
642 }
643
644 // to avoid aliasing:
645 size_t * hfirstinrow = firstinrow.Addr(0);
646 size_t * hfirstinrow_ri = firstinrow_ri.Addr(0);
647 int * hrowindex2 = rowindex2.Addr(0);
648 TM * hlfact = lfact.Addr(0);
649
650 // enum { BS = 4 };
651 constexpr int BS=4;
652
653 Array<TM> sum(BS*maxrow);
654
655 // double flops1 = 0;
656 // double flops2 = 0;
657 // starttime1 = clock();
658
659 for (int i1 = 0; i1 < n; )
660 {
661 int last_same = i1;
662 while (last_same < n && blocknrs[last_same] == blocknrs[i1])
663 last_same++;
664
665 timerb.Start();
666
667 // same rows
668 int mi = last_same - i1;
669 int miBS = (mi / BS) * BS;
670
671 for (int jj = 0; jj < miBS; jj+=4)
672 {
673 for (int j2 = 0; j2 < 4; j2++)
674 if (n > 2000 && (i1+jj+j2) % 1000 == 999)
675 {
676 if ((i1+jj+j2) % 10000 == 9999)
677 cout << IM(4) << "+" << flush;
678 else
679 cout << IM(4) << "." << flush;
680 }
681
682 int nk = hfirstinrow[i1+jj+1]-hfirstinrow[i1+jj];
683 for (int k = 0; k < nk*BS; k++)
684 sum[k] = 0;
685
686 for (int i2 = 0; i2 < jj; i2++)

Callers

nothing calls this directly

Calls 5

IMClass · 0.85
AddrMethod · 0.80
StopMethod · 0.80
TransFunction · 0.50
CalcInverseFunction · 0.50

Tested by

no test coverage detected