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

Go to the source code of this file.

Functions

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

Function Documentation

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

operator<<

Definition at line 83 of file dsymatrix_small-functions.hpp.

References i().

84 {CPPL_VERBOSE_REPORT;
85  s << std::setiosflags(std::ios::showpos);
86  for(CPPL_INT i=0; i<n; i++){
87  for(CPPL_INT j=0; j<=i; j++){ s << " " << A(i,j) << " "<< std::flush; }
88  for(CPPL_INT j=i+1; j<n; j++){ s << "{" << A(j,i) << "}" << std::flush; }
89  s << std::endl;
90  }
91  return s;
92 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
double trace ( const dsymatrix_small< n > &  A)
inline

return its trace

Definition at line 193 of file dsymatrix_small-functions.hpp.

References i().

194 {CPPL_VERBOSE_REPORT;
195  double trace =0.;
196  for(CPPL_INT i=0; i<n; i++){
197  trace +=A(i,i);
198  }
199  return trace;
200 }
_dgematrix i(const _dgbmatrix &mat)
double trace(const dsymatrix_small< n > &A)
template<CPPL_INT n>
void idamax ( CPPL_INT &  I,
CPPL_INT &  J,
const dsymatrix_small< n > &  A 
)
inline

return index of maximum component

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

References i().

Referenced by damax().

206 {CPPL_VERBOSE_REPORT;
207  double max(-1.);
208  for(int i=0; i<n; i++){
209  for(int j=0; j<=i; j++){
210  if( max<fabs(A(i,j)) ){
211  I=i;
212  J=j;
213  max =fabs(A(i,j));
214  }
215  }
216  }
217  return;
218 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
double damax ( const dsymatrix_small< n > &  A)
inline

return maximum component

Definition at line 223 of file dsymatrix_small-functions.hpp.

References i(), and idamax().

224 {CPPL_VERBOSE_REPORT;
225  CPPL_INT i(0),j(0);
226  idamax(i,j,A);
227  return A(i,j);
228 }
_dgematrix i(const _dgbmatrix &mat)
void idamax(CPPL_INT &I, CPPL_INT &J, const dsymatrix_small< n > &A)
template<CPPL_INT n>
dsymatrix_small<n>& operator+= ( dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dsymatrix_small+=dsymatrix_small operator

Definition at line 241 of file dsymatrix_small-functions.hpp.

References dsymatrix_small< n >::array.

242 {CPPL_VERBOSE_REPORT;
243  for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.array[k]+=B.array[k]; }
244  return A;
245 }
double array[(n *(n+1))/2]
1D array to store vector data
template<CPPL_INT n>
dsymatrix_small<n>& operator-= ( dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dsymatrix_small-=dsymatrix_small operator

Definition at line 250 of file dsymatrix_small-functions.hpp.

References dsymatrix_small< n >::array.

251 {CPPL_VERBOSE_REPORT;
252  for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.array[k]-=B.array[k]; }
253  return A;
254 }
double array[(n *(n+1))/2]
1D array to store vector data
template<CPPL_INT n>
dsymatrix_small<n>& operator*= ( dsymatrix_small< n > &  A,
const double &  v 
)
inline

dsymatrix_small*=double operator

Definition at line 259 of file dsymatrix_small-functions.hpp.

References i().

260 {CPPL_VERBOSE_REPORT;
261  for(CPPL_INT i=0; i<n; i++){
262  for(CPPL_INT j=0; j<=i; j++){
263  A(i,j)*=v;
264  }
265  }
266  return A;
267 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dsymatrix_small<n>& operator/= ( dsymatrix_small< n > &  A,
const double &  v 
)
inline

dsymatrix_small/=double operator

Definition at line 272 of file dsymatrix_small-functions.hpp.

References i().

273 {CPPL_VERBOSE_REPORT;
274  for(CPPL_INT i=0; i<n; i++){
275  for(CPPL_INT j=0; j<=i; j++){
276  A(i,j)/=v;
277  }
278  }
279  return A;
280 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
const dsymatrix_small<n>& operator+ ( const dsymatrix_small< n > &  A)
inline

unary + operator

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

290 {CPPL_VERBOSE_REPORT;
291  return A;
292 }
template<CPPL_INT n>
dsymatrix_small<n> operator- ( const dsymatrix_small< n > &  A)
inline

unary - operator

Definition at line 297 of file dsymatrix_small-functions.hpp.

References i().

298 {CPPL_VERBOSE_REPORT;
300  for(CPPL_INT i=0; i<n; i++){
301  for(CPPL_INT j=0; j<=i; j++){
302  X(i,j)=-A(i,j);
303  }
304  }
305  return X;
306 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> operator+ ( const dsymatrix_small< n > &  A,
const dgematrix_small< n, n > &  B 
)
inline

dsymatrix_small+dgematrix_small operator

Definition at line 315 of file dsymatrix_small-functions.hpp.

References i().

316 {CPPL_VERBOSE_REPORT;
318  for(CPPL_INT i=0; i<n; i++){
319  for(CPPL_INT j=0; j<i; j++){
320  X(i,j) =A(i,j)+B(i,j);
321  }
322  for(CPPL_INT j=i; j<n; j++){
323  X(i,j) =A(j,i)+B(i,j);
324  }
325  }
326  return X;
327 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dsymatrix_small<n> operator+ ( const dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dsymatrix_small+dsymatrix_small operator

Definition at line 332 of file dsymatrix_small-functions.hpp.

References i().

333 {CPPL_VERBOSE_REPORT;
335  for(CPPL_INT i=0; i<n; i++){
336  for(CPPL_INT j=0; j<=i; j++){
337  X(i,j) =A(i,j)+B(i,j);
338  }
339  }
340  return X;
341 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> operator- ( const dsymatrix_small< n > &  A,
const dgematrix_small< n, n > &  B 
)
inline

dsymatrix_small-dgematrix_small operator

Definition at line 347 of file dsymatrix_small-functions.hpp.

References i().

348 {CPPL_VERBOSE_REPORT;
350  for(CPPL_INT i=0; i<n; i++){
351  for(CPPL_INT j=0; j<i; j++){
352  X(i,j) =A(i,j)-B(i,j);
353  }
354  for(CPPL_INT j=i; j<n; j++){
355  X(i,j) =A(j,i)-B(i,j);
356  }
357  }
358  return X;
359 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dsymatrix_small<n> operator- ( const dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dsymatrix_small-dsymatrix_small operator

Definition at line 364 of file dsymatrix_small-functions.hpp.

References i().

365 {CPPL_VERBOSE_REPORT;
367  for(CPPL_INT i=0; i<n; i++){
368  for(CPPL_INT j=0; j<=i; j++){
369  X(i,j) =A(i,j)-B(i,j);
370  }
371  }
372  return X;
373 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dcovector_small<n> operator* ( const dsymatrix_small< n > &  A,
const dcovector_small< n > &  B 
)
inline

dsymatrix_small*dcovector_small operator

Definition at line 378 of file dsymatrix_small-functions.hpp.

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

379 {CPPL_VERBOSE_REPORT;
381  C.zero();
382  for(CPPL_INT i=0; i<n; i++){
383  for(CPPL_INT j=0; j<i; j++){
384  C(i) +=A(i,j)*B(j);
385  }
386  for(CPPL_INT j=i; j<n; j++){
387  C(i) +=A(j,i)*B(j);
388  }
389  }
390  return C;
391 }
dcovector_small< l > & zero()
_dgematrix i(const _dgbmatrix &mat)
Samll Real Double-precision Column Vector Class.
template<CPPL_INT m, CPPL_INT n>
dgematrix_small<m,n> operator* ( const dsymatrix_small< m > &  A,
const dgematrix_small< m, n > &  B 
)
inline

dsymatrix_small*dgematrix_small operator

Definition at line 396 of file dsymatrix_small-functions.hpp.

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

397 {CPPL_VERBOSE_REPORT;
399  X.zero();
400  for(CPPL_INT i=0; i<m; i++){
401  for(CPPL_INT j=0; j<n; j++){
402  for(CPPL_INT k=0; k<i; k++){
403  X(i,j) +=A(i,k)*B(k,j);
404  }
405  for(CPPL_INT k=i; k<m; k++){
406  X(i,j) +=A(k,i)*B(k,j);
407  }
408  }
409  }
410  return X;
411 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
dgematrix_small< m, n > & zero()
template<CPPL_INT n>
dgematrix_small<n,n> operator* ( const dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

dsymatrix_small*dsymatrix_small operator

Definition at line 416 of file dsymatrix_small-functions.hpp.

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

417 {CPPL_VERBOSE_REPORT;
419  X.zero();
420  for(CPPL_INT i=0; i<n; i++){
421  for(CPPL_INT j=0; j<i; j++){
422  for(CPPL_INT k=0; k<j; k++){
423  X(i,j) +=A(i,k)*B(j,k);
424  }
425  for(CPPL_INT k=j; k<i; k++){
426  X(i,j) +=A(i,k)*B(k,j);
427  }
428  for(CPPL_INT k=i; k<n; k++){
429  X(i,j) +=A(k,i)*B(k,j);
430  }
431  }
432  for(CPPL_INT j=i; j<n; j++){
433  for(CPPL_INT k=0; k<i; k++){
434  X(i,j) +=A(i,k)*B(j,k);
435  }
436  for(CPPL_INT k=i; k<j; k++){
437  X(i,j) +=A(k,i)*B(j,k);
438  }
439  for(CPPL_INT k=j; k<n; k++){
440  X(i,j) +=A(k,i)*B(k,j);
441  }
442  }
443  }
444  return X;
445 }
Samll Real Double-precision General Dence Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
dgematrix_small< m, n > & zero()
template<CPPL_INT n>
dsymatrix_small<n> operator* ( const dsymatrix_small< n > &  A,
const double &  v 
)
inline

dsymatrix_small*double operator

Definition at line 450 of file dsymatrix_small-functions.hpp.

References i().

451 {CPPL_VERBOSE_REPORT;
453  for(CPPL_INT i=0; i<n; i++){
454  for(CPPL_INT j=0; j<=i; j++){
455  C(i,j) =A(i,j)*v;
456  }
457  }
458  return C;
459 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dsymatrix_small<n> operator/ ( const dsymatrix_small< n > &  A,
const double &  v 
)
inline

dsymatrix_small/double operator

Definition at line 464 of file dsymatrix_small-functions.hpp.

References i().

465 {CPPL_VERBOSE_REPORT;
467  for(CPPL_INT i=0; i<n; i++){
468  for(CPPL_INT j=0; j<=i; j++){
469  C(i,j) =A(i,j)/v;
470  }
471  }
472  return C;
473 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dgematrix_small<n,n> hadamerd ( const dsymatrix_small< n > &  A,
const dgematrix_small< n, n > &  B 
)
inline

Hadamerd operator

Definition at line 482 of file dsymatrix_small-functions.hpp.

References i().

483 {CPPL_VERBOSE_REPORT;
485  for(CPPL_INT i=0; i<n; i++){
486  for(CPPL_INT j=0; j<=i; j++){
487  C(i,j) =A(i,j)*B(i,j);
488  }
489  for(CPPL_INT j=i+1; j<n; j++){
490  C(i,j) =A(j,i)*B(i,j);
491  }
492  }
493  return C;
494 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
dsymatrix_small<n> hadamerd ( const dsymatrix_small< n > &  A,
const dsymatrix_small< n > &  B 
)
inline

Hadamerd operator

Definition at line 499 of file dsymatrix_small-functions.hpp.

References i().

500 {CPPL_VERBOSE_REPORT;
502  for(CPPL_INT i=0; i<n; i++){
503  for(CPPL_INT j=0; j<=i; j++){
504  C(i,j) =A(i,j)*B(i,j);
505  }
506  }
507  return C;
508 }
Samll Real Double-precision Symmetric Matrix Class.
_dgematrix i(const _dgbmatrix &mat)