Skip to content

remove relabels and set_labels#752

Open
pcchen wants to merge 10 commits intomasterfrom
relabel-rebased
Open

remove relabels and set_labels#752
pcchen wants to merge 10 commits intomasterfrom
relabel-rebased

Conversation

@pcchen
Copy link
Collaborator

@pcchen pcchen commented Mar 20, 2026

Replaces the deprecated use of relabels by relabel, and the use of relabels_ and set_labels by relabel_.

Rebased version of #729 resolving the conflict in src/linalg/Lanczos_Exp.cpp.

Additional fixes applied during review:

  • Fix relabels_(new_labels) deprecated message pointing to wrong overload
  • Mark set_labels() overloads as [[deprecated]] in public UniTensor API
  • Mark set_labels and relabels_ as [[deprecated]] in UniTensor_base
  • Restore deprecated-function tests with #pragma suppression
  • Emit DeprecationWarning from deprecated Python pybind bindings

manuschneider and others added 10 commits March 20, 2026 11:57
The [[deprecated]] attribute and Doxygen comment on the 1-parameter
relabels_() overload incorrectly directed users to the 2-parameter
relabel_(old_labels, new_labels). Corrected to relabel_(new_labels).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both the vector<string> and initializer_list<char*> overloads of
set_labels() were missing [[deprecated]] attributes despite all call
sites having been replaced with relabel_(). Users will now get a
compiler warning directing them to relabel_(new_labels).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The three base class declarations (set_labels, relabels_(new_labels),
relabels_(old_labels, new_labels)) were missing [[deprecated]] attributes,
so callers going through the base class pointer would get no compiler
warning. Each now points to its relabel_ replacement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests for set_labels, relabels, and relabels_ were deleted by the PR,
leaving no automated check that the deprecated wrappers still work.
Restored all removed tests and wrapped them in:
  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
so they compile cleanly while still exercising the deprecated API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c_set_labels, relabels (both overloads), and c_relabels_ (both overloads)
now call PyErr_WarnEx(PyExc_DeprecationWarning, ...) before delegating
to their relabel/relabel_ replacements, matching Python convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@pcchen pcchen added the Pending check/approval Issue fixed, and need feedback label Mar 20, 2026
@pcchen pcchen requested a review from manuschneider March 20, 2026 05:29
@pcchen
Copy link
Collaborator Author

pcchen commented Mar 20, 2026

@manuschneider Due to the complicit in original PR #729 . I do the rebased the code and create this new PR. This PR has addressed the issues raised by Claude Code during the code review. Please help to review this PR. After you merger this PR to the main branch. Please help to close the original PR #729 .

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 50.94340% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.46%. Comparing base (fa015d4) to head (227a9b0).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
src/tn_algo/DMRG.cpp 0.00% 12 Missing ⚠️
src/tn_algo/RegularMPS.cpp 0.00% 6 Missing ⚠️
src/linalg/Qdr.cpp 0.00% 3 Missing ⚠️
src/linalg/Qr.cpp 0.00% 2 Missing ⚠️
src/linalg/Lanczos_Exp.cpp 87.50% 1 Missing ⚠️
src/ncon.cpp 0.00% 0 Missing and 1 partial ⚠️
src/tn_algo/iMPS.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #752      +/-   ##
==========================================
+ Coverage   35.44%   35.46%   +0.01%     
==========================================
  Files         215      215              
  Lines       33071    33057      -14     
  Branches    13170    13167       -3     
==========================================
  Hits        11723    11723              
+ Misses      19424    19410      -14     
  Partials     1924     1924              

☔ 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.

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.

2 participants