Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

matrix.h

Go to the documentation of this file.
00001 #ifndef MSL_MATRIX_H
00002 #define MSL_MATRIX_H
00003 
00004 #include "vector.h"
00005 
00006 class MSLMatrix {
00007 
00008   MSLVector** v;
00009   int  d1;
00010   int  d2;
00011 
00012   void     flip_rows(int,int);
00013   void     check_dimensions(const MSLMatrix&) const; 
00014   double&  elem(int i, int j) const { return v[i]->v[j]; }
00015   double** triang(const MSLMatrix&, int&) const;
00016   
00017 public:
00018 
00019   MSLMatrix(int n=0, int m=0);
00020   MSLMatrix(int n, int m, double* D);
00021   MSLMatrix(const MSLMatrix&);
00022   MSLMatrix(const MSLVector&);
00023   MSLMatrix& operator=(const MSLMatrix&);
00024   ~MSLMatrix();
00025 
00026   int     dim1()  const  {  return d1; }
00027   int     dim2()  const  {  return d2; }
00028   MSLVector& row(int i) const;
00029   MSLVector  col(int i) const;
00030   MSLMatrix  trans() const;
00031   MSLMatrix  inv()   const;
00032   double  det()   const;
00033   MSLMatrix solve(const MSLMatrix&) const;
00034   MSLVector solve(const MSLVector& b) const 
00035     { return MSLVector(solve(MSLMatrix(b))); }
00036   operator MSLVector() const;
00037   MSLVector& operator[](int i)    const { return row(i); }
00038   double& operator()(int i, int j);
00039   double  operator()(int,int) const;
00040   int     operator==(const MSLMatrix&)    const;
00041   int     operator!=(const MSLMatrix& x)  const { return !(*this == x); }
00042   MSLMatrix operator+(const MSLMatrix& M1) const;
00043   MSLMatrix operator-(const MSLMatrix& M1) const;
00044   MSLMatrix operator-() const;
00045   MSLMatrix& operator-=(const MSLMatrix&);
00046   MSLMatrix& operator+=(const MSLMatrix&);
00047   MSLMatrix operator*(const MSLMatrix& M1) const;
00048   MSLVector operator*(const MSLVector& vec) const 
00049     { return MSLVector(*this * MSLMatrix(vec)); }
00050   MSLMatrix operator*(double x) const;
00051   void read(istream& I);
00052   void read() { read(cin); }
00053 
00054   friend ostream& operator<<(ostream& O, const MSLMatrix& M);
00055   friend istream& operator>>(istream& I, MSLMatrix& M);
00056 };
00057 
00058 
00059 #endif
Motion Strategy Library


Web page maintained by Steve LaValle
Partial support provided by NSF CAREER Award IRI-970228 (LaValle), Honda Research, and Iowa State University.
Contributors: Anna Atramentov, Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.