JIXIE Namespace Reference
IntroductionCopyright (c) 2016 Theodore Gast, Chuyuan Fu, Chenfanfu Jiang, Joseph Teran Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. If the code is used in an article, the following paper shall be cited: @techreport{qrsvd:2016, title={Implicit-shifted Symmetric QR Singular Value Decomposition of 3x3 Matrices}, author={Gast, Theodore and Fu, Chuyuan and Jiang, Chenfanfu and Teran, Joseph}, year={2016}, institution={University of California Los Angeles} } THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This file implements 2D and 3D polar decompositions and SVDs. T may be float or double. 2D Polar: Eigen::Matrix<T, 2, 2> A,R,S; A<<1,2,3,4; JIXIE::polarDecomposition(A, R, S); R will be the closest rotation to A S will be symmetric 2D SVD: Eigen::Matrix<T, 2, 2> A; A<<1,2,3,4; Eigen::Matrix<T, 2, 1> S; Eigen::Matrix<T, 2, 2> U; Eigen::Matrix<T, 2, 2> V; JIXIE::singularValueDecomposition(A,U,S,V); A = U S V' U and V will be rotations S will be singular values sorted by decreasing magnitude. Only the last one may be negative. 3D Polar: Eigen::Matrix<T, 3, 3> A,R,S; A<<1,2,3,4,5,6; JIXIE::polarDecomposition(A, R, S); R will be the closest rotation to A S will be symmetric 3D SVD: Eigen::Matrix<T, 3, 3> A; A<<1,2,3,4,5,6; Eigen::Matrix<T, 3, 1> S; Eigen::Matrix<T, 3, 3> U; Eigen::Matrix<T, 3, 3> V; JIXIE::singularValueDecomposition(A,U,S,V); A = U S V' U and V will be rotations S will be singular values sorted by decreasing magnitude. Only the last one may be negative. SVD based on implicit QR with Wilkinson Shift Copyright (c) 2016 Theodore Gast, Chuyuan Fu, Chenfanfu Jiang, Joseph Teran Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. If the code is used in an article, the following paper shall be cited: @techreport{qrsvd:2016, title={Implicit-shifted Symmetric QR Singular Value Decomposition of 3x3 Matrices}, author={Gast, Theodore and Fu, Chuyuan and Jiang, Chenfanfu and Teran, Joseph}, year={2016}, institution={University of California Los Angeles} } THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This file provides a random number generator and a timer. Sample usage: RandomNumber<float> rand; float x = randReal(-0.5, 0.8); Timer timer; timer.start(); SOME CODE A std::cout<<"CODE A took "<<timer.click()<<" seconds"<<std::endl; SOME CODE B std::cout<<"CODE B took "<<timer.click()<<" seconds"<<std::endl; Function Documentation◆ zeroChase()
template<class T >
Reduce H to of form x x + 0 x x 0 0 x Reduce H to of form x x 0 0 x x 0 + x Can calculate r2 without multiplying by r1 since both entries are in first two rows thus no need to divide by sqrt(a^2+b^2) Reduce H to of form x x 0 0 x x 0 0 x Definition at line 253 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::columnRotation(), JIXIE::GivensRotation< T >::compute(), and JIXIE::GivensRotation< T >::rowRotation(). Referenced by makeUpperBidiag(), and singularValueDecomposition(). ◆ makeUpperBidiag()
template<class T >
Reduce H to of form x x x x x x 0 x x Definition at line 310 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::columnRotation(), JIXIE::GivensRotation< T >::rowRotation(), and zeroChase(). Referenced by singularValueDecomposition(). ◆ makeLambdaShape()
template<class T >
Reduce H to of form x x 0 x x x x x x Reduce H to of form x x 0 x x 0 x x x Reduce H to of form x x 0 x x 0 x 0 x Reduce H to of form x 0 0 x x 0 x 0 x Definition at line 341 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::columnRotation(), JIXIE::GivensRotation< T >::computeUnconventional(), and JIXIE::GivensRotation< T >::rowRotation(). ◆ polarDecomposition() [1/3]
template<class TA , class T , class TS >
Whole matrix S is stored since its faster to calculate due to simd vectorization Polar guarantees negative sign is on the small magnitude singular value. S is guaranteed to be the closest one to identity. R is guaranteed to be the closest rotation to A. Definition at line 403 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::rowRotation(). Referenced by polarDecomposition(), and singularValueDecomposition(). ◆ polarDecomposition() [2/3]
template<class TA , class TR , class TS >
Whole matrix S is stored since its faster to calculate due to simd vectorization Polar guarantees negative sign is on the small magnitude singular value. S is guaranteed to be the closest one to identity. R is guaranteed to be the closest rotation to A. Definition at line 437 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::fill(), and polarDecomposition(). ◆ singularValueDecomposition() [1/3]
template<class TA , class T , class Ts >
Definition at line 456 of file ImplicitQRSVD.h. References polarDecomposition(). Referenced by polarDecomposition(), process(), singularValueDecomposition(), and SVDMethodIQRSVD(). ◆ singularValueDecomposition() [2/3]
template<class TA , class TU , class Ts , class TV >
Definition at line 528 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::fill(), and singularValueDecomposition(). ◆ wilkinsonShift()
template<class T >
Definition at line 553 of file ImplicitQRSVD.h. Referenced by singularValueDecomposition(). ◆ singularValueDecomposition() [3/3]
template<class T >
Do implicit shift QR until A^T A is block diagonal Handle the cases of one of the alphas and betas being 0 Sorted by ease of handling and then frequency of occurrence If B is of form x x 0 0 x 0 0 0 x If B is of form x 0 0 0 x x 0 0 x If B is of form x x 0 0 0 x 0 0 x Reduce B to x x 0 0 0 0 0 0 x If B is of form x x 0 0 x x 0 0 0 Reduce B to x x + 0 x 0 0 0 0 Reduce B to x x 0
If B is of form 0 x 0 0 x x 0 0 x Reduce B to 0 0 + 0 x x 0 0 x Reduce B to 0 0 0 0 x x 0 + x Definition at line 688 of file ImplicitQRSVD.h. References JIXIE::GivensRotation< T >::columnRotation(), JIXIE::GivensRotation< T >::compute(), JIXIE::GivensRotation< T >::computeUnconventional(), makeUpperBidiag(), JIXIE::GivensRotation< T >::rowRotation(), wilkinsonShift(), and zeroChase(). ◆ polarDecomposition() [3/3]
template<class T >
Whole matrix S is stored Polar guarantees negative sign is on the small magnitude singular value. S is guaranteed to be the closest one to identity. R is guaranteed to be the closest rotation to A. Definition at line 864 of file ImplicitQRSVD.h. References singularValueDecomposition(). |
Follow us!