Source: k2dgrflow/vectorimp.h


Annotated List
Files
Globals
Hierarchy
Index
// -*-c++-*-; Emacs major mode definition
/********************************************************************************
                R C S  --   I N F O R M A T I O N

  $Author: benny $
  $Date: 2001/06/08 09:42:25 $
 ********************************************************************************/
#ifndef _VECTORIMP_H_
#define _VECTORIMP_H_
/*********************************************************************************
 *                                                                               *
 *                                  vectorimp.h                                     *
 *                                                                               *
 * CLASSES                                                                       *
 *   Vector2D                                                                    *
 *   Vector3D                                                                    *
 *   VectornD                                                                    *
 *                                                                               * 
 * Comment:                                                                      *
 *   Classes for real vectors providing the entire functionality familiar from   *
 *   linear algebra                                                              *
 *                                                                               *
 *  changes :
          - added classes by Marian Slodica University Gent
          - changed names by Benny Malengier University Gent
 *********************************************************************************/

// *******************************************************************************
// SPECIFIC INCLUDES
// *******************************************************************************
#include "meshtype.h"

// *******************************************************************************
// GENERAL INCLUDES
// *******************************************************************************

#include <math.h>
#include <fstream.h>

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

// *******************************************************************************
// CLASS: Vector2D
// *******************************************************************************

class Vector2D
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
public:
  CoordReal x[2];   // coordinates x and y
  
// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  Vector2D();
  Vector2D(const Vector2D &c);
  Vector2D(double x0, double y0);
  Vector2D(const float *);
  Vector2D(const double *);
  Vector2D(const short *);
  Vector2D(const int *);
  Vector2D(const long *);
  operator CoordReal* ();
  operator const CoordReal* () const;
  CoordReal operator[](MeshCard i) const ;

  Vector2D &operator = (const Vector2D &p);
  Vector2D  operator  - () const;
  Vector2D  operator  + (const Vector2D &b) const;
  Vector2D  operator  - (const Vector2D &b) const;
  Vector2D  operator  * (double f) const;
//friend Vector2D operator * (double f,const Vector2D &p);
  Vector2D  operator  / (double f) const;
  Vector2D &operator *= (double f);
  Vector2D &operator /= (double f);
  Vector2D &operator -= (const Vector2D &c);
  Vector2D &operator += (const Vector2D &c);
  double   operator  * (const Vector2D &b) const;
  MeshBool operator == (const Vector2D &b) const;
  double   norm() const;
  double   normsq() const;
  
  Vector2D  min(const Vector2D &c) const;
  Vector2D  max(const Vector2D &c) const;
  Vector2D  mid(const Vector2D &c) const;
  void     normalize();
  void     negate();
//friend double angle(const Vector2D &x,const Vector2D &y);
};

// *******************************************************************************
// INLINE FUNCTIONs: class Vector2D
// *******************************************************************************

