MCPcopy Create free account
hub / github.com/Derious/cuMPC / upperbidiag

Function upperbidiag

dependence/eigen-3.4.0/test/upperbidiagonalization.cpp:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <Eigen/SVD>
12
13template<typename MatrixType> void upperbidiag(const MatrixType& m)
14{
15 const Index rows = m.rows();
16 const Index cols = m.cols();
17
18 typedef Matrix<typename MatrixType::RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType;
19 typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TransposeMatrixType;
20
21 MatrixType a = MatrixType::Random(rows,cols);
22 internal::UpperBidiagonalization<MatrixType> ubd(a);
23 RealMatrixType b(rows, cols);
24 b.setZero();
25 b.block(0,0,cols,cols) = ubd.bidiagonal();
26 MatrixType c = ubd.householderU() * b * ubd.householderV().adjoint();
27 VERIFY_IS_APPROX(a,c);
28 TransposeMatrixType d = ubd.householderV() * b.adjoint() * ubd.householderU().adjoint();
29 VERIFY_IS_APPROX(a.adjoint(),d);
30}
31
32EIGEN_DECLARE_TEST(upperbidiagonalization)
33{

Callers 1

EIGEN_DECLARE_TESTFunction · 0.85

Calls 7

householderUMethod · 0.80
householderVMethod · 0.80
rowsMethod · 0.45
colsMethod · 0.45
setZeroMethod · 0.45
blockMethod · 0.45
adjointMethod · 0.45

Tested by

no test coverage detected