Skip to content

reshape(::OneToOne) #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 7, 2025
Merged

reshape(::OneToOne) #10

merged 6 commits into from
Apr 7, 2025

Conversation

ogauthe
Copy link
Collaborator

@ogauthe ogauthe commented Mar 31, 2025

This PR allows Base.reshape to handle OneToOne similarly to Base.OneTo(1), to be used e.g. in TensorAlgebra.fusedims.

Copy link

codecov bot commented Mar 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (fc0668a) to head (154849e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #10   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           20        21    +1     
=========================================
+ Hits            20        21    +1     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ogauthe
Copy link
Collaborator Author

ogauthe commented Apr 4, 2025

In TensorAlgebra I end up using to_shape.(axes), so I can solve the current issue just by defining Base.to_shape(::OneToOne) = 1. This avoids type piracy and allows natural code to work.

@ogauthe
Copy link
Collaborator Author

ogauthe commented Apr 7, 2025

Since we ended up not using OneToOne in ITensor/TensorAlgebra.jl#50, we may decide to completely remove it. If we prefer to keep it I think we can merge this PR that just defines Base.to_shape(::OneToOne)

@mtfishman
Copy link
Member

I'll merge this, but let's keep an eye out for uses of OneToOne that we can remove.

@mtfishman mtfishman merged commit e5556df into ITensor:main Apr 7, 2025
16 checks passed
@ogauthe ogauthe deleted the reshape branch April 7, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants