amroc/hds/VectorLarge.h File Reference

Generic vector implementation. More...

#include "generic.h"
#include <iostream>
#include <cassert>
#include <cstring>
#include <cmath>

Go to the source code of this file.

Classes

class  Vector< DataType, size >
 Generic vector implementation. More...

Defines

#define Vector_Vector_Operator(ope, op)
#define Vector_Scalar_Operator(ope, op)
#define Vector_Vector_RelOperator(op)
#define Vector_Vector_RelOperator(op)
#define Vector_Scalar_RelOperator(op)
#define Vector_Scalar_RelOperator(op)
#define Global_Vector_Scalar_Operator(op)
#define Global_Vector_Function(fct)
#define Vector_Vector_Functions(NameTo, NameFrom, ope)

Functions

template<class DataType , int size>
std::ostream & operator<< (std::ostream &os, const Vector< DataType, size > &v)
template<class DataType , int size>
Vector< DataType, size > operator+ (const DataType &v, const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > operator- (const DataType &v, const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > operator* (const DataType &v, const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > operator/ (const DataType &v, const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > fabs (const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > sqrt (const Vector< DataType, size > &x)
template<class DataType , int size>
Vector< DataType, size > Min (const Vector< DataType, size > &x, const Vector< DataType, size > &y)
template<class DataType , int size>
Vector< DataType, size > Max (const Vector< DataType, size > &x, const Vector< DataType, size > &y)
template<class DataType , int size>
double Abs (const Vector< DataType, size > &x)
template<class DataType , int size>
DataType mincomp (const Vector< DataType, size > &x)
template<class DataType , int size>
DataType maxcomp (const Vector< DataType, size > &x)
template<class DataType , class VectorType , int size>
void equals_to (Vector< DataType, size > &x, const VectorType &y)
template<class DataType , class VectorType , int size>
void equals_from (VectorType &x, const Vector< DataType, size > &y)
template<class DataType , class VectorType , int size>
void plus_to (Vector< DataType, size > &x, const VectorType &y)
template<class DataType , class VectorType , int size>
void plus_from (VectorType &x, const Vector< DataType, size > &y)
template<class DataType , class VectorType , int size>
void minus_to (Vector< DataType, size > &x, const VectorType &y)
template<class DataType , class VectorType , int size>
void minus_from (VectorType &x, const Vector< DataType, size > &y)
template<class DataType , class VectorType , int size>
void multiply_to (Vector< DataType, size > &x, const VectorType &y)
template<class DataType , class VectorType , int size>
void multiply_from (VectorType &x, const Vector< DataType, size > &y)
template<class DataType , class VectorType , int size>
void divide_to (Vector< DataType, size > &x, const VectorType &y)
template<class DataType , class VectorType , int size>
void divide_from (VectorType &x, const Vector< DataType, size > &y)

Detailed Description

Generic vector implementation.

Author:
Ralf Deiterding
Version:
1.0
Date:
Jul-2004

Define Documentation

#define Global_Vector_Function ( fct   ) 
Value:
template <class DataType, int size>                                       \
inline Vector<DataType,size> fct(const Vector<DataType,size> &x)          \
   {                                                                      \
     Vector<DataType,size> ret;                                           \
     for (register int n=0; n<size; n++)                                  \
       ret[n] = std::fct(x[n]);                                           \
     return(ret);                                                         \
   }
#define Global_Vector_Scalar_Operator ( op   ) 
Value:
template <class DataType, int size>                                        \
inline Vector<DataType,size> operator op (const DataType &v,               \
   const Vector<DataType,size> &x)                                         \
   { return(x op v); }
#define Vector_Scalar_Operator ( ope,
op   ) 
Value:
inline TVector& operator ope (const DataType &v)             \
     {                                                          \
       for (register int n=0; n<size; n++)                      \
         data_[n] ope v;                                        \
       return(*this);                                           \
     }                                                          \
   inline TVector operator op (const DataType &v) const         \
     {                                                          \
       TVector ret(*this);                                      \
       for (register int n=0; n<size; n++)                      \
         ret.data_[n] ope v;                                    \
       return(ret);                                             \
     }
#define Vector_Scalar_RelOperator ( op   ) 
Value:
inline int operator op (const DataType &v) const            \
     {                                                         \
       bool ret = (data_[0] op v);                             \
       for (register int n=1; n<size; n++)                     \
         ret = ret || (data_[n] op v);                         \
       return(ret);                                            \
     }
#define Vector_Scalar_RelOperator ( op   ) 
Value:
inline int operator op (const DataType &v) const            \
     {                                                         \
       bool ret = (data_[0] op v);                             \
       for (register int n=1; n<size; n++)                     \
         ret = ret && (data_[n] op v);                         \
       return(ret);                                            \
     }
#define Vector_Vector_Functions ( NameTo,
NameFrom,
ope   ) 
Value:
template <class DataType, class VectorType, int size>                     \
  inline void NameTo (Vector<DataType,size> &x, const VectorType &y)      \
    {                                                                     \
      for (register int n=0; n<size; n++)                                 \
        x(n) ope y(n);                                                    \
    }                                                                     \
  template <class DataType, class VectorType, int size>                   \
  inline void NameFrom (VectorType &x, const Vector<DataType,size> &y)    \
    {                                                                     \
      for (register int n=0; n<size; n++)                                 \
        x(n) ope y(n);                                                    \
    }
#define Vector_Vector_Operator ( ope,
op   ) 
Value:
inline TVector& operator ope (const TVector &x)              \
     {                                                          \
       for (register int n=0; n<size; n++)                      \
         data_[n] ope x.data_[n];                               \
       return(*this);                                           \
     }                                                          \
   inline TVector operator op (const TVector &x) const          \
     {                                                          \
       TVector ret(*this);                                      \
       for (register int n=0; n<size; n++)                      \
         ret.data_[n] ope x.data_[n];                           \
       return(ret);                                             \
     }
#define Vector_Vector_RelOperator ( op   ) 
Value:
inline int operator op (const TVector &x) const              \
     {                                                          \
       bool ret = (data_[0] op x.data_[0]);                     \
       for (register int n=1; n<size; n++)                      \
         ret = ret || (data_[n] op x.data_[n]);                 \
       return(ret);                                             \
     }
#define Vector_Vector_RelOperator ( op   ) 
Value:
inline int operator op (const TVector &x) const              \
     {                                                          \
       bool ret = (data_[0] op x.data_[0]);                     \
       for (register int n=1; n<size; n++)                      \
         ret = ret && (data_[n] op x.data_[n]);                 \
       return(ret);                                             \
     }

Function Documentation

template<class DataType , int size>
double Abs ( const Vector< DataType, size > &  x  )  [inline]
template<class DataType , class VectorType , int size>
void divide_from ( VectorType &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , class VectorType , int size>
void divide_to ( Vector< DataType, size > &  x,
const VectorType &  y 
) [inline]
template<class DataType , class VectorType , int size>
void equals_from ( VectorType &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , class VectorType , int size>
void equals_to ( Vector< DataType, size > &  x,
const VectorType &  y 
) [inline]
template<class DataType , int size>
Vector<DataType,size> fabs ( const Vector< DataType, size > &  x  )  [inline]

Referenced by Abs(), partition_all(), and partition_two().

template<class DataType , int size>
Vector<DataType,size> Max ( const Vector< DataType, size > &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , int size>
DataType maxcomp ( const Vector< DataType, size > &  x  )  [inline]
template<class DataType , int size>
Vector<DataType,size> Min ( const Vector< DataType, size > &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , int size>
DataType mincomp ( const Vector< DataType, size > &  x  )  [inline]
template<class DataType , class VectorType , int size>
void minus_from ( VectorType &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , class VectorType , int size>
void minus_to ( Vector< DataType, size > &  x,
const VectorType &  y 
) [inline]
template<class DataType , class VectorType , int size>
void multiply_from ( VectorType &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , class VectorType , int size>
void multiply_to ( Vector< DataType, size > &  x,
const VectorType &  y 
) [inline]
template<class DataType , int size>
Vector<DataType,size> operator* ( const DataType &  v,
const Vector< DataType, size > &  x 
) [inline]
template<class DataType , int size>
Vector<DataType,size> operator+ ( const DataType &  v,
const Vector< DataType, size > &  x 
) [inline]
template<class DataType , int size>
Vector<DataType,size> operator- ( const DataType &  v,
const Vector< DataType, size > &  x 
) [inline]
template<class DataType , int size>
Vector<DataType,size> operator/ ( const DataType &  v,
const Vector< DataType, size > &  x 
) [inline]
template<class DataType , int size>
std::ostream& operator<< ( std::ostream &  os,
const Vector< DataType, size > &  v 
) [inline]

References size().

template<class DataType , class VectorType , int size>
void plus_from ( VectorType &  x,
const Vector< DataType, size > &  y 
) [inline]
template<class DataType , class VectorType , int size>
void plus_to ( Vector< DataType, size > &  x,
const VectorType &  y 
) [inline]
template<class DataType , int size>
Vector<DataType,size> sqrt ( const Vector< DataType, size > &  x  )  [inline]
Generated on Thu Jun 30 02:19:00 2016 for AMROC's Hierachical Data Structures by  doxygen 1.6.3