22 #ifndef __LIBCRYST_VECTOR_H 
   23 #define __LIBCRYST_VECTOR_H 
   25 #include "ObjCryst/ObjCryst/General.h" 
   27 #undef __LIBCRYST_VECTOR_USE_BLITZ__ 
   30 #ifdef __LIBCRYST_VECTOR_USE_BLITZ__ 
   32 #include <blitz/array.h> 
   33 using namespace blitz;
 
   38 #define __VFN_GEOM_STRUCT_FACTOR_USE_POINTERS 
   40 #define CrystVector_REAL Array<REAL,1> 
   41 #define CrystVector_float  Array<float,1> 
   42 #define CrystVector_long   Array<long,1> 
   43 #define CrystVector_int    Array<int,1> 
   44 #define CrystVector_uint   Array<unsigned int,1> 
   45 #define CrystVector_bool   Array<bool,1> 
   47 #define CrystMatrix_REAL Array<REAL,2> 
   48 #define CrystMatrix_float  Array<float,2> 
   49 #define CrystMatrix_long   Array<long,2> 
   50 #define CrystMatrix_int    Array<int,2> 
   51 #define CrystMatrix_uint   Array<unsigned int,2> 
   52 #define CrystMatrix_bool   Array<bool,2> 
   54 #define CrystVector_T    Array<T,1> 
   55 #define CrystMatrix_T    Array<T,2> 
   56 #define CrystArray3D_T    Array<T,3> 
   58 template<
class T> T MaxDifference(
const Array<T,1> &a,
const Array<T,1> &b);
 
   60 template<
class T> T MaxDifference(
const Array<T,2> &a,
const Array<T,2> &b);
 
   62 #else  // __VFN_VECTOR_USE_BLITZ__ 
   65 #define CrystVector_REAL CrystVector<REAL> 
   66 #define CrystVector_double  CrystVector<double> 
   67 #define CrystVector_float  CrystVector<float> 
   68 #define CrystVector_long   CrystVector<long> 
   69 #define CrystVector_int    CrystVector<int> 
   70 #define CrystVector_uint   CrystVector<unsigned int> 
   71 #define CrystVector_bool   CrystVector<bool> 
   73 #define CrystMatrix_REAL CrystMatrix<REAL> 
   74 #define CrystMatrix_double CrystMatrix<double> 
   75 #define CrystMatrix_float  CrystMatrix<float> 
   76 #define CrystMatrix_long   CrystMatrix<long> 
   77 #define CrystMatrix_int    CrystMatrix<int> 
   78 #define CrystMatrix_uint   CrystMatrix<unsigned int> 
   79 #define CrystMatrix_bool   CrystMatrix<bool> 
   81 #define CrystArray3D_REAL CrystArray3D<REAL> 
   83 #define CrystVector_T    CrystVector<T> 
   84 #define CrystMatrix_T    CrystMatrix<T> 
   85 #define CrystArray3D_T    CrystMatrix<T> 
   87 #define __VFN_GEOM_STRUCT_FACTOR_USE_POINTERS 
   93 #ifdef _MSC_VER // MS VC++ predefined macros.... 
  137       if(mNumElements != old.numElements())
 
  139          mNumElements = old.numElements();
 
  141          mpData=
new T[mNumElements];
 
  145       const U *p2=old.data();
 
  146       for(
long i=0;i<mNumElements;i++) *p1++ = (T) *p2++;
 
  194    void reference(
CrystVector &old, 
const long imin=0, 
const long imax=0);
 
  196    long numElements()
const;
 
  202    unsigned long imin(
const unsigned long start=0,
const unsigned long finish=0)
const;
 
  204    unsigned long imax(
const unsigned long start=0,
const unsigned long finish=0)
const;
 
  207    const T * data() 
const;
 
  209    void resize(
const long newNbElements);
 
  211    void resizeAndPreserve(
const long newNbElements);
 
  213    void operator*=(
const T num);
 
  217    void operator/=(
const T num);
 
  221    void operator+=(
const T num);
 
  283    void operator=(
const T num);
 
  285    T operator()(
const long i) 
const;
 
  287    T& operator()(
const long i);
 
  299 template<
class T> ostream& operator<<(ostream &os, CrystVector<T> &vect);
 
  306                                      long last,
long first=0, 
int depth=0);
 
  353    long numElements()
const;
 
  362    const T * data() 
