cristi1990an / Tensor-plus-plus

tensor_lib::tensor is a class template that describes a mathematical tensor, implemented as a heap allocated array. It is build as an alternative to structures such as std::vector <std::vector <std::vector<...>>>, replicating its behaviour and syntax almost entirely with the added benefits of having its data contiguous in memory.
1 stars 3 forks source link

Added tensor::replace() and subdimension::replace() methods #10

Closed cristi1990an closed 3 years ago

cristi1990an commented 3 years ago

replace() is supposed to be a size-checking copy assignment operator. The copy assignment operator for subdimension is currently working the same way an iterator would, making the object "point" to a different subdimension, maybe even in a different tensor. replace() does a size check and copies the values from the tensor/subdimension/const_subdimension reference it was given, without modifying it. replace() was also added to the tensor class for continuity and it differs from the copy assignment operator by not allowing resizes, the source of the data must have the same order as the destination.