Home | History | Annotate | Download | only in SVD

Lines Matching full:matrix

24  *** Their role is to reduce the problem of computing the SVD to the case of a square matrix.
75 typedef Matrix<Scalar, 1, RowsAtCompileTime, RowMajor, 1, MaxRowsAtCompileTime> WorkspaceType;
87 bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
89 if(matrix.rows() > matrix.cols())
91 m_qr.compute(matrix);
92 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
119 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
133 bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
135 if(matrix.cols() > matrix.rows())
137 m_adjoint = matrix.adjoint();
139 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
172 bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
174 if(matrix.rows() > matrix.cols())
176 m_qr.compute(matrix);
177 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
181 svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
211 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
226 bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
228 if(matrix.cols() > matrix.rows())
230 m_adjoint = matrix.adjoint();
233 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
237 svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
272 bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
274 if(matrix.rows() > matrix.cols())
276 m_qr.compute(matrix);
277 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
281 svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
284 if(svd.computeV()) svd.m_matrixV.setIdentity(matrix.cols(), matrix.cols());
310 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
325 bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
327 if(matrix.cols() > matrix.rows())
329 m_adjoint = matrix.adjoint();
332 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
336 svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
339 if(svd.computeU()) svd.m_matrixU.setIdentity(matrix.rows(), matrix.rows());
415 void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
421 Matrix<RealScalar,2,2> m;
422 m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)),
423 numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q));
452 * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix
454 * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
458 * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product
460 matrix which is zero outside of its main diagonal;
468 * You can ask for only \em thin \a U or \a V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting \a m be the
470 * singular vectors. Asking for \em thin \a U or \a V means asking for only their \a m first columns to be formed. So \a U is then a n-by-m matrix,
471 * and \a V is then a p-by-m matrix. Notice that thin \a U and \a V are all you need for (least squares) solving.
482 * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
518 typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime,
521 typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime,
527 typedef Matrix<Scalar, DiagSizeAtCompileTime, DiagSizeAtCompileTime,
561 /** \brief Constructor performing the decomposition of given matrix.
563 * \param matrix the matrix to decompose
568 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
571 JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
578 compute(matrix, computationOptions);
581 /** \brief Method performing the decomposition of given matrix using custom options.
583 * \param matrix the matrix to decompose
588 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
591 JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions);
593 /** \brief Method performing the decomposition of given matrix using current options.
595 * \param matrix the matrix to decompose
599 JacobiSVD& compute(const MatrixType& matrix)
601 return compute(matrix, m_computationOptions);
604 /** \returns the \a U matrix.
606 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
607 * the U matrix is n-by-n if you asked for #ComputeFullU, and is n-by-m if you asked for #ComputeThinU.
609 * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed.
620 /** \returns the \a V matrix.
622 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
623 * the V matrix is p-by-p if you asked for #ComputeFullV, and is p-by-m if you asked for ComputeThinV.
625 * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed.
638 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
677 /** \returns the rank of the matrix of which \c *this is the SVD.
792 "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns.");
817 JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
820 allocate(matrix.rows(), matrix.cols(), computationOptions);
829 /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
831 if(!m_qr_precond_morecols.run(*this, matrix) && !m_qr_precond_morerows.run(*this, matrix))
833 m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize);
852 // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix
858 // if this 2x2 sub-matrix is not diagonal already...
868 // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
884 /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/
935 Matrix<Scalar, Dynamic, Rhs::ColsAtCompileTime, 0, _MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime> tmp;