Conversation
… need to be careful when dealing with fermions
… &mapper) by copying and adapting the updated cytnx_uint64 version
… legs of type BD_KET ("P gate")
…ion, also for bosonic cases
-twist_ implemented to be called by label as well
…owrank accordingly to really transpose the matrix form of a tensor
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #703 +/- ##
==========================================
+ Coverage 32.35% 35.85% +3.50%
==========================================
Files 215 215
Lines 36363 33158 -3205
Branches 14597 13213 -1384
==========================================
+ Hits 11764 11889 +125
+ Misses 22659 19342 -3317
+ Partials 1940 1927 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Is it possible to add some simple unit test? |
done |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba15358496
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| idxorder[i] = idxnum - i; | ||
| } | ||
| this->permute_nosignflip_(idxorder); | ||
| this->_rowrank = this->_bonds.size() - this->_rowrank; |
There was a problem hiding this comment.
Refresh braket-form cache after rowrank flip
Transpose_() recomputes _is_braket_form inside permute_nosignflip_() using the old rowrank, then line 1928 changes _rowrank again without updating the cache. For fermionic tensors where rowrank changes under transpose (for example rank 4 with rowrank 1), is_braket_form() can return a stale value after transpose, so downstream logic that relies on this flag may branch incorrectly.
Useful? React with 👍 / 👎.
| std::vector<std::string>::iterator it; | ||
| it = std::find(this->_labels.begin(), this->_labels.end(), label); | ||
| cytnx_error_msg(it == this->_labels.end(), | ||
| "[ERROR] label %d does not exist in current UniTensor.\n", label.c_str()); |
There was a problem hiding this comment.
Fix invalid format specifier in twist label error
The error path in twist_(const std::string label) passes label.c_str() to a "%d" format placeholder. This is a type mismatch in varargs formatting and can print garbage or trigger undefined behavior when a missing label is provided, making diagnostics unreliable in exactly the case this check is intended to handle.
Useful? React with 👍 / 👎.
-Added fermion twists, which corresponds to the P-gates in arXiv:2404.14611
-Cleaned up code and updated documentation
-Made all methods return a pointer to the class to allow for chaining (e.g.
UniTensor.contiguous().fermion_twists(). ...)