tensor3(2) a third order tensor


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


template<class T>
class tensor3_basic {
  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); }
  tensor3_basic<T>  operator*  (const T& k) const;
  tensor3_basic<T>  operator/  (const T& k) const;
  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;
  tensor3_basic<T>  operator-  (const tensor3_basic<T>& b) const;
// inputs/outputs:
  std::ostream& put (std::ostream& s, size_type d = 3) const;
  std::istream& get (std::istream&);
// data:
  T _x [3][3][3];
typedef tensor3_basic<Float> tensor3;