]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGMatrix.cpp
FG_HAVE_STD_INCLUDES -> SG_HAVE_STD_INCLUDES
[flightgear.git] / src / FDM / JSBSim / FGMatrix.cpp
index 5b4f5da10ba5937b5f0495d92a53517c19144544..5660020fdb2ca6414acdcad581395b7fbb23c06b 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 Module: FGMatrix.cpp
 Author: Originally by Tony Peden [formatted here (and broken??) by JSB]
@@ -14,15 +14,18 @@ HISTORY
 ??/??/??   TP   Created
 03/16/2000 JSB  Added exception throwing
 
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGMatrix.h"
 
-/*******************************************************************************
-************************************ CODE **************************************
-*******************************************************************************/
+static const char *IdSrc = "$Header$";
+static const char *IdHdr = ID_MATRIX;
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS IMPLEMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 double** FGalloc(int rows, int cols)
 {
@@ -38,7 +41,7 @@ double** FGalloc(int rows, int cols)
   return A;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void dealloc(double **A, int rows)
 {
@@ -46,7 +49,7 @@ void dealloc(double **A, int rows)
   delete[] A;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix::FGMatrix(const unsigned int r, const unsigned int c) : rows(r), cols(c)
 {
@@ -55,7 +58,7 @@ FGMatrix::FGMatrix(const unsigned int r, const unsigned int c) : rows(r), cols(c
   rowCtr = colCtr = 1;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix::FGMatrix(const FGMatrix& M)
 {
@@ -64,7 +67,7 @@ FGMatrix::FGMatrix(const FGMatrix& M)
   *this = M;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix::~FGMatrix(void)
 {
@@ -73,7 +76,7 @@ FGMatrix::~FGMatrix(void)
   rows = cols = 0;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 ostream& operator<<(ostream& os, const FGMatrix& M)
 {
@@ -88,7 +91,7 @@ ostream& operator<<(ostream& os, const FGMatrix& M)
   return os;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix& FGMatrix::operator<<(const float ff)
 {
@@ -101,7 +104,7 @@ FGMatrix& FGMatrix::operator<<(const float ff)
   return *this;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 istream& operator>>(istream& is, FGMatrix& M)
 {
@@ -113,7 +116,7 @@ istream& operator>>(istream& is, FGMatrix& M)
   return is;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix& FGMatrix::operator=(const FGMatrix& M)
 {
@@ -137,21 +140,21 @@ FGMatrix& FGMatrix::operator=(const FGMatrix& M)
   return *this;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 unsigned int FGMatrix::Rows(void) const
 {
   return rows;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 unsigned int FGMatrix::Cols(void) const
 {
   return cols;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::SetOParams(char delim,int width,int prec,int origin)
 {
@@ -161,7 +164,7 @@ void FGMatrix::SetOParams(char delim,int width,int prec,int origin)
   FGMatrix::origin = origin;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::InitMatrix(double value)
 {
@@ -174,7 +177,7 @@ void FGMatrix::InitMatrix(double value)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::InitMatrix(void)
 {
@@ -203,7 +206,7 @@ FGMatrix FGMatrix::operator-(const FGMatrix& M)
   return Diff;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::operator-=(const FGMatrix &M)
 {
@@ -220,7 +223,7 @@ void FGMatrix::operator-=(const FGMatrix &M)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix FGMatrix::operator+(const FGMatrix& M)
 {
@@ -240,7 +243,7 @@ FGMatrix FGMatrix::operator+(const FGMatrix& M)
   return Sum;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::operator+=(const FGMatrix &M)
 {
@@ -257,7 +260,7 @@ void FGMatrix::operator+=(const FGMatrix &M)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix operator*(double scalar, FGMatrix &M)
 {
@@ -271,7 +274,7 @@ FGMatrix operator*(double scalar, FGMatrix &M)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::operator*=(const double scalar)
 {
@@ -282,7 +285,7 @@ void FGMatrix::operator*=(const double scalar)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix FGMatrix::operator*(const FGMatrix& M)
 {
@@ -305,7 +308,7 @@ FGMatrix FGMatrix::operator*(const FGMatrix& M)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::operator*=(const FGMatrix& M)
 {
@@ -331,7 +334,7 @@ void FGMatrix::operator*=(const FGMatrix& M)
   cols = M.cols;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGMatrix FGMatrix::operator/(const double scalar)
 {
@@ -349,7 +352,7 @@ FGMatrix FGMatrix::operator/(const double scalar)
   return Quot;  
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::operator/=(const double scalar)
 {
@@ -364,7 +367,7 @@ void FGMatrix::operator/=(const double scalar)
     cerr << "Attempt to divide by zero in method FGMatrix::operator/=(const double scalar), object " << this << endl; 
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::T(void)
 {
@@ -374,7 +377,7 @@ void FGMatrix::T(void)
     TransposeNonSquare();
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGMatrix::operator*(const FGColumnVector& Col)
 {
@@ -395,7 +398,7 @@ FGColumnVector FGMatrix::operator*(const FGColumnVector& Col)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::TransposeSquare(void)
 {
@@ -408,7 +411,7 @@ void FGMatrix::TransposeSquare(void)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGMatrix::TransposeNonSquare(void)
 {
@@ -430,21 +433,21 @@ void FGMatrix::TransposeNonSquare(void)
   cols       = m;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector::FGColumnVector(void):FGMatrix(3,1) { }
 FGColumnVector::FGColumnVector(int m):FGMatrix(m,1) { }
 FGColumnVector::FGColumnVector(const FGColumnVector& b):FGMatrix(b) { }
 FGColumnVector::~FGColumnVector() { }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 double& FGColumnVector::operator()(int m) const
 {
   return FGMatrix::operator()(m,1);
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector operator*(const FGMatrix& Mat, const FGColumnVector& Col)
 {
@@ -466,7 +469,7 @@ FGColumnVector operator*(const FGMatrix& Mat, const FGColumnVector& Col)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::operator+(const FGColumnVector& C)
 {
@@ -485,7 +488,7 @@ FGColumnVector FGColumnVector::operator+(const FGColumnVector& C)
   return Sum;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::operator*(const double scalar)
 {
@@ -496,7 +499,7 @@ FGColumnVector FGColumnVector::operator*(const double scalar)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::operator-(const FGColumnVector& V)
 {
@@ -515,7 +518,7 @@ FGColumnVector FGColumnVector::operator-(const FGColumnVector& V)
   return Diff;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::operator/(const double scalar)
 {
@@ -532,7 +535,7 @@ FGColumnVector FGColumnVector::operator/(const double scalar)
     
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector operator*(const double scalar, const FGColumnVector& C)
 {
@@ -545,7 +548,7 @@ FGColumnVector operator*(const double scalar, const FGColumnVector& C)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 float FGColumnVector::Magnitude(void)
 {
@@ -562,7 +565,7 @@ float FGColumnVector::Magnitude(void)
   }
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::Normalize(void)
 {
@@ -577,7 +580,7 @@ FGColumnVector FGColumnVector::Normalize(void)
   return *this;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::operator*(const FGColumnVector& V)
 {
@@ -596,7 +599,7 @@ FGColumnVector FGColumnVector::operator*(const FGColumnVector& V)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGColumnVector FGColumnVector::multElementWise(const FGColumnVector& V)
 {
@@ -615,4 +618,4 @@ FGColumnVector FGColumnVector::multElementWise(const FGColumnVector& V)
   return Product;
 }
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%