www.pudn.com > faces.rar > matrix.h


/*** 
 **     libface - Library of face recognition and supporting algorithms 
        Copyright (c) 2003 Stefan Farthofer 
 
	This file is part of libface, which is 
 
        free software; you can redistribute it and/or modify 
        it under the terms of the GNU General Public License as published by 
        the Free Software Foundation; either version 2 of the License, or 
        (at your option) any later version. 
 
        This program is distributed in the hope that it will be useful, 
        but WITHOUT ANY WARRANTY; without even the implied warranty of 
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
        GNU General Public License for more details. 
 
        You should have received a copy of the GNU General Public License 
        along with this program; if not, write to the Free Software 
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
	For further information seek us at http://sourceforge.net/projects/openbio/ 
**	or write an email to dimitri.pissarenko@gmx.net or farthofer@chello.at. 
***/ 
 
/* matrix calculation functions */ 
/* S means symmetric 
 * Q means square 
 * D means distinct source and destination, if not specified the first operand will be replaced 
 *   with the result 
 */ 
 
#ifndef __MATRIX_H 
#define __MATRIX_H 
 
 
//these are used by computeEgenVectorValue, which was copied from 
//Turk&Pentland (they got it from numerical recipes in C) 
#define EPS 0.000000001f 
#define ROTATE(a, i, j, k, l, n) g=a[i*n+j]; h=a[k*n+l]; a[i*n+j] = g-s*(h+g*tau); \ 
  a[k*n+l] = h+s*(g-h*tau) 
 
 
void _matTransposeD(float* dst, float* src, unsigned int rows, unsigned int cols); 
void _matTransposeQ(float* mat, unsigned int n); 
 
/* computes m x n * n x p matrix multiply */ 
void _matMultiplyD(float* dst, float* a, float* b, unsigned int m, unsigned int n, unsigned int p); 
 
/* subtract same-sized matrizes */ 
void _matSubtractD(float* dst, float* a, float* b, unsigned int m, unsigned int n); 
 
/* add same-sized matrizes */ 
void _matAdd(float* dst, float* b, unsigned int m, unsigned int n); 
 
/* computes eigenvalues and vectors of a symmetric matrix  
 * columns of matVectors contain the eigenvectors 
 */ 
int _matEigenSD(float* mat, int n, float* vecValues, float* matVectors); 
 
#endif /* header guard */