25 #ifdef BT_DEBUG_OSTREAM 28 #endif //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);
151 template <
typename T>
246 for (
int row = 0; row <
rows(); row++)
248 for (
int col = 0; col < row; col++)
250 setElem(col, row, (*
this)(row, col));
278 for (
int row = 0; row <
rows(); row++)
286 printf(
"%s ---------------------\n", msg);
287 for (
int i = 0; i <
rows(); i++)
290 for (
int j = 0; j <
cols(); j++)
292 printf(
"%2.1f\t", (*
this)(i, j));
295 printf(
"\n---------------------\n");
301 for (
int i = 0; i <
rows(); i++)
304 for (
int j = 0; j <
cols(); j++)
306 if ((*
this)(i, j) != 0.f)
318 for (
int i = 0; i <
m_cols; i++)
319 for (
int j = 0; j <
m_rows; j++)
338 for (
int j = 0; j < res.cols(); ++j)
341 for (
int i = 0; i < res.rows(); ++i)
350 for (
int v = 0; v <
rows(); v++)
353 if (other(v, j) != 0.f)
355 dotProd += w * other(v, j);
361 res.setElem(i, j, dotProd);
372 for (
int i = 0; i < numRows; i++)
375 for (
int j = 0; j < numRowsOther; j++)
379 sum += bb[1] * cc[1];
380 sum += bb[2] * cc[2];
381 sum += bb[4] * cc[4];
382 sum += bb[5] * cc[5];
383 sum += bb[6] * cc[6];
393 btAssert(numRows > 0 && numRowsOther > 0 && B && C);
395 for (
int i = 0; i < numRows; i++)
398 for (
int j = 0; j < numRowsOther; j++)
402 sum += bb[1] * cc[1];
403 sum += bb[2] * cc[2];
404 sum += bb[4] * cc[4];
405 sum += bb[5] * cc[5];
406 sum += bb[6] * cc[6];
414 void setSubMatrix(
int rowstart,
int colstart,
int rowend,
int colend,
const T value)
416 int numRows = rowend + 1 - rowstart;
417 int numCols = colend + 1 - colstart;
419 for (
int row = 0; row < numRows; row++)
421 for (
int col = 0; col < numCols; col++)
423 setElem(rowstart + row, colstart + col, value);
432 for (
int row = 0; row < block.
rows(); row++)
434 for (
int col = 0; col < block.
cols(); col++)
436 setElem(rowstart + row, colstart + col, block(row, col));
444 for (
int row = 0; row < block.
rows(); row++)
446 for (
int col = 0; col < block.
cols(); col++)
448 setElem(rowstart + row, colstart + col, block[row]);
456 for (
int i = 0; i <
rows(); i++)
457 for (
int j = 0; j <
cols(); j++)
472 #ifdef BT_DEBUG_OSTREAM 473 template <
typename T>
474 std::ostream& operator<<(std::ostream& os, const btMatrixX<T>& mat)
478 for (
int i = 0; i < mat.rows(); i++)
480 for (
int j = 0; j < mat.cols(); j++)
482 os << std::setw(12) << mat(i, j);
484 if (i != mat.rows() - 1)
493 template <
typename T>
494 std::ostream& operator<<(std::ostream& os, const btVectorX<T>& mat)
498 for (
int i = 0; i < mat.rows(); i++)
500 os << std::setw(12) << mat[i];
501 if (i != mat.rows() - 1)
511 #endif //BT_DEBUG_OSTREAM 523 #ifdef BT_USE_DOUBLE_PRECISION 524 #define btVectorXu btVectorXd 525 #define btMatrixXu btMatrixXd 527 #define btVectorXu btVectorXf 528 #define btMatrixXu btMatrixXf 529 #endif //BT_USE_DOUBLE_PRECISION 531 #endif //BT_MATRIX_H_H void setElem(int row, int col, T val)
static T sum(const btAlignedObjectArray< T > &items)
btVectorX< double > btVectorXd
void push_back(const T &_Val)
btAlignedObjectArray< T > m_storage
btAlignedObjectArray< T > m_storage
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
bool operator()(const int &a, const int &b) const
btVectorX< float > btVectorXf
void mulElem(int row, int col, T val)
original version written by Erwin Coumans, October 2013
void printMatrix(const char *msg)
T * getBufferPointerWritable()
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 & operator[](int index) const
const T * getBufferPointer() const
void setSubMatrix(int rowstart, int colstart, int rowend, int colend, const btVectorX< T > &block)
T * getBufferPointerWritable()
void btSetZero(T *a, int n)
btMatrixX< double > btMatrixXd
btMatrixX transpose() const
void multiply2_p8r(const btScalar *B, const btScalar *C, int numRows, int numRowsOther, int row, int col)
void setSubMatrix(int rowstart, int colstart, int rowend, int colend, const T value)
void rowComputeNonZeroElements() const
const T * getBufferPointer() const
btMatrixX< float > btMatrixXf
void resize(int newsize, const T &fillData=T())
T & operator[](int index)
void setElem(btMatrixXd &mat, int row, int col, double val)
const T & operator()(int row, int col) const
void multiplyAdd2_p8r(const btScalar *B, const btScalar *C, int numRows, int numRowsOther, int row, int col)
void copyLowerToUpperTriangle()
void resize(int rows, int cols)
btMatrixX operator*(const btMatrixX &other)
btAlignedObjectArray< btAlignedObjectArray< int > > m_rowNonZeroElements1
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btMatrixX(int rows, int cols)
btScalar btFabs(btScalar x)