inline Vector2D::Vector2D(void) {}
inline Vector2D::Vector2D(const Vector2D &c) { x[0]=c.x[0]; x[1]=c.x[1]; }
inline Vector2D::Vector2D(double x0, double y0) { x[0] = x0; x[1] = y0; }
inline Vector2D::Vector2D(const float *c) { x[0] = c[0]; x[1] = c[1]; }
inline Vector2D::Vector2D(const double *c) { x[0] = c[0]; x[1] = c[1]; }
inline Vector2D::Vector2D(const int *c) { x[0] = c[0]; x[1] = c[1]; }
inline Vector2D::Vector2D(const short *c) { x[0] = c[0]; x[1] = c[1]; }
inline Vector2D::Vector2D(const long *c) { x[0] = c[0]; x[1] = c[1]; }
inline Vector2D::operator CoordReal* () { return x; }
inline Vector2D::operator const CoordReal* () const { return x; }
inline CoordReal Vector2D::operator[](MeshCard i) const { return x[i]; }
inline Vector2D &Vector2D::operator = (const Vector2D &p)
{ x[0]=p.x[0]; x[1]=p.x[1]; return *this; }
inline Vector2D  Vector2D::operator - () const { return Vector2D(-x[0], -x[1]); }
inline Vector2D  Vector2D::operator + (const Vector2D &b) const
{ return Vector2D(x[0]+b.x[0],x[1]+b.x[1]); }
inline Vector2D  Vector2D::operator - (const Vector2D &b) const
{ return Vector2D(x[0]-b.x[0],x[1]-b.x[1]); }
inline Vector2D  Vector2D::operator * (double f) const
{ return Vector2D(x[0]*f,x[1]*f); }
inline Vector2D  Vector2D::operator / (double f) const
{ return Vector2D(x[0]/f,x[1]/f); }
inline Vector2D &Vector2D::operator *= (double f)
{ x[0]*=f; x[1]*=f; return *this; }
inline Vector2D &Vector2D::operator /= (double f)
{ x[0]/=f; x[1]/=f; return *this; }
inline Vector2D &Vector2D::operator -= (const Vector2D &c)
{ x[0] -= c.x[0]; x[1] -= c.x[1]; return *this; }
inline Vector2D &Vector2D::operator += (const Vector2D &c)
{ x[0] += c.x[0]; x[1] += c.x[1]; return *this; }
inline double   Vector2D::operator * (const Vector2D &b) const
{ return x[0]*b.x[0]+x[1]*b.x[1]; }
inline MeshBool Vector2D::operator == (const Vector2D &b) const
{ return x[0]==b.x[0] && x[1]==b.x[1]; }
inline Vector2D  Vector2D::min(const Vector2D &c) const
{ return Vector2D(x[0]<c.x[0]?x[0]:c.x[0], x[1]<c.x[1]?x[1]:c.x[1]); }
inline Vector2D  Vector2D::max(const Vector2D &c) const
{ return Vector2D(x[0]>c.x[0]?x[0]:c.x[0], x[1]>c.x[1]?x[1]:c.x[1]); }
inline Vector2D  Vector2D::mid(const Vector2D &c) const
{ return Vector2D((x[0]+c.x[0])/2, (x[1]+c.x[1])/2); }
inline void     Vector2D::negate() { x[0] = -x[0]; x[1] = -x[1]; }
inline double Vector2D::norm() const { return sqrt(x[0]*x[0]+x[1]*x[1]); }
inline double Vector2D::normsq() const { return x[0]*x[0]+x[1]*x[1]; }

// Friend function

inline Vector2D operator * (double f,const Vector2D &p)
{ return Vector2D(f*p.x[0],f*p.x[1]); } 
inline double angle(const Vector2D &A,const Vector2D &B)
{ return acos((A.x[0]*B.x[0]+A.x[1]*B.x[1])/
	      sqrt(A.x[0]*A.x[0]+A.x[1]*A.x[1])*sqrt(B.x[0]*B.x[0]+B.x[1]*B.x[1])); }

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

// *******************************************************************************
// CLASS: Vector3D
// *******************************************************************************

class Vector3D
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
public:
  CoordReal x[3];   // cordinates x, y and z
  
// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  Vector3D();
  Vector3D(const Vector3D &c);
  Vector3D(double x0, double y0, double z0);
  Vector3D(const float *);
  Vector3D(const double *);
  Vector3D(const short *);
  Vector3D(const int *);
  Vector3D(const long *);
  operator CoordReal* ();
  operator const CoordReal* () const;
  CoordReal operator[](MeshCard i) const ;
  CoordReal &operator[](MeshCard i) ;

  Vector3D &operator = (const Vector3D &p);
  Vector3D  operator  - () const;
  Vector3D  operator  + (const Vector3D &b) const;
  Vector3D  operator  - (const Vector3D &b) const;
  Vector3D  operator  ^ (const Vector3D &b) const; // Kreuz-Produkt
  Vector3D  operator  * (double f) const;
//friend Vector3D operator * (double f,const Vector3D &p);
  Vector3D  operator  / (double f) const;
  Vector3D &operator *= (double f);
  Vector3D &operator /= (double f);
  Vector3D &operator -= (const Vector3D &c);
  Vector3D &operator += (const Vector3D &c);
  double   operator  * (const Vector3D &b) const; // Skalarprodukt
  MeshBool operator == (const Vector3D &b) const;
  double   norm() const;
  double   normsq() const;
  
  Vector3D  min(const Vector3D &c) const;
  Vector3D  max(const Vector3D &c) const;
  Vector3D  mid(const Vector3D &c) const;
  void     normalize();
  void     negate();
//friend double angle(const Vector3D &x,const Vector3D &y);
};

