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;
86 bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
88 if(matrix.rows() > matrix.cols())
90 m_qr.compute(matrix);
91 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
117 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
130 bool run(JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
132 if(matrix.cols() > matrix.rows())
134 m_adjoint = matrix.adjoint();
136 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
167 bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
169 if(matrix.rows() > matrix.cols())
171 m_qr.compute(matrix);
172 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
176 svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
205 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
219 bool run(JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd, const MatrixType& matrix)
221 if(matrix.cols() > matrix.rows())
223 m_adjoint = matrix.adjoint();
226 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
230 svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
263 bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
265 if(matrix.rows() > matrix.cols())
267 m_qr.compute(matrix);
268 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Upper>();
272 svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols());
275 if(svd.computeV()) svd.m_matrixV.setIdentity(matrix.cols(), matrix.cols());
300 typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime>
314 bool run(JacobiSVD<MatrixType, HouseholderQRPreconditioner>& svd, const MatrixType& matrix)
316 if(matrix.cols() > matrix.rows())
318 m_adjoint = matrix.adjoint();
321 svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Upper>().adjoint();
325 svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows());
328 if(svd.computeU()) svd.m_matrixU.setIdentity(matrix.rows(), matrix.rows());
397 void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
401 Matrix<RealScalar,2,2> m;
402 m << real(matrix.coeff(p,p)), real(matrix.coeff(p,q)),
403 real(matrix.coeff(q,p)), real(matrix.coeff(q,q));
430 * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix
432 * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
436 * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product
438 * where \a U is a n-by-n unitary, \a V is a p-by-p unitary, and \a S is a n-by-p real positive matrix which is zero outside of its main diagonal;
446 * 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
448 * 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,
449 * 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.
460 * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
496 typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime,
499 typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime,
505 typedef Matrix<Scalar, DiagSizeAtCompileTime, DiagSizeAtCompileTime,
537 /** \brief Constructor performing the decomposition of given matrix.
539 * \param matrix the matrix to decompose
544 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
547 JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
553 compute(matrix, computationOptions);
556 /** \brief Method performing the decomposition of given matrix using custom options.
558 * \param matrix the matrix to decompose
563 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
566 JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions);
568 /** \brief Method performing the decomposition of given matrix using current options.
570 * \param matrix the matrix to decompose
574 JacobiSVD& compute(const MatrixType& matrix)
576 return compute(matrix, m_computationOptions);
579 /** \returns the \a U matrix.
581 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
582 * the U matrix is n-by-n if you asked for #ComputeFullU, and is n-by-m if you asked for #ComputeThinU.
584 * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed.
595 /** \returns the \a V matrix.
597 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p,
598 * the V matrix is p-by-p if you asked for #ComputeFullV, and is p-by-m if you asked for ComputeThinV.
600 * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed.
613 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
703 "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns.");
726 JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
728 allocate(matrix.rows(), matrix.cols(), computationOptions);
737 /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
739 if(!m_qr_precond_morecols.run(*this, matrix) && !m_qr_precond_morerows.run(*this, matrix))
741 m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize);
755 // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix
761 // if this 2x2 sub-matrix is not diagonal already...
771 // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
787 /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/