Commit 2b452e36 by Kenneth Vanhoey

### Add method for completing a Tensor that is partially filled and supposed

`to be symmetric.`
parent 92e95d00
 ... @@ -29,6 +29,9 @@ ... @@ -29,6 +29,9 @@ * \file tensor.h * \file tensor.h */ */ #define CONST_VAL -5212368.54127 // random value namespace CGoGN namespace CGoGN { { ... @@ -192,6 +195,15 @@ class Tensor ... @@ -192,6 +195,15 @@ class Tensor */ */ static bool incremIndex(std::vector& p) ; static bool incremIndex(std::vector& p) ; /*! * \brief method to complete a symmetric tensor that was * only filled in its first half (defined by an index that * is order ascendantly) * * \param T the tensor to fill */ void completeSymmetricTensor() ; /**********************************************/ /**********************************************/ /* STREAM OPERATORS */ /* STREAM OPERATORS */ /**********************************************/ /**********************************************/ ... ...
 ... @@ -134,6 +134,21 @@ Tensor::getIndex(std::vector p) const ... @@ -134,6 +134,21 @@ Tensor::getIndex(std::vector p) const return res ; return res ; } } template void Tensor::completeSymmetricTensor() { std::vector p ; p.resize(order(), 0) ; do { std::vector sorted_p = p ; std::sort(sorted_p.begin(), sorted_p.begin() + (*this).order()) ; (*this)(p) = (*this)(sorted_p) ; } while (incremIndex(p)) ; } template template const unsigned int& const unsigned int& Tensor::order() const Tensor::order() const ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment