*/
Tensor (const array_type &initializer);
+ /**
+ * Copy constructor taking a tesnor of another base data type
+ */
+ template <typename OtherNumber>
+ explicit
+ Tensor (const Tensor<rank_,dim,OtherNumber> &);
+
/**
* Conversion operator from tensor of tensors.
*/
*/
Tensor &operator = (const Tensor<rank_,dim,Number> &);
+ template <typename OtherNumber>
+ Tensor &operator = (const Tensor<rank_,dim,OtherNumber> &);
+
/**
* This operator assigns a scalar to a tensor. To avoid confusion with what
* exactly it means to assign a scalar value to a tensor, zero is the only
+template <int rank_, int dim, typename Number>
+template <typename OtherNumber>
+inline
+Tensor<rank_,dim,Number> &
+Tensor<rank_,dim,Number>::operator = (const Tensor<rank_,dim,OtherNumber> &t)
+{
+ for (unsigned int i=0; i<dim; ++i)
+ subtensor[i] = t.subtensor[i];
+ return *this;
+}
+
+template <int rank_, int dim, typename Number>
+template <typename OtherNumber>
+Tensor<rank_,dim,Number>::Tensor (const Tensor<rank_,dim,OtherNumber> &t)
+{
+ *this = t;
+}
+
+
+
template <int rank_, int dim, typename Number>
inline
Tensor<rank_,dim,Number> &
*/
Tensor<0,dim,Number> &operator = (const Tensor<0,dim,Number> &);
+ template <typename OtherNumber>
+ Tensor<0,dim,Number> &operator = (const Tensor<0,dim,OtherNumber> &);
+
/**
* Assignment operator.
*/
*/
Tensor<1,dim,Number> &operator = (const Tensor<1,dim,Number> &);
+ template <typename OtherNumber>
+ Tensor<1,dim,Number> &operator = (const Tensor<1,dim,OtherNumber> &);
+
/**
* This operator assigns a scalar to a tensor. To avoid confusion with what
* exactly it means to assign a scalar value to a tensor, zero is the only
return *this;
}
+template <int dim, typename Number>
+template <typename OtherNumber>
+inline
+Tensor<0,dim,Number> &Tensor<0,dim,Number>::operator = (const Tensor<0,dim,OtherNumber> &p)
+{
+ value = p.value;
+ return *this;
+}
template <int dim, typename Number>
+template <int dim, typename Number>
+template <typename OtherNumber>
+inline
+Tensor<1,dim,Number> &
+Tensor<1,dim,Number>::operator = (const Tensor<1,dim,OtherNumber> &p)
+{
+ for (unsigned int i=0; i<dim; ++i)
+ values[i] = p.values[i];
+
+ return *this;
+}
+
+
+
template <int dim, typename Number>
inline
Tensor<1,dim,Number> &Tensor<1,dim,Number>::operator = (const Number d)