const;
 
  364    void resize(
const long ySize,
const long xSize);
 
  366    void resizeAndPreserve(
const long ySize,
const long xSize);
 
  370    void operator*=(
const T num);
 
  374    void operator/=(
const T num);
 
  376    void operator+=(
const T num);
 
  378    void operator-=(
const T num);
 
  407             mVectData(vect.data()),mValue(value),
 
  408             mNumElements(vect.numElements()),wipeOnDestruct(
true)
 
  415                for(
int i=0;i<mNumElements;i++)*mVectData++ = mValue;
 
  421             wipeOnDestruct=
false;
 
  441    T operator()(
const long i) 
const;
 
  443    T operator()(
const long row,
const long col) 
const;
 
  445    T& operator()(
const long i);
 
  447    T& operator()(
const long i,
const long j);
 
  462 template<
class T> ostream& operator<<(ostream &os, const CrystMatrix<T> &vect);
 
  497    CrystArray3D(
const long zSize,
const long ySize,
const long xSize);
 
  506    long numElements()
const;
 
  516    const T * data() 
const;
 
  518    void resize(
const long zSize,
const long ySize,
const long xSize);
 
  520    void resizeAndPreserve(
const long zSize,
const long ySize,
const long xSize);
 
  522    void operator=(
const T num);
 
  523    void operator*=(
const T num);
 
  525    void operator/=(
const T num);
 
  526    void operator+=(
const T num);
 
  527    void operator-=(
const T num);
 
  531    T operator()(
const long i) 
const;
 
  533    T operator()(
const long depth,
const long row,
const long col) 
const;
 
  535    T& operator()(
const long i);
 
  537    T& operator()(
const long depth,
const long row,
const long col);
 
  543    long mXSize,mYSize,mZSize;
 
  546 template<
class T> ostream& operator<<(ostream &os, const CrystArray3D<T> &vect);
 
  548 #endif // __LIBCRYST_VECTOR_USE_BLITZ__ 
  552 CrystMatrix_REAL InvertMatrix(
const CrystMatrix_REAL &m);
 
  553 template<
class T> 
void MatrixExchangeRows(CrystMatrix_T &m, 
const long row1, 
const long row2);
 
  556 template<
class T> T MaxAbs(
const CrystVector_T &vector);
 
  558 template<
class T> T MinAbs(
const CrystVector_T &vector);
 
  570       CubicSpline(
const CrystVector_REAL &x, 
const CrystVector_REAL &y,
 
  571                   const REAL yp1, 
const REAL ypn);
 
  573       CubicSpline(
const REAL *px, 
const REAL *py, 
const unsigned long nbPoints,
 
  574                   const REAL yp1, 
const REAL ypn);
 
  576       CubicSpline(
const CrystVector_REAL &x, 
const CrystVector_REAL &y);
 
  578       CubicSpline(
const REAL *px, 
const REAL *py, 
const unsigned long nbPoints);
 
  582       void Init(
const CrystVector_REAL &x, 
const CrystVector_REAL &y,
 
  583                 const REAL yp1, 
const REAL ypn);
 
  585       void Init(
const REAL *px, 
const REAL *py, 
const unsigned long nbPoints,
 
  586                 const REAL yp1, 
const REAL ypn);
 
  588       void Init(
const CrystVector_REAL &x, 
const CrystVector_REAL &y);
 
  590       void Init(
const REAL *px, 
const REAL *py, 
const unsigned long nbPoints);
 
  593       CrystVector_REAL operator()(
const CrystVector_REAL &x) 
const;
 
  595       CrystVector_REAL operator()(
const REAL min,
const REAL step, 
const long nbpoint) 
const;
 
  597       REAL operator()(
const REAL x) 
const;
 
  599       void InitSpline(
const REAL yp1, 
const REAL ypn);
 
  600       void InitNaturalSpline();
 
  603       CrystVector_REAL mYsecond;
 
  611 CrystVector_REAL SavitzkyGolay(
const CrystVector_REAL &v, 
const unsigned int m, 
const unsigned int deriv);
 
  613 #endif   // __LIBCRYST_VECTOR_H 
3D Vector (Blitz++ mimic) for ObjCryst++ 
Vector library (Blitz++ mimic) for ObjCryst++. 
Cubic spline interpolation. 
2D Vector library (Blitz++ mimic) for ObjCryst++