/* *_________________________________________________________________________* * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * * DESCRIPTION: SEE READ-ME * * FILE NAME: matrixfun.cpp * * AUTHORS: See Author List * * GRANTS: See Grants List * * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * * LICENSE: Please see License Agreement * * DOWNLOAD: Free at www.rpi.edu/~anderk5 * * ADMINISTRATOR: Prof. Kurt Anderson * * Computational Dynamics Lab * * Rensselaer Polytechnic Institute * * 110 8th St. Troy NY 12180 * * CONTACT: anderk5@rpi.edu * *_________________________________________________________________________*/ #include "matrixfun.h" #include #include "fastmatrixops.h" #include using namespace std; // // Create a new matrix // VirtualMatrix* NewMatrix(int type){ switch( MatrixType(type) ) { case MATRIX : return new Matrix; case COLMATRIX : return new ColMatrix; case ROWMATRIX : return new RowMatrix; case MAT3X3 : return new Mat3x3; case MAT4X4 : return new Mat4x4; case VECT3 : return new Vect3; case VECT4 : return new Vect4; default : return 0; // error! } } // // Transpose // Matrix T(const VirtualMatrix& A){ int numrows = A.GetNumRows(); int numcols = A.GetNumCols(); Matrix C(numcols,numrows); for(int i=0;i