25#ifdef BT_DEBUG_OSTREAM
88 for (
int ix = 0; ix < nn; ix++)
90 if ((*
this)[ix] != 0.0)
92 T absxi =
btFabs((*
this)[ix]);
97 ssq = ssq * (temp * temp) +
BT_ONE;
103 temp = absxi / scale;
108 norm = scale * sqrt(ssq);
246 for (
int row = 0; row <
rows(); row++)
248 for (
int col = 0; col < row; col++)
250 setElem(col, row, (*
this)(row, col));
281 for (
int row = 0; row <
rows(); row++)
289 printf(
"%s ---------------------\n", msg);
290 for (
int i = 0; i <
rows(); i++)
293 for (
int j = 0; j <
cols(); j++)
295 printf(
"%2.1f\t", (*
this)(i, j));
298 printf(
"\n---------------------\n");
304 for (
int i = 0; i <
rows(); i++)
307 for (
int j = 0; j <
cols(); j++)
309 if ((*
this)(i, j) != 0.f)
321 for (
int i = 0; i <
m_cols; i++)
322 for (
int j = 0; j <
m_rows; j++)
341 for (
int i = 0; i <
rows(); ++i)
344 for (
int j = 0; j < other.
cols(); ++j)
351 for (
int k = 0; k < c; k++)
354 if (other(k, j) != 0.f)
356 dotProd += w * other(k, j);
373 for (
int i = 0; i < numRows; i++)
376 for (
int j = 0; j < numRowsOther; j++)
380 sum += bb[1] * cc[1];
381 sum += bb[2] * cc[2];
382 sum += bb[4] * cc[4];
383 sum += bb[5] * cc[5];
384 sum += bb[6] * cc[6];
394 btAssert(numRows > 0 && numRowsOther > 0 && B && C);
396 for (
int i = 0; i < numRows; i++)
399 for (
int j = 0; j < numRowsOther; j++)
403 sum += bb[1] * cc[1];
404 sum += bb[2] * cc[2];
405 sum += bb[4] * cc[4];
406 sum += bb[5] * cc[5];
407 sum += bb[6] * cc[6];
415 void setSubMatrix(
int rowstart,
int colstart,
int rowend,
int colend,
const T value)
417 int numRows = rowend + 1 - rowstart;
418 int numCols = colend + 1 - colstart;
420 for (
int row = 0; row < numRows; row++)
422 for (
int col = 0; col < numCols; col++)
424 setElem(rowstart + row, colstart + col, value);
433 for (
int row = 0; row < block.
rows(); row++)
435 for (
int col = 0; col < block.
cols(); col++)
437 setElem(rowstart + row, colstart + col, block(row, col));
445 for (
int row = 0; row < block.
rows(); row++)
447 for (
int col = 0; col < block.
cols(); col++)
449 setElem(rowstart + row, colstart + col, block[row]);
457 for (
int i = 0; i <
rows(); i++)
458 for (
int j = 0; j <
cols(); j++)
473#ifdef BT_DEBUG_OSTREAM
475std::ostream& operator<<(std::ostream& os,
const btMatrixX<T>& mat)
479 for (
int i = 0; i < mat.
rows(); i++)
481 for (
int j = 0; j < mat.
cols(); j++)
483 os << std::setw(12) << mat(i, j);
485 if (i != mat.
rows() - 1)
495std::ostream& operator<<(std::ostream& os,
const btVectorX<T>& mat)
499 for (
int i = 0; i < mat.
rows(); i++)
501 os << std::setw(12) << mat[i];
502 if (i != mat.rows() - 1)
524#ifdef BT_USE_DOUBLE_PRECISION
525#define btVectorXu btVectorXd
526#define btMatrixXu btMatrixXd
528#define btVectorXu btVectorXf
529#define btMatrixXu btMatrixXf
btVectorX< double > btVectorXd
btMatrixX< double > btMatrixXd
btVectorX< float > btVectorXf
btMatrixX< float > btMatrixXf
void setElem(btMatrixXd &mat, int row, int col, double val)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void btSetZero(T *a, int n)
btScalar btFabs(btScalar x)
static T sum(const btAlignedObjectArray< T > &items)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
void resize(int newsize, const T &fillData=T())
void push_back(const T &_Val)
original version written by Erwin Coumans, October 2013
bool operator()(const int &a, const int &b) const
void rowComputeNonZeroElements() const
btAlignedObjectArray< T > m_storage
btMatrixX transpose() const
btMatrixX operator*(const btMatrixX &other)
void setSubMatrix(int rowstart, int colstart, int rowend, int colend, const T value)
void mulElem(int row, int col, T val)
btMatrixX(int rows, int cols)
btAlignedObjectArray< btAlignedObjectArray< int > > m_rowNonZeroElements1
void setSubMatrix(int rowstart, int colstart, int rowend, int colend, const btMatrixX &block)
void addElem(int row, int col, T val)
we don't want this read/write operator(), because we cannot keep track of non-zero elements,...
const T * getBufferPointer() const
void multiply2_p8r(const btScalar *B, const btScalar *C, int numRows, int numRowsOther, int row, int col)
void copyLowerToUpperTriangle()
T * getBufferPointerWritable()
void multiplyAdd2_p8r(const btScalar *B, const btScalar *C, int numRows, int numRowsOther, int row, int col)
void printMatrix(const char *msg) const
const T & operator()(int row, int col) const
void resize(int rows, int cols)
void setElem(int row, int col, T val)
void setSubMatrix(int rowstart, int colstart, int rowend, int colend, const btVectorX< T > &block)
btAlignedObjectArray< T > m_storage
const T & operator[](int index) const
T & operator[](int index)
const T * getBufferPointer() const
T * getBufferPointerWritable()