diff --git a/include/simcoon/FTensor/Tensor3_antisymmetric/Tensor3_antisymmetric_pointer.hpp b/include/simcoon/FTensor/Tensor3_antisymmetric/Tensor3_antisymmetric_pointer.hpp index 9b279286..1e3f3768 100644 --- a/include/simcoon/FTensor/Tensor3_antisymmetric/Tensor3_antisymmetric_pointer.hpp +++ b/include/simcoon/FTensor/Tensor3_antisymmetric/Tensor3_antisymmetric_pointer.hpp @@ -48,44 +48,41 @@ namespace FTensor T operator()(const int N1, const int N2, const int N3) const { #ifdef FTENSOR_DEBUG - if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0 - || N3 >= Tensor_Dim12 || N3 < 0) - { - std::stringstream s; - s << "Bad index in Tensor3_antisymmetric.operator(" << N1 << "," << N2 << "," << N3 - << ") const" << std::endl; - throw std::out_of_range(s.str()); - } -#endif + if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0 + || N3 >= Tensor_Dim12 || N3 < 0) + { + std::stringstream s; + s << "Bad index in Tensor3_antisymmetric.operator(" << N1 << "," << N2 << "," << N3 + << ") const" << std::endl; + throw std::out_of_range(s.str()); + } + #endif return N2 < N3 - ? *data[N1] - [N3 - 1 + (N2 * (2 * (Tensor_Dim12 - 1) - N2 - 1)) / 2] - : (N2 > N3 - ? -*data[N1][N2 - 1 - + (N3 * (2 * (Tensor_Dim12 - 1) - N3 - 1)) / 2] + ? *data[N1][N3 - 1 + (N2 * (2 * (Tensor_Dim12 - 1) - N2 - 1)) / 2] + : (N2 > N3 + ? -(*data[N1][N2 - 1 + (N3 * (2 * (Tensor_Dim12 - 1) - N3 - 1)) / 2]) : 0.0); } T *ptr(const int N1, const int N2, const int N3) const { #ifdef FTENSOR_DEBUG - if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0 - || N3 >= Tensor_Dim12 || N3 < 0) - { - std::stringstream s; - s << "Bad index in Tensor3_antisymmetric.ptr(" << N1 << "," << N2 << "," << N3 << ")" - << std::endl; - throw std::out_of_range(s.str()); - } + if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0 + || N3 >= Tensor_Dim12 || N3 < 0) + { + std::stringstream s; + s << "Bad index in Tensor3_antisymmetric.ptr(" << N1 << "," << N2 << "," << N3 << ")" + << std::endl; + throw std::out_of_range(s.str()); + } #endif return N2 < N3 - ? data[N1][N3 - 1 + (N2 * (2 * (Tensor_Dim12 - 1) - N2 - 1)) / 2] - : (N2 > N3 - ? -data[N1][N2 - 1 - + (N3 * (2 * (Tensor_Dim12 - 1) - N3 - 1)) / 2] - : 0); + ? data[N1][N3 - 1 + (N2 * (2 * (Tensor_Dim12 - 1) - N2 - 1)) / 2] + : (N2 > N3 + ? data[N1][N2 - 1 + (N3 * (2 * (Tensor_Dim12 - 1) - N3 - 1)) / 2] + : nullptr); } /* These operator()'s are the first part in constructing template