From 91d8f4cc468e1e63716e2410c9305ea39bd33212 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Thu, 23 Oct 2025 18:09:21 +0200 Subject: [PATCH] working on fourindex conversions in tensor class --- tensor.cc | 3 --- tensor.h | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tensor.cc b/tensor.cc index 4414497..f419ead 100644 --- a/tensor.cc +++ b/tensor.cc @@ -1417,9 +1417,6 @@ else - - - template class Tensor; template class Tensor >; template std::ostream & operator<<(std::ostream &s, const Tensor &x); diff --git a/tensor.h b/tensor.h index 221822f..a746ec5 100644 --- a/tensor.h +++ b/tensor.h @@ -46,7 +46,7 @@ //@@@ will need to store vector of INDEX to the original tensor for the result's flatindex //@@@ will not be particularly efficient // -//@@@conversions to/from fourindex, optional negarive range for beta spin handling +//@@@conversions to/from fourindex, optional negative range for beta spin handling in some cases //@@@use the fact that fourindex_dense is inherited from Mat/SMat and construct tensor from the (unsymmetrized) NRMat sharing data, just rewrite then the shape // //@@@?general permutation of individual indices - check the indices in sym groups remain adjacent, calculate result's shape, loopover the result and permute using unwind_callback @@ -265,6 +265,26 @@ public: }; +//due to template nesting and specialization limitation, this cannot be class member - the S parameter has to be the outer one +template +Tensor fourindex2tensor(const fourindex_dense &f); +template +void tensor2fourindex(const Tensor &t, fourindex_dense &f); + +//conversions from/to fourindex specialized by symmetry type +template +Tensor fourindex2tensor(const fourindex_dense &f) +{ +} + +template +void tensor2fourindex(const Tensor &t, fourindex_dense &f) +{ +} + + + + template std::ostream & operator<<(std::ostream &s, const Tensor &x);