Debian Codegraph @

lib/fab/vendor/Eigen/src/SVD/JacobiSVD.h

raw symbols SCIP
1 // This file is part of Eigen, a lightweight C++ template librarycxx . . $ `<file>/lib/fab/vendor/Eigen/src/SVD/JacobiSVD.h`/
2 // for linear algebra.
3 //
4 // Copyright (C) 2009-2010 Benoit Jacob <[email protected]>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10 #ifndef EIGEN_JACOBISVD_H
11 #define EIGEN_JACOBISVD_Hcxx . . $ `lib/fab/vendor/Eigen/src/SVD/JacobiSVD.h:11:9`!
12
13 namespace Eigencxx . . $ Eigen/ {
14
15 namespace internalcxx . . $ Eigen/internal/ {
16 // forward declaration (needed by ICC)
17 // the empty body is required by MSVC
18 template<typename MatrixType, int QRPreconditioner,
19 bool IsComplex = NumTraitscxx . . $ Eigen/NumTraits#<typename MatrixType::Scalar>::IsComplex>
20 struct svd_precondition_2x2_block_to_be_realcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real# {};
21
22 /*** QR preconditioners (R-SVD)
23 ***
24 *** Their role is to reduce the problem of computing the SVD to the case of a square matrix.
25 *** This approach, known as R-SVD, is an optimization for rectangular-enough matrices, and is a requirement for
26 *** JacobiSVD which by itself is only able to work on square matrices.
27 ***/
28
29 enumcxx . . $ Eigen/internal/$anonymous_type_a6ad9fa18c1c7675_0# { PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows., PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols. };
30
31 template<typename MatrixType, int QRPreconditioner, int Case>
32 struct qr_preconditioner_should_do_anythingcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#
33 {
34 enumcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#$anonymous_type_1# { acxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#a. = MatrixType::RowsAtCompileTime != Dynamiccxx . . $ Eigen/Dynamic. &&
35 MatrixType::ColsAtCompileTime != Dynamiccxx . . $ Eigen/Dynamic. &&
36 MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime,
37 bcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#b. = MatrixType::RowsAtCompileTime != Dynamiccxx . . $ Eigen/Dynamic. &&
38 MatrixType::ColsAtCompileTime != Dynamiccxx . . $ Eigen/Dynamic. &&
39 MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime,
40 retcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#ret. = !( (QRPreconditioner == NoQRPreconditionercxx . . $ Eigen/NoQRPreconditioner.) ||
41 (Case == PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows. && bool(acxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#a.)) ||
42 (Case == PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols. && bool(bcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#b.)) )
43 };
44 };
45
46 template<typename MatrixType, int QRPreconditioner, int Case,
47 bool DoAnything = qr_preconditioner_should_do_anythingcxx . . $ Eigen/internal/qr_preconditioner_should_do_anything#<MatrixType, QRPreconditioner, Case>::ret
48 > struct qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl# {};
49
50 template<typename MatrixType, int QRPreconditioner, int Case>
51 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, QRPreconditioner, Case, false>
52 {
53 public:
54 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
55 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(a62626e3d7d5c517).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner>&) {}
56 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(8f7a3c28066274a4).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner>&, const MatrixType&)
57 {
58 return false;
59 }
60 };
61
62 /*** preconditioner using FullPivHouseholderQR ***/
63
64 template<typename MatrixType>
65 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner., PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols., true>
66 {
67 public:
68 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
69 typedef typename MatrixType::Scalar Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#;
70 enumcxx . . $ Eigen/internal/qr_preconditioner_impl#$anonymous_type_2#
71 {
72 RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime. = MatrixType::RowsAtCompileTime,
73 MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime. = MatrixType::MaxRowsAtCompileTime
74 };
75 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#, 1, RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime., RowMajorcxx . . $ Eigen/RowMajor., 1, MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime.> WorkspaceTypecxx . . $ Eigen/internal/qr_preconditioner_impl#WorkspaceType#;
76
77 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(34542171b91d04c6).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner.>& svd)
78 {
79 if (svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/FullPivHouseholderQR#rows(2c7b05c1f1314d58).() || svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/FullPivHouseholderQR#cols(2c7b05c1f1314d58).())
80 {
81 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
82 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).(), svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
83 }
84 if (svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
85 }
86
87 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(9b1d1ea48a82a4d6).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
88 {
89 if(matrix.rows() > matrix.cols())
90 {
91 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/FullPivHouseholderQR#compute(f19e5512699daad3).(matrix);
92 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/FullPivHouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Uppercxx . . $ Eigen/Upper.>();
93 if(svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQcxx . . $ Eigen/FullPivHouseholderQR#matrixQ(7a95313722e5ee7).().evalTo(svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
94 if(svd.computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colsPermutationcxx . . $ Eigen/FullPivHouseholderQR#colsPermutation(839d3c3ba1a5120).();
95 return true;
96 }
97 return false;
98 }
99 private:
100 typedef FullPivHouseholderQRcxx . . $ Eigen/FullPivHouseholderQR#<MatrixType> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
101 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
102 WorkspaceTypecxx . . $ Eigen/internal/qr_preconditioner_impl#WorkspaceType# m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
103 };
104
105 template<typename MatrixType>
106 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner., PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows., true>
107 {
108 public:
109 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
110 typedef typename MatrixType::Scalar Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#;
111 enumcxx . . $ Eigen/internal/qr_preconditioner_impl#$anonymous_type_3#
112 {
113 RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime. = MatrixType::RowsAtCompileTime,
114 ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime. = MatrixType::ColsAtCompileTime,
115 MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime. = MatrixType::MaxRowsAtCompileTime,
116 MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime. = MatrixType::MaxColsAtCompileTime,
117 Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options. = MatrixType::Options
118 };
119 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#, ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime., RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime., Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options., MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime., MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime.>
120 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#;
121
122 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(34542171b91d04c6).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner.>& svd)
123 {
124 if (svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/FullPivHouseholderQR#rows(2c7b05c1f1314d58).() || svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/FullPivHouseholderQR#cols(2c7b05c1f1314d58).())
125 {
126 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
127 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
128 }
129 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
130 if (svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
131 }
132
133 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(9b1d1ea48a82a4d6).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
134 {
135 if(matrix.cols() > matrix.rows())
136 {
137 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint. = matrix.adjoint();
138 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/FullPivHouseholderQR#compute(f19e5512699daad3).(m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.);
139 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/FullPivHouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Uppercxx . . $ Eigen/Upper.>().adjoint();
140 if(svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQcxx . . $ Eigen/FullPivHouseholderQR#matrixQ(7a95313722e5ee7).().evalTo(svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
141 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colsPermutationcxx . . $ Eigen/FullPivHouseholderQR#colsPermutation(839d3c3ba1a5120).();
142 return true;
143 }
144 else return false;
145 }
146 private:
147 typedef FullPivHouseholderQRcxx . . $ Eigen/FullPivHouseholderQR#<TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
148 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
149 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder# m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.;
150 typename internalcxx . . $ Eigen/internal/::plain_row_typecxx . . $ Eigen/internal/plain_row_type#<MatrixType>::type m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
151 };
152
153 /*** preconditioner using ColPivHouseholderQR ***/
154
155 template<typename MatrixType>
156 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner., PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols., true>
157 {
158 public:
159 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
160
161 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(ede087bbd6ce27fa).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner.>& svd)
162 {
163 if (svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/ColPivHouseholderQR#rows(2c7b05c1f1314d58).() || svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/ColPivHouseholderQR#cols(2c7b05c1f1314d58).())
164 {
165 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
166 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).(), svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
167 }
168 if (svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
169 else if (svd.m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
170 }
171
172 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(65da081c99bb2bc6).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
173 {
174 if(matrix.rows() > matrix.cols())
175 {
176 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/ColPivHouseholderQR#compute(d408efc11db6a281).(matrix);
177 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/ColPivHouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Uppercxx . . $ Eigen/Upper.>();
178 if(svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/ColPivHouseholderQR#householderQ(2b3a63f8e9920815).().evalTo(svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
179 else if(svd.m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.)
180 {
181 svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..setIdentity(matrix.rows(), matrix.cols());
182 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/ColPivHouseholderQR#householderQ(2b3a63f8e9920815).().applyThisOnTheLeft(svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
183 }
184 if(svd.computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colsPermutationcxx . . $ Eigen/ColPivHouseholderQR#colsPermutation(839d3c3ba1a5120).();
185 return true;
186 }
187 return false;
188 }
189
190 private:
191 typedef ColPivHouseholderQRcxx . . $ Eigen/ColPivHouseholderQR#<MatrixType> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
192 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
193 typename internalcxx . . $ Eigen/internal/::plain_col_typecxx . . $ Eigen/internal/plain_col_type#<MatrixType>::type m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
194 };
195
196 template<typename MatrixType>
197 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner., PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows., true>
198 {
199 public:
200 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
201 typedef typename MatrixType::Scalar Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#;
202 enumcxx . . $ Eigen/internal/qr_preconditioner_impl#$anonymous_type_4#
203 {
204 RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime. = MatrixType::RowsAtCompileTime,
205 ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime. = MatrixType::ColsAtCompileTime,
206 MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime. = MatrixType::MaxRowsAtCompileTime,
207 MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime. = MatrixType::MaxColsAtCompileTime,
208 Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options. = MatrixType::Options
209 };
210
211 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#, ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime., RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime., Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options., MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime., MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime.>
212 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#;
213
214 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(ede087bbd6ce27fa).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner.>& svd)
215 {
216 if (svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/ColPivHouseholderQR#rows(2c7b05c1f1314d58).() || svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/ColPivHouseholderQR#cols(2c7b05c1f1314d58).())
217 {
218 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
219 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
220 }
221 if (svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
222 else if (svd.m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
223 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
224 }
225
226 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(65da081c99bb2bc6).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, ColPivHouseholderQRPreconditionercxx . . $ Eigen/ColPivHouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
227 {
228 if(matrix.cols() > matrix.rows())
229 {
230 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint. = matrix.adjoint();
231 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/ColPivHouseholderQR#compute(d408efc11db6a281).(m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.);
232
233 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/ColPivHouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Uppercxx . . $ Eigen/Upper.>().adjoint();
234 if(svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/ColPivHouseholderQR#householderQ(2b3a63f8e9920815).().evalTo(svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
235 else if(svd.m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.)
236 {
237 svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..setIdentity(matrix.cols(), matrix.rows());
238 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/ColPivHouseholderQR#householderQ(2b3a63f8e9920815).().applyThisOnTheLeft(svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
239 }
240 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colsPermutationcxx . . $ Eigen/ColPivHouseholderQR#colsPermutation(839d3c3ba1a5120).();
241 return true;
242 }
243 else return false;
244 }
245
246 private:
247 typedef ColPivHouseholderQRcxx . . $ Eigen/ColPivHouseholderQR#<TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
248 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
249 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder# m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.;
250 typename internalcxx . . $ Eigen/internal/::plain_row_typecxx . . $ Eigen/internal/plain_row_type#<MatrixType>::type m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
251 };
252
253 /*** preconditioner using HouseholderQR ***/
254
255 template<typename MatrixType>
256 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner., PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols., true>
257 {
258 public:
259 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
260
261 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(6a401d55d7cf3ae1).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner.>& svd)
262 {
263 if (svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/HouseholderQR#rows(2c7b05c1f1314d58).() || svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/HouseholderQR#cols(2c7b05c1f1314d58).())
264 {
265 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
266 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).(), svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
267 }
268 if (svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
269 else if (svd.m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
270 }
271
272 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(7df421e615bc7302).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
273 {
274 if(matrix.rows() > matrix.cols())
275 {
276 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/HouseholderQR#compute(9fde7616a40c34c2).(matrix);
277 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/HouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.cols(),matrix.cols()).template triangularView<Uppercxx . . $ Eigen/Upper.>();
278 if(svd.m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/HouseholderQR#householderQ(2b3a63f8e9920815).().evalTo(svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
279 else if(svd.m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.)
280 {
281 svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..setIdentity(matrix.rows(), matrix.cols());
282 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/HouseholderQR#householderQ(2b3a63f8e9920815).().applyThisOnTheLeft(svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
283 }
284 if(svd.computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..setIdentity(matrix.cols(), matrix.cols());
285 return true;
286 }
287 return false;
288 }
289 private:
290 typedef HouseholderQRcxx . . $ Eigen/HouseholderQR#<MatrixType> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
291 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
292 typename internalcxx . . $ Eigen/internal/::plain_col_typecxx . . $ Eigen/internal/plain_col_type#<MatrixType>::type m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
293 };
294
295 template<typename MatrixType>
296 class qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner., PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows., true>
297 {
298 public:
299 typedef typename MatrixType::Index Indexcxx . . $ Eigen/internal/qr_preconditioner_impl#Index#;
300 typedef typename MatrixType::Scalar Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#;
301 enumcxx . . $ Eigen/internal/qr_preconditioner_impl#$anonymous_type_5#
302 {
303 RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime. = MatrixType::RowsAtCompileTime,
304 ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime. = MatrixType::ColsAtCompileTime,
305 MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime. = MatrixType::MaxRowsAtCompileTime,
306 MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime. = MatrixType::MaxColsAtCompileTime,
307 Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options. = MatrixType::Options
308 };
309
310 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/internal/qr_preconditioner_impl#Scalar#, ColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#ColsAtCompileTime., RowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#RowsAtCompileTime., Optionscxx . . $ Eigen/internal/qr_preconditioner_impl#Options., MaxColsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxColsAtCompileTime., MaxRowsAtCompileTimecxx . . $ Eigen/internal/qr_preconditioner_impl#MaxRowsAtCompileTime.>
311 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#;
312
313 void allocatecxx . . $ Eigen/internal/qr_preconditioner_impl#allocate(6a401d55d7cf3ae1).(const JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner.>& svd)
314 {
315 if (svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..rowscxx . . $ Eigen/HouseholderQR#rows(2c7b05c1f1314d58).() || svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() != m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..colscxx . . $ Eigen/HouseholderQR#cols(2c7b05c1f1314d58).())
316 {
317 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..~QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#();
318 ::new (&m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.) QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
319 }
320 if (svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).());
321 else if (svd.m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.) m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace..resize(svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
322 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(svd.colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).(), svd.rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).());
323 }
324
325 bool runcxx . . $ Eigen/internal/qr_preconditioner_impl#run(7df421e615bc7302).(JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, HouseholderQRPreconditionercxx . . $ Eigen/HouseholderQRPreconditioner.>& svd, const MatrixType& matrix)
326 {
327 if(matrix.cols() > matrix.rows())
328 {
329 m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint. = matrix.adjoint();
330 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..computecxx . . $ Eigen/HouseholderQR#compute(9fde7616a40c34c2).(m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.);
331
332 svd.m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..matrixQRcxx . . $ Eigen/HouseholderQR#matrixQR(ea465e50d690edfe).().block(0,0,matrix.rows(),matrix.rows()).template triangularView<Uppercxx . . $ Eigen/Upper.>().adjoint();
333 if(svd.m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/HouseholderQR#householderQ(2b3a63f8e9920815).().evalTo(svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
334 else if(svd.m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.)
335 {
336 svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..setIdentity(matrix.cols(), matrix.rows());
337 m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr..householderQcxx . . $ Eigen/HouseholderQR#householderQ(2b3a63f8e9920815).().applyThisOnTheLeft(svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV., m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.);
338 }
339 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..setIdentity(matrix.rows(), matrix.rows());
340 return true;
341 }
342 else return false;
343 }
344
345 private:
346 typedef HouseholderQRcxx . . $ Eigen/HouseholderQR#<TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder#> QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType#;
347 QRTypecxx . . $ Eigen/internal/qr_preconditioner_impl#QRType# m_qrcxx . . $ Eigen/internal/qr_preconditioner_impl#m_qr.;
348 TransposeTypeWithSameStorageOrdercxx . . $ Eigen/internal/qr_preconditioner_impl#TransposeTypeWithSameStorageOrder# m_adjointcxx . . $ Eigen/internal/qr_preconditioner_impl#m_adjoint.;
349 typename internalcxx . . $ Eigen/internal/::plain_row_typecxx . . $ Eigen/internal/plain_row_type#<MatrixType>::type m_workspacecxx . . $ Eigen/internal/qr_preconditioner_impl#m_workspace.;
350 };
351
352 /*** 2x2 SVD implementation
353 ***
354 *** JacobiSVD consists in performing a series of 2x2 SVD subproblems
355 ***/
356
357 template<typename MatrixType, int QRPreconditioner>
358 struct svd_precondition_2x2_block_to_be_realcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#<MatrixType, QRPreconditioner, false>
359 {
360 typedef JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner> SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#;
361 typedef typename SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#::Index Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index#;
362 static void runcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#run(3372931ff3bd314f).(typename SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#::WorkMatrixType&, SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#&, Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index#, Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index#) {}
363 };
364
365 template<typename MatrixType, int QRPreconditioner>
366 struct svd_precondition_2x2_block_to_be_realcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#<MatrixType, QRPreconditioner, true>
367 {
368 typedef JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner> SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#;
369 typedef typename MatrixType::Scalar Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar#;
370 typedef typename MatrixType::RealScalar RealScalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#RealScalar#;
371 typedef typename SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#::Index Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index#;
372 static void runcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#run(3372931ff3bd314f).(typename SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#::WorkMatrixType& work_matrix, SVDcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#SVD#& svd, Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index# p, Indexcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Index# q)
373 {
374 using stdcxx . . $ std/::sqrtcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#run(3372931ff3bd314f).sqrt(a358fd9634d01384).;
375 Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar# z;
376 JacobiRotationcxx . . $ Eigen/JacobiRotation#<Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar#> rot;
377 RealScalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#RealScalar# n = sqrtcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#run(3372931ff3bd314f).sqrt(a358fd9634d01384).(numextcxx . . $ Eigen/numext/::abs2cxx . . $ Eigen/numext/abs2(70b90807620a8982).(work_matrix.coeff(p,p)) + numextcxx . . $ Eigen/numext/::abs2cxx . . $ Eigen/numext/abs2(70b90807620a8982).(work_matrix.coeff(q,p)));
378
379 if(n==0)
380 {
381 z = abscxx . . $ Eigen/abs(fc823ec572f3f371).(work_matrix.coeff(p,q)) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). work_matrix.coeff(p,q);
382 work_matrix.row(p) *= z;
383 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(p) *= conjcxx . . $ Eigen/conj(d17ad7d7a283d2e9).(z);
384 if(work_matrix.coeff(q,q)!=Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar#(0))
385 {
386 z = abscxx . . $ Eigen/abs(fc823ec572f3f371).(work_matrix.coeff(q,q)) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). work_matrix.coeff(q,q);
387 work_matrix.row(q) *= z;
388 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(q) *= conjcxx . . $ Eigen/conj(d17ad7d7a283d2e9).(z);
389 }
390 // otherwise the second row is already zero, so we have nothing to do.
391 }
392 else
393 {
394 rot.ccxx . . $ Eigen/JacobiRotation#c(19b2b6f17af048b).() = conjcxx . . $ Eigen/conj(d17ad7d7a283d2e9).(work_matrix.coeff(p,p)) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). n;
395 rot.scxx . . $ Eigen/JacobiRotation#s(19b2b6f17af048b).() = work_matrix.coeff(q,p) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). n;
396 work_matrix.applyOnTheLeft(p,q,rot);
397 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..applyOnTheRight(p,q,rot.adjointcxx . . $ Eigen/JacobiRotation#adjoint(6a60529c4850f7c1).());
398 if(work_matrix.coeff(p,q) != Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar#(0))
399 {
400 Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar# z = abscxx . . $ Eigen/abs(fc823ec572f3f371).(work_matrix.coeff(p,q)) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). work_matrix.coeff(p,q);
401 work_matrix.col(q) *= z;
402 if(svd.computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) svd.m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..col(q) *= z;
403 }
404 if(work_matrix.coeff(q,q) != Scalarcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#Scalar#(0))
405 {
406 z = abscxx . . $ Eigen/abs(fc823ec572f3f371).(work_matrix.coeff(q,q)) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). work_matrix.coeff(q,q);
407 work_matrix.row(q) *= z;
408 if(svd.computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) svd.m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(q) *= conjcxx . . $ Eigen/conj(d17ad7d7a283d2e9).(z);
409 }
410 }
411 }
412 };
413
414 template<typename MatrixType, typename RealScalar, typename Index>
415 void real_2x2_jacobi_svdcxx . . $ Eigen/internal/real_2x2_jacobi_svd(fd42b5f6123024b3).(const MatrixType& matrix, Index p, Index q,
416 JacobiRotationcxx . . $ Eigen/JacobiRotation#<RealScalar> *j_left,
417 JacobiRotationcxx . . $ Eigen/JacobiRotation#<RealScalar> *j_right)
418 {
419 using stdcxx . . $ std/::sqrtcxx . . $ Eigen/internal/real_2x2_jacobi_svd(fd42b5f6123024b3).sqrt(a358fd9634d01384).;
420 using stdcxx . . $ std/::abscxx . . $ Eigen/internal/real_2x2_jacobi_svd(fd42b5f6123024b3).abs(bb57395c51337e15).;
421 Matrixcxx . . $ Eigen/Matrix#<RealScalar,2,2> m;
422 m <<cxx . . $ Eigen/`operator<<`(aa745f4771f14e54). numextcxx . . $ Eigen/numext/::realcxx . . $ Eigen/numext/real(9fff23bc4be709fb).(matrix.coeff(p,p)), numextcxx . . $ Eigen/numext/::realcxx . . $ Eigen/numext/real(9fff23bc4be709fb).(matrix.coeff(p,q)),
423 numextcxx . . $ Eigen/numext/::realcxx . . $ Eigen/numext/real(9fff23bc4be709fb).(matrix.coeff(q,p)), numextcxx . . $ Eigen/numext/::realcxx . . $ Eigen/numext/real(9fff23bc4be709fb).(matrix.coeff(q,q));
424 JacobiRotationcxx . . $ Eigen/JacobiRotation#<RealScalar> rot1;
425 RealScalar t = m.coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(0,0) + m.coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(1,1);
426 RealScalar d = m.coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(1,0) - m.coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(0,1);
427 if(t == RealScalar(0))
428 {
429 rot1.ccxx . . $ Eigen/JacobiRotation#c(19b2b6f17af048b).() = RealScalar(0);
430 rot1.scxx . . $ Eigen/JacobiRotation#s(19b2b6f17af048b).() = d > RealScalar(0) ? RealScalar(1) : RealScalar(-1);
431 }
432 else
433 {
434 RealScalar t2d2 = numextcxx . . $ Eigen/numext/::hypotcxx . . $ Eigen/numext/hypot(dac6affe6572016b).(t,d);
435 rot1.ccxx . . $ Eigen/JacobiRotation#c(19b2b6f17af048b).() = abscxx . . $ Eigen/internal/real_2x2_jacobi_svd(fd42b5f6123024b3).abs(bb57395c51337e15).(t)/cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561).t2d2;
436 rot1.scxx . . $ Eigen/JacobiRotation#s(19b2b6f17af048b).() = d/cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561).t2d2;
437 if(t<RealScalar(0))
438 rot1.scxx . . $ Eigen/JacobiRotation#s(19b2b6f17af048b).() = -rot1.scxx . . $ Eigen/JacobiRotation#s(19b2b6f17af048b).();
439 }
440 m.applyOnTheLeft(0,1,rot1);
441 j_right->makeJacobicxx . . $ Eigen/JacobiRotation#makeJacobi(1481007d82d38931).(m,0,1);
442 *j_left = rot1 *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). j_right->transposecxx . . $ Eigen/JacobiRotation#transpose(6a60529c4850f7c1).();
443 }
444
445 } // end namespace internal
446
447 /** \ingroup SVD_Module
448 *
449 *
450 * \class JacobiSVD
451 *
452 * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix
453 *
454 * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
455 * \param QRPreconditioner this optional parameter allows to specify the type of QR decomposition that will be used internally
456 * for the R-SVD step for non-square matrices. See discussion of possible values below.
457 *
458 * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product
459 * \f[ A = U S V^* \f]
460 * 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;
461 * the diagonal entries of S are known as the \em singular \em values of \a A and the columns of \a U and \a V are known as the left
462 * and right \em singular \em vectors of \a A respectively.
463 *
464 * Singular values are always sorted in decreasing order.
465 *
466 * This JacobiSVD decomposition computes only the singular values by default. If you want \a U or \a V, you need to ask for them explicitly.
467 *
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
469 * smaller value among \a n and \a p, there are only \a m singular vectors; the remaining columns of \a U and \a V do not correspond to actual
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.
472 *
473 * Here's an example demonstrating basic usage:
474 * \include JacobiSVD_basic.cpp
475 * Output: \verbinclude JacobiSVD_basic.out
476 *
477 * This JacobiSVD class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than
478 * bidiagonalizing SVD algorithms for large square matrices; however its complexity is still \f$ O(n^2p) \f$ where \a n is the smaller dimension and
479 * \a p is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms.
480 * In particular, like any R-SVD, it takes advantage of non-squareness in that its complexity is only linear in the greater dimension.
481 *
482 * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to
483 * terminate in finite (and reasonable) time.
484 *
485 * The possible values for QRPreconditioner are:
486 * \li ColPivHouseholderQRPreconditioner is the default. In practice it's very safe. It uses column-pivoting QR.
487 * \li FullPivHouseholderQRPreconditioner, is the safest and slowest. It uses full-pivoting QR.
488 * Contrary to other QRs, it doesn't allow computing thin unitaries.
489 * \li HouseholderQRPreconditioner is the fastest, and less safe and accurate than the pivoting variants. It uses non-pivoting QR.
490 * This is very similar in safety and accuracy to the bidiagonalization process used by bidiagonalizing SVD algorithms (since bidiagonalization
491 * is inherently non-pivoting). However the resulting SVD is still more reliable than bidiagonalizing SVDs because the Jacobi-based iterarive
492 * process is more reliable than the optimized bidiagonal SVD iterations.
493 * \li NoQRPreconditioner allows not to use a QR preconditioner at all. This is useful if you know that you will only be computing
494 * JacobiSVD decompositions of square matrices. Non-square matrices require a QR preconditioner. Using this option will result in
495 * faster compilation and smaller executable code. It won't significantly speed up computation, since JacobiSVD is always checking
496 * if QR preconditioning is needed before applying it anyway.
497 *
498 * \sa MatrixBase::jacobiSvd()
499 */
500 template<typename _MatrixType, int QRPreconditioner> class JacobiSVDcxx . . $ Eigen/JacobiSVD#
501 {
502 public:
503
504 typedef _MatrixType MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#;
505 typedef typename MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::Scalar Scalarcxx . . $ Eigen/JacobiSVD#Scalar#;
506 typedef typename NumTraitscxx . . $ Eigen/NumTraits#<typename MatrixType::Scalar>::Real RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#;
507 typedef typename MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::Index Indexcxx . . $ Eigen/JacobiSVD#Index#;
508 enumcxx . . $ Eigen/JacobiSVD#$anonymous_type_6# {
509 RowsAtCompileTimecxx . . $ Eigen/JacobiSVD#RowsAtCompileTime. = MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::RowsAtCompileTime,
510 ColsAtCompileTimecxx . . $ Eigen/JacobiSVD#ColsAtCompileTime. = MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::ColsAtCompileTime,
511 DiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#DiagSizeAtCompileTime. = EIGEN_SIZE_MIN_PREFER_DYNAMICcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:389:9`!(RowsAtCompileTime,ColsAtCompileTime),
512 MaxRowsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxRowsAtCompileTime. = MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::MaxRowsAtCompileTime,
513 MaxColsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxColsAtCompileTime. = MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::MaxColsAtCompileTime,
514 MaxDiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxDiagSizeAtCompileTime. = EIGEN_SIZE_MIN_PREFER_FIXEDcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:397:9`!(MaxRowsAtCompileTime,MaxColsAtCompileTime),
515 MatrixOptionscxx . . $ Eigen/JacobiSVD#MatrixOptions. = MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#::Options
516 };
517
518 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/JacobiSVD#Scalar#, RowsAtCompileTimecxx . . $ Eigen/JacobiSVD#RowsAtCompileTime., RowsAtCompileTimecxx . . $ Eigen/JacobiSVD#RowsAtCompileTime.,
519 MatrixOptionscxx . . $ Eigen/JacobiSVD#MatrixOptions., MaxRowsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxRowsAtCompileTime., MaxRowsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxRowsAtCompileTime.>
520 MatrixUTypecxx . . $ Eigen/JacobiSVD#MatrixUType#;
521 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/JacobiSVD#Scalar#, ColsAtCompileTimecxx . . $ Eigen/JacobiSVD#ColsAtCompileTime., ColsAtCompileTimecxx . . $ Eigen/JacobiSVD#ColsAtCompileTime.,
522 MatrixOptionscxx . . $ Eigen/JacobiSVD#MatrixOptions., MaxColsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxColsAtCompileTime., MaxColsAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxColsAtCompileTime.>
523 MatrixVTypecxx . . $ Eigen/JacobiSVD#MatrixVType#;
524 typedef typename internalcxx . . $ Eigen/internal/::plain_diag_typecxx . . $ Eigen/internal/plain_diag_type#<MatrixType, RealScalar>::type SingularValuesTypecxx . . $ Eigen/JacobiSVD#SingularValuesType#;
525 typedef typename internalcxx . . $ Eigen/internal/::plain_row_typecxx . . $ Eigen/internal/plain_row_type#<MatrixType>::type RowTypecxx . . $ Eigen/JacobiSVD#RowType#;
526 typedef typename internalcxx . . $ Eigen/internal/::plain_col_typecxx . . $ Eigen/internal/plain_col_type#<MatrixType>::type ColTypecxx . . $ Eigen/JacobiSVD#ColType#;
527 typedef Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/JacobiSVD#Scalar#, DiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#DiagSizeAtCompileTime., DiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#DiagSizeAtCompileTime.,
528 MatrixOptionscxx . . $ Eigen/JacobiSVD#MatrixOptions., MaxDiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxDiagSizeAtCompileTime., MaxDiagSizeAtCompileTimecxx . . $ Eigen/JacobiSVD#MaxDiagSizeAtCompileTime.>
529 WorkMatrixTypecxx . . $ Eigen/JacobiSVD#WorkMatrixType#;
530
531 /** \brief Default Constructor.
532 *
533 * The default constructor is useful in cases in which the user intends to
534 * perform decompositions via JacobiSVD::compute(const MatrixType&).
535 */
536 JacobiSVDcxx . . $ Eigen/JacobiSVD#`JacobiSVD<MatrixType, QRPreconditioner>`(49f6e7a06ebc5aa8).()
537 : m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized.(false),
538 m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated.(false),
539 m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold.(false),
540 m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.(0),
541 m_rowscxx . . $ Eigen/JacobiSVD#m_rows.(-1), m_colscxx . . $ Eigen/JacobiSVD#m_cols.(-1), m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.(0)
542 {}
543
544
545 /** \brief Default Constructor with memory preallocation
546 *
547 * Like the default constructor but with preallocation of the internal data
548 * according to the specified problem size.
549 * \sa JacobiSVD()
550 */
551 JacobiSVDcxx . . $ Eigen/JacobiSVD#`JacobiSVD<MatrixType, QRPreconditioner>`(22858fad3828e736).(Indexcxx . . $ Eigen/JacobiSVD#Index# rows, Indexcxx . . $ Eigen/JacobiSVD#Index# cols, unsigned int computationOptions = 0)
552 : m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized.(false),
553 m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated.(false),
554 m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold.(false),
555 m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.(0),
556 m_rowscxx . . $ Eigen/JacobiSVD#m_rows.(-1), m_colscxx . . $ Eigen/JacobiSVD#m_cols.(-1)
557 {
558 allocatecxx . . $ Eigen/JacobiSVD#allocate(22858fad3828e736).(rows, cols, computationOptions);
559 }
560
561 /** \brief Constructor performing the decomposition of given matrix.
562 *
563 * \param matrix the matrix to decompose
564 * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
565 * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU,
566 * #ComputeFullV, #ComputeThinV.
567 *
568 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
569 * available with the (non-default) FullPivHouseholderQR preconditioner.
570 */
571 JacobiSVDcxx . . $ Eigen/JacobiSVD#`JacobiSVD<MatrixType, QRPreconditioner>`(88fdfb5e0aa09885).(const MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#& matrix, unsigned int computationOptions = 0)
572 : m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized.(false),
573 m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated.(false),
574 m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold.(false),
575 m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.(0),
576 m_rowscxx . . $ Eigen/JacobiSVD#m_rows.(-1), m_colscxx . . $ Eigen/JacobiSVD#m_cols.(-1)
577 {
578 computecxx . . $ Eigen/JacobiSVD#compute(7038221de27c42cc).(matrix, computationOptions);
579 }
580
581 /** \brief Method performing the decomposition of given matrix using custom options.
582 *
583 * \param matrix the matrix to decompose
584 * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
585 * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU,
586 * #ComputeFullV, #ComputeThinV.
587 *
588 * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
589 * available with the (non-default) FullPivHouseholderQR preconditioner.
590 */
591 JacobiSVD& computecxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).(const MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#& matrix, unsigned int computationOptions);
592
593 /** \brief Method performing the decomposition of given matrix using current options.
594 *
595 * \param matrix the matrix to decompose
596 *
597 * This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int).
598 */
599 JacobiSVD& computecxx . . $ Eigen/JacobiSVD#compute(7038221de27c42cc).(const MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#& matrix)
600 {
601 return computecxx . . $ Eigen/JacobiSVD#compute(7038221de27c42cc).(matrix, m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.);
602 }
603
604 /** \returns the \a U matrix.
605 *
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.
608 *
609 * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed.
610 *
611 * This method asserts that you asked for \a U to be computed.
612 */
613 const MatrixUTypecxx . . $ Eigen/JacobiSVD#MatrixUType#& matrixUcxx . . $ Eigen/JacobiSVD#matrixU(dc1a6ba0512fded6).() const
614 {
615 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
616 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(computeU() && "This JacobiSVD decomposition didn't compute U. Did you ask for it?");
617 return m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU.;
618 }
619
620 /** \returns the \a V matrix.
621 *
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.
624 *
625 * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed.
626 *
627 * This method asserts that you asked for \a V to be computed.
628 */
629 const MatrixVTypecxx . . $ Eigen/JacobiSVD#MatrixVType#& matrixVcxx . . $ Eigen/JacobiSVD#matrixV(741c8e32cb472d01).() const
630 {
631 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
632 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(computeV() && "This JacobiSVD decomposition didn't compute V. Did you ask for it?");
633 return m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV.;
634 }
635
636 /** \returns the vector of singular values.
637 *
638 * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
639 * returned vector has size \a m. Singular values are always sorted in decreasing order.
640 */
641 const SingularValuesTypecxx . . $ Eigen/JacobiSVD#SingularValuesType#& singularValuescxx . . $ Eigen/JacobiSVD#singularValues(e62cf59bbb0576bf).() const
642 {
643 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
644 return m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues.;
645 }
646
647 /** \returns true if \a U (full or thin) is asked for in this SVD decomposition */
648 inline bool computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).() const { return m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU. || m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.; }
649 /** \returns true if \a V (full or thin) is asked for in this SVD decomposition */
650 inline bool computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).() const { return m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV. || m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.; }
651
652 /** \returns a (least squares) solution of \f$ A x = b \f$ using the current SVD decomposition of A.
653 *
654 * \param b the right-hand-side of the equation to solve.
655 *
656 * \note Solving requires both U and V to be computed. Thin U and V are enough, there is no need for full U or V.
657 *
658 * \note SVD solving is implicitly least-squares. Thus, this method serves both purposes of exact solving and least-squares solving.
659 * In other words, the returned solution is guaranteed to minimize the Euclidean norm \f$ \Vert A x - b \Vert \f$.
660 */
661 template<typename Rhs>
662 inline const internalcxx . . $ Eigen/internal/::solve_retvalcxx . . $ Eigen/internal/solve_retval#<JacobiSVD, Rhs>
663 solvecxx . . $ Eigen/JacobiSVD#solve(d4dca057417316c7).(const MatrixBasecxx . . $ Eigen/MatrixBase#<Rhs>& b) const
664 {
665 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
666 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(computeU() && computeV() && "JacobiSVD::solve() requires both unitaries U and V to be computed (thin unitaries suffice).");
667 return internalcxx . . $ Eigen/internal/::solve_retvalcxx . . $ Eigen/internal/solve_retval#<JacobiSVD, Rhs>(*this, b.derived());
668 }
669
670 /** \returns the number of singular values that are not exactly 0 */
671 Indexcxx . . $ Eigen/JacobiSVD#Index# nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#nonzeroSingularValues(2c7b05c1f1314d58).() const
672 {
673 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
674 return m_nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#m_nonzeroSingularValues.;
675 }
676
677 /** \returns the rank of the matrix of which \c *this is the SVD.
678 *
679 * \note This method has to determine which singular values should be considered nonzero.
680 * For that, it uses the threshold value that you can control by calling
681 * setThreshold(const RealScalar&).
682 */
683 inline Indexcxx . . $ Eigen/JacobiSVD#Index# rankcxx . . $ Eigen/JacobiSVD#rank(2c7b05c1f1314d58).() const
684 {
685 using stdcxx . . $ std/::abscxx . . $ Eigen/JacobiSVD#rank(2c7b05c1f1314d58).abs(bb57395c51337e15).;
686 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized && "JacobiSVD is not initialized.");
687 if(m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..size()==0) return 0;
688 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# premultiplied_threshold = m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..coeff(0) *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). thresholdcxx . . $ Eigen/JacobiSVD#threshold(525f0cfcdd3715c5).();
689 Indexcxx . . $ Eigen/JacobiSVD#Index# i = m_nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#m_nonzeroSingularValues.-1;
690 while(i>=0 && m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..coeff(i) < premultiplied_threshold) --i;
691 return i+1;
692 }
693
694 /** Allows to prescribe a threshold to be used by certain methods, such as rank() and solve(),
695 * which need to determine when singular values are to be considered nonzero.
696 * This is not used for the SVD decomposition itself.
697 *
698 * When it needs to get the threshold value, Eigen calls threshold().
699 * The default is \c NumTraits<Scalar>::epsilon()
700 *
701 * \param threshold The new value to use as the threshold.
702 *
703 * A singular value will be considered nonzero if its value is strictly greater than
704 * \f$ \vert singular value \vert \leqslant threshold \times \vert max singular value \vert \f$.
705 *
706 * If you want to come back to the default behavior, call setThreshold(Default_t)
707 */
708 JacobiSVD& setThresholdcxx . . $ Eigen/JacobiSVD#setThreshold(69ffd6c682e52574).(const RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#& threshold)
709 {
710 m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold. = true;
711 m_prescribedThresholdcxx . . $ Eigen/JacobiSVD#m_prescribedThreshold. = threshold;
712 return *this;
713 }
714
715 /** Allows to come back to the default behavior, letting Eigen use its default formula for
716 * determining the threshold.
717 *
718 * You should pass the special object Eigen::Default as parameter here.
719 * \code svd.setThreshold(Eigen::Default); \endcode
720 *
721 * See the documentation of setThreshold(const RealScalar&).
722 */
723 JacobiSVD& setThresholdcxx . . $ Eigen/JacobiSVD#setThreshold(addc855c4a2dbb0d).(Default_tcxx . . $ Eigen/Default_t#)
724 {
725 m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold. = false;
726 return *this;
727 }
728
729 /** Returns the threshold that will be used by certain methods such as rank().
730 *
731 * See the documentation of setThreshold(const RealScalar&).
732 */
733 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# thresholdcxx . . $ Eigen/JacobiSVD#threshold(525f0cfcdd3715c5).() const
734 {
735 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(m_isInitialized || m_usePrescribedThreshold);
736 return m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold. ? m_prescribedThresholdcxx . . $ Eigen/JacobiSVD#m_prescribedThreshold.
737 : (stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).<Indexcxx . . $ Eigen/JacobiSVD#Index#>)(1,m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.)*cxx . . $ Eigen/`operator*`(138cccbaccb3e907).NumTraitscxx . . $ Eigen/NumTraits#<Scalar>::epsilon();
738 }
739
740 inline Indexcxx . . $ Eigen/JacobiSVD#Index# rowscxx . . $ Eigen/JacobiSVD#rows(2c7b05c1f1314d58).() const { return m_rowscxx . . $ Eigen/JacobiSVD#m_rows.; }
741 inline Indexcxx . . $ Eigen/JacobiSVD#Index# colscxx . . $ Eigen/JacobiSVD#cols(2c7b05c1f1314d58).() const { return m_colscxx . . $ Eigen/JacobiSVD#m_cols.; }
742
743 private:
744 void allocatecxx . . $ Eigen/JacobiSVD#allocate(22858fad3828e736).(Indexcxx . . $ Eigen/JacobiSVD#Index# rows, Indexcxx . . $ Eigen/JacobiSVD#Index# cols, unsigned int computationOptions);
745
746 protected:
747 MatrixUTypecxx . . $ Eigen/JacobiSVD#MatrixUType# m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU.;
748 MatrixVTypecxx . . $ Eigen/JacobiSVD#MatrixVType# m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV.;
749 SingularValuesTypecxx . . $ Eigen/JacobiSVD#SingularValuesType# m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues.;
750 WorkMatrixTypecxx . . $ Eigen/JacobiSVD#WorkMatrixType# m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix.;
751 bool m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized., m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated., m_usePrescribedThresholdcxx . . $ Eigen/JacobiSVD#m_usePrescribedThreshold.;
752 bool m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU., m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.;
753 bool m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV., m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.;
754 unsigned int m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.;
755 Indexcxx . . $ Eigen/JacobiSVD#Index# m_nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#m_nonzeroSingularValues., m_rowscxx . . $ Eigen/JacobiSVD#m_rows., m_colscxx . . $ Eigen/JacobiSVD#m_cols., m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.;
756 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# m_prescribedThresholdcxx . . $ Eigen/JacobiSVD#m_prescribedThreshold.;
757
758 template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
759 friend struct internalcxx . . $ Eigen/internal/::svd_precondition_2x2_block_to_be_realcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#;
760 template<typename __MatrixType, int _QRPreconditioner, int _Case, bool _DoAnything>
761 friend struct internalcxx . . $ Eigen/internal/::qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#;
762
763 internalcxx . . $ Eigen/internal/::qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#, QRPreconditioner, internalcxx . . $ Eigen/internal/::PreconditionIfMoreColsThanRowscxx . . $ Eigen/internal/PreconditionIfMoreColsThanRows.> m_qr_precond_morecolscxx . . $ Eigen/JacobiSVD#m_qr_precond_morecols.;
764 internalcxx . . $ Eigen/internal/::qr_preconditioner_implcxx . . $ Eigen/internal/qr_preconditioner_impl#<MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#, QRPreconditioner, internalcxx . . $ Eigen/internal/::PreconditionIfMoreRowsThanColscxx . . $ Eigen/internal/PreconditionIfMoreRowsThanCols.> m_qr_precond_morerowscxx . . $ Eigen/JacobiSVD#m_qr_precond_morerows.;
765 MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType# m_scaledMatrixcxx . . $ Eigen/JacobiSVD#m_scaledMatrix.;
766 };
767
768 template<typename MatrixType, int QRPreconditioner>
769 void JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner>::allocatecxx . . $ Eigen/JacobiSVD#allocate(22858fad3828e736).(Indexcxx . . $ Eigen/JacobiSVD#Index# rows, Indexcxx . . $ Eigen/JacobiSVD#Index# cols, unsigned int computationOptions)
770 {
771 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(rows >= 0 && cols >= 0);
772
773 if (m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated. &&
774 rows == m_rowscxx . . $ Eigen/JacobiSVD#m_rows. &&
775 cols == m_colscxx . . $ Eigen/JacobiSVD#m_cols. &&
776 computationOptions == m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions.)
777 {
778 return;
779 }
780
781 m_rowscxx . . $ Eigen/JacobiSVD#m_rows. = rows;
782 m_colscxx . . $ Eigen/JacobiSVD#m_cols. = cols;
783 m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized. = false;
784 m_isAllocatedcxx . . $ Eigen/JacobiSVD#m_isAllocated. = true;
785 m_computationOptionscxx . . $ Eigen/JacobiSVD#m_computationOptions. = computationOptions;
786 m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU. = (computationOptions & ComputeFullUcxx . . $ Eigen/ComputeFullU.) != 0;
787 m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU. = (computationOptions & ComputeThinUcxx . . $ Eigen/ComputeThinU.) != 0;
788 m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV. = (computationOptions & ComputeFullVcxx . . $ Eigen/ComputeFullV.) != 0;
789 m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV. = (computationOptions & ComputeThinVcxx . . $ Eigen/ComputeThinV.) != 0;
790 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(!(m_computeFullU && m_computeThinU) && "JacobiSVD: you can't ask for both full and thin U");
791 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(!(m_computeFullV && m_computeThinV) && "JacobiSVD: you can't ask for both full and thin V");
792 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(EIGEN_IMPLIEScxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:410:9`!(m_computeThinU || m_computeThinV, MatrixType::ColsAtCompileTime==Dynamic) &&
793 "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns.");
794 if (QRPreconditioner == FullPivHouseholderQRPreconditionercxx . . $ Eigen/FullPivHouseholderQRPreconditioner.)
795 {
796 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(!(m_computeThinU || m_computeThinV) &&
797 "JacobiSVD: can't compute thin U or thin V with the FullPivHouseholderQR preconditioner. "
798 "Use the ColPivHouseholderQR preconditioner instead.");
799 }
800 m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize. = (stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).)(m_rowscxx . . $ Eigen/JacobiSVD#m_rows., m_colscxx . . $ Eigen/JacobiSVD#m_cols.);
801 m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..resize(m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.);
802 if(RowsAtCompileTimecxx . . $ Eigen/JacobiSVD#RowsAtCompileTime.==Dynamiccxx . . $ Eigen/Dynamic.)
803 m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(m_rowscxx . . $ Eigen/JacobiSVD#m_rows., m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU. ? m_rowscxx . . $ Eigen/JacobiSVD#m_rows.
804 : m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU. ? m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.
805 : 0);
806 if(ColsAtCompileTimecxx . . $ Eigen/JacobiSVD#ColsAtCompileTime.==Dynamiccxx . . $ Eigen/Dynamic.)
807 m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(m_colscxx . . $ Eigen/JacobiSVD#m_cols., m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV. ? m_colscxx . . $ Eigen/JacobiSVD#m_cols.
808 : m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV. ? m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.
809 : 0);
810 m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..resizecxx . . $ Eigen/PlainObjectBase#resize(f61ba36a3fd3eb36).(m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize., m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.);
811
812 if(m_colscxx . . $ Eigen/JacobiSVD#m_cols.>m_rowscxx . . $ Eigen/JacobiSVD#m_rows.) m_qr_precond_morecolscxx . . $ Eigen/JacobiSVD#m_qr_precond_morecols..allocate(*this);
813 if(m_rowscxx . . $ Eigen/JacobiSVD#m_rows.>m_colscxx . . $ Eigen/JacobiSVD#m_cols.) m_qr_precond_morerowscxx . . $ Eigen/JacobiSVD#m_qr_precond_morerows..allocate(*this);
814 if(m_colscxx . . $ Eigen/JacobiSVD#m_cols.!=m_colscxx . . $ Eigen/JacobiSVD#m_cols.) m_scaledMatrixcxx . . $ Eigen/JacobiSVD#m_scaledMatrix..resize(rows,cols);
815 }
816
817 template<typename MatrixType, int QRPreconditioner>
818 JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner>&
819 JacobiSVDcxx . . $ Eigen/JacobiSVD#<MatrixType, QRPreconditioner>::computecxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).(const MatrixTypecxx . . $ Eigen/JacobiSVD#MatrixType#& matrix, unsigned int computationOptions)
820 {
821 using stdcxx . . $ std/::abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).;
822 allocatecxx . . $ Eigen/JacobiSVD#allocate(22858fad3828e736).(matrix.rows(), matrix.cols(), computationOptions);
823
824 // currently we stop when we reach precision 2*epsilon as the last bit of precision can require an unreasonable number of iterations,
825 // only worsening the precision of U and V as we accumulate more rotations
826 const RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# precision = RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(2) *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). NumTraitscxx . . $ Eigen/NumTraits#<Scalar>::epsilon();
827
828 // limit for very small denormal numbers to be considered zero in order to avoid infinite loops (see bug 286)
829 const RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# considerAsZero = RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(2) *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<RealScalar>::denorm_min();
830
831 // Scaling factor to reduce over/under-flows
832 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# scale = matrix.cwiseAbs().maxCoeff();
833 if(scale==RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(0)) scale = RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(1);
834
835 /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
836
837 if(m_rowscxx . . $ Eigen/JacobiSVD#m_rows.!=m_colscxx . . $ Eigen/JacobiSVD#m_cols.)
838 {
839 m_scaledMatrixcxx . . $ Eigen/JacobiSVD#m_scaledMatrix. = matrix /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). scale;
840 m_qr_precond_morecolscxx . . $ Eigen/JacobiSVD#m_qr_precond_morecols..run(*this, m_scaledMatrixcxx . . $ Eigen/JacobiSVD#m_scaledMatrix.);
841 m_qr_precond_morerowscxx . . $ Eigen/JacobiSVD#m_qr_precond_morerows..run(*this, m_scaledMatrixcxx . . $ Eigen/JacobiSVD#m_scaledMatrix.);
842 }
843 else
844 {
845 m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix. = matrix.block(0,0,m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.,m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.) /cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561). scale;
846 if(m_computeFullUcxx . . $ Eigen/JacobiSVD#m_computeFullU.) m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..setIdentity(m_rowscxx . . $ Eigen/JacobiSVD#m_rows.,m_rowscxx . . $ Eigen/JacobiSVD#m_rows.);
847 if(m_computeThinUcxx . . $ Eigen/JacobiSVD#m_computeThinU.) m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..setIdentity(m_rowscxx . . $ Eigen/JacobiSVD#m_rows.,m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.);
848 if(m_computeFullVcxx . . $ Eigen/JacobiSVD#m_computeFullV.) m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..setIdentity(m_colscxx . . $ Eigen/JacobiSVD#m_cols.,m_colscxx . . $ Eigen/JacobiSVD#m_cols.);
849 if(m_computeThinVcxx . . $ Eigen/JacobiSVD#m_computeThinV.) m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..setIdentity(m_colscxx . . $ Eigen/JacobiSVD#m_cols., m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.);
850 }
851
852 /*** step 2. The main Jacobi SVD iteration. ***/
853
854 bool finished = false;
855 while(!finished)
856 {
857 finished = true;
858
859 // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix
860
861 for(Indexcxx . . $ Eigen/JacobiSVD#Index# p = 1; p < m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.; ++p)
862 {
863 for(Indexcxx . . $ Eigen/JacobiSVD#Index# q = 0; q < p; ++q)
864 {
865 // if this 2x2 sub-matrix is not diagonal already...
866 // notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't
867 // keep us iterating forever. Similarly, small denormal numbers are considered zero.
868 using stdcxx . . $ std/::maxcxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).max(27ef22a5dfeda5c).;
869 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# threshold = (maxcxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).max(27ef22a5dfeda5c).)(considerAsZero, precision *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). (maxcxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).max(27ef22a5dfeda5c).)(abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(p,p)),
870 abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(q,q))));
871 // We compare both values to threshold instead of calling max to be robust to NaN (See bug 791)
872 if(abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(p,q))>threshold || abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(q,p)) > threshold)
873 {
874 finished = false;
875
876 // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
877 internalcxx . . $ Eigen/internal/::svd_precondition_2x2_block_to_be_realcxx . . $ Eigen/internal/svd_precondition_2x2_block_to_be_real#<MatrixType, QRPreconditioner>::run(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix., *this, p, q);
878 JacobiRotationcxx . . $ Eigen/JacobiRotation#<RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#> j_left, j_right;
879 internalcxx . . $ Eigen/internal/::real_2x2_jacobi_svdcxx . . $ Eigen/internal/real_2x2_jacobi_svd(fd42b5f6123024b3).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix., p, q, &j_left, &j_right);
880
881 // accumulate resulting Jacobi rotations
882 m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..applyOnTheLeft(p,q,j_left);
883 if(computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..applyOnTheRight(p,q,j_left.transposecxx . . $ Eigen/JacobiRotation#transpose(6a60529c4850f7c1).());
884
885 m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..applyOnTheRight(p,q,j_right);
886 if(computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..applyOnTheRight(p,q,j_right);
887 }
888 }
889 }
890 }
891
892 /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/
893
894 for(Indexcxx . . $ Eigen/JacobiSVD#Index# i = 0; i < m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.; ++i)
895 {
896 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# a = abscxx . . $ Eigen/JacobiSVD#compute(d24434979a6b53f3).abs(bb57395c51337e15).(m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(i,i));
897 m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..coeffRef(i) = a;
898 if(computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).() && (a!=RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(0))) m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(i) *= m_workMatrixcxx . . $ Eigen/JacobiSVD#m_workMatrix..coeffcxx . . $ Eigen/PlainObjectBase#coeff(78a91d3b8e25ed20).(i,i)/cxx . . $ Eigen/`operator/`(d9bc0e56bbab6561).a;
899 }
900
901 /*** step 4. Sort singular values in descending order and compute the number of nonzero singular values ***/
902
903 m_nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#m_nonzeroSingularValues. = m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.;
904 for(Indexcxx . . $ Eigen/JacobiSVD#Index# i = 0; i < m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.; i++)
905 {
906 Indexcxx . . $ Eigen/JacobiSVD#Index# pos;
907 RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar# maxRemainingSingularValue = m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..tail(m_diagSizecxx . . $ Eigen/JacobiSVD#m_diagSize.-i).maxCoeff(&pos);
908 if(maxRemainingSingularValue == RealScalarcxx . . $ Eigen/JacobiSVD#RealScalar#(0))
909 {
910 m_nonzeroSingularValuescxx . . $ Eigen/JacobiSVD#m_nonzeroSingularValues. = i;
911 break;
912 }
913 if(pos)
914 {
915 pos += i;
916 stdcxx . . $ std/::swapcxx . . $ std/swap(fd14d5ffdc2aa84d).(m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..coeffRef(i), m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues..coeffRef(pos));
917 if(computeUcxx . . $ Eigen/JacobiSVD#computeU(50ce9a9e25b4a850).()) m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(pos).swap(m_matrixUcxx . . $ Eigen/JacobiSVD#m_matrixU..col(i));
918 if(computeVcxx . . $ Eigen/JacobiSVD#computeV(50ce9a9e25b4a850).()) m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..col(pos).swap(m_matrixVcxx . . $ Eigen/JacobiSVD#m_matrixV..col(i));
919 }
920 }
921
922 m_singularValuescxx . . $ Eigen/JacobiSVD#m_singularValues. *= scale;
923
924 m_isInitializedcxx . . $ Eigen/JacobiSVD#m_isInitialized. = true;
925 return *this;
926 }
927
928 namespace internalcxx . . $ Eigen/internal/ {
929 template<typename _MatrixType, int QRPreconditioner, typename Rhs>
930 struct solve_retvalcxx . . $ Eigen/internal/solve_retval#<JacobiSVDcxx . . $ Eigen/JacobiSVD#<_MatrixType, QRPreconditioner>, Rhs>
931 : solve_retval_basecxx . . $ Eigen/internal/solve_retval_base#<JacobiSVDcxx . . $ Eigen/JacobiSVD#<_MatrixType, QRPreconditioner>, Rhs>
932 {
933 typedef JacobiSVDcxx . . $ Eigen/JacobiSVD#<_MatrixType, QRPreconditioner> JacobiSVDTypecxx . . $ Eigen/internal/solve_retval#JacobiSVDType#;
934 EIGEN_MAKE_SOLVE_HELPERScxx . . $ `lib/fab/vendor/Eigen/src/misc/Solve.h:61:9`!(JacobiSVDType,Rhs)
935
936 template<typename Dest> void evalTocxx . . $ Eigen/internal/solve_retval#evalTo(b7b72e2ad5578bfe).(Dest& dst) const
937 {
938 eigen_assertcxx . . $ `lib/fab/vendor/Eigen/src/Core/util/Macros.h:214:9`!(rhs().rows() == dec().rows());
939
940 // A = U S V^*
941 // So A^{-1} = V S^{-1} U^*
942
943 Matrixcxx . . $ Eigen/Matrix#<Scalarcxx . . $ Eigen/internal/solve_retval#Scalar#, Dynamiccxx . . $ Eigen/Dynamic., Rhs::ColsAtCompileTime, 0, _MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime> tmp;
944 Indexcxx . . $ Eigen/internal/solve_retval#Index# rank = dec().rank();
945
946 tmp.noalias() = dec().matrixU().leftCols(rank).adjoint() *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). rhs();
947 tmp = dec().singularValues().head(rank).asDiagonal().inverse() *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). tmp;
948 dst = dec().matrixV().leftCols(rank) *cxx . . $ Eigen/`operator*`(138cccbaccb3e907). tmp;
949 }
950 };
951 } // end namespace internal
952
953 /** \svd_module
954 *
955 * \return the singular value decomposition of \c *this computed by two-sided
956 * Jacobi transformations.
957 *
958 * \sa class JacobiSVD
959 */
960 template<typename Derived>
961 JacobiSVDcxx . . $ Eigen/JacobiSVD#<typename MatrixBasecxx . . $ Eigen/MatrixBase#<Derived>::PlainObjectcxx . . $ Eigen/MatrixBase#PlainObject#>
962 MatrixBasecxx . . $ Eigen/MatrixBase#<Derived>::jacobiSvdcxx . . $ Eigen/MatrixBase#jacobiSvd(5bb187b0a029a1d7).(unsigned int computationOptions) const
963 {
964 return JacobiSVDcxx . . $ Eigen/JacobiSVD#<PlainObjectcxx . . $ Eigen/MatrixBase#PlainObject#>(*this, computationOptions);
965 }
966
967 } // end namespace Eigen
968
969 #endif // EIGEN_JACOBISVD_H