Closed chengyanlai closed 7 years ago
An uniTensor seems to be transformed back to RTYPE after callingUniTensor::assign(const std::vector<Bond>& _bond) when it was initialized as CTYPE.
UniTensor::assign(const std::vector<Bond>& _bond)
The current function reads
UniTensor& UniTensor::assign(const std::vector<Bond>& _bond){ try{ UniTensor T(_bond); *this = T; } catch(const std::exception& e){ propogate_exception(e, "In function UniTensor::assign(std::vector<Bond>&):"); } return *this; }
which uses UniTensor(const std::vector<Bond>& _bonds, const std::string& _name) and that constructor calls initUniT(RTYPE) by default. This action abandons the original tensor type, and it always turns into an RTYPE uniTensor.
UniTensor(const std::vector<Bond>& _bonds, const std::string& _name)
initUniT(RTYPE)
A quick fix can be the following
UniTensor& UniTensor::assign(const std::vector<Bond>& _bond){ try{ if ( this->typeID() == 1 ){ UniTensor T("R", _bond); *this = T; }else if ( this->typeID() == 2 ){ UniTensor T("C", _bond); *this = T; } } catch(const std::exception& e){ propogate_exception(e, "In function UniTensor::assign(std::vector<Bond>&):"); } return *this; }
If this is not caused on purpose, it should be fixed.
Hi, very thanks for your report. This is a bug indeed. I will fix it soon.
Fixed by 6a426aead29cb8a20b9d12722e995adb8f41df4e
An uniTensor seems to be transformed back to RTYPE after calling
UniTensor::assign(const std::vector<Bond>& _bond)
when it was initialized as CTYPE.The current function reads
which uses
UniTensor(const std::vector<Bond>& _bonds, const std::string& _name)
and that constructor callsinitUniT(RTYPE)
by default. This action abandons the original tensor type, and it always turns into an RTYPE uniTensor.A quick fix can be the following
If this is not caused on purpose, it should be fixed.