-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGMatrix.h
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
??/??/?? TP Created
03/16/2000 JSB Added exception throwing
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGMATRIX_H
#define FGMATRIX_H
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <stdlib.h>
#ifdef FGFS
+# include <math.h>
# include <simgear/compiler.h>
-# ifdef FG_HAVE_STD_INCLUDES
-# include <fstream>
-# include <cmath>
-# include <iostream>
-# else
-# include <fstream.h>
-# include <math.h>
-# include <iostream.h>
-# endif
+# include STL_STRING
+# include STL_FSTREAM
+# include STL_IOSTREAM
+ SG_USING_STD(string);
+ SG_USING_STD(ostream);
+ SG_USING_STD(istream);
+ SG_USING_STD(cerr);
+ SG_USING_STD(cout);
+ SG_USING_STD(endl);
#else
# include <fstream>
# include <cmath>
# include <iostream>
+# include <string>
+ using std::string;
+ using std::ostream;
+ using std::istream;
+ using std::cerr;
+ using std::cout;
+ using std::endl;
#endif
-#include <string>
-#define ID_MATRIX "$Header"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-/*******************************************************************************
+#define ID_MATRIX "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector;
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: MatrixException
-*******************************************************************************/
-
-using std::string;
-using std::ostream;
-using std::istream;
-using std::cerr;
-using std::endl;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class MatrixException /* : public exception */
+class MatrixException /* : public exception */
{
public:
string Message;
};
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGMatrix
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGMatrix
{
-protected:
- double **data;
-
-private:
- unsigned int rows,cols;
- char delim;
- int width,prec,origin;
- void TransposeSquare(void);
- void TransposeNonSquare(void);
- unsigned int rowCtr, colCtr;
-
public:
FGMatrix(unsigned int r, unsigned int c);
FGMatrix(const FGMatrix& A);
+ FGMatrix(void) {};
~FGMatrix(void);
FGMatrix& operator=(const FGMatrix& A);
friend FGMatrix operator*(double scalar,FGMatrix& A);
void SetOParams(char delim,int width,int prec, int origin=0);
+
+protected:
+ double **data;
+ unsigned int rows,cols;
+
+private:
+ char delim;
+ int width,prec,origin;
+ void TransposeSquare(void);
+ void TransposeNonSquare(void);
+ unsigned int rowCtr, colCtr;
+ void Debug(void);
};
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGColumnVector
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector : public FGMatrix
{
FGColumnVector(void);
FGColumnVector(int m);
FGColumnVector(const FGColumnVector& b);
- ~FGColumnVector();
+ ~FGColumnVector(void);
FGColumnVector operator*(const double scalar);
FGColumnVector operator*(const FGColumnVector& V); // Cross product operator
FGColumnVector operator/(const double scalar);
- FGColumnVector operator+(const FGColumnVector& B);
+ FGColumnVector operator+(const FGColumnVector& B); // must not return reference
FGColumnVector operator-(const FGColumnVector& B);
float Magnitude(void);
FGColumnVector Normalize(void);
friend FGColumnVector operator*(const FGMatrix& M, const FGColumnVector& V);
double& operator()(int m) const;
-
+
FGColumnVector multElementWise(const FGColumnVector& V);
+
+private:
+ void Debug(void);
};
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif