25 #ifdef BT_DEBUG_OSTREAM 28 #endif //BT_DEBUG_OSTREAM 89 for (
int ix=0;ix<nn;ix++)
91 if ((*
this)[ix] != 0.0)
93 T absxi =
btFabs((*
this)[ix]);
98 ssq = ssq * (temp * temp) +
BT_ONE;
104 temp = absxi / scale;
109 norm = scale * sqrt(ssq);
155 template <
typename T>
253 for (
int row=0;row<
rows();row++)
255 for (
int col=0;col<row;col++)
257 setElem(col,row, (*
this)(row,col));
287 for (
int row=0;row<
rows();row++)
297 printf(
"%s ---------------------\n",msg);
298 for (
int i=0;i<
rows();i++)
301 for (
int j=0;j<
cols();j++)
303 printf(
"%2.1f\t",(*
this)(i,j));
306 printf(
"\n---------------------\n");
314 for (
int i=0;i<
rows();i++)
317 for (
int j=0;j<
cols();j++)
319 if ((*
this)(i,j)!=0.f)
331 for (
int i=0;i<
m_cols;i++)
332 for (
int j=0;j<
m_rows;j++)
352 for (
int j=0; j < res.cols(); ++j)
355 for (
int i=0; i < res.rows(); ++i)
364 for (
int v=0;v<
rows();v++)
369 dotProd+=w*other(v,j);
376 res.setElem(i,j,dotProd);
387 for (
int i = 0;i<numRows;i++)
390 for (
int j = 0;j<numRowsOther;j++)
408 btAssert (numRows>0 && numRowsOther>0 && B && C);
410 for (
int i = 0;i<numRows;i++)
413 for (
int j = 0;j<numRowsOther;j++)
429 void setSubMatrix(
int rowstart,
int colstart,
int rowend,
int colend,
const T value)
431 int numRows = rowend+1-rowstart;
432 int numCols = colend+1-colstart;
434 for (
int row=0;row<numRows;row++)
436 for (
int col=0;col<numCols;col++)
438 setElem(rowstart+row,colstart+col,value);
447 for (
int row=0;row<block.
rows();row++)
449 for (
int col=0;col<block.
cols();col++)
451 setElem(rowstart+row,colstart+col,block(row,col));
459 for (
int row=0;row<block.
rows();row++)
461 for (
int col=0;col<block.
cols();col++)
463 setElem(rowstart+row,colstart+col,block[row]);
472 for (
int i=0;i<
rows();i++)
473 for (
int j=0;j<
cols();j++)
492 #ifdef BT_DEBUG_OSTREAM 493 template <
typename T>
494 std::ostream& operator<< (std::ostream& os, const btMatrixX<T>& mat)
499 for (
int i=0;i<mat.rows();i++)
501 for (
int j=0;j<mat.cols();j++)
503 os << std::setw(12) << mat(i,j);
506 os << std::endl <<
" ";
513 template <
typename T>
514 std::ostream& operator<< (std::ostream& os, const btVectorX<T>& mat)
519 for (
int i=0;i<mat.rows();i++)
521 os << std::setw(12) << mat[i];
523 os << std::endl <<
" ";
531 #endif //BT_DEBUG_OSTREAM 544 #ifdef BT_USE_DOUBLE_PRECISION 545 #define btVectorXu btVectorXd 546 #define btMatrixXu btMatrixXd 548 #define btVectorXu btVectorXf 549 #define btMatrixXu btMatrixXf 550 #endif //BT_USE_DOUBLE_PRECISION 554 #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())
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)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btAlignedObjectArray< btAlignedObjectArray< int > > m_rowNonZeroElements1
btMatrixX(int rows, int cols)
btScalar btFabs(btScalar x)