ESTER
Evolution STEllaire en Rotation
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
matrix.h
Go to the documentation of this file.
1 #ifndef _MATRIX_H
2 #define _MATRIX_H
3 
4 #include "ester-config.h"
5 #include <stdio.h>
6 
9 class matrix {
10  double *p;
11  int nf,nc;
12 public:
13  explicit matrix(int nfil=1,int ncol=1);
14  ~matrix();
15  matrix(const matrix &);
16  int nrows() const;
17  int ncols() const;
18  double *data() const;
19  matrix &dim(int nrow,int ncol);
20  matrix &redim(int nrow,int ncol);
21  matrix &operator=(const matrix &);
22  double &operator()(int irow,int icol);
23  double &operator()(int ielem);
24  const double &operator()(int irow,int icol) const;
25  const double &operator()(int ielem) const;
26  int read(int nrow,int ncol,FILE *fp,char mode='t');
27  int write(FILE *fp=stdout,char mode='t') const;
28  void write_fmt(const char *fmt,FILE *fp=stdout) const;
29  void swap(matrix &);
30  void zero(int nrows,int ncols);
31  void values(double,...);
32 
33  friend matrix operator-(double,const matrix &);
34  friend matrix operator-(const matrix &);
35  friend matrix operator/(double,const matrix &);
36 
37  matrix operator+(const matrix &) const;
38  matrix operator+(double) const;
39  matrix operator-(const matrix &) const;
40  matrix operator-(double) const;
41  matrix operator*(const matrix &) const;
42  matrix operator*(double) const;
43  matrix operator/(const matrix &) const;
44  matrix operator/(double) const;
45  matrix operator==(const matrix &) const;
46  matrix operator==(double) const;
47  matrix operator!=(const matrix &) const;
48  matrix operator!=(double) const;
49  matrix operator>(const matrix &) const;
50  matrix operator>(double) const;
51  matrix operator<(const matrix &a) const {return a>*this;}
52  matrix operator<(double) const;
53  matrix operator>=(const matrix &) const;
54  matrix operator>=(double) const;
55  matrix operator<=(const matrix &a) const {return a>=*this;}
56  matrix operator<=(double) const;
57  matrix operator&&(const matrix &) const;
58  matrix operator&&(double) const;
59  matrix operator||(const matrix &) const;
60  matrix operator||(double) const;
61  matrix &operator+=(const matrix &);
62  matrix &operator-=(const matrix &);
63  matrix &operator*=(const matrix &);
64  matrix &operator/=(const matrix &);
65  matrix &operator+=(double);
66  matrix &operator-=(double);
67  matrix &operator*=(double);
68  matrix &operator/=(double);
69 
70  const matrix row(int irow) const;
71  const matrix col(int icol) const;
72  const matrix block(int irow1,int irow2,int icol1,int icol2) const;
73  const matrix block_step(int irow1,int irow2,int drow,int icol1,int icol2,int dcol) const;
74  matrix &setrow(int irow,const matrix &);
75  matrix &setcol(int icol,const matrix &);
76  matrix &setblock(int irow1,int irow2,int icol1,int icol2,const matrix &);
77  matrix &setblock_step(int irow1,int irow2,int drow,int icol1,int icol2,int dcol,const matrix &);
78  matrix concatenate(const matrix &a,int dir=0) const;
79 
80  matrix transpose() const;
81  matrix fliplr() const;
82  matrix flipud() const;
83 
84  friend matrix ones(int nfil,int ncol);
85  friend matrix zeros(int nfil,int ncol);
86  friend matrix random_matrix(int nfil,int ncol);
87  friend matrix eye(int n);
88  friend matrix vector(double x0,double x1,int n);
89  friend matrix vector_t(double x0,double x1,int n);
90 
91  friend double max(const matrix &);
92  friend double min(const matrix &);
93  friend double sum(const matrix &);
94  friend double mean(const matrix &);
95 
96  friend matrix max(const matrix &,const matrix &);
97  friend matrix max(const matrix &,double);
98  friend matrix max(double,const matrix &);
99  friend matrix min(const matrix &,const matrix &);
100  friend matrix min(const matrix &,double);
101  friend matrix min(double,const matrix &);
102 
103  friend int exist(const matrix &);
104  friend int isequal(const matrix &,const matrix &);
105 
106  friend matrix cos(const matrix &);
107  friend matrix sin(const matrix &);
108  friend matrix tan(const matrix &);
109  friend matrix acos(const matrix &);
110  friend matrix asin(const matrix &);
111  friend matrix atan(const matrix &);
112  friend matrix cosh(const matrix &);
113  friend matrix sinh(const matrix &);
114  friend matrix tanh(const matrix &);
115  friend matrix exp(const matrix &);
116  friend matrix log(const matrix &);
117  friend matrix log10(const matrix &);
118  friend matrix sqrt(const matrix &);
119  friend matrix abs(const matrix &);
120  friend matrix floor(const matrix &);
121  friend matrix ceil(const matrix &);
122  friend matrix round(const matrix &);
123  friend matrix atan2(const matrix &,const matrix &);
124  friend matrix atan2(double,const matrix &);
125  friend matrix atan2(const matrix &,double);
126  friend matrix pow(const matrix &,const matrix &);
127  friend matrix pow(double,const matrix &);
128  friend matrix pow(const matrix &,double);
129  friend matrix pow(const matrix &,int);
130 
131  matrix operator,(const matrix &) const;
132  matrix solve(matrix) const;
133  matrix inv() const;
134 
135  friend class matrix_block_diag;
136 
137 };
138 
139 inline matrix operator+(double n,const matrix &a) {return a+n;}
140 inline matrix operator+(const matrix &a) {return a;}
141 matrix operator-(double,const matrix &);
142 matrix operator-(const matrix &);
143 inline matrix operator*(double n,const matrix &a) {return a*n;}
144 matrix operator/(double,const matrix &);
145 inline matrix operator==(double n,const matrix &a) {return a==n;}
146 inline matrix operator!=(double n,const matrix &a) {return a!=n;}
147 inline matrix operator<(double n,const matrix &a) {return a>n;}
148 inline matrix operator>(double n,const matrix &a) {return a<n;}
149 inline matrix operator<=(double n,const matrix &a) {return a>=n;}
150 inline matrix operator>=(double n,const matrix &a) {return a<=n;}
151 inline matrix operator&&(double n,const matrix &a) {return a&&n;}
152 inline matrix operator||(double n,const matrix &a) {return a||n;}
153 
154 matrix ones(int nfil,int ncol);
155 matrix zeros(int nfil,int ncol);
156 matrix random_matrix(int nfil,int ncol);
157 matrix eye(int n);
158 matrix vector(double x0,double x1,int n);
159 matrix vector_t(double x0,double x1,int n);
160 
161 double max(const matrix &);
162 double min(const matrix &);
163 double sum(const matrix &);
164 double mean(const matrix &);
165 
166 matrix max(const matrix &,const matrix &);
167 matrix max(const matrix &,double);
168 matrix max(double,const matrix &);
169 matrix min(const matrix &,const matrix &);
170 matrix min(const matrix &,double);
171 matrix min(double,const matrix &);
172 
173 int exist(const matrix &);
174 int isequal(const matrix &,const matrix &);
175 
176 matrix cos(const matrix &);
177 matrix sin(const matrix &);
178 matrix tan(const matrix &);
179 matrix acos(const matrix &);
180 matrix asin(const matrix &);
181 matrix atan(const matrix &);
182 matrix cosh(const matrix &);
183 matrix sinh(const matrix &);
184 matrix tanh(const matrix &);
185 matrix exp(const matrix &);
186 matrix log(const matrix &);
187 matrix log10(const matrix &);
188 matrix sqrt(const matrix &);
189 matrix abs(const matrix &);
190 matrix floor(const matrix &);
191 matrix ceil(const matrix &);
192 matrix round(const matrix &);
193 matrix atan2(const matrix &,const matrix &);
194 matrix atan2(double,const matrix &);
195 matrix atan2(const matrix &,double);
196 matrix pow(const matrix &,const matrix &);
197 matrix pow(double,const matrix &);
198 matrix pow(const matrix &,double);
199 matrix pow(const matrix &,int);
200 
204  int nb;
205 public:
206  explicit matrix_block_diag(int nblocks=1);
211  operator matrix() const;
212  const matrix &block(int i) const;
213  matrix &block(int i);
214  int nblocks() const;
215  int nrows() const;
216  int ncols() const;
217  friend matrix operator,(const matrix &,const matrix_block_diag &);
218  matrix operator,(const matrix &) const;
220  friend matrix_block_diag operator*(const matrix &,const matrix_block_diag &);
221  friend matrix_block_diag operator*(double,const matrix_block_diag &);
222  matrix_block_diag operator*(const matrix &) const;
223  matrix_block_diag operator/(const matrix &) const;
224  matrix_block_diag operator*(double) const;
225  matrix_block_diag operator/(double) const;
231  matrix row(int n) const;
232  double operator()(int nfil,int ncol) const;
233  friend matrix_block_diag eye(const matrix_block_diag &);
235 
236 };
237 
238 matrix operator,(const matrix &,const matrix_block_diag &);
239 inline matrix_block_diag operator*(const matrix &a,const matrix_block_diag &D) {return D*a;}
240 inline matrix_block_diag operator*(double n,const matrix_block_diag &D){return D*n;}
241 inline matrix_block_diag operator+(const matrix_block_diag&a) {return a;}
244 
245 #include<map>
246 #include<string>
247 
248 class double_map : public std::map<std::string,double> {
249 public:
250  inline double &operator[](const std::string& key) {return std::map<std::string,double>::operator[](key);}
251  inline const double &operator[](const std::string& key) const {return find(key)->second;};
252  double sum();
253 
254 };
255 
257 {
258 private:
260 public:
261  create_double_map(const std::string& key, const double& val)
262  {
263  m_map[key] = val;
264  }
265 
266  create_double_map& operator()(const std::string& key, const double& val)
267  {
268  m_map[key] = val;
269  return *this;
270  }
271 
272  operator double_map()
273  {
274  return m_map;
275  }
276 };
277 
278 class matrix_map_elem : public std::map<std::string,double *> {
279 public:
280  operator double_map();
283  matrix_map_elem &operator=(double);
284 };
285 
286 
287 class matrix_map : public std::map<std::string,matrix> {
288 public:
289  inline matrix &operator[](const std::string& key) {return std::map<std::string,matrix>::operator[](key);}
290  inline const matrix &operator[](const std::string& key) const {return find(key)->second;};
291  matrix_map_elem operator()(int nfil, int ncol);
292  const double_map operator()(int nfil, int ncol) const;
293  const matrix_map row(int irow) const;
294  const matrix_map col(int icol) const;
295  const matrix_map block(int irow1,int irow2,int icol1,int icol2) const;
296  const matrix_map block_step(int irow1,int irow2,int drow,int icol1,int icol2,int dcol) const;
297  matrix_map &setrow(int irow,const matrix_map &);
298  matrix_map &setcol(int icol,const matrix_map &);
299  matrix_map &setblock(int irow1,int irow2,int icol1,int icol2,const matrix_map &);
300  matrix_map &setblock_step(int irow1,int irow2,int drow,int icol1,int icol2,int dcol,const matrix_map &);
301  matrix_map &setrow(int irow,const matrix &);
302  matrix_map &setcol(int icol,const matrix &);
303  matrix_map &setblock(int irow1,int irow2,int icol1,int icol2,const matrix &);
304  matrix_map &setblock_step(int irow1,int irow2,int drow,int icol1,int icol2,int dcol,const matrix &);
305 
306  matrix_map operator*(double d) const;
307  matrix_map operator*(const matrix &m) const;
308  matrix_map &operator*=(const double_map &d);
309  matrix_map &operator/=(const double_map &d);
310  matrix_map &operator+=(const matrix_map &d);
311  matrix_map &operator-=(const matrix_map &d);
312  matrix_map &operator*=(const matrix_map &d);
313  matrix_map &operator/=(const matrix_map &d);
314 
315  matrix sum();
316 
317 };
318 
320 {
321 private:
323 public:
324  create_matrix_map(const std::string& key, const matrix& val)
325  {
326  m_map[key] = val;
327  }
328 
329  create_matrix_map& operator()(const std::string& key, const matrix& val)
330  {
331  m_map[key] = val;
332  return *this;
333  }
334 
335  operator matrix_map()
336  {
337  return m_map;
338  }
339 };
340 
341 matrix_map operator*(const double_map &,const matrix &);
342 inline matrix_map operator*(const matrix &m,const double_map &d) {return d*m;};
343 inline matrix_map operator*(double d,const matrix_map &a) {return a*d;};
344 inline matrix_map operator*(const matrix &m,const matrix_map &a) {return a*m;};
345 
346 #include<sys/time.h>
347 class tiempo {
348  double t,t0;
349  timeval tim;
350 public:
351  int active;
352  tiempo() {t=0;active=0;}
353  void reset() {t=0;}
354  void start() {gettimeofday(&tim,NULL);t0=tim.tv_sec+tim.tv_usec/1e6;active=1;}
355  void stop() {gettimeofday(&tim,NULL);if(active) t+=tim.tv_sec+tim.tv_usec/1e6-t0;active=0;}
356  double value() {double tt;gettimeofday(&tim,NULL);tt=t;if(active) tt+=tim.tv_sec+tim.tv_usec/1e6-t0;return tt;}
357 };
358 
359 
360 #endif
double sum()
Definition: matrix_map.cpp:169
double t0
Definition: matrix.h:348
matrix operator<=(const matrix &a) const
Definition: matrix.h:55
Definition: matrix.h:287
friend matrix log10(const matrix &)
Definition: mat_math.cpp:162
matrix_map m_map
Definition: matrix.h:322
matrix atan2(const matrix &, const matrix &)
Definition: mat_math.cpp:246
friend matrix_block_diag operator*(const matrix &, const matrix_block_diag &)
Definition: matrix.h:239
tiempo()
Definition: matrix.h:352
matrix_map & setrow(int irow, const matrix_map &)
Definition: matrix_map.cpp:99
matrix operator&&(const matrix &) const
Definition: matrix.cpp:851
double t
Definition: matrix.h:348
matrix operator*(const matrix &) const
Definition: matrix.cpp:449
int nb
Definition: matrix.h:204
const matrix & block(int i) const
Definition: matrix_block_diag.cpp:107
matrix & operator[](const std::string &key)
Definition: matrix.h:289
friend matrix vector(double x0, double x1, int n)
Definition: matrix.cpp:1404
matrix random_matrix(int nfil, int ncol)
Definition: matrix.cpp:1361
double max(const matrix &)
Definition: matrix.cpp:1416
matrix_map & setblock(int irow1, int irow2, int icol1, int icol2, const matrix_map &)
Definition: matrix_map.cpp:115
matrix sqrt(const matrix &)
Definition: mat_math.cpp:176
matrix log10(const matrix &)
Definition: mat_math.cpp:162
matrix & setblock_step(int irow1, int irow2, int drow, int icol1, int icol2, int dcol, const matrix &)
Definition: matrix.cpp:1222
matrix_block_diag(int nblocks=1)
Definition: matrix_block_diag.cpp:14
int nrows() const
Definition: matrix_block_diag.cpp:125
friend matrix operator,(const matrix &, const matrix_block_diag &)
Definition: matrix_block_diag.cpp:180
friend matrix atan(const matrix &)
Definition: mat_math.cpp:78
void write_fmt(const char *fmt, FILE *fp=stdout) const
Saves matrix to a file with a special format.
Definition: matrix.cpp:259
double operator()(int nfil, int ncol) const
Definition: matrix_block_diag.cpp:370
matrix tanh(const matrix &)
Definition: mat_math.cpp:120
double * data() const
Returns the pointer to the matrix data.
Definition: matrix.cpp:75
friend matrix sinh(const matrix &)
Definition: mat_math.cpp:106
The matrix class is used to facilitate the work with regular dense matrices.
Definition: matrix.h:9
double value()
Definition: matrix.h:356
matrix operator||(double n, const matrix &a)
Definition: matrix.h:152
matrix cosh(const matrix &)
Definition: mat_math.cpp:92
matrix_map & setblock_step(int irow1, int irow2, int drow, int icol1, int icol2, int dcol, const matrix_map &)
Definition: matrix_map.cpp:123
int isequal(const matrix &, const matrix &)
Definition: matrix.cpp:1537
friend double min(const matrix &)
Definition: matrix.cpp:1430
friend matrix ones(int nfil, int ncol)
Definition: matrix.cpp:1337
void zero(int nrows, int ncols)
Sets the matrix to the nrows x ncols zero matrix.
Definition: matrix.cpp:291
friend int isequal(const matrix &, const matrix &)
Definition: matrix.cpp:1537
const matrix_map block(int irow1, int irow2, int icol1, int icol2) const
Definition: matrix_map.cpp:81
The matrix_block_diag class is used to store block diagonal matrices.
Definition: matrix.h:202
matrix operator<(const matrix &a) const
Definition: matrix.h:51
matrix atan(const matrix &)
Definition: mat_math.cpp:78
int nc
Definition: matrix.h:11
const double & operator[](const std::string &key) const
Definition: matrix.h:251
matrix operator==(double n, const matrix &a)
Definition: matrix.h:145
matrix ceil(const matrix &)
Definition: mat_math.cpp:218
matrix fliplr() const
Definition: matrix.cpp:1299
friend matrix sqrt(const matrix &)
Definition: mat_math.cpp:176
friend matrix operator/(double, const matrix &)
Definition: matrix.cpp:541
matrix floor(const matrix &)
Definition: mat_math.cpp:204
int exist(const matrix &)
Definition: matrix.cpp:1527
friend matrix operator-(double, const matrix &)
Definition: matrix.cpp:411
double & operator[](const std::string &key)
Definition: matrix.h:250
double sum(const matrix &)
Definition: matrix.cpp:1444
matrix inv() const
Definition: mat_spec.cpp:59
matrix operator-(double, const matrix &)
Definition: matrix.cpp:411
matrix operator,(const matrix &) const
Definition: mat_spec.cpp:19
friend matrix exp(const matrix &)
Definition: mat_math.cpp:134
int read(int nrow, int ncol, FILE *fp, char mode='t')
Reads matrix data from a file.
Definition: matrix.cpp:215
matrix operator||(const matrix &) const
Definition: matrix.cpp:799
friend double sum(const matrix &)
Definition: matrix.cpp:1444
matrix flipud() const
Definition: matrix.cpp:1319
void values(double,...)
Sets the values of the matrix (given in column major order).
Definition: matrix.cpp:300
matrix ones(int nfil, int ncol)
Definition: matrix.cpp:1337
matrix cos(const matrix &)
Definition: mat_math.cpp:8
const matrix_map block_step(int irow1, int irow2, int drow, int icol1, int icol2, int dcol) const
Definition: matrix_map.cpp:90
int nf
Definition: matrix.h:11
matrix pow(const matrix &, const matrix &)
Definition: mat_math.cpp:293
double_map m_map
Definition: matrix.h:259
matrix operator!=(const matrix &) const
Definition: matrix.cpp:618
void start()
Definition: matrix.h:354
matrix log(const matrix &)
Definition: mat_math.cpp:148
const matrix col(int icol) const
Definition: matrix.cpp:1090
friend matrix floor(const matrix &)
Definition: mat_math.cpp:204
matrix sum()
Definition: matrix_map.cpp:159
friend matrix_block_diag eye(const matrix_block_diag &)
Definition: matrix_block_diag.cpp:393
matrix & operator/=(const matrix &)
Definition: matrix.cpp:981
create_double_map & operator()(const std::string &key, const double &val)
Definition: matrix.h:266
create_matrix_map(const std::string &key, const matrix &val)
Definition: matrix.h:324
friend matrix ceil(const matrix &)
Definition: mat_math.cpp:218
matrix sin(const matrix &)
Definition: mat_math.cpp:22
matrix_block_diag & set_nblocks(int nblocks)
Definition: matrix_block_diag.cpp:59
matrix operator*(double n, const matrix &a)
Definition: matrix.h:143
int ncols() const
Definition: matrix_block_diag.cpp:136
friend matrix log(const matrix &)
Definition: mat_math.cpp:148
friend matrix cos(const matrix &)
Definition: mat_math.cpp:8
double & operator()(int irow, int icol)
Access matrix's elements.
Definition: matrix.cpp:161
Definition: matrix.h:278
~matrix_block_diag()
Definition: matrix_block_diag.cpp:30
void swap(matrix &)
Swaps two matrices.
Definition: matrix.cpp:274
matrix_map & setcol(int icol, const matrix_map &)
Definition: matrix_map.cpp:107
Definition: matrix.h:248
friend matrix vector_t(double x0, double x1, int n)
Definition: matrix.cpp:1389
matrix operator>(const matrix &) const
Definition: matrix.cpp:669
matrix_map_elem operator()(int nfil, int ncol)
Definition: matrix_map.cpp:41
matrix & setblock(int irow1, int irow2, int icol1, int icol2, const matrix &)
Definition: matrix.cpp:1190
matrix & operator-=(const matrix &)
Definition: matrix.cpp:929
matrix concatenate(const matrix &a, int dir=0) const
Definition: matrix.cpp:1254
matrix & operator=(const matrix &)
Affectation operator.
Definition: matrix.cpp:148
const matrix block_step(int irow1, int irow2, int drow, int icol1, int icol2, int dcol) const
Definition: matrix.cpp:1162
matrix operator/(double, const matrix &)
Definition: matrix.cpp:541
matrix solve(matrix) const
Definition: mat_spec.cpp:33
matrix acos(const matrix &)
Definition: mat_math.cpp:50
friend matrix zeros(int nfil, int ncol)
Definition: matrix.cpp:1349
friend matrix eye(int n)
Definition: matrix.cpp:1375
matrix asin(const matrix &)
Definition: mat_math.cpp:64
matrix tan(const matrix &)
Definition: mat_math.cpp:36
matrix exp(const matrix &)
Definition: mat_math.cpp:134
const matrix & operator[](const std::string &key) const
Definition: matrix.h:290
matrix vector_t(double x0, double x1, int n)
Definition: matrix.cpp:1389
friend matrix tanh(const matrix &)
Definition: mat_math.cpp:120
matrix_map & operator-=(const matrix_map &d)
Definition: matrix_map.cpp:252
matrix operator!=(double n, const matrix &a)
Definition: matrix.h:146
Definition: matrix.h:256
friend matrix acos(const matrix &)
Definition: mat_math.cpp:50
double * p
Definition: matrix.h:10
matrix round(const matrix &)
Definition: mat_math.cpp:232
friend matrix sin(const matrix &)
Definition: mat_math.cpp:22
int active
Definition: matrix.h:351
matrix zeros(int nfil, int ncol)
Definition: matrix.cpp:1349
~matrix()
Destructor.
Definition: matrix.cpp:38
friend matrix tan(const matrix &)
Definition: mat_math.cpp:36
const matrix block(int irow1, int irow2, int icol1, int icol2) const
Definition: matrix.cpp:1134
const matrix_map col(int icol) const
Definition: matrix_map.cpp:72
matrix operator==(const matrix &) const
Definition: matrix.cpp:566
friend matrix abs(const matrix &)
Definition: mat_math.cpp:190
friend matrix round(const matrix &)
Definition: mat_math.cpp:232
friend matrix_block_diag operator-(const matrix_block_diag &)
Definition: matrix_block_diag.cpp:329
friend matrix atan2(const matrix &, const matrix &)
Definition: mat_math.cpp:246
matrix operator,(const matrix &, const matrix_block_diag &)
Definition: matrix_block_diag.cpp:180
int nrows() const
Returns the number of rows of the matrix.
Definition: matrix.cpp:62
Definition: matrix.h:319
matrix operator+(const matrix &) const
Performs matrix addition.
Definition: matrix.cpp:320
matrix operator<=(double n, const matrix &a)
Definition: matrix.h:149
matrix transpose() const
Definition: matrix.cpp:1281
matrix * m
Definition: matrix.h:203
create_double_map(const std::string &key, const double &val)
Definition: matrix.h:261
friend matrix cosh(const matrix &)
Definition: mat_math.cpp:92
double min(const matrix &)
Definition: matrix.cpp:1430
matrix_map & operator+=(const matrix_map &d)
Definition: matrix_map.cpp:239
const matrix row(int irow) const
Definition: matrix.cpp:1046
matrix vector(double x0, double x1, int n)
Definition: matrix.cpp:1404
friend int exist(const matrix &)
Definition: matrix.cpp:1527
friend matrix pow(const matrix &, const matrix &)
Definition: mat_math.cpp:293
int nblocks() const
Definition: matrix_block_diag.cpp:119
int write(FILE *fp=stdout, char mode='t') const
Saves matrix to a file.
Definition: matrix.cpp:233
matrix & redim(int nrow, int ncol)
Re-dimension the matrix.
Definition: matrix.cpp:122
matrix operator>(double n, const matrix &a)
Definition: matrix.h:148
create_matrix_map & operator()(const std::string &key, const matrix &val)
Definition: matrix.h:329
matrix_map_elem & operator=(const double_map &)
Definition: matrix_map.cpp:15
matrix abs(const matrix &)
Definition: mat_math.cpp:190
int ncols() const
Returns the columns of rows of the matrix.
Definition: matrix.cpp:69
matrix_map & operator*=(const double_map &d)
Definition: matrix_map.cpp:213
matrix_map operator*(double d) const
Definition: matrix_map.cpp:179
const matrix_map row(int irow) const
Definition: matrix_map.cpp:63
matrix_map & operator/=(const double_map &d)
Definition: matrix_map.cpp:226
friend double max(const matrix &)
Definition: matrix.cpp:1416
matrix_block_diag operator/(const matrix &) const
Definition: matrix_block_diag.cpp:225
matrix operator&&(double n, const matrix &a)
Definition: matrix.h:151
matrix & operator*=(const matrix &)
Definition: matrix.cpp:955
friend matrix random_matrix(int nfil, int ncol)
Definition: matrix.cpp:1361
matrix & operator+=(const matrix &)
Definition: matrix.cpp:903
friend matrix_block_diag operator+(const matrix_block_diag &)
Definition: matrix.h:241
friend double mean(const matrix &)
Definition: matrix.cpp:1457
double mean(const matrix &)
Definition: matrix.cpp:1457
matrix & dim(int nrow, int ncol)
Re-dimension the matrix.
Definition: matrix.cpp:85
matrix operator>=(double n, const matrix &a)
Definition: matrix.h:150
matrix row(int n) const
Definition: matrix_block_diag.cpp:341
matrix & setcol(int icol, const matrix &)
Definition: matrix.cpp:1110
matrix(int nfil=1, int ncol=1)
Default matrix constructor.
Definition: matrix.cpp:15
matrix & setrow(int irow, const matrix &)
Definition: matrix.cpp:1066
matrix operator<(double n, const matrix &a)
Definition: matrix.h:147
matrix operator+(double n, const matrix &a)
Definition: matrix.h:139
matrix sinh(const matrix &)
Definition: mat_math.cpp:106
matrix eye(int n)
Definition: matrix.cpp:1375
void stop()
Definition: matrix.h:355
friend matrix asin(const matrix &)
Definition: mat_math.cpp:64
timeval tim
Definition: matrix.h:349
matrix_block_diag transpose() const
Definition: matrix_block_diag.cpp:404
matrix_block_diag & operator=(const matrix_block_diag &)
Definition: matrix_block_diag.cpp:48
void reset()
Definition: matrix.h:353
Definition: matrix.h:347
matrix operator>=(const matrix &) const
Definition: matrix.cpp:734