// *******************************************************************************
// INLINE FUNCTIONs: class Vector3D
// *******************************************************************************

inline Vector3D::Vector3D(void) {}
inline Vector3D::Vector3D(const Vector3D &c)
{x[0]=c.x[0]; x[1]=c.x[1]; x[2]=c.x[2]; }
inline Vector3D::Vector3D(double x0, double y0, double z0) 
{x[0]=x0; x[1]=y0; x[2]=z0; }
inline Vector3D::Vector3D(const double *c)
{ x[0]=c[0]; x[1]=c[1]; x[2]=c[2]; }
inline Vector3D::Vector3D(const float *c)
{ x[0]=c[0]; x[1]=c[1]; x[2]=c[2]; }
inline Vector3D::Vector3D(const int *c)
{ x[0]=c[0]; x[1]=c[1]; x[2]=c[2]; }
inline Vector3D::Vector3D(const long *c)
{ x[0]=c[0]; x[1]=c[1]; x[2]=c[2]; }
inline Vector3D::Vector3D(const short *c)
{ x[0]=c[0]; x[1]=c[1]; x[2]=c[2]; }
inline Vector3D::operator CoordReal* () { return x; }
inline Vector3D::operator const CoordReal* () const { return x; }
inline CoordReal Vector3D::operator[](MeshCard i) const { return x[i]; }
inline CoordReal &Vector3D::operator[](MeshCard i)  { return x[i]; }
inline Vector3D &Vector3D::operator = (const Vector3D &p)
{ x[0]=p.x[0]; x[1]=p.x[1]; x[2]=p.x[2]; return *this; }
inline Vector3D  Vector3D::operator - () const { return Vector3D(-x[0], -x[1], -x[2]);}
inline Vector3D  Vector3D::operator + (const Vector3D &b) const
{ return Vector3D(x[0]+b.x[0],x[1]+b.x[1],x[2]+b.x[2]); }
inline Vector3D  Vector3D::operator - (const Vector3D &b) const
{ return Vector3D(x[0]-b.x[0],x[1]-b.x[1],x[2]-b.x[2]); }
inline Vector3D  Vector3D::operator * (double f) const
{ return Vector3D(x[0]*f,x[1]*f,x[2]*f); }
inline Vector3D  Vector3D::operator / (double f) const
{ return Vector3D(x[0]/f,x[1]/f,x[2]/f); }
inline Vector3D &Vector3D::operator *= (double f)
{ x[0]*=f; x[1]*=f; x[2]*=f; return *this; }
inline Vector3D &Vector3D::operator /= (double f)
{ x[0]/=f; x[1]/=f; x[2]/=f; return *this; }
inline Vector3D &Vector3D::operator -= (const Vector3D &c)
{ x[0]-=c.x[0]; x[1]-=c.x[1]; x[2]-=c.x[2]; return *this; }
inline Vector3D &Vector3D::operator += (const Vector3D &c)
{ x[0]+=c.x[0]; x[1]+=c.x[1]; x[2]+=c.x[2]; return *this; }
inline double   Vector3D::operator * (const Vector3D &b) const
{ return x[0]*b.x[0]+x[1]*b.x[1]+x[2]*b.x[2]; }
inline MeshBool Vector3D::operator == (const Vector3D &b) const
{ return x[0]==b.x[0] && x[1]==b.x[1] && x[2]==b.x[2]; }
inline Vector3D  Vector3D::min(const Vector3D &c) const
{ return Vector3D(x[0]<c.x[0]?x[0]:c.x[0], x[1]<c.x[1]?x[1]:c.x[1], x[2]<c.x[2]?x[2]:c.x[2]); }
inline Vector3D  Vector3D::max(const Vector3D &c) const
{ return Vector3D(x[0]>c.x[0]?x[0]:c.x[0], x[1]>c.x[1]?x[1]:c.x[1], x[2]>c.x[2]?x[2]:c.x[2]); }
inline Vector3D  Vector3D::mid(const Vector3D &c) const
{ return Vector3D((x[0]+c.x[0])/2, (x[1]+c.x[1])/2, (x[2]+c.x[2])/2); }
inline void     Vector3D::negate() { x[0] = -x[0]; x[1] = -x[1]; x[2] = -x[2]; }
inline double Vector3D::norm() const 
{ return sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]); }
inline double Vector3D::normsq() const 
{ return (x[0]*x[0]+x[1]*x[1]+x[2]*x[2]); }

