diff --git a/tensor.cc b/tensor.cc index d1e82f6..cb4b3f9 100644 --- a/tensor.cc +++ b/tensor.cc @@ -711,6 +711,7 @@ kk=u.groupsizes[0]; if(kk!=rhsu.groupsizes[0]) laerror("internal error in contraction"); nn=1; for(int i=1; i(nn,mm,kk,&data[0],&u.data[0], &rhsu.data[0],alpha,beta,conjugate); } @@ -739,8 +740,9 @@ for(int p=0; p->size(); ++p) template void Tensor::apply_permutation_algebra(const Tensor &rhs, const PermutationAlgebra &pa, bool inverse, T alpha, T beta) { -if(beta!=(T)0) *this *= beta; else clear(); +if(beta!=(T)0) {if(beta!=(T)1) *this *= beta;} else clear(); if(alpha==(T)0) return; +copyonwrite(); help_t = const_cast *>(&rhs); help_pa = &pa;