00001 /* 00002 File: Factor.h 00003 00004 Function: Provides routines for factoring a matrix: 00005 00006 + SVD decomposes A into three matrices, A = U D Vt, where: 00007 00008 U is m x n, and orthogonal 00009 00010 D is n x n, and is diagonal; its elements are the 00011 eigenvalues of AtA. 00012 00013 V is n x n, and orthogonal. 00014 00015 + QR factors A into A = Q R, where R is upper-triangular, 00016 and Q is orthogonal. 00017 00018 Author: Andrew Willmott 00019 00020 Copyright: (c) 1999-2000, Andrew Willmott 00021 */ 00022 00023 #ifndef __Factor__ 00024 #define __Factor__ 00025 00026 #include "vl/VLd.h" 00027 00028 00029 // --- Factorization routines-------------------------------------------------- 00030 00031 Void SVDFactorization(Matd &A, Matd &U, Matd &V, Vecd &diagonal); 00032 // Factor A into U D V 00033 // Destroys A. 00034 00035 Double QRFactorization(Matd &A, Matd &Q, Matd &R); 00036 // Factor A into an orthogonal matrix Q and an upper-triangular matrix R. 00037 // Destroys A. 00038 00039 // --- Utility routines-------------------------------------------------------- 00040 00041 Double LeftHouseholder(Matd &A, Matd &U, const Int i); 00042 Double RightHouseholder(Matd &A, Matd &V, const Int i); 00043 Void Bidiagonalize(Matd &A, Matd &U, Matd &V, Vecd &diagonal, Vecd &superDiag); 00044 Void Diagonalize(Vecd &diagonal, Vecd &superDiag, Matd &U, Matd &V); 00045 00046 #endif