// Friend function

inline Vector3D operator * (double f,const Vector3D &p)
{ return Vector3D(f*p.x[0],f*p.x[1],f*p.x[2]); } 
inline double angle(const Vector3D &A,const Vector3D &B)
{ return acos((A.x[0]*B.x[0]+A.x[1]*B.x[1]+A.x[2]*B.x[2])/
	      sqrt(A.x[0]*A.x[0]+A.x[1]*A.x[1]+A.x[2]*A.x[2])*
	      sqrt(B.x[0]*B.x[0]+B.x[1]*B.x[1]+B.x[2]*B.x[2])); }

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

// *******************************************************************************
// CLASS:  VectornD
// *******************************************************************************

class VectornD
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
private:
  unsigned int      n;
  double *v;
  
// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  VectornD(MeshCard,double initval=0.0);
  VectornD(const VectornD &);
  VectornD(const double *,unsigned int);
  VectornD(const float *,unsigned int);
  ~VectornD(void);
  
  int dim() const;
  
  VectornD &operator =  (const VectornD &x);
  MeshBool operator == (const VectornD &x) const;
  MeshBool operator != (const VectornD &x) const;
  operator MeshBool (); 
  
  double &operator [] (int i);
  double  operator [] (int i) const;
  operator double* ();
  operator double* () const;
  
  VectornD operator  +  (const VectornD &v) const;
  VectornD operator  -  (const VectornD &v) const;
  VectornD operator  *  (double alpha) const;
  VectornD operator  /  (double alpha) const;
  
  VectornD &operator += (const VectornD &x);
  VectornD &operator -= (const VectornD &x);
  VectornD &operator *= (double alpha);
  VectornD &operator /= (double alpha);
  double operator * (const VectornD &x) const;
  
  VectornD &xpgay(double alpha, const VectornD &x);
  VectornD &xmgay(double alpha, const VectornD &x);
  VectornD &gaxpy(double alpha,const VectornD &y);
  VectornD &neg(void);
  
  double norm(void) const;
  double normsq(void) const;
  
friend VectornD operator  *  (double alpha,const VectornD &x);
friend double angle(const VectornD &v1,const VectornD &v2);
friend ostream &operator << (ostream &o, const VectornD &x);
friend istream &operator >> (istream &i, VectornD &x);
};

// *******************************************************************************
// INLINE FUNCTIONS: class VectornD
// *******************************************************************************

// Type conversion into an array of real numbers
inline VectornD::operator double* () { return v; }
inline VectornD::operator double* () const { return v; }
inline int VectornD::dim(void) const { return n; }

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

// *******************************************************************************
// CLASS: FullMatrix
// a rectangular matrix over the real field
// *******************************************************************************

class FullMatrix
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
protected:
  MeshCard i,j;
  long size;
  double* a ;

// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  FullMatrix(MeshCard i,MeshCard j,const double initval = 0.0);
  FullMatrix(MeshCard i,MeshCard j,const VectornD *columns);
  FullMatrix(const FullMatrix &m);
  virtual ~FullMatrix(void);

  FullMatrix &operator =  (const FullMatrix &x);
  MeshBool operator == (const FullMatrix &x) const;
  MeshBool operator != (const FullMatrix &x) const;
  operator MeshBool (); 

  MeshCard lines(void) const;
  MeshCard cols(void) const;

  FullMatrix operator  ~  (void) const;
  FullMatrix operator  +  (const FullMatrix &v) const;
  FullMatrix operator  -  (const FullMatrix &v) const;
  FullMatrix operator  *  (const FullMatrix &v) const;
  FullMatrix operator  *  (double alpha) const;
  FullMatrix operator  /  (double alpha) const;
  FullMatrix  &operator *= (double alpha);
  FullMatrix  &operator /= (double alpha);
  FullMatrix  &operator += (const FullMatrix &);
  FullMatrix  &operator -= (const FullMatrix &);
  VectornD operator * (const VectornD &) const;
 
  double operator()(MeshCard, MeshCard) const;
  double &operator()(MeshCard, MeshCard);
  double *operator[](MeshCard i);

  FullMatrix submat(MeshCard i,MeshCard j,MeshCard di,MeshCard dj);

  // Line operations
  void lxpgaly(double alpha,MeshCard ln_x,MeshCard ln_y);
  void rotl(double c,double s,MeshCard ln_x,MeshCard ln_y); 
  void multl(double alpha,MeshCard ln);
  void swapl(MeshCard ln_1,MeshCard ln_2);
  void cxpgacy(double alpha,MeshCard cl_x,MeshCard cl_y);
  void rotc(double c,double s,MeshCard cl_x,MeshCard cl_y); 
  void multc(double alpha,MeshCard col);
  void swapc(MeshCard cl_1,MeshCard cl_2);

