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

◆ fill_lower_and_upper() [2/2]

void fill_lower_and_upper ( const std::vector< double > & lapack_numbers,
DMatRR & lower,
DMatRR & upper )

Definition at line 126 of file lapack.cpp.

133{
134 int nrows = static_cast<int>(lower.numRows());
135 int ncols = static_cast<int>(upper.numColumns());
136 int min = static_cast<int>(lower.numColumns());
137 assert(min == static_cast<int>(upper.numRows()));
138
139 // At this point, lower and upper should be zero matrices.
140 assert(MatrixOps::isZero(lower));
141 assert(MatrixOps::isZero(upper));
142
143 const double* U = lapack_numbers.data();
144 for (size_t c = 0; c < upper.numColumns(); c++)
145 {
146 for (size_t r = 0; r <= c and r <= min; r++)
147 upper.entry(r, c) = *U++;
148 lower.entry(c, c) = 1;
149 for (size_t r = c+1 ; r <= lower.numColumns(); ++r)
150 lower.entry(r,c) = *U++;
151 }
152}
size_t numRows() const
Definition dmat.hpp:144
ElementType & entry(size_t row, size_t column)
Definition dmat.hpp:148
size_t numColumns() const
Definition dmat.hpp:145
bool isZero(const DMat< RT > &A)
const mpreal min(const mpreal &x, const mpreal &y)
Definition mpreal.h:2792

References DMat< ACoeffRing >::entry(), MatrixOps::isZero(), DMat< ACoeffRing >::numColumns(), and DMat< ACoeffRing >::numRows().

Referenced by Lapack::LU(), and Lapack::LU().