base/softAbsMetric.h
00001 #ifndef _BETA_SOFTABSMETRIC_
00002 
00003 #include <Eigen/Dense>
00004 
00005 #include "dynamMetric.h"
00006 
00012 
00013 class softAbsMetric: public dynamMetric
00014 {
00015     
00016     public:
00017         
00018         explicit softAbsMetric(int dim);
00019         virtual ~softAbsMetric() {};
00020         
00022         //                   Accessors                  //
00024         
00025         double T();
00026         double tau();
00027     
00029         MatrixXd Lambda() 
00030         { 
00031             return mEigenDeco.eigenvectors() * mSoftAbsLambdaInv.asDiagonal() * mEigenDeco.eigenvectors().transpose(); 
00032         }
00033         
00034         void bounceP(const VectorXd& normal);
00035         
00037         SelfAdjointEigenSolver<MatrixXd>& eigenDeco() { return mEigenDeco; }
00038         
00040         VectorXd& lambdaDotP() { return dTaudp(); }
00041     
00043         //                   Mutators                   //
00045         
00046         void sampleP(Random& random);
00047         
00049         void setSoftAbsAlpha(double alpha) { mSoftAbsAlpha = alpha; }
00050     
00052         //              Auxiliary Functions             //
00054         
00055         void checkEvolution(const double epsilon = 1e-6);
00056         
00057         void displayState();
00058         
00059     protected:
00060         
00061         double mSoftAbsAlpha;   
00062     
00063         MatrixXd mH;            
00064         MatrixXd mGradH;        
00065         
00066         MatrixXd mPseudoJ;      
00067     
00068         MatrixXd mAuxMatrixOne; 
00069         MatrixXd mAuxMatrixTwo; 
00070         MatrixXd mCacheMatrix;  
00071     
00072         SelfAdjointEigenSolver<MatrixXd> mEigenDeco;  
00073 
00074         VectorXd mSoftAbsLambda;    
00075         VectorXd mSoftAbsLambdaInv; 
00076         VectorXd mQp;               
00077         VectorXd mLambdaQp;         
00078 
00080         virtual void fComputeH() = 0;
00081         
00083         virtual void fComputeGradH(int i) = 0;
00084         
00085         void fComputeMetric();
00086         void fPrepareSpatialGradients();
00087         void fUpdateP();
00088     
00089         VectorXd& dTaudp();
00090         VectorXd& dTaudq();
00091         VectorXd& dPhidq();
00092     
00093 };
00094 
00095 #define _BETA_SOFTABSMETRIC_
00096 #endif
 All Classes Functions Variables