14 #ifndef TBCI_F_MATRIX_H 15 #define TBCI_F_MATRIX_H 17 #include "tbci/vector.h" 18 #include "tbci/matrix_sig.h" 19 #include "tbci/matrix.h" 20 #include "tbci/cscmatrix.h" 23 #if !defined(NO_GD) && !defined(AUTO_DECL) 24 # include "tbci/f_matrix_gd.h" 29 #ifdef HAVE_GCC295_FRIEND_BUG 30 # define _VEC getvec() 31 # define _ENDVEC getendvec() 34 # define _COL columns() 35 # define _FAC getfac() 38 # define _ENDVEC endvec 49 template <
typename T>
class F_Matrix;
52 template <
typename T>
class BdMatrix;
55 template <
typename T>
class Matrix;
56 template <
typename T>
class TMatrix;
59 # pragma interface "f_matrix.h" 92 #ifdef HAVE_GCC295_FRIEND_BUG 94 T*
const getvec()
const {
return vec; }
95 T*
const getendvec()
const {
return endvec; }
101 F_TMatrix (
const unsigned,
const unsigned);
102 F_TMatrix (
const T&,
const unsigned,
const unsigned);
119 static const char*
mat_info () {
return (
"F_TMatrix"); }
169 #ifndef HAVE_GCC295_FRIEND_BUG 179 T&
operator () (
const unsigned int,
const unsigned int)
const;
182 const T&
get (
const unsigned r,
const unsigned c)
const {
return mat[
c][r]; }
186 {
return !(*
this == m); }
191 {
return !(*
this == tm); }
195 {
return !(*
this ==
ts); }
206 void setval(
const T val,
const unsigned int r,
const unsigned int c)
208 T&
setval(
const unsigned int r,
const unsigned int c)
225 double fabs ()
const;
232 template <
typename T>
242 template <
typename T>
246 for (
unsigned int c = 0;
c < col; ++
c)
247 for (
unsigned int r = 0; r < row; ++r)
253 template <
typename T>
258 for (
unsigned int i=0;
i<col;
i++) {
267 dim = 0; col = 0; row = 0;
274 template <
typename T>
276 : dim((unsigned long)d*d), col(d), row(d),
277 mat(d>0?
NEW(
T*,d):0), vec(d>0?
NEW(
T,d*d):0)
283 template <
typename T>
285 : dim(((unsigned long)r)*
c), col(
c), row(r),
286 mat(dim>0?
NEW(
T*,
c):0), vec(dim>0?
NEW(
T,dim):0)
291 template <
typename T>
293 : dim(((unsigned long)r)*
c), col(
c), row(r),
294 mat(dim>0?
NEW(
T*,
c):0), vec(dim>0?
NEW(
T,dim):0)
301 template <
typename T>
303 : dim(v.dim), col(r==
rowvec?1:v.dim), row(r==
rowvec?v.dim:1),
304 mat(v.dim?
NEW(
T*,col):0), vec(v.dim>0?
NEW(
T,v.dim):0)
311 template <
typename T>
313 : dim(m.dim), col(m.col), row(m.row),
314 mat(m.dim>0?
NEW(
T*,m.col):0),
315 vec(m.dim>0?
NEW(
T,m.dim):0)
322 template <
typename T>
324 : dim (tm.dim), col (tm.col), row (tm.row),
325 mat (tm.mat), vec (tm.vec), endvec (tm.endvec)
328 template <
typename T>
330 : dim (
ts.dim), col (
ts.col), row (
ts.row)
337 template <
typename T>
357 template <
typename T>
360 BCHK(dim !=
a.dim,
MatErr, Different sizes in assignment,
a.dim, *
this );
366 template <
typename T>
369 BCHK(row !=
a.row || col !=
a.col,
MatErr, Different sizes in assignment,
a.dim, *
this );
373 dim =
a.dim; col =
a.col; row =
a.row;
374 mat =
a.mat; vec =
a.vec; endvec =
a.endvec;
379 template <
typename T>
382 BCHK(col !=
a.col || row !=
a.row,
MatErr, Different sizes in assignment,
a.dim, *
this );
388 template <
typename T>
391 return this->
fill (val);
395 template <
typename T>
399 BCHK(col!=row,
MatErr, setunit makes only sense on quadratic matrices, col, *
this);
400 const unsigned iend =
MIN(row,col);
405 template <
typename T>
413 template <
typename T>
423 template <
typename T>
431 template <
typename T>
440 template <
typename T>
444 for (
REGISTER unsigned int j=0; j<col; j++)
445 mat[j][r] = v.
vec[j];
448 template <
typename T>
453 for (
REGISTER unsigned int j=0; j<col; j++)
454 v.
vec[j] = mat[j][r];
459 #ifndef LAPACK_INLINE 460 # define LAPACK_INLINE 462 template <
typename T>
465 if (r == row &&
c == col)
470 unsigned long dd =dim;
471 dim = ((
unsigned long)r)*
c;
476 mat = (
T**)0; vec = (
T*)0; endvec = (
T*)0;
485 template <
typename T>
488 if (r == row &&
c == col) {
501 mat = (
T**)0; vec = (
T*)0; endvec = (
T*)0;
509 template <
typename T>
516 template <
typename T>
520 BCHK (row != col,
MatErr, Trace over non quadratic matrix, 0, tr=0);
529 template <
typename T>
532 if (rows() == columns())
534 for(
unsigned int i=0;
i<rows();
i++)
535 for(
unsigned int j=
i+1; j<columns(); j++)
536 SWAP(mat[
i][j], mat[j][
i]);
539 STD__ cout <<
"Not implemented!" <<
STD__ endl;
545 template <
typename T>
548 STD__ cout <<
"WRONG: F_TMatrix<T>::herm()" <<
STD__ endl;
549 if (rows() == columns())
551 for(
unsigned int i=0;
i<rows();
i++)
554 for(
unsigned int j=
i+1; j<columns(); j++)
558 SWAP(mat[
i][j], mat[j][
i]);
563 STD__ cout <<
"Not implemented!" <<
STD__ endl;
569 template <
typename T>
572 STD__ cout <<
"Wrong: F_TMatrix<T>::conf()" <<
STD__ endl;
578 template <
typename T>
581 for (
REGISTER T* ptr=vec; ptr<endvec; ptr++) *ptr = -(*ptr);
585 template <
typename T>
589 if (row != m.
row || col != m.
col)
return false;
590 if (vec == m.
vec || dim == 0)
return true;
595 template <
typename T>
599 if (row !=
ts.row || col !=
ts.col)
return (
ts.destroy(),
false);
600 if (dim == 0) {
return true; }
603 if (vec ==
ts.vec)
return true;
604 if (
TBCICOMP (vec,
ts.vec,
T, dim)) {
ts.destroy ();
return false; }
608 if (vec ==
ts.vec)
return false;
609 for (
REGISTER T *p1 = vec, *p2 =
ts.vec; p1 < endvec; p1++, p2++)
610 if (*p1 != *p2 *
ts.fac) {
ts.destroy ();
return false; }
612 ts.destroy ();
return true;
616 #define F_TMFORALL_M(op) \ 617 template <typename T> \ 618 inline F_TMatrix<T>& F_TMatrix<T>::operator op (const F_Matrix<T>& a) \ 620 BCHK(row != a.row, MatErr, number of rows differ in op, a.row, *this ); \ 621 BCHK(col != a.col, MatErr, number of cols differ in op, a.col, *this ); \ 622 for (REGISTER T *p1 = vec, *p2 = a.vec; p1 < endvec; p1++, p2++) *p1 op *p2; \ 631 #define F_TMFORALL_TM(op) \ 632 template <typename T> \ 633 inline F_TMatrix<T>& F_TMatrix<T>::operator op (F_TMatrix<T> a)\ 635 return this->operator op (F_Matrix<T>(a)); \ 642 #define F_TMFORALL_TS(op) \ 643 template <typename T> \ 644 inline F_TMatrix<T>& F_TMatrix<T>::operator op (F_TSMatrix<T> ts) \ 646 BCHK(row != ts.row, MatErr, number of rows differ in op, ts.row, (ts.destroy(),*this) ); \ 647 BCHK(col != ts.col, MatErr, number of cols differ in op, ts.col, (ts.destroy(),*this) ); \ 648 for (REGISTER T *p1 = vec, *p2 = ts.vec; p1 < endvec; p1++, p2++) \ 649 *p1 op##= *p2 * ts.fac; \ 650 ts.destroy (); return *this; \ 658 #define F_TMFORALL_T(op) \ 659 template <typename T> \ 660 inline F_TMatrix<T>& F_TMatrix<T>::operator op (const T& a) \ 662 for (REGISTER T* ptr = vec; ptr < endvec; ptr++) *ptr op a; \ 672 template <typename
T>
676 template <
typename T>
685 #define F_STDDEF_TMM(op) \ 686 template <typename T> \ 687 inline F_TMatrix<T>& F_TMatrix<T>::operator op (const F_Matrix<T>& a) \ 688 { return this->operator op##= (a); } 694 #define F_STDDEF_TMTM(op) \ 695 template <typename T> \ 696 inline F_TMatrix<T>& F_TMatrix<T>::operator op (F_TMatrix<T> a) \ 697 { return this->operator op##= (F_Matrix<T>(a)); } 703 #define F_STDDEF_TMT(op) \ 704 template <typename T> \ 705 inline F_TMatrix<T>& F_TMatrix<T>::operator op (const T& a) \ 706 { return this->operator op##= (a); } 712 template <typename
T>
716 template <
typename T>
726 #define F_STDDEF_TTM(op) \ 727 INST(template <typename T> class F_TMatrix friend F_TMatrix<T> operator op (const T&, F_TMatrix<T>);) \ 728 template <typename T> \ 729 inline F_TMatrix<T> operator op (const T& a, F_TMatrix<T> b) \ 731 for (REGISTER T* ptr=b._VEC; ptr<b._ENDVEC; ptr++) \ 742 template <typename
T>
749 #define F_STDDEF_TM(op) \ 750 INST(template <typename T> class F_TMatrix friend F_TMatrix<T> operator op (const T&, const F_Matrix<T>&);) \ 751 template <typename T> \ 752 inline F_TMatrix<T> operator op (const T& a, const F_Matrix<T>& b) \ 754 F_TMatrix<T> c (b._ROW, b._COL); \ 755 for (REGISTER T *p1=c._VEC, *p2=b._VEC; p1<c._ENDVEC; p1++, p2++) \ 767 template <typename
T>
773 template <
typename T>
782 template <
typename T>
796 #ifdef HAVE_GCC295_FRIEND_BUG 798 T*
const getvec ()
const {
return vec; }
799 T*
const getendvec ()
const {
return endvec; }
800 T& getfac () {
return fac; }
801 const T& getfac ()
const {
return fac; }
829 T get (
const unsigned r,
const unsigned c)
const {
return mat[
c][r] *
fac; }
835 static const char*
mat_info () {
return (
"F_TSMatrix"); }
845 fac = (
T)1;
mut =
true;
return *
this; }
864 #ifndef HAVE_GCC295_FRIEND_BUG 890 template <
typename T>
895 for (
unsigned int i=0;
i<m1.
rows();
i++)
896 for (
unsigned int j=0; j<m2.
columns(); j++)
900 for (
unsigned int x=m2.
pcol[j];
x<m2.
pcol[j+1];
x++)
902 erg.setval(
fac*val,
i, j);
913 template <
typename T>
916 if (!mut || !
dim)
return;
922 template <
typename T>
925 if ((!tm && mut) || !
dim)
return;
940 template <
typename T>
943 if ((mut && !tm)|| !
dim)
return;
944 T* oldv =
vec;
T** oldm =
mat;
bool omut = mut;
946 if (evl &&
fac != (
T)1)
960 template <
typename T>
980 #define F_STDDEF_TSM(op) \ 981 template <typename T> \ 982 inline F_TMatrix<T> F_TSMatrix<T>::operator op (const F_Matrix<T>& m) \ 984 BCHK(row != m.row || col != m.col, MatErr, Op op on diff size Mats, m.row, F_TMatrix<T> (*this)); \ 985 F_TSMatrix<T> ts (*this); ts.detach (); \ 986 for (REGISTER T *p1 = ts.vec, *p2 = vec, *p3 = m.vec; p2 < endvec; p1++, p2++, p3++) \ 987 *p1 = *p2 * fac op *p3; \ 988 ts.fac = (T)1; return F_TMatrix<T> (ts); \ 995 #define F_STDDEF_TSTM(op) \ 996 template <typename T> \ 997 inline F_TMatrix<T> F_TSMatrix<T>::operator op (const F_TMatrix<T>& tm) \ 999 BCHK(row != tm.row || col != tm.col, MatErr, Op op on diff size Mats, tm.row, tm); \ 1000 for (REGISTER T *p1 = tm.vec, *p2 = vec; p2 < endvec; p1++, p2++) \ 1001 *p1 = *p2 * fac op *p1; \ 1002 destroy (); return tm; \ 1009 #define F_STDDEF_TSTS(op) \ 1010 template <typename T> \ 1011 inline F_TMatrix<T> F_TSMatrix<T>::operator op (F_TSMatrix<T> ts) \ 1013 BCHK(row != ts.row || col != ts.col, MatErr, Op op on diff size Mats, ts.row, F_TMatrix<T> (*this)); \ 1015 if (!mut && ts.mut) tm = ts; \ 1016 else { tm = *this; tm.detach (); } \ 1017 for (REGISTER T *p1 = tm.vec, *p2 = vec, *p3 = ts.vec; p2 < endvec; p1++, p2++, p3++) \ 1018 *p1 = *p2 * fac op *p3 * ts.fac; \ 1019 if (!mut && ts.mut) destroy (); else ts.destroy (); \ 1020 tm.fac = (T)1; return F_TMatrix<T> (tm); \ 1027 #define F_STDDEF_TST(op) \ 1028 template <typename T> \ 1029 inline F_TMatrix<T> F_TSMatrix<T>::operator op (const T& a) \ 1031 F_TSMatrix<T> ts (*this); ts.detach (); \ 1032 for (REGISTER T *p1 = ts.vec, *p2 = vec; p2 < endvec; p1++, p2++) \ 1033 *p1 = *p2 * fac op a; \ 1034 ts.fac = (T)1; return F_TMatrix<T> (ts); \ 1041 #define F_STDDEF_TTS(op) \ 1042 INST(template <typename T> class F_TSMatrix friend F_TMatrix<T> operator op (const T&, F_TSMatrix<T>);) \ 1043 template <typename T> \ 1044 inline F_TMatrix<T> operator op (const T& a, F_TSMatrix<T> ts) \ 1046 F_TSMatrix<T> tm (ts); tm.detach (); \ 1047 for (REGISTER T *p1 = tm._VEC, *p2 = ts._VEC; p1 < tm._ENDVEC; p1++, p2++) \ 1048 *p1 = a op *p2 * ts._FAC; \ 1049 tm._FAC = (T)1; return F_TMatrix<T> (tm); \ 1056 template <typename
T>
1062 for (
unsigned int r=0; r<
row; r++) {
1063 for (
unsigned int c=0;
c<m.col;
c++) {
1064 tmp =
mat[0][r] * m(0,
c);
1066 tmp +=
mat[l][r] * m(l,
c);
1074 template <
typename T>
1080 for (
unsigned int r=0; r<
row; r++)
1084 el +=
mat[
c][r] * v(
c);
1091 template <
typename T>
1095 if (
dim == 0) {
return true; }
1098 if (
vec == m.
vec)
return true;
1103 if (
vec == m.
vec)
return false;
1105 if (*p1 *
fac != *p2) {
destroy ();
return false; }
1111 template <
typename T>
1115 if (
dim == 0) {
return true; }
1125 if (*p1 *
fac != *p2) {
destroy ();
ts.destroy ();
return false; }
1130 template <
typename T>
1134 for (
unsigned int c = 0;
c < this->
col; ++
c)
1135 for (
unsigned int r = 0; r < this->
row; ++r)
1142 template <
typename T>
1147 for (; ptr <
endvec; ptr++)
1155 template <typename T>
1157 {
ts._FAC = f *
ts._FAC;
return ts; }
1170 template <
typename T>
1204 static const char*
mat_info () {
return (
"F_Matrix"); }
1207 T&
operator () (
const unsigned int,
const unsigned int)
const;
1210 const T&
get (
const unsigned r,
const unsigned c)
const 1211 {
return this->mat[
c][r]; }
1221 void setval(
const T val,
const unsigned int r,
const unsigned int c)
1237 {
return this->
resize (d, d); }
1293 {
return !(*
this == m); }
1298 {
return !(*
this == tm); }
1302 {
return !(*
this ==
ts); }
1306 friend STD__ ostream& operator << FGD (STD__ ostream&, const F_Matrix<T>&);
1315 double fabs ()
const;
1321 template <
typename T>
1325 for (
unsigned int r=0; r<m.
rows(); r++)
1327 operator()(r,
c) = m(r,
c);
1330 template <
typename T>
1334 for (
unsigned int r = 0; r < this->
row; ++r)
1335 for (
unsigned int c = 0;
c < this->
col; ++
c)
1339 template <
typename T>
1343 for (
unsigned int c = 0;
c < this->
col; ++
c)
1344 for (
unsigned int r = 0; r < this->
row; ++r)
1350 template <
typename T>
1351 STD__ ostream& operator << (STD__ ostream& os, const F_Matrix<T>& m)
1353 for (
unsigned int r=0; r<m.row; r++) {
1354 for (
unsigned int c=0;
c<m.col;
c++)
1355 os << m(r,
c) <<
" ";
1362 template <typename T>
1371 template <typename T>
1374 return os << F_Matrix<T>(
ts);
1378 template <
typename T>
1383 for (
unsigned int i=0;
i<m.
col;
i++)
1395 #define F_MSTDDEF_T(op) \ 1396 template <typename T> \ 1397 inline F_TMatrix<T> F_Matrix<T>::operator op (const T& a) const \ 1399 F_TMatrix<T> t (this->row, this->col); \ 1400 for (REGISTER T *p1=t.vec, *p2=this->vec; p2<this->endvec; ++p1, ++p2) \ 1408 template <typename
T>
1412 template <
typename T>
1419 #define F_MSTDDEF_M(op) \ 1420 template <typename T> \ 1421 inline F_TMatrix<T> F_Matrix<T>::operator op (const F_Matrix<T>& a) const \ 1423 F_TMatrix<T> t (this->row, this->col); \ 1424 BCHK(this->dim != a.dim, MatErr, Operator op on diff size matrices, a.dim, t); \ 1425 for (REGISTER T *p1=t.vec, *p2=this->vec, *p3=a.vec; p2<this->endvec; ++p1, ++p2, ++p3) \ 1434 #define F_MSTDDEF_TM(op) \ 1435 template <typename T> \ 1436 inline F_TMatrix<T> F_Matrix<T>::operator op (F_TMatrix<T> a) const \ 1438 BCHK(this->dim != a.dim, MatErr, Applying op on diff. size matrices, a.dim, a); \ 1439 for (REGISTER T *p1=a.vec, *p2=this->vec; p2<this->endvec; ++p1, ++p2) \ 1447 #define F_MSTDDEF_TS(op) \ 1448 template <typename T> \ 1449 inline F_TMatrix<T> F_Matrix<T>::operator op (F_TSMatrix<T> ts) const \ 1451 BCHK(this->dim != ts.dim, MatErr, Applying op on diff. size matrices, ts.dim, (ts.destroy(),F_TMatrix<T> (*this)) ); \ 1452 F_TSMatrix<T> tm (ts); tm.detach (); \ 1453 for (REGISTER T *p1=tm.vec, *p2=this->vec, *p3=ts.vec; p2<this->endvec; ++p1, ++p2, ++p3) \ 1454 *p1 = *p2 op *p3 * ts.fac; \ 1455 tm.fac = (T)1; return F_TMatrix<T> (tm); \ 1463 template <typename
T>
1468 for (
unsigned int r=0; r<this->
row; ++r) {
1472 tmp += (*
this)(r, l) *
a(l,
c);
1479 template <
typename T>
1485 for (
unsigned int r=0; r<this->
row; ++r) {
1487 tmp = (*this)(
c, 0) *
a.mat[
c][0];
1489 tmp += (*
this)(r, l) *
a.mat[
c][l];
1493 a.destroy ();
return ftm;
1497 template <
typename T>
1504 template <
typename T>
1512 template <
typename T>
1519 template <
typename T>
1527 template <
typename T>
1530 if (this->row != m.
row || this->col != m.
col)
1532 if (this->vec == m.
vec || this->dim == 0)
1540 template <
typename T>
1543 if (this->row !=
ts.row || this->col !=
ts.col)
1544 return (
ts.destroy(),
false);
1545 if (this->vec == 0) {
1548 if (
ts.fac == (
T)1) {
1549 if (this->vec ==
ts.vec)
1552 ts.destroy ();
return false;
1555 if (this->vec ==
ts.vec)
1558 if (*p1 != *p2 *
ts.fac) {
1559 ts.destroy ();
return false;
1567 template<
typename T>
1571 for (
unsigned int r=0; r<this->
row; ++r) {
1574 el += this->
operator() (r,
c) * v(
c);
1580 template<
typename T>
1584 return (*
this * cn);
1588 template <
typename T>
1594 v.vec[j] = this->mat[j][
i];
1599 template <
typename T>
1605 template <
typename T>
1611 template <
typename T>
1617 template <
typename T>
1623 template <
typename T>
1628 return this->mat[
c][r];
1641 template <
typename T>
1651 template <
typename T>
1655 for (
unsigned r = 0; r < this->
row; ++r)
1656 for (
unsigned c = 0;
c < this->
col; ++
c)
1657 trm.
mat[
c][r] = this->mat[r][
c];
1666 template <typename T>
1672 template <
typename T>
1675 if (this->col != this->row) {
1678 return this->swap(transmat);
1681 for (
unsigned r = 1; r < this->
row; ++r)
1682 for (
unsigned c = 0;
c < r; ++
c)
1683 SWAP(this->mat[r][
c], this->mat[
c][r]);
1688 template <
typename T>
1695 unsigned int tcol = this->
col; this->col = m.
col; m.
col = tcol;
1713 template <typename T>
1715 {
return ftm.fabs (); }
1718 template <typename T>
1720 {
return fm.fabs (); }
1723 template <typename T>
1725 {
return ftsm.fabs (); }
#define TBCICOPY(n, o, t, s)
#define BCHKNR(cond, exc, txt, ind)
F_TSMatrix< T > & operator*=(const T &f)
T * get_fortran_matrix() const
void setval(const T val, const unsigned int r, const unsigned int c)
unsigned long size() const
unsigned int columns() const
TVector< T > get_row(const unsigned int) const
T & operator()(const unsigned int, const unsigned int) const
F_TSMatrix(const F_TMatrix< T > &tm, const T &f=(T) 1)
F_TSMatrix< T > & operator-()
bool operator!=(const F_Matrix< T > &m)
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
F_Matrix< T > & operator+=(const F_Matrix< T > &a)
F_Matrix(const unsigned d=0)
void detach(F_TMatrix< T > *=0)
unsigned int rows() const
Common interface definition (signature) for all Matrices.
F_Matrix< T > & resize(const unsigned r, const unsigned c)
void set_row(const Vector< T > &, const unsigned int)
#define BCHK(cond, exc, txt, ind, rtval)
F_TMatrix< T > conj() const
F_Matrix< T > & operator=(const F_Matrix< T > &m)
bool operator!=(const F_Matrix< T > &m) const
#define NAMESPACE_CSTD_END
F_Matrix< T > & setunit(const T &f=1)
static const char * mat_info()
#define TBCIFILL(n, v, t, s)
void clone(bool=false, F_TMatrix< T > *=0)
T aligned_value_type TALIGN(MIN_ALIGN2)
F_TSMatrix< T > & operator/(const T &f)
const Vector< T > const Vector< T > & x
T aligned_value_type TALIGN(MIN_ALIGN2)
F_Matrix< T > & resize(const T &v, const unsigned r, const unsigned c)
F_Matrix< T > & operator/=(const T &a)
F_TMatrix< T > & resize(const unsigned int, const unsigned int)
#define F_STDDEF_TMTM(op)
F_Matrix(F_TSMatrix< T > &ts)
INST(template< typename T > class F_TMatrix friend F_TMatrix< T > operator+(const T &, F_TMatrix< T >);) template< typename T > inline F_TMatrix< T > operator+(const T &a
F_TMatrix< T > operator+(const F_Matrix< T > &)
unsigned int columns() const
unsigned int columns() const
Temporary object for scaled matrices.
T & setval(const T &val, const unsigned int r, const unsigned int c)
bool operator==(const F_Matrix< T > &m) const
F_TSMatrix< T > & operator/=(const T &f)
NAMESPACE_END NAMESPACE_CSTD double fabs(const TBCI__ F_TMatrix< T > &ftm)
void setval(const T val, const unsigned int r, const unsigned int c)
F_TMatrix< T > & operator-=(F_TMatrix< T >)
F_Matrix(const T &v, const unsigned r, const unsigned c)
F_TSMatrix< T > operator/=(const T &)
CTensor< T > & fill(const T &value)
F_Matrix< T > & fill(const T &v=0)
T & operator()(const unsigned int, const unsigned int) const
F_TMatrix< T > & setunit(const T &=1)
#define F_STDDEF_TSTS(op)
F_TSMatrix< T > operator/(const T &)
F_Matrix< T > & resize(const unsigned d)
F_TSMatrix< T > operator*(const T &)
Tensor class including arithmetics.
F_TSMatrix< T > & operator*(const T &f)
long int Vector< T > & index
F_Matrix< T > & operator*=(const T &a)
F_TMatrix< T > & operator+(F_TMatrix< T >)
unsigned int rows() const
F_TSMatrix(const F_Matrix< T > &m, const T &f=(T) 1)
static const char * mat_info()
TVector< T > get_row(const unsigned int) const
F_TMatrix(const unsigned=0)
unsigned long size() const
for(REGISTER T *p1=c. vec, *p2=b. vec ;p1< c. endvec ;p1++, p2++) *p1
bool operator==(const F_Matrix< T > &m)
unsigned long size() const
static const char * mat_info()
void SWAP(T &a, T &b)
SWAP function Note: We could implement a swap function without temporaries: a -= b b += a a -= b a = ...
bool operator!=(const F_Matrix< T > &m)
F_Matrix< T > & operator-=(const F_Matrix< T > &a)
F_TMatrix< T > & alias(const F_Matrix< T > &m)
F_Matrix(const unsigned r, const unsigned c)
F_TMatrix< T > transposed_copy() const
Inefficient! Use transMult if possible.
F_TMatrix< T > operator*(const F_Matrix< T > &) const
F_TMatrix< T > & transpose()
T & set(const T &val, const unsigned long i) const
Temporary Base Class (non referable!) (acc.
F_TMatrix< T > herm() const
F_TMatrix< T > & fill(const T &=0)
exception class: Use MatErr from matrix.h
unsigned int rows() const
F_TSMatrix< T > & operator=(const F_TSMatrix< T > &ts)
F_TMatrix< T > trans() const
#define TBCIDELETE(t, v, sz)
void set_col(const Vector< T > &, const unsigned int)
#define F_TMFORALL_TM(op)
F_TMatrix< T > & swap(F_TMatrix< T > &)
T aligned_value_type TALIGN(MIN_ALIGN2)
Temporary Base Class Idiom: Class TVector is used for temporary variables.
unsigned int rows() const
query matrix dimensions
F_TMatrix< T > operator+(const F_Matrix< T > &) const
F_TMatrix< T > & operator-()
F_Matrix(const F_TMatrix< T > &tm)
F_TSMatrix< T > operator*=(const T &)
F_TMatrix< T > transpose(const F_TMatrix< T > &ftm)
F_TMatrix< T > & operator=(const F_Matrix< T > &)
void set_col(const Vector< T > &, const unsigned int)
T & setval(const unsigned int r, const unsigned int c)
TVector< T > get_col(const unsigned int) const
F_TSMatrix(const F_TSMatrix< T > &ts)
double fabssqr(const double a)
TVector< T > get_col(const unsigned int) const
T * get_fortran_matrix() const
F_TMatrix< T > operator-() const
#define TBCICOMP(n, o, t, s)
F_TMatrix< T > & resize(const unsigned int d)
STD__ istream & operator>>(STD__ istream &in, F_Matrix< T > &m)
unsigned int columns() const
#define F_TMFORALL_TS(op)
const unsigned TMatrix< T > const Matrix< T > * a
F_TSMatrix< T > operator/(const T &) const
bool operator==(const F_Matrix< T > &)
T ** mat
Fortran storage layout: mat[col][row].
F_Matrix(const F_Matrix< T > &m)
T operator()(const unsigned r, const unsigned c)
#define LIKELY(expr)
branch prediction note that we sometimes on purpose mark the unlikely possibility likely and vice ver...
#define F_STDDEF_TSTM(op)
F_TSMatrix< T > & eval(F_TMatrix< T > *=0)
F_TMatrix< T > & operator+=(F_TMatrix< T >)
void set_row(const Vector< T > &, const unsigned int)