// <<<<<<<<<<<< FRIEND FUNCTIONS >>>>>>>>>>>>
friend FullMatrix operator  *  (double alpha,const FullMatrix &);
friend ostream &operator << (ostream &o, const FullMatrix &x);
friend istream &operator >> (istream &i, FullMatrix &x);

// <<<<<<<<<<<<  STATIC DATA   >>>>>>>>>>>>
  static double output_precision;
};

// *******************************************************************************
// INLINE FUNCTIONS: Class FullMatrix
// *******************************************************************************

inline MeshCard FullMatrix::lines(void) const { return i; }
inline MeshCard FullMatrix::cols(void) const { return j; }

#ifndef CHECK
inline double FullMatrix::operator()(MeshCard pi, MeshCard pj) const
{
  return a[pj*i+pi];
}
inline double &FullMatrix::operator()(MeshCard pi, MeshCard pj)
{
  return a[pj*i+pi];
}
inline double *FullMatrix::operator[](MeshCard pj)
{
  return (a+pj*i);
}
#endif

// *******************************************************************************
// CLASS: Matrix22
// a rectangular 2*2-matrix over the real field
// *******************************************************************************
 
class Matrix22
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
private:
  double* a ;
 
// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  Matrix22(double initval = 0.0);
  Matrix22(const Vector2D *columns);
  Matrix22(const Matrix22 &);
  virtual ~Matrix22(void);
 
  Matrix22 &operator =  (const Matrix22 &x);
  MeshBool operator == (const Matrix22 &x) const;
  MeshBool operator != (const Matrix22 &x) const;
  operator MeshBool ();

  Matrix22 operator  ~  (void) const;
  Matrix22 operator  +  (const Matrix22 &v) const;
  Matrix22 operator  -  (const Matrix22 &v) const;
  Matrix22 operator  *  (const Matrix22 &v) const;
  Matrix22 operator  *  (double alpha) const;
  Matrix22 operator  /  (double alpha) const;
  Matrix22  &operator *= (double alpha);
  Matrix22  &operator /= (double alpha);
  Matrix22  &operator += (const Matrix22 &);
  Matrix22  &operator -= (const Matrix22 &);
  double determinant(void);            //determinant
  void repcol(MeshCard, Vector2D);     //replace "i"th column by Vector2D

  double operator()(MeshCard, MeshCard) const;
  double &operator()(MeshCard, MeshCard);
  double *operator[](MeshCard i);

// <<<<<<<<<<<< FRIEND FUNCTIONS >>>>>>>>>>>>
friend Matrix22 operator  *  (double alpha,const Matrix22 &);
friend ostream &operator << (ostream &o, const Matrix22 &x);
friend istream &operator >> (istream &i, Matrix22 &x);
friend Vector2D operator * (const Matrix22 &, const Vector2D &) ; // Matrix22 * Vector2D

 
// <<<<<<<<<<<<  STATIC DATA   >>>>>>>>>>>>
  static double output_precision;
};
 
// *******************************************************************************
// INLINE FUNCTIONS: Class Matrix22
// *******************************************************************************
 
#ifndef CHECK
inline double Matrix22::operator()(MeshCard pi, MeshCard pj) const
{
  return a[pj*2+pi];
}
inline double &Matrix22::operator()(MeshCard pi, MeshCard pj)
{
  return a[pj*2+pi];
}
inline double *Matrix22::operator[](MeshCard pj)
{
  return (a+pj*2);
}
#endif


//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// *******************************************************************************
// CLASS: Matrix33
// a rectangular 3*3-matrix over the real field
// *******************************************************************************
 
class Matrix33
{
// <<<<<<<<<<<< DATA  >>>>>>>>>>>>
private:
  double* a ;
 
// <<<<<<<<<<<< METHODS >>>>>>>>>>>>
public:
  Matrix33(double initval = 0.0) ;
  Matrix33(const Vector3D *columns);
  Matrix33(const Matrix33 &);
  virtual ~Matrix33(void);
 
