31 # error: "need right C-Library: Your C-Library doesn't have memset() function"
34 # error: "need right C-Library: Your C-Library doesn't have memcpy() function"
77 inline SgMatrix(
unsigned int NRow,
unsigned int NCol,
bool IsNeedClear =
true);
96 inline unsigned int nRow()
const;
100 inline unsigned int nCol()
const;
106 inline double&
operator()(
unsigned int i,
unsigned int j);
112 inline double getElement(
unsigned int i,
unsigned int j)
const;
119 inline void setElement(
unsigned int i,
unsigned int j,
double d);
249 inline const double*
const*
base_c()
const {
return B_;};
305 for (
unsigned int i=0; i<
NCol_; i++, w++)
307 *w =
new double[
NRow_];
309 memset((
void*)(*w), 0,
sizeof(
double)*
NRow_);
321 double **w=
B_, **q=M.
B_;
322 for (
unsigned int i=0; i<
NCol_; i++,w++,q++)
324 *w =
new double[
NRow_];
325 memcpy((
void*)(*w), (
const void*)(*q),
NRow_*
sizeof(
double));
337 for (
unsigned int i=0; i<
NCol_; i++,w++)
372 std::cerr <<
"WARNING: double& SgMatrix::operator()(unsigned int i, unsigned int j): "
373 <<
"row index [" << i <<
"] out of range [0.." <<
NRow_-1 <<
"].\n";
375 std::cerr <<
"WARNING: double& SgMatrix::operator()(unsigned int i, unsigned int j): "
376 <<
"column index [" << j <<
"] out of range [0.." <<
NCol_-1 <<
"].\n";
389 std::cerr <<
"WARNING: double SgMatrix::getElement(unsigned int i, unsigned int j) const: "
390 <<
"row index [" << i <<
"] out of range [0.." <<
NRow_-1 <<
"].\n";
392 std::cerr <<
"WARNING: double SgMatrix::getElement(unsigned int i, unsigned int j) const: "
393 <<
"column index [" << j <<
"] out of range [0.." <<
NCol_-1 <<
"].\n";
406 std::cerr <<
"WARNING: void SgMatrix::setElement(unsigned int i, unsigned int j, double d): "
407 <<
"row index [" << i <<
"] out of range [0.." <<
NRow_-1 <<
"].\n";
409 std::cerr <<
"WARNING: void SgMatrix::setElement(unsigned int i, unsigned int j, double d): "
410 <<
"column index [" << j <<
"] out of range [0.." <<
NCol_-1 <<
"].\n";
428 for (
unsigned int i=0; i<
NCol_; i++, w++)
429 memset((
void*)(*w), 0,
sizeof(
double)*
NRow_);
439 for (i=0; i<
NCol_; i++,w++)
440 for (ww=*w,j=0; i<
NRow_; j++,w++)
450 double **w=
B_, **q=M.
B_, *ww, *qq;
452 for (i=0; i<NCol; i++,w++,q++)
453 for (ww=*w,qq=*q,j=0; j<NRow; j++)
463 double **w=
B_, **q=M.
B_, *ww, *qq;
465 for (i=0; i<NCol; i++,w++,q++)
466 for (ww=*w,qq=*q,j=0; j<NRow; j++)
478 for (i=0; i<
NCol_; i++,w++)
479 for (ww=*w,j=0; j<
NRow_; j++)
491 for (i=0; i<
NCol_; i++,w++)
492 for (ww=*w,j=0; j<
NRow_; j++)
503 double **a=M.
B_, *aa;
505 for (j=0; j<M.
NCol_; j++,a++)
506 for (aa=*a,i=0; i<M.
NRow_; i++,aa++)
519 double **w=
B_, **q=M.
B_, *ww, *qq;
521 for (i=0; Is && i<
NCol_; i++,w++,q++)
522 for (ww=*w,qq=*q,j=0; Is && j<
NRow_; j++)
523 Is = Is && *ww++==*qq++;
SgMatrix operator/(const SgMatrix &M, double d)
SgMatrix operator+(const SgMatrix &M1, const SgMatrix &M2)
std::ostream & operator<<(std::ostream &s, const SgMatrix &M)
SgMatrix operator*(const SgMatrix &M, double d)
SgMatrix operator-(const SgMatrix &M)
friend SgMatrix operator/(const SgMatrix &M, double d)
bool operator==(const SgMatrix &M) const
double dTmp_
Local temporary variable.
friend SgMatrix operator+(const SgMatrix &M1, const SgMatrix &M2)
friend SgMatrix calcProduct_mat_x_matT(const SgMatrix &M1, const SgMatrix &M2)
friend SgVector calcProduct_matT_x_vec(const SgMatrix &M, const SgVector &V)
unsigned int NCol_
An number of columns in a matrix.
SgMatrix & operator*=(double d)
SgMatrix & operator+=(const SgMatrix &M)
unsigned int nRow() const
SgMatrix & operator/=(double d)
friend SgMatrix operator*(const SgMatrix &M, double d)
friend SgMatrix calcProduct_matT_x_mat(const SgMatrix &M1, const SgMatrix &M2)
double & operator()(unsigned int i, unsigned int j)
friend SgMatrix operator-(const SgMatrix &M)
SgMatrix & operator-=(const SgMatrix &M)
SgMatrix & operator=(const SgMatrix &M)
void setElement(unsigned int i, unsigned int j, double d)
friend SgMatrix calcProduct_mat_x_mat(const SgMatrix &M1, const SgMatrix &M2)
const double *const * base_c() const
double getElement(unsigned int i, unsigned int j) const
bool operator!=(const SgMatrix &M) const
double ** B_
A pointer on a pointer of a first element of the matrix.
unsigned int nCol() const
unsigned int NRow_
An number of rows in a matrix.