Macaulay2 Engine
Loading...
Searching...
No Matches

◆ computeLU() [1/5]

void DMatLUinPlace< M2::ARingCC >::computeLU ( )
inlineprivate

Definition at line 367 of file dmat-lu-inplace.hpp.

368{
369 if (mIsDone) return;
370
371 // std::cout << "computing LU decomposition ARingCC" << std::endl;
372 int rows = static_cast<int>(mLU.numRows());
373 int cols = static_cast<int>(mLU.numColumns());
374 int info;
375 int min = (rows <= cols) ? rows : cols;
376
377 if (min == 0)
378 return;
379
380 int* perm = new int[min];
382
383 zgetrf_(&rows, &cols, copyA.data(), &rows, perm, &info);
384
385 if (info < 0)
386 {
387 delete[] perm;
388 throw exc::engine_error("argument passed to zgetrf had an illegal value");
389 }
390
391 // Now copy back to row major order
393
394 // Now place the correct permutation into mPerm
395 for (int i = 0; i < min; i++)
396 {
397 int thisloc = perm[i] - 1;
398 if (i != thisloc)
399 {
400 mSign = not mSign;
401 size_t tmp = mPerm[thisloc];
402 mPerm[thisloc] = mPerm[i];
403 mPerm[i] = tmp;
404 }
405 }
406
408 mIsDone = true;
409
410 delete[] perm;
411}
std::vector< size_t > mPivotColumns
std::vector< size_t > mPerm
static void computePivotColumns(const Mat &LU, std::vector< size_t > &result_columns)
std::vector< double > make_lapack_array(const DMatRR &mat)
Definition lapack.cpp:20
void fill_from_lapack_array(const std::vector< double > &doubles, DMatRR &mat)
Definition lapack.cpp:45
int zgetrf_(int *rows, int *cols, double *M, int *ld, int *ipiv, int *info)