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());
410 void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
415 Matrix<RealScalar,2,2> m;
416 m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)),
417 numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q));
444 * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix
446 * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
450 * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product
452 * 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;
460 * 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
462 * 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,
463 * 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.
474 * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
511 typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime,
514 typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime,
520 typedef Matrix<Scalar, DiagSizeAtCompileTime, DiagSizeAtCompileTime,
546 /** \brief Constructor performing the decomposition of given matrix.
548 * \param matrix the matrix to decompose
553 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
556 JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
559 compute(matrix, computationOptions);
562 /** \brief Method performing the decomposition of given matrix using custom options.
564 * \param matrix the matrix to decompose
569 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
572 SVDBase<MatrixType>& compute(const MatrixType& matrix, unsigned int computationOptions);
574 /** \brief Method performing the decomposition of given matrix using current options.
576 * \param matrix the matrix to decompose
580 SVDBase<MatrixType>& compute(const MatrixType& matrix)
582 return compute(matrix, this->m_computationOptions);
640 JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
643 allocate(matrix.rows(), matrix.cols(), computationOptions);
652 /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
654 if(!m_qr_precond_morecols.run(*this, matrix) && !m_qr_precond_morerows.run(*this, matrix))
656 m_workMatrix = matrix.block(0,0,this->m_diagSize,this->m_diagSize);
670 // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix
676 // if this 2x2 sub-matrix is not diagonal already...
686 // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
702 /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/