79 iNumRows(iNR), iNumCols(iNC), iRawSize(iSize), iMaxCols(iMaxC),
80 pdRaw(pd), pdRawm1(0),
81 ppdCols(ppd), ppdColsm1(0), m_end(*this,
true)
102 iNumRows(iNR), iNumCols(iNC ? iNC : iNumRows),
103 iRawSize(iNumRows*iNumCols), iMaxCols(iNumCols),
104 pdRaw(NULL), pdRawm1(NULL),
105 ppdCols(NULL), ppdColsm1(NULL), m_end(*this,
true)
121 iNumRows(0), iNumCols(0), iRawSize(0), iMaxCols(0),
122 pdRaw(NULL), pdRawm1(NULL),
123 ppdCols(NULL), ppdColsm1(NULL), m_end(*this,
true)
131 iNumRows(0), iNumCols(0), iRawSize(0), iMaxCols(0),
132 pdRaw(NULL), pdRawm1(NULL),
133 ppdCols(NULL), ppdColsm1(NULL), m_end(*this,
true)
152 silent_cerr(
"FullMatrixHandler::operator = (const FullMatrixHandler&): "
176 if (iNewRows < 0 || iNewCols < 0) {
177 silent_cerr(
"Negative size!" << std::endl);
181 integer iSize = iNewRows*iNewCols;
232 silent_cerr(
"Can't resize to "
234 <<
": larger than max size "
239 silent_cerr(
"Can't resize to "
241 <<
" cols: larger than max "
259 silent_cerr(
"internal error!" << std::endl);
333 FullMatrixHandler::IsValid(
void)
const
343 #ifdef DEBUG_MEMMANAGER
354 #ifdef HAVE_FMTFLAGS_IN_IOS
355 std::ios::fmtflags oldbits = out.setf(std::ios::scientific);
357 long oldbits = out.setf(ios::scientific);
360 out <<
"<FullMatrixHandler> n. rows: " << m.
iNumRows
361 <<
"; n. cols: " << m.
iNumCols << std::endl;
362 for (
int i = 1; i <= m.
iNumRows; i++) {
363 out <<
"Row " << std::setw(8) << i;
364 for (
int j = 1; j <= m.
iNumCols; j++) {
365 out << std::setw(10) << std::setprecision(2)
381 #ifdef HAVE_FMTFLAGS_IN_IOS
382 std::ios::fmtflags oldbits = out.setf(std::ios::scientific);
384 long oldbits = out.setf(ios::scientific);
391 for (
int i = 1; i <= m.
iNumRows; i++) {
392 for (
int j = 1; j <= m.
iNumCols; j++) {
393 out << std::setw(20) << std::setprecision(12)
407 return SubMH.
AddTo(*
this);
421 return SubMH.
AddTo(*
this);
440 silent_cerr(
"FullMatrixHandler::MatMul: size mismatch "
453 for (
integer iK = 1; iK <= nc; iK++) {
591 __FC_DECL__(dgemm)(
const char *
const TRANSA,
const char *
const TRANSB,
632 silent_cerr(
"FullMatrixHandler::MatMatMul_base: size mismatch "
633 "out(" << out_nr <<
", " << out_nc <<
") "
635 "* in(" << in_nr <<
", " << in.
iGetNumCols() <<
")"
645 for (
integer r = 1; r <= out_nr; r++) {
648 for (
integer k = 1; k <= in_nr; k++) {
680 const char *TRANSA =
"N";
681 const char *TRANSB =
"N";
682 __FC_DECL__(dgemm)(TRANSA, TRANSB, &out_nr, &out_nc, &in_nr,
684 this->
pdRaw, &out_nr,
687 pout->
pdRaw, &out_nr);
689 #else // ! USE_LAPACK
692 for (
integer r = 1; r <= out_nr; r++) {
695 for (
integer k = 1; k <= in_nr; k++) {
707 for (
integer r = 1; r <= out_nr; r++) {
710 for (
integer k = 1; k <= in_nr; k++) {
722 for (
integer r = 1; r <= out_nr; r++) {
725 for (
integer k = 1; k <= in_nr; k++) {
738 #endif // ! USE_LAPACK
775 silent_cerr(
"FullMatrixHandler::MatTMatMul_base: size mismatch "
776 "out(" << out_nr <<
", " << out_nc <<
") "
778 "* in(" << in_nr <<
", " << in.
iGetNumCols() <<
")"
788 for (
integer r = 1; r <= out_nr; r++) {
791 for (
integer k = 1; k <= in_nr; k++) {
823 const char *TRANSA =
"T";
824 const char *TRANSB =
"N";
825 __FC_DECL__(dgemm)(TRANSA, TRANSB, &out_nr, &out_nc, &in_nr,
830 pout->
pdRaw, &out_nr);
832 #else // ! USE_LAPACK
835 for (
integer r = 1; r <= out_nr; r++) {
838 for (
integer k = 1; k <= in_nr; k++) {
850 for (
integer r = 1; r <= out_nr; r++) {
853 for (
integer k = 1; k <= in_nr; k++) {
865 for (
integer r = 1; r <= out_nr; r++) {
868 for (
integer k = 1; k <= in_nr; k++) {
881 #endif // ! USE_LAPACK
899 for (
integer ir = 1; ir <= nr; ir++) {
901 for (
integer ic = 1; ic <= nc; ic++) {
913 for (
integer ir = 1; ir <= nr; ir++) {
915 for (
integer ic = 1; ic <= nc; ic++) {
926 for (
integer ir = 1; ir <= nr; ir++) {
928 for (
integer ic = 1; ic <= nc; ic++) {
936 for (
integer ir = 1; ir <= nr; ir++) {
938 for (
integer ic = 1; ic <= nc; ic++) {
946 for (
integer ir = 1; ir <= nr; ir++) {
948 for (
integer ic = 1; ic <= nc; ic++) {
975 for (
integer ir = 1; ir <= nr; ir++) {
977 for (
integer ic = 1; ic <= nc; ic++) {
989 for (
integer ir = 1; ir <= nr; ir++) {
991 for (
integer ic = 1; ic <= nc; ic++) {
1002 for (
integer ir = 1; ir <= nr; ir++) {
1004 for (
integer ic = 1; ic <= nc; ic++) {
1006 d +=
ppdColsm1[ir][ic]*pin->pdVecm1[ic];
1012 for (
integer ir = 1; ir <= nr; ir++) {
1014 for (
integer ic = 1; ic <= nc; ic++) {
1016 d +=
ppdColsm1[ir][ic]*pin->pdVecm1[ic];
1022 for (
integer ir = 1; ir <= nr; ir++) {
1024 for (
integer ic = 1; ic <= nc; ic++) {
1026 d +=
ppdColsm1[ir][ic]*pin->pdVecm1[ic];
1057 if (iRow < 0 || iCol < 0
1065 for (
integer ir = 1; ir <= nr; ir++) {
1066 for (
integer ic = 1; ic <= nc; ic++) {
1094 if (iRow < 0 || iCol < 0
1102 for (
integer ir = 1; ir <= nr; ir++) {
1103 for (
integer ic = 1; ic <= nc; ic++) {
1131 if (iRow < 0 || iCol < 0
1139 for (
integer ir = 1; ir <= nr; ir++) {
1140 for (
integer ic = 1; ic <= nc; ic++) {
1169 if (iRow < 0 || iCol < 0
1177 for (
integer ir = 1; ir <= nr; ir++) {
1178 for (
integer ic = 1; ic <= nc; ic++) {
1207 if (iRow < 0 || iCol < 0
1215 for (
integer ir = 1; ir <= nr; ir++) {
1216 for (
integer ic = 1; ic <= nc; ic++) {
1245 if (iRow < 0 || iCol < 0
1253 for (
integer ir = 1; ir <= nr; ir++) {
1254 for (
integer ic = 1; ic <= nc; ic++) {
1282 if (iRow < 0 || iCol < 0
1290 for (
integer ir = 1; ir <= nr; ir++) {
1291 for (
integer ic = 1; ic <= nc; ic++) {
1319 if (iRow < 0 || iCol < 0
1327 for (
integer ir = 1; ir <= nr; ir++) {
1328 for (
integer ic = 1; ic <= nc; ic++) {
1356 if (iRow < 0 || iCol < 0
1364 for (
integer ir = 1; ir <= nr; ir++) {
1365 for (
integer ic = 1; ic <= nc; ic++) {
1394 if (iRow < 0 || iCol < 0
1402 for (
integer ir = 1; ir <= nr; ir++) {
1403 for (
integer ic = 1; ic <= nc; ic++) {
1432 if (iRow < 0 || iCol < 0
1440 for (
integer ir = 1; ir <= nr; ir++) {
1441 for (
integer ic = 1; ic <= nc; ic++) {
1470 if (iRow < 0 || iCol < 0
1478 for (
integer ir = 1; ir <= nr; ir++) {
1479 for (
integer ic = 1; ic <= nc; ic++) {
1882 for (
unsigned c = 0;
c < 2;
c++) {
1883 for (
unsigned r = 0; r < 2; r++) {
1960 for (
unsigned c = 0;
c < 2;
c++) {
1961 for (
unsigned r = 0; r < 2; r++) {
2036 for (
unsigned c = 0;
c < 2;
c++) {
2037 for (
unsigned r = 0; r < 2; r++) {
2097 for (
int r = 3; r > 0; r--) {
2123 for (
int r = 3; r > 0; r--) {
2149 for (
int r = 3; r > 0; r--) {
2312 for (
integer ic = 1; ic <= nc; ic++) {
2324 ASSERT(source_start_row >= 1);
2326 ASSERT(source_start_row <= source_end_row);
2330 ASSERT(source_start_col >= 1);
2332 ASSERT(source_start_col <= source_end_col);
2336 for (
integer ir = source_start_row; ir <= source_end_row; ir++) {
2337 integer row = dest_row + (ir - source_start_row);
2338 for (
integer ic = source_start_col; ic <= source_end_col; ic++) {
2339 integer col = dest_col + (ic - source_start_col);
2379 if (++elem.iRow == m.iNumRows) {
2380 if (++elem.iCol == m.iNumCols) {
2385 }
while (m.pdRaw[i_idx] == 0.);
2389 if (++elem.iRow == m.iNumRows) {
2390 if (++elem.iCol == m.iNumCols) {
2397 elem.dCoef = m.pdRaw[i_idx];
2417 return elem == op.
elem;
2423 return elem != op.
elem;
void PutT(integer iRow, integer iCol, const FullMatrixHandler &source)
void MatMul(const FullMatrixHandler &m1, const FullMatrixHandler &m2)
void reset(bool is_end=false)
virtual MatrixHandler & operator-=(const SubMatrixHandler &SubMH)
const FullMatrixHandler::const_iterator & operator++(void) const
virtual integer iGetNumCols(void) const =0
virtual void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
SparseMatrixHandler::SparseMatrixElement elem
#define MBDYN_EXCEPT_ARGS
bool operator==(const FullMatrixHandler::const_iterator &op) const
void Put(integer iRow, integer iCol, const FullMatrixHandler &source)
const SparseMatrixHandler::SparseMatrixElement * operator->(void) const
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
virtual MatrixHandler & AddTo(MatrixHandler &MH) const =0
#define SAFEDELETEARR(pnt)
const_iterator(const FullMatrixHandler &m, bool is_end=false)
virtual void IncCoef(integer iRow, const doublereal &dCoef)=0
virtual void DecCoef(integer iRow, integer iCol, const doublereal &dCoef)
void CopyMatrixRow(integer dest_row, const FullMatrixHandler &source, integer source_row)
void Add(integer iRow, integer iCol, const FullMatrixHandler &source)
integer iGetNumRows(void) const
virtual MatrixHandler & operator+=(const SubMatrixHandler &SubMH)
virtual void Resize(integer iNewRows, integer iNewCols)
virtual integer iGetSize(void) const =0
virtual void DecCoef(integer iRow, const doublereal &dCoef)=0
virtual ~FullMatrixHandler(void)
virtual MatrixHandler & MatTMatMul_base(void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
virtual MatrixHandler & SubFrom(MatrixHandler &MH) const =0
bool operator!=(const FullMatrixHandler::const_iterator &op) const
std::ostream & operator<<(std::ostream &out, const FullMatrixHandler &m)
MatrixHandler & AddTo(MatrixHandler &MH) const
virtual void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
virtual VectorHandler & MatTVecMul_base(void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
integer iGetNumCols(void) const
#define ASSERT(expression)
void CopyMatrixBlock(integer dest_row, integer dest_col, const FullMatrixHandler &source, integer source_start_row, integer source_end_row, integer source_start_col, integer source_end_col)
virtual MatrixHandler & MatMatMul_base(void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
void CreateColRow(integer iNR, integer iNC)
MatrixHandler & MatTMatMul_base(void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
MatrixHandler & SubFrom(MatrixHandler &MH) const
void Sub(integer iRow, integer iCol, const FullMatrixHandler &source)
#define defaultMemoryManager
virtual integer iGetNumCols(void) const
const SparseMatrixHandler::SparseMatrixElement & operator*(void) const
static std::stack< cleanup * > c
MatrixHandler & MatMatMul_base(void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
const doublereal * pGetMat(void) const
void Attach(integer iNewRows, integer iNewCols, doublereal *pd, doublereal **ppd, integer iMSize=0, integer iMaxC=0)
const doublereal * pGetVec(void) const
const FullMatrixHandler & m
#define SAFENEWARR(pnt, item, sz)
void SubT(integer iRow, integer iCol, const FullMatrixHandler &source)
void AddT(integer iRow, integer iCol, const FullMatrixHandler &source)
virtual VectorHandler & MatVecMul_base(void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
virtual integer iGetNumRows(void) const
virtual integer iGetNumRows(void) const =0
FullMatrixHandler & operator=(const FullMatrixHandler &)