CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
dgematrix_small-functions.hpp File Reference

Go to the source code of this file.

Functions

template<CPPL_INT m, CPPL_INT n>
std::ostream & operator<< (std::ostream &s, const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< n, m > t (const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
double trace (const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
void idamax (CPPL_INT &I, CPPL_INT &J, const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
double damax (const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > & operator+= (dgematrix_small< m, n > &A, const dgematrix_small< m, n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > & operator-= (dgematrix_small< m, n > &A, const dgematrix_small< m, n > &B)
 
template<CPPL_INT m, CPPL_INT l, CPPL_INT n>
dgematrix_small< m, n > & operator*= (dgematrix_small< m, l > &A, const dgematrix_small< l, n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > & operator*= (dgematrix_small< m, n > &A, const double &d)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > & operator/= (dgematrix_small< m, n > &A, const double &d)
 
template<CPPL_INT m, CPPL_INT n>
const dgematrix_small< m, n > & operator+ (const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator- (const dgematrix_small< m, n > &A)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator+ (const dgematrix_small< m, n > &A, const dgematrix_small< m, n > &B)
 
template<CPPL_INT n>
dgematrix_small< n, n > operator+ (const dgematrix_small< n, n > &A, const dsymatrix_small< n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator- (const dgematrix_small< m, n > &A, const dgematrix_small< m, n > &B)
 
template<CPPL_INT n>
dgematrix_small< n, n > operator- (const dgematrix_small< n, n > &A, const dsymatrix_small< n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dcovector_small< m > operator* (const dgematrix_small< m, n > &A, const dcovector_small< n > &B)
 
template<CPPL_INT m, CPPL_INT l, CPPL_INT n>
dgematrix_small< m, n > operator* (const dgematrix_small< m, l > &A, const dgematrix_small< l, n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator* (const dgematrix_small< m, n > &A, const dsymatrix_small< n > &B)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator* (const dgematrix_small< m, n > &A, const double &v)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > operator/ (const dgematrix_small< m, n > &A, const double &v)
 
template<CPPL_INT m, CPPL_INT n>
dgematrix_small< m, n > hadamard (const dgematrix_small< m, n > &A, const dgematrix_small< m, n > &B)
 
template<CPPL_INT n>
dgematrix_small< n, n > hadamard (const dgematrix_small< n, n > &A, const dsymatrix_small< n > &B)
 

Function Documentation

template<CPPL_INT m, CPPL_INT n>
std::ostream& operator<< ( std::ostream &  s,
const dgematrix_small< m, n > &  A 
)
inline

operator<<

Definition at line 65 of file dgematrix_small-functions.hpp.

References i().

66 {CPPL_VERBOSE_REPORT;
67  s << std::setiosflags(std::ios::showpos);
68  for(CPPL_INT i=0; i<m; i++){
69  for(CPPL_INT j=0; j<n; j++){
70  s << " " << A(i,j);
71  }
72  s << std::endl;
73  }
74  return s;
75 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<n,m> t ( const dgematrix_small< m, n > &  A)
inline

return transposed matrix

Definition at line 158 of file dgematrix_small-functions.hpp.

References i().

159 {CPPL_VERBOSE_REPORT;
161  for(CPPL_INT i=0; i<m; i++){
162  for(CPPL_INT j=0; j<n; j++){
163  X(j,i) =A(i,j);
164  }
165  }
166  return X;
167 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
double trace ( const dgematrix_small< m, n > &  A)
inline

return its trace

Definition at line 172 of file dgematrix_small-functions.hpp.

References i().

173 {CPPL_VERBOSE_REPORT;
174  double trace =0.;
175 
176  const CPPL_INT imax =std::min(m,n);
177  for(CPPL_INT i=0; i<imax; i++){
178  trace +=A(i,i);
179  }
180 
181  return trace;
182 }
_dgematrix i(const _dgbmatrix &mat)
double trace(const dgematrix_small< m, n > &A)
template<CPPL_INT m, CPPL_INT n>
void idamax ( CPPL_INT &  I,
CPPL_INT &  J,
const dgematrix_small< m, n > &  A 
)
inline

find index of the maximum component

Definition at line 187 of file dgematrix_small-functions.hpp.

References i().

Referenced by damax().

188 {CPPL_VERBOSE_REPORT;
189  double max(-1.);
190  for(CPPL_INT i=0; i<m; i++){
191  for(CPPL_INT j=0; j<n; j++){
192  if( max<fabs(A(i,j)) ){
193  I=i;
194  J=j;
195  max =fabs(A(i,j));
196  }
197  }
198  }
199  return;
200 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
double damax ( const dgematrix_small< m, n > &  A)
inline

return the maximum component

Definition at line 205 of file dgematrix_small-functions.hpp.

References i(), and idamax().

206 {CPPL_VERBOSE_REPORT;
207  CPPL_INT i(0), j(0);
208  idamax(i,j,A);
209  return A(i,j);
210 }
_dgematrix i(const _dgbmatrix &mat)
void idamax(CPPL_INT &I, CPPL_INT &J, const dgematrix_small< m, n > &A)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n>& operator+= ( dgematrix_small< m, n > &  A,
const dgematrix_small< m, n > &  B 
)
inline

dgematrix_small+=dgematrix_small operator

Definition at line 267 of file dgematrix_small-functions.hpp.

References dgematrix_small< m, n >::array.

268 {CPPL_VERBOSE_REPORT;
269  for(CPPL_INT k=0; k<m*n; k++){
270  A.array[k] +=B.array[k];
271  }
272  return A;
273 }
double array[m *n]
1D array to store vector data
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n>& operator-= ( dgematrix_small< m, n > &  A,
const dgematrix_small< m, n > &  B 
)
inline

dgematrix_small-=dgematrix_small operator

Definition at line 278 of file dgematrix_small-functions.hpp.

References dgematrix_small< m, n >::array.

279 {CPPL_VERBOSE_REPORT;
280  for(CPPL_INT k=0; k<m*n; k++){
281  A.array[k] -=B.array[k];
282  }
283  return A;
284 }
double array[m *n]
1D array to store vector data
template<CPPL_INT m, CPPL_INT l, CPPL_INT n>
dgematrix_small<m,n>& operator*= ( dgematrix_small< m, l > &  A,
const dgematrix_small< l, n > &  B 
)
inline

dgematrix_small*=dgematrix_small operator

Definition at line 289 of file dgematrix_small-functions.hpp.

References i(), and dgematrix_small< m, n >::zero().

290 {CPPL_VERBOSE_REPORT;
292  X.zero();
293  for(CPPL_INT i=0; i<m; i++){
294  for(CPPL_INT j=0; j<n; j++){
295  for(CPPL_INT k=0; k<l; k++){
296  X(i,j) += A(i,k)*B(k,j);
297  }
298  }
299  }
300  A =X;
301  return A;
302 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
dgematrix_small< m, n > & zero()
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n>& operator*= ( dgematrix_small< m, n > &  A,
const double &  d 
)
inline

dgematrix_small*=double operator

Definition at line 307 of file dgematrix_small-functions.hpp.

References dgematrix_small< m, n >::array.

308 {CPPL_VERBOSE_REPORT;
309  for(CPPL_INT k=0; k<m*n; k++){
310  A.array[k] *=d;
311  }
312  return A;
313 }
double array[m *n]
1D array to store vector data
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n>& operator/= ( dgematrix_small< m, n > &  A,
const double &  d 
)
inline

dgematrix_small/double operator

Definition at line 318 of file dgematrix_small-functions.hpp.

References dgematrix_small< m, n >::array.

319 {CPPL_VERBOSE_REPORT;
320  for(CPPL_INT k=0; k<m*n; k++){
321  A.array[k] /=d;
322  }
323  return A;
324 }
double array[m *n]
1D array to store vector data
template<CPPL_INT m, CPPL_INT n>
const dgematrix_small<m,n>& operator+ ( const dgematrix_small< m, n > &  A)
inline

unary + operator

Definition at line 333 of file dgematrix_small-functions.hpp.

334 {CPPL_VERBOSE_REPORT;
335  return A;
336 }
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator- ( const dgematrix_small< m, n > &  A)
inline

unary - operator

Definition at line 341 of file dgematrix_small-functions.hpp.

References i().

342 {CPPL_VERBOSE_REPORT;
344  for(CPPL_INT i=0; i<m; i++){
345  for(CPPL_INT j=0; j<n; j++){
346  X(i,j) =-A(i,j);
347  }
348  }
349  return X;
350 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator+ ( const dgematrix_small< m, n > &  A,
const dgematrix_small< m, n > &  B 
)
inline

dgematrix_small+dgematrix_small operator

Definition at line 359 of file dgematrix_small-functions.hpp.

References i().

360 {CPPL_VERBOSE_REPORT;
362  for(int i=0; i<m; i++){
363  for(int j=0; j<n; j++){
364  C(i,j) =A(i,j)+B(i,j);
365  }
366  }
367  return C;
368 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> operator+ ( const dgematrix_small< n, n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dgematrix_small+dsymatrix_small operator

Definition at line 373 of file dgematrix_small-functions.hpp.

References i().

374 {CPPL_VERBOSE_REPORT;
376  for(CPPL_INT i=0; i<n; i++){
377  for(CPPL_INT j=0; j<i; j++){
378  X(i,j) =A(i,j)+B(i,j);
379  }
380  for(CPPL_INT j=i; j<n; j++){
381  X(i,j) =A(i,j)+B(j,i);
382  }
383  }
384  return X;
385 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator- ( const dgematrix_small< m, n > &  A,
const dgematrix_small< m, n > &  B 
)
inline

dgematrix_small-dgematrix_small operator

Definition at line 390 of file dgematrix_small-functions.hpp.

References i().

391 {CPPL_VERBOSE_REPORT;
393  for(int i=0; i<m; i++){
394  for(int j=0; j<n; j++){
395  C(i,j)=A(i,j)-B(i,j);
396  }
397  }
398  return C;
399 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> operator- ( const dgematrix_small< n, n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dgematrix_small-dsymatrix_small operator

Definition at line 404 of file dgematrix_small-functions.hpp.

References i().

405 {CPPL_VERBOSE_REPORT;
407  for(CPPL_INT i=0; i<n; i++){
408  for(CPPL_INT j=0; j<=i; j++){ X(i,j)=A(i,j)-B(i,j); }
409  for(CPPL_INT j=i+1; j<n; j++){ X(i,j)=A(i,j)-B(j,i); }
410  }
411  return X;
412 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dcovector_small<m> operator* ( const dgematrix_small< m, n > &  A,
const dcovector_small< n > &  B 
)
inline

dgematrix_small*dcovector_small operator

Definition at line 417 of file dgematrix_small-functions.hpp.

References i(), and dcovector_small< l >::zero().

418 {CPPL_VERBOSE_REPORT;
420  C.zero();
421  for(CPPL_INT i=0; i<m; i++){
422  for(CPPL_INT j=0; j<n; j++){
423  C(i) +=A(i,j)*B(j);
424  }
425  }
426  return C;
427 }
dcovector_small< l > & zero()
_dgematrix i(const _dgbmatrix &mat)
Samll Real Double-precision Column Vector Class.
template<CPPL_INT m, CPPL_INT l, CPPL_INT n>
dgematrix_small<m,n> operator* ( const dgematrix_small< m, l > &  A,
const dgematrix_small< l, n > &  B 
)
inline

dgematrix_small*dgematrix_small operator

Definition at line 432 of file dgematrix_small-functions.hpp.

References i(), and dgematrix_small< m, n >::zero().

433 {CPPL_VERBOSE_REPORT;
435  C.zero();
436  for(int i=0; i<m; i++){
437  for(int j=0; j<n; j++){
438  for(int k=0; k<l; k++){
439  C(i,j) +=A(i,k)*B(k,j);
440  }
441  }
442  }
443  return C;
444 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
dgematrix_small< m, n > & zero()
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator* ( const dgematrix_small< m, n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dgematrix_small*dsymatrix_small operator

Definition at line 449 of file dgematrix_small-functions.hpp.

References i(), and dgematrix_small< m, n >::zero().

450 {CPPL_VERBOSE_REPORT;
452  X.zero();
453  for(CPPL_INT i=0; i<m; i++){
454  for(CPPL_INT j=0; j<n; j++){
455  for(CPPL_INT k=0; k<j; k++){ X(i,j)+=A(i,k)*B(j,k); }
456  for(CPPL_INT k=j; k<n; k++){ X(i,j)+=A(i,k)*B(k,j); }
457  }
458  }
459  return X;
460 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
dgematrix_small< m, n > & zero()
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator* ( const dgematrix_small< m, n > &  A,
const double &  v 
)
inline

dgematrix_small*double operator

Definition at line 465 of file dgematrix_small-functions.hpp.

References i().

466 {CPPL_VERBOSE_REPORT;
468  for(CPPL_INT i=0; i<m; i++){
469  for(CPPL_INT j=0; j<n; j++){
470  C(i,j) =A(i,j)*v;
471  }
472  }
473  return C;
474 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator/ ( const dgematrix_small< m, n > &  A,
const double &  v 
)
inline

dgematrix_small/double operator

Definition at line 479 of file dgematrix_small-functions.hpp.

References i().

480 {CPPL_VERBOSE_REPORT;
482  for(CPPL_INT i=0; i<m; i++){
483  for(CPPL_INT j=0; j<n; j++){
484  C(i,j) =A(i,j)/v;
485  }
486  }
487  return C;
488 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> hadamard ( const dgematrix_small< m, n > &  A,
const dgematrix_small< m, n > &  B 
)
inline

Hadamard product

Definition at line 497 of file dgematrix_small-functions.hpp.

References i().

498 {CPPL_VERBOSE_REPORT;
500  for(CPPL_INT i=0; i<m; i++){
501  for(CPPL_INT j=0; j<n; j++){
502  C(i,j) =A(i,j)*B(i,j);
503  }
504  }
505  return C;
506 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> hadamard ( const dgematrix_small< n, n > &  A,
const dsymatrix_small< n > &  B 
)
inline

Hadamard product

Definition at line 511 of file dgematrix_small-functions.hpp.

References i().

512 {CPPL_VERBOSE_REPORT;
514  for(CPPL_INT i=0; i<n; i++){
515  for(CPPL_INT j=0; j<=i; j++){
516  C(i,j) =A(i,j)*B(i,j);
517  }
518  for(CPPL_INT j=i+1; j<n; j++){
519  C(i,j) =A(i,j)*B(j,i);
520  }
521  }
522  return C;
523 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)