Skip to content

changed get() and slicing #714

Open
manuschneider wants to merge 8 commits intomasterfrom
slicing
Open

changed get() and slicing #714
manuschneider wants to merge 8 commits intomasterfrom
slicing

Conversation

@manuschneider
Copy link
Copy Markdown
Collaborator

UniTensors keep their metadata (possibly with bonds removed for constant access of one element in a given dimension).
Diagonal UniTensors can be accessed by two-dimensional slicing as well now.

This fixes #397

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 75.32468% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.55%. Comparing base (fa015d4) to head (5b89af3).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
src/DenseUniTensor.cpp 65.85% 7 Missing and 7 partials ⚠️
include/UniTensor.hpp 58.33% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #714      +/-   ##
==========================================
+ Coverage   35.44%   35.55%   +0.10%     
==========================================
  Files         215      214       -1     
  Lines       33071    33118      +47     
  Branches    13170    13191      +21     
==========================================
+ Hits        11723    11776      +53     
+ Misses      19424    19412      -12     
- Partials     1924     1930       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hunghaoti
Copy link
Copy Markdown
Collaborator

Is it possible to add some simple unit test?

@manuschneider manuschneider added the Pending check/approval Issue fixed, and need feedback label Feb 24, 2026
@ianmccul
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25121c9397

ℹ️ 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".

set behaves like get for diagonal UniTenosrs
get always returns a UniTensor with independent metadata
no memory leak with empty 'removed' argument using get()
…th two accessor elements on a diagonal UniTensor

this creates consistency; use one accessor element to address only the diagonal elements;
@manuschneider
Copy link
Copy Markdown
Collaborator Author

All issues were fixed, and unit tests were added.

I changed the behavior so that slicing a diagonal-dense UniTensor with two accessors always yields a non-diagonal UniTensor. Before, the result was still diagonal if the two accessors were the same, but this led to inconsistent behavior. If the output should be diagonal, use only one accessor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending check/approval Issue fixed, and need feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rowrank is modified after slicing

3 participants