CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
zhematrix_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 zhematrix_small< n > &A)
 
template<CPPL_INT n>
comple trace (const zhematrix_small< n > &A)
 
template<CPPL_INT n>
void idamax (CPPL_INT &I, CPPL_INT &J, const zhematrix_small< n > &A)
 
template<CPPL_INT n>
comple damax (const zhematrix_small< n > &A)
 
template<CPPL_INT n>
zhematrix_small< n > & operator+= (zhematrix_small< n > &A, const zhematrix_small< n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > & operator-= (zhematrix_small< n > &A, const zhematrix_small< n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > & operator*= (zhematrix_small< n > &A, const double &v)
 
template<CPPL_INT n>
zhematrix_small< n > & operator*= (zhematrix_small< n > &A, const comple &v)
 
template<CPPL_INT n>
zhematrix_small< n > & operator/= (zhematrix_small< n > &A, const double &v)
 
template<CPPL_INT n>
zhematrix_small< n > & operator/= (zhematrix_small< n > &A, const comple &v)
 
template<CPPL_INT n>
const zhematrix_small< n > & operator+ (const zhematrix_small< n > &A)
 
template<CPPL_INT n>
zhematrix_small< n > operator- (const zhematrix_small< n > &A)
 
template<CPPL_INT n>
zgematrix_small< n, n > operator+ (const zhematrix_small< n > &A, const zgematrix_small< n, n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > operator+ (const zhematrix_small< n > &A, const zhematrix_small< n > &B)
 
template<CPPL_INT n>
zgematrix_small< n, n > operator- (const zhematrix_small< n > &A, const zgematrix_small< n, n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > operator- (const zhematrix_small< n > &A, const zhematrix_small< n > &B)
 
template<CPPL_INT n>
zcovector_small< n > operator* (const zhematrix_small< n > &A, const zcovector_small< n > &B)
 
template<CPPL_INT m, CPPL_INT n>
zgematrix_small< m, n > operator* (const zhematrix_small< m > &A, const zgematrix_small< m, n > &B)
 
template<CPPL_INT n>
zgematrix_small< n, n > operator* (const zhematrix_small< n > &A, const zhematrix_small< n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > operator* (const zhematrix_small< n > &A, const double &v)
 
template<CPPL_INT n>
zhematrix_small< n > operator* (const zhematrix_small< n > &A, const comple &v)
 
template<CPPL_INT n>
zhematrix_small< n > operator/ (const zhematrix_small< n > &A, const double &v)
 
template<CPPL_INT n>
zhematrix_small< n > operator/ (const zhematrix_small< n > &A, const comple &v)
 
template<CPPL_INT n>
zgematrix_small< n, n > hadamard (const zhematrix_small< n > &A, const zgematrix_small< n, n > &B)
 
template<CPPL_INT n>
zhematrix_small< n > hadamard (const zhematrix_small< n > &A, const zhematrix_small< n > &B)
 

Function Documentation

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

operator<<

Definition at line 83 of file zhematrix_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>
comple trace ( const zhematrix_small< n > &  A)
inline

return its trace

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

References i().

194 {CPPL_VERBOSE_REPORT;
195  comple trace =comple(0.,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)
comple trace(const zhematrix_small< n > &A)
template<CPPL_INT n>
void idamax ( CPPL_INT &  I,
CPPL_INT &  J,
const zhematrix_small< n > &  A 
)
inline

find index of the maximum component

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

References i().

Referenced by damax().

206 {CPPL_VERBOSE_REPORT;
207  double max(-1.);
208  for(CPPL_INT i=0; i<n; i++){
209  for(CPPL_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>
comple damax ( const zhematrix_small< n > &  A)
inline

return the maximum component

Definition at line 223 of file zhematrix_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 zhematrix_small< n > &A)
template<CPPL_INT n>
zhematrix_small<n>& operator+= ( zhematrix_small< n > &  A,
const zhematrix_small< n > &  B 
)
inline

zhematrix_small+=zhematrix_small operator

Definition at line 240 of file zhematrix_small-functions.hpp.

References zhematrix_small< n >::array.

241 {CPPL_VERBOSE_REPORT;
242  for(CPPL_INT k=0; k<(n*(n+1))/2; k++){
243  A.array[k] +=B.array[k];
244  }
245  return A;
246 }
comple array[(n *(n+1))/2]
template<CPPL_INT n>
zhematrix_small<n>& operator-= ( zhematrix_small< n > &  A,
const zhematrix_small< n > &  B 
)
inline

zhematrix_small-=zhematrix_small operator

Definition at line 251 of file zhematrix_small-functions.hpp.

References zhematrix_small< n >::array.

252 {CPPL_VERBOSE_REPORT;
253  for(CPPL_INT k=0; k<(n*(n+1))/2; k++){
254  A.array[k] -=B.array[k];
255  }
256  return A;
257 }
comple array[(n *(n+1))/2]
template<CPPL_INT n>
zhematrix_small<n>& operator*= ( zhematrix_small< n > &  A,
const double &  v 
)
inline

zhematrix_small*=double operator

Definition at line 262 of file zhematrix_small-functions.hpp.

References i().

263 {CPPL_VERBOSE_REPORT;
264  for(CPPL_INT i=0; i<n; i++){
265  for(CPPL_INT j=0; j<=i; j++){
266  A(i,j) *=v;
267  }
268  }
269  return A;
270 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
zhematrix_small<n>& operator*= ( zhematrix_small< n > &  A,
const comple &  v 
)
inline

zhematrix_small*=comple operator

Definition at line 275 of file zhematrix_small-functions.hpp.

References i().

276 {CPPL_VERBOSE_REPORT;
277  for(CPPL_INT i=0; i<n; i++){
278  for(CPPL_INT j=0; j<=i; j++){
279  A(i,j) *=v;
280  }
281  }
282  return A;
283 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
zhematrix_small<n>& operator/= ( zhematrix_small< n > &  A,
const double &  v 
)
inline

zhematrix_small/=double operator

Definition at line 288 of file zhematrix_small-functions.hpp.

References i().

289 {CPPL_VERBOSE_REPORT;
290  for(CPPL_INT i=0; i<n; i++){
291  for(CPPL_INT j=0; j<=i; j++){
292  A(i,j) /=v;
293  }
294  }
295  return A;
296 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
zhematrix_small<n>& operator/= ( zhematrix_small< n > &  A,
const comple &  v 
)
inline

zhematrix_small/=comple operator

Definition at line 301 of file zhematrix_small-functions.hpp.

References i().

302 {CPPL_VERBOSE_REPORT;
303  for(CPPL_INT i=0; i<n; i++){
304  for(CPPL_INT j=0; j<=i; j++){
305  A(i,j) /=v;
306  }
307  }
308  return A;
309 }
_dgematrix i(const _dgbmatrix &mat)
template<CPPL_INT n>
const zhematrix_small<n>& operator+ ( const zhematrix_small< n > &  A)
inline

unary

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

319 {CPPL_VERBOSE_REPORT;
320  return A;
321 }
template<CPPL_INT n>
zhematrix_small<n> operator- ( const zhematrix_small< n > &  A)
inline

unary

Definition at line 326 of file zhematrix_small-functions.hpp.

References i().

327 {CPPL_VERBOSE_REPORT;
329  for(CPPL_INT i=0; i<n; i++){
330  for(CPPL_INT j=0; j<=i; j++){
331  X(i,j) =-A(i,j);
332  }
333  }
334  return X;
335 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zgematrix_small<n,n> operator+ ( const zhematrix_small< n > &  A,
const zgematrix_small< n, n > &  B 
)
inline

zhematrix_small+zgematrix_small operator

Definition at line 344 of file zhematrix_small-functions.hpp.

References i().

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

zhematrix_small+zhematrix_small operator

Definition at line 361 of file zhematrix_small-functions.hpp.

References i().

362 {CPPL_VERBOSE_REPORT;
364  for(CPPL_INT i=0; i<n; i++){
365  for(CPPL_INT j=0; j<=i; j++){
366  X(i,j) =A(i,j)+B(i,j);
367  }
368  }
369  return X;
370 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zgematrix_small<n,n> operator- ( const zhematrix_small< n > &  A,
const zgematrix_small< n, n > &  B 
)
inline

zhematrix_small-zgematrix_small operator

Definition at line 379 of file zhematrix_small-functions.hpp.

References i().

380 {CPPL_VERBOSE_REPORT;
382  for(CPPL_INT i=0; i<n; i++){
383  for(CPPL_INT j=0; j<i; j++){
384  X(i,j) =A(i,j)-B(i,j);
385  }
386  for(CPPL_INT j=i; j<n; j++){
387  X(i,j) =A(j,i)-B(i,j);
388  }
389  }
390  return X;
391 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision General Dence Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> operator- ( const zhematrix_small< n > &  A,
const zhematrix_small< n > &  B 
)
inline

zhematrix_small-zhematrix_small operator

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

References i().

397 {CPPL_VERBOSE_REPORT;
399  for(CPPL_INT i=0; i<n; i++){
400  for(CPPL_INT j=0; j<=i; j++){
401  X(i,j) =A(i,j)-B(i,j);
402  }
403  }
404  return X;
405 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zcovector_small<n> operator* ( const zhematrix_small< n > &  A,
const zcovector_small< n > &  B 
)
inline

zhematrix_small*zcovector_small operator

Definition at line 414 of file zhematrix_small-functions.hpp.

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

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

zhematrix_small*zgematrix_small operator

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

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

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

zhematrix_small*zhematrix_small operator

Definition at line 452 of file zhematrix_small-functions.hpp.

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

453 {CPPL_VERBOSE_REPORT;
455  X.zero();
456  for(CPPL_INT i=0; i<n; i++){
457  for(CPPL_INT j=0; j<i; j++){
458  for(CPPL_INT k=0; k<j; k++){
459  X(i,j) +=A(i,k)*B(j,k);
460  }
461  for(CPPL_INT k=j; k<i; k++){
462  X(i,j) +=A(i,k)*B(k,j);
463  }
464  for(CPPL_INT k=i; k<n; k++){
465  X(i,j) +=A(k,i)*B(k,j);
466  }
467  }
468  for(CPPL_INT j=i; j<n; j++){
469  for(CPPL_INT k=0; k<i; k++){
470  X(i,j) +=A(i,k)*B(j,k);
471  }
472  for(CPPL_INT k=i; k<j; k++){
473  X(i,j) +=A(k,i)*B(j,k);
474  }
475  for(CPPL_INT k=j; k<n; k++){
476  X(i,j) +=A(k,i)*B(k,j);
477  }
478  }
479  }
480  return X;
481 }
_dgematrix i(const _dgbmatrix &mat)
zgematrix_small< m, n > & zero()
Samll Complex Double-precision General Dence Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> operator* ( const zhematrix_small< n > &  A,
const double &  v 
)
inline

zhematrix_small*double operator

Definition at line 486 of file zhematrix_small-functions.hpp.

References i().

487 {CPPL_VERBOSE_REPORT;
489  for(CPPL_INT i=0; i<n; i++){
490  for(CPPL_INT j=0; j<=i; j++){
491  C(i,j) =A(i,j)*v;
492  }
493  }
494  return C;
495 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> operator* ( const zhematrix_small< n > &  A,
const comple &  v 
)
inline

zhematrix_small*comple operator

Definition at line 500 of file zhematrix_small-functions.hpp.

References i().

501 {CPPL_VERBOSE_REPORT;
503  for(CPPL_INT i=0; i<n; i++){
504  for(CPPL_INT j=0; j<=i; j++){
505  C(i,j) =A(i,j)*v;
506  }
507  }
508  return C;
509 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> operator/ ( const zhematrix_small< n > &  A,
const double &  v 
)
inline

zhematrix_small/double operator

Definition at line 518 of file zhematrix_small-functions.hpp.

References i().

519 {CPPL_VERBOSE_REPORT;
521  for(CPPL_INT i=0; i<n; i++){
522  for(CPPL_INT j=0; j<=i; j++){
523  C(i,j) =A(i,j)/v;
524  }
525  }
526  return C;
527 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> operator/ ( const zhematrix_small< n > &  A,
const comple &  v 
)
inline

zhematrix_small/comple operator

Definition at line 532 of file zhematrix_small-functions.hpp.

References i().

533 {CPPL_VERBOSE_REPORT;
535  for(CPPL_INT i=0; i<n; i++){
536  for(CPPL_INT j=0; j<=i; j++){
537  C(i,j) =A(i,j)/v;
538  }
539  }
540  return C;
541 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.
template<CPPL_INT n>
zgematrix_small<n,n> hadamard ( const zhematrix_small< n > &  A,
const zgematrix_small< n, n > &  B 
)
inline

Hadamard product

Definition at line 550 of file zhematrix_small-functions.hpp.

References conj(), and i().

551 {CPPL_VERBOSE_REPORT;
553  for(CPPL_INT i=0; i<n; i++){
554  for(CPPL_INT j=0; j<=i; j++){
555  C(i,j) =A(i,j)*B(i,j);
556  }
557  for(CPPL_INT j=i+1; j<n; j++){
558  C(i,j) =conj(A(j,i))*B(i,j);
559  }
560  }
561  return C;
562 }
_dgematrix i(const _dgbmatrix &mat)
_zcovector conj(const _zcovector &vec)
Samll Complex Double-precision General Dence Matrix Class.
template<CPPL_INT n>
zhematrix_small<n> hadamard ( const zhematrix_small< n > &  A,
const zhematrix_small< n > &  B 
)
inline

Hadamard product

Definition at line 567 of file zhematrix_small-functions.hpp.

References i().

568 {CPPL_VERBOSE_REPORT;
570  for(CPPL_INT i=0; i<n; i++){
571  for(CPPL_INT j=0; j<=i; j++){
572  C(i,j) =A(i,j)*B(i,j);
573  }
574  }
575  return C;
576 }
_dgematrix i(const _dgbmatrix &mat)
Samll Complex Double-precision Symmetric Matrix Class.