include/it/linalg.h

Go to the documentation of this file.
00001 /*
00002    libit - Library for basic source and channel coding functions
00003    Copyright (C) 2005-2008 
00004    Francois Cayre, Vivien Chappelier, Herve Jegou
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public
00017    License along with this library; if not, write to the Free
00018    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 /*
00022   Linear algebra functions
00023   Copyright (C) 2006-2008 François Cayre
00024 
00025 
00026   These basic linear algebra functions are meant as a good 
00027   Swiss knife for every day use in most situations (real, 
00028   dense matrices). 
00029 
00030   We do not plan to add support for sparse, banded matrices 
00031   or whatsoever. 
00032 
00033   GENERAL NOTE: Several functions provided here imply using 
00034   several additionnal storage for various matrices or vectors 
00035   related to the goal of the function (think of matrices U 
00036   *and* V of a SVD for example). IN THESE CASES, IT IS THE 
00037   RESPONSIBILITY OF THE USER TO PROPERLY ALLOCATE MEMORY BEFORE 
00038   CALLING THE ROUTINE. However, we gracefully perform checking 
00039   before actually launching the routine. 
00040 
00041   Functions: 
00042   - mat_eig_sym    [ It is the responsibility of the user to make ]
00043   - mat_eig_nonsym [ a proper decision between these two routines ]
00044   - mat_svd 
00045   - mat_rank 
00046   
00047   are taken from the public-domain JAMA package: 
00048   http://math.nist.gov/javanumerics/jama/ 
00049 
00050   Original code from: 
00051   - Joe Hicklin         (MathWorks)
00052   - Cleve Moler         (MathWorks)
00053   - Peter Webb          (MathWorks)
00054   - Ronald F. Boisvert  (NIST)
00055   - Bruce Miller        (NIST)
00056   - Roldan Pozo         (NIST)
00057   - Karin Remington     (NIST)
00058 
00059   According to the JAMA page: 
00060   "The algorithms employed are similar to those of the 
00061    classic Wilkinson and Reinsch Handbook, i.e. the same 
00062    algorithms used in EISPACK, LINPACK and MATLAB."
00063 
00064   The linear system solver is based on LU with partial or 
00065   total pivoting strategy (choice is left to the user). 
00066 
00067   TODO (possibly before 2048): 
00068   - Least square QR solver (possibly constrained) 
00069   - Implementation of various Arnoldi/Lanczos-based methods 
00070 
00071 */
00072 
00073 #ifndef __it_linalg_h
00074 #define __it_linalg_h
00075 
00076 #include <it/vec.h>
00077 #include <it/mat.h>
00078 #include <it/io.h>
00079 #include <it/math.h>
00080 
00081 /*---------------------------------------------------------------------------*/
00082 /*! \defgroup linalg Linear Algebra                                          */
00083 /* @{                                                                        */
00084 /*---------------------------------------------------------------------------*/
00085 
00086 
00087 /* Direct LU solver */
00088 vec  mat_solve_vec (mat A, vec b);
00089 mat  mat_solve_mat (mat A, mat B);
00090 
00091 /* Direct Least Square QR-based solver
00092  */
00093 mat mat_ls( mat A, mat B ); 
00094 
00095 /* Matrix decompositions and transforms */
00096 double mat_lu (mat a, ivec piv ); 
00097 void mat_cholesky( mat a );
00098 vec  mat_qr (mat a);
00099 void mat_gs (mat A);  
00100 mat  mat_real_schur (mat a);  
00101 cvec mat_eig (mat a, cmat evec);
00102 vec  mat_eig_sym (mat a, mat evec);
00103 mat  mat_hessenberg (mat a, mat V);
00104 vec  mat_svd (mat A, mat U, mat V);
00105 
00106 /* Inversion of a matrix using the Gaussian method */
00107 mat  mat_inv (mat m);
00108 mat  mat_new_inv (mat m);
00109 cmat cmat_inv (cmat m);
00110 cmat cmat_new_inv (cmat m);
00111 
00112 /* Unsorted */
00113 int  mat_is_symmetric (mat a);
00114 double mat_det (mat a);
00115 double mat_norm2 (mat a);
00116 double mat_cond (mat a);
00117 int  mat_rank (mat a);
00118 
00119 /* @} */
00120 
00121 #endif        /* __it_linalg_h */

Hosted by
Copyright (C) 2005-2006 Hervé Jégou
Vivien Chappelier
Francois Cayre
libit logo courtesy of Jonathan Delhumeau