My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qf_matrix.h
Go to the documentation of this file.
1 /***************************************************************************
2  qf_matrix.h
3  ----------------
4  begin : Mon Jan 02 2006
5  copyright : (C) 2006 by Stefan Jahn
6  email : stefan@lkcc.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef _QF_MATRIX_H
19 #define _QF_MATRIX_H
20 
21 class qf_matrix
22 {
23  public:
24  // constructor
25  qf_matrix (unsigned int d) {
26  data = (qf_double_t *) calloc (d * d, sizeof (qf_double_t));
27  n = d;
28  }
29 
30  // destructor
32  free (data);
33  }
34 
35  // accessor operators
36  qf_double_t operator () (int r, int c) const {
37  return data[r * n + c];
38  }
39  qf_double_t & operator () (int r, int c) {
40  return data[r * n + c];
41  }
42 
43  // size of matrix
44  unsigned int n;
45 
46  private:
47  qf_double_t * data;
48 };
49 
50 #endif // _QF_MATRIX_H