| 1 |
tim |
741 |
/********************************************************************** |
| 2 |
|
|
matrix.h - Operations on arbitrary-sized matrix. |
| 3 |
|
|
|
| 4 |
|
|
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. |
| 5 |
|
|
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison |
| 6 |
|
|
|
| 7 |
|
|
This file is part of the Open Babel project. |
| 8 |
|
|
For more information, see <http://openbabel.sourceforge.net/> |
| 9 |
|
|
|
| 10 |
|
|
This program is free software; you can redistribute it and/or modify |
| 11 |
|
|
it under the terms of the GNU General Public License as published by |
| 12 |
|
|
the Free Software Foundation version 2 of the License. |
| 13 |
|
|
|
| 14 |
|
|
This program is distributed in the hope that it will be useful, |
| 15 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
|
|
GNU General Public License for more details. |
| 18 |
|
|
***********************************************************************/ |
| 19 |
|
|
|
| 20 |
|
|
#ifndef OB_MATRIX_H |
| 21 |
|
|
#define OB_MATRIX_H |
| 22 |
|
|
#include "babelconfig.hpp" |
| 23 |
|
|
#include <vector> |
| 24 |
|
|
#include <math.h> |
| 25 |
|
|
|
| 26 |
|
|
namespace OpenBabel |
| 27 |
|
|
{ |
| 28 |
|
|
|
| 29 |
|
|
/* |
| 30 |
|
|
* vector<vector<double> > m : m[row][col] gives appropriate row/col entry |
| 31 |
|
|
* double **m : m[row][col] gives appropriate row/col entry |
| 32 |
|
|
* double *m : m[(row * numCols) + col] gives appropriate row/col entry |
| 33 |
|
|
*/ |
| 34 |
|
|
|
| 35 |
|
|
void print_matrix(std::vector<std::vector<double> > &m); |
| 36 |
|
|
void print_matrix_f (double *m, int rows, int cols); |
| 37 |
|
|
void print_matrix_ff(double **m, int rows, int cols); |
| 38 |
|
|
|
| 39 |
|
|
bool mult_matrix(std::vector<std::vector<double> > &c, std::vector<std::vector<double> > &a, std::vector<std::vector<double> > &b); |
| 40 |
|
|
bool mult_matrix_f (double *c, double *a, double *b, int rows, int cols); |
| 41 |
|
|
bool mult_matrix_ff(double **c, double **a, double **b, int rows, int cols); |
| 42 |
|
|
|
| 43 |
|
|
bool invert_matrix(std::vector<std::vector<double> > &m, double &det); |
| 44 |
|
|
bool invert_matrix_f (double *m, double &det, int rows, int cols); |
| 45 |
|
|
bool invert_matrix_ff(double **m, double &det, int rows, int cols); |
| 46 |
|
|
|
| 47 |
|
|
bool convert_matrix_f (std::vector<std::vector<double> > &src, double *dst); |
| 48 |
|
|
bool convert_matrix_ff(std::vector<std::vector<double> > &src, double **dst); |
| 49 |
|
|
bool convert_matrix_f (double *src, std::vector<std::vector<double> > &dst, int rows, int cols); |
| 50 |
|
|
bool convert_matrix_ff(double **src, std::vector<std::vector<double> > &dst, int rows, int cols); |
| 51 |
|
|
bool convert_matrix_ff_f(double **src, double *dst, int rows, int cols); |
| 52 |
|
|
bool convert_matrix_f_ff(double *src, double **dst, int rows, int cols); |
| 53 |
|
|
|
| 54 |
|
|
} |
| 55 |
|
|
|
| 56 |
|
|
#endif // OB_MATRIX_H |
| 57 |
|
|
|
| 58 |
|
|
//! \file matrix.h |
| 59 |
|
|
//! \brief Operations on arbitrary-sized matrix. |