16 template <
typename MatrixType>
27 MatrixType::RowsAtCompileTime>
38 MatrixQType
q =
cod.householderQ();
46 t.topLeftCorner(rank, rank) =
47 cod.matrixT().topLeftCorner(rank, rank).template triangularView<Upper>();
66 template <
typename MatrixType,
int Cols2>
69 Rows = MatrixType::RowsAtCompileTime,
70 Cols = MatrixType::ColsAtCompileTime
74 int rank = internal::random<int>(1, (
std::min)(
int(Rows),
int(
Cols)) - 1);
80 VERIFY(
cod.isInjective() == (rank == Rows));
82 VERIFY(
cod.isInvertible() == (
cod.isInjective() &&
cod.isSurjective()));
99 template<
typename MatrixType>
void qr()
120 MatrixQType
q =
qr.householderQ();
123 MatrixType r =
qr.matrixQR().template triangularView<Upper>();
134 if (
x < threshold &&
y < threshold)
continue;
137 std::cout <<
"i = " <<
j <<
", |r_ii| = " <<
numext::abs(r(
j,
j)) << std::endl;
139 std::cout <<
"Failure at i=" <<
i <<
", rank=" << rank
140 <<
", threshold=" << threshold << std::endl;
145 check_solverbase<MatrixType, MatrixType>(
m1,
qr,
rows,
cols, cols2);
153 }
while(!
qr.isInvertible());
155 m3 =
m1 * MatrixType::Random(
size,cols2);
165 enum { Rows = MatrixType::RowsAtCompileTime,
Cols = MatrixType::ColsAtCompileTime };
168 int rank = internal::random<int>(1, (
std::min)(
int(Rows),
int(
Cols))-1);
191 if (
x < threshold &&
y < threshold)
continue;
194 std::cout <<
"i = " <<
j <<
", |r_ii| = " <<
numext::abs(r(
j,
j)) << std::endl;
196 std::cout <<
"Failure at i=" <<
i <<
", rank=" << rank
197 <<
", threshold=" << threshold << std::endl;
226 m1.row(
i).tail(
rows -
i - 1) = -pow_s_i *
c * MatrixType::Ones(1,
rows -
i - 1);
231 MatrixType r =
qr.matrixQR().template triangularView<Upper>();
238 if (
x < threshold &&
y < threshold)
continue;
241 std::cout <<
"i = " <<
j <<
", |r_ii| = " <<
numext::abs(r(
j,
j)) << std::endl;
243 std::cout <<
"Failure at i=" <<
i <<
", rank=" <<
qr.rank()
244 <<
", threshold=" << threshold << std::endl;
257 int size = internal::random<int>(10,50);
266 m1 +=
a *
a.adjoint();
275 for(
int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();
277 m3 =
qr.householderQ();