00001 #ifndef IONFLUX_TOOLS_MATRIX3
00002 #define IONFLUX_TOOLS_MATRIX3
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <string>
00030 #include <iostream>
00031 #include <sstream>
00032 #include <math.h>
00033 #include "ionflux/Vector3.hpp"
00034 #include "ionflux/ManagedObject.hpp"
00035
00036 namespace Ionflux
00037 {
00038
00039 namespace Tools
00040 {
00041
00047 class Matrix3
00048 : public ManagedObject
00049 {
00050 protected:
00052 double* entry;
00053
00054 public:
00059 Matrix3();
00060
00075 Matrix3(double initX11, double initX12, double initX13, double initX21,
00076 double initX22, double initX23, double initX31, double initX32, double
00077 initX33);
00078
00085 Matrix3(const Matrix3& initMat);
00086
00095 Matrix3(const Vector3& initC1, const Vector3& initC2, const Vector3&
00096 initC3);
00097
00104 Matrix3(const double* initEntry);
00105
00110 virtual ~Matrix3();
00111
00126 virtual void setEntries(double newX11, double newX12, double newX13,
00127 double newX21, double newX22, double newX23, double newX31,
00128 double newX32, double newX33);
00129
00138 virtual void setEntries(const double* newEntry);
00139
00148 virtual void setColumns(const Vector3& newC1, const Vector3& newC2,
00149 const Vector3& newC3);
00150
00159 virtual void setRows(const Vector3& newR1, const Vector3& newR2,
00160 const Vector3& newR3);
00161
00173 virtual void setEntry(int rowIndex, int colIndex, double newEntry);
00174
00184 virtual void setColumn(int colIndex, const Vector3& newCol);
00185
00195 virtual void setRow(int rowIndex, const Vector3& newRow);
00196
00208 virtual Vector3 getColumn(int colIndex) const;
00209
00221 virtual Vector3 getRow(int rowIndex) const;
00222
00235 virtual double getEntry(int rowIndex, int colIndex) const;
00236
00245 virtual Matrix3& operator=(const Matrix3& newMat);
00246
00255 virtual Matrix3 operator+(const Matrix3& otherMat) const;
00256
00265 virtual Matrix3 operator-(const Matrix3& otherMat) const;
00266
00275 virtual Matrix3 operator*(const Matrix3& otherMat) const;
00276
00285 virtual Matrix3& operator+=(const Matrix3& otherMat);
00286
00295 virtual Matrix3& operator-=(const Matrix3& otherMat);
00296
00305 virtual Matrix3& operator*=(const Matrix3& otherMat);
00306
00315 virtual Matrix3& operator*=(double a);
00316
00325 virtual Vector3 operator*(const Vector3& argVec) const;
00326
00335 virtual Matrix3 operator*(double a) const;
00336
00348 virtual Vector3 operator[](int rowIndex) const;
00349
00358 virtual std::string toString() const;
00359
00371 virtual double getSubDet(int rowIndex, int colIndex) const;
00372
00379 virtual double getDet() const;
00380
00387 virtual Matrix3 getAdjoint() const;
00388
00395 virtual Matrix3& transpose();
00396
00403 virtual Matrix3& invert();
00404
00411 virtual Matrix3& clear();
00412
00419 virtual Matrix3& setIdentity();
00420
00429 virtual Matrix3& setRotateX(double phi);
00430
00439 virtual Matrix3& setRotateY(double phi);
00440
00449 virtual Matrix3& setRotateZ(double phi);
00450
00461 virtual Matrix3& setScale(double scaleX, double scaleY, double scaleZ);
00462
00469 virtual void setX11(double newX11);
00470
00477 virtual void setX12(double newX12);
00478
00485 virtual void setX13(double newX13);
00486
00493 virtual void setX21(double newX21);
00494
00501 virtual void setX22(double newX22);
00502
00509 virtual void setX23(double newX23);
00510
00517 virtual void setX31(double newX31);
00518
00525 virtual void setX32(double newX32);
00526
00533 virtual void setX33(double newX33);
00534
00539 virtual double getX11() const;
00540
00545 virtual double getX12() const;
00546
00551 virtual double getX13() const;
00552
00557 virtual double getX21() const;
00558
00563 virtual double getX22() const;
00564
00569 virtual double getX23() const;
00570
00575 virtual double getX31() const;
00576
00581 virtual double getX32() const;
00582
00587 virtual double getX33() const;
00588 };
00589
00598 Matrix3 operator*(double a, const Matrix3& mat);
00599
00600 }
00601
00602 }
00603
00607 #endif