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

◆ fill_lower_and_upper() [1/2]

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

Definition at line 154 of file lapack.cpp.

161{
162 auto& ring = lower.ring();
163 int nrows = static_cast<int>(lower.numRows());
164 int ncols = static_cast<int>(upper.numColumns());
165 int min = static_cast<int>(lower.numColumns());
166 assert(min == static_cast<int>(upper.numRows()));
167
168 // At this point, lower and upper should be zero matrices.
169 assert(MatrixOps::isZero(lower));
170 assert(MatrixOps::isZero(upper));
171
172 const double* U = lapack_numbers.data();
173 for (size_t c = 0; c < upper.numColumns(); c++)
174 {
175 for (size_t r = 0; r <= c and r <= min; r++)
176 {
177 double re = *U++;
178 double im = *U++;
179 ring.set_from_doubles(upper.entry(r, c), re, im);
180 // upper.entry(r, c).re = *U++;
181 // upper.entry(r, c).im = *U++;
182 }
183 ring.set_from_long(lower.entry(c, c), 1);
184 for (size_t r = c+1 ; r <= lower.numColumns(); ++r)
185 {
186 double re = *U++;
187 double im = *U++;
188 ring.set_from_doubles(lower.entry(r, c), re, im);
189 // lower.entry(r,c).re = *U++;
190 // lower.entry(r,c).im = *U++;
191 }
192 }
193}
size_t numRows() const
Definition dmat.hpp:144
ElementType & entry(size_t row, size_t column)
Definition dmat.hpp:148
const ACoeffRing & ring() const
Definition dmat.hpp:143
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(), DMat< ACoeffRing >::numRows(), and DMat< ACoeffRing >::ring().