  Matrix33 &operator =  (const Matrix33 &x);
  MeshBool operator == (const Matrix33 &x) const;
  MeshBool operator != (const Matrix33 &x) const;
  operator MeshBool ();

  Matrix33 operator  ~  (void) const;
  Matrix33 operator  +  (const Matrix33 &v) const;
  Matrix33 operator  -  (const Matrix33 &v) const;
  Matrix33 operator  *  (const Matrix33 &v) const;
  Matrix33 operator  *  (double alpha) const;
  Matrix33 operator  /  (double alpha) const;
  Matrix33  &operator *= (double alpha);
  Matrix33  &operator /= (double alpha);
  Matrix33  &operator += (const Matrix33 &);
  Matrix33  &operator -= (const Matrix33 &);
  double determinant(void);            //determinant
  void repcol(MeshCard, Vector3D);     //replace "i"th column by Vector3D

  double operator()(MeshCard, MeshCard) const;
  double &operator()(MeshCard, MeshCard);
  double *operator[](MeshCard i);

// <<<<<<<<<<<< FRIEND FUNCTIONS >>>>>>>>>>>>
friend Matrix33 operator  *  (double alpha,const Matrix33 &);
friend ostream &operator << (ostream &o, const Matrix33 &x);
friend istream &operator >> (istream &i, Matrix33 &x);
friend Vector3D operator * (Matrix33 &, Vector3D &) ; // Matrix33 * Vector3D

 
// <<<<<<<<<<<<  STATIC DATA   >>>>>>>>>>>>
  static double output_precision;
};
 
// *******************************************************************************
// INLINE FUNCTIONS: Class Matrix33
// *******************************************************************************
 
#ifndef CHECK
inline double Matrix33::operator()(MeshCard pi, MeshCard pj) const
{
  return a[pj*3+pi];
}
inline double &Matrix33::operator()(MeshCard pi, MeshCard pj)
{
  return a[pj*3+pi];
}
inline double *Matrix33::operator[](MeshCard pj)
{
  return (a+pj*3);
}
#endif


//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

// *******************************************************************************
// GLOBAL FUNCTIONS
// *******************************************************************************

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  GLOBAL FUNCTION: SolveLin
  1st arg: (FullMat &) regular N x (N+1) matrix whose last column contains the 
                      right hand side
  The global function solves square systems of linear equations by applying 
  Gaussian elimination with a simple pivot strategy. FALSE is returned if the
  systems turns  out to be singular
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
MeshBool SolveLin(FullMatrix &mat,double _eps = 1.0E-7);

 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  GLOBAL FUNCTION: Givens 
  1st arg: (const double/float *) vector with two components to be rotated.
  2nd arg: (double/float *) buffer for returning the crucial sin and cos entries of the
           rotation matrix
  this routine performs the Givens rotation wrenching the original vector into
  a direction parallel to the x-Axis. FALSE is returned if vec == 0
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
MeshBool Givens(const double *vec,double *rot,double accuracy = 1.0E-7);
MeshBool Givens(const float *vec,double *rot,double accuracy = 1.0E-7);
MeshBool Givens(const double *vec,float *rot,double accuracy = 1.0E-7);
MeshBool Givens(const float *vec,float *rot,double accuracy = 1.0E-7);

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  GLOBAL FUNCTION: partElim / partElimQR
  1st arg: (FullMatrix &) matrix on which elimination should be performed
  2nd arg: (MeshCard) terminating column for elimination
  3rd arg: (MeshCard) starting column for elimination
  This method eliminates all below diagonal entries of the specified columns
  by means of Gaussian elimination without pivot search/Givens rotation.
  FALSE is returned if a vanisching pivot is encountered or the matrix turns
  out to be (nearly) singular.
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
MeshBool partElim(FullMatrix &mat,MeshCard right,MeshCard left = 0,
		  double accuracy = 1.0E-7);
MeshBool partElimQR(FullMatrix &mat,MeshCard right,MeshCard left = 0,
		    double accuracy = 1.0E-7);


#endif

// end of file

Generated by: benny@okidoki on Thu Jun 21 10:41:51 2001, using kdoc 2.0a53.