SYNOPSYS

The tensor3 class defines a fourth tensor where indices varie from zero to 2 (aka 3D physical space).

IMPLEMENTATION

template<class T>
class tensor3_basic {
public:

  typedef size_t size_type;
  typedef T      element_type;
  typedef T      float_type;

// allocators:

  tensor3_basic (const T& init_val = 0);
  tensor3_basic (const tensor3_basic<T>& a);

// affectation:

  tensor3_basic<T>& operator= (const tensor3_basic<T>& a);
  tensor3_basic<T>& operator= (const T& val);

// accessors:

  T&       operator()(size_type i, size_type j, size_type k);
  const T& operator()(size_type i, size_type j, size_type k) const;

// algebra
  tensor3_basic<T>& operator*= (const T& k);
  tensor3_basic<T>& operator/= (const T& k) { return operator*= (1./k); }
  tensor_basic<T>   operator*  (const point_basic<T>& v) const;
  tensor3_basic<T>  operator*  (const tensor_basic<T>& b) const;
  tensor3_basic<T>  operator+  (const tensor3_basic<T>& b) const;

// data:
protected:
  T _x [3][3][3];
};
typedef tensor3_basic<Float> tensor3;