File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed
Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -1214,19 +1214,19 @@ namespace cytnx {
12141214 };
12151215
12161216 void BlockUniTensor::Transpose_ () {
1217- cytnx_int64 rank = this ->bonds ().size ();
1217+ const cytnx_int64 rank = this ->bonds ().size ();
12181218 std::vector<cytnx_int64> idxorder (rank);
1219- cytnx_int64 rowrank = this ->_rowrank ;
1220- for (cytnx_int64 i = 0 ; i < rowrank; i++) {
1219+ const cytnx_int64 oldrowrank = this ->_rowrank ;
1220+ this ->_rowrank = rank - oldrowrank;
1221+ for (cytnx_int64 i = 0 ; i < this ->_rowrank ; i++) {
12211222 this ->bonds ()[i].redirect_ ();
1222- idxorder[i] = i + rowrank ;
1223+ idxorder[i] = i + oldrowrank ;
12231224 }
1224- for (cytnx_int64 i = rowrank ; i < rank; i++) {
1225+ for (cytnx_int64 i = this -> _rowrank ; i < rank; i++) {
12251226 this ->bonds ()[i].redirect_ ();
1226- idxorder[i] = i - rowrank ;
1227+ idxorder[i] = i - this -> _rowrank ;
12271228 }
12281229 this ->permute_ (idxorder);
1229- this ->_rowrank = rank - rowrank;
12301230 };
12311231
12321232 void BlockUniTensor::normalize_ () {
Original file line number Diff line number Diff line change @@ -1190,19 +1190,19 @@ namespace cytnx {
11901190
11911191 void DenseUniTensor::Transpose_ () {
11921192 if (this ->is_tag ()) {
1193- cytnx_int64 rank = this ->bonds ().size ();
1193+ const cytnx_int64 rank = this ->bonds ().size ();
11941194 std::vector<cytnx_int64> idxorder (rank);
1195- cytnx_int64 rowrank = this ->_rowrank ;
1196- for (cytnx_int64 i = 0 ; i < rowrank; i++) {
1195+ const cytnx_int64 oldrowrank = this ->_rowrank ;
1196+ this ->_rowrank = rank - oldrowrank;
1197+ for (cytnx_int64 i = 0 ; i < this ->_rowrank ; i++) {
11971198 this ->bonds ()[i].redirect_ ();
1198- idxorder[i] = i + rowrank ;
1199+ idxorder[i] = i + oldrowrank ;
11991200 }
1200- for (cytnx_int64 i = rowrank ; i < rank; i++) {
1201+ for (cytnx_int64 i = this -> _rowrank ; i < rank; i++) {
12011202 this ->bonds ()[i].redirect_ ();
1202- idxorder[i] = i - rowrank ;
1203+ idxorder[i] = i - this -> _rowrank ;
12031204 }
12041205 this ->permute_ (idxorder);
1205- this ->_rowrank = rank - rowrank;
12061206 } else {
12071207 std::vector<cytnx_int64> new_permute =
12081208 vec_concatenate (vec_range<cytnx_int64>(this ->rowrank (), this ->rank ()),
You can’t perform that action at this time.
0 commit comments