Skip to content

Conversation

@akirakyle
Copy link
Member

This implements the alternative basis interface for dealing with tensor bases described in this comment and copied here:

shape(b::CompositeBasis) = b.shape
dimension(b::CompositeBasis) = prod(b.shape)
Base.length(b::CompositeBasis) = length(b.bases)
Base.getindex(b::CompositeBasis, i) = getindex(b.bases, i)

shape(b::Basis) = [length(b)]
dimension(b::B) where B<:Basis # must be implemented and should return Hilbert space dimension
Base.length(b::Basis) = 1
Base.getindex(b::Basis, i) = i==1 ? b : throw(BoundsError("attempted to access a nonexistent subsystem basis"))

@codecov
Copy link

codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 17.75362% with 227 lines in your changes missing coverage. Please review.

Project coverage is 27.22%. Comparing base (f7aaafa) to head (3e05d9f).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/bases.jl 37.69% 81 Missing ⚠️
src/superoperators.jl 0.00% 44 Missing ⚠️
src/deprecated.jl 0.00% 41 Missing ⚠️
src/julia_base.jl 0.00% 27 Missing ⚠️
src/embed_permute.jl 0.00% 20 Missing ⚠️
src/expect_variance.jl 0.00% 11 Missing ⚠️
src/abstract_types.jl 0.00% 2 Missing ⚠️
src/julia_linalg.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
- Coverage   34.66%   27.22%   -7.45%     
==========================================
  Files          15       15              
  Lines         424      551     +127     
==========================================
+ Hits          147      150       +3     
- Misses        277      401     +124     

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

@akirakyle akirakyle mentioned this pull request Apr 20, 2025
@akirakyle akirakyle changed the title Implementing altertative basis interface and abstract type changes in #40 Implementing alternative basis interface and abstract type changes in #40 Apr 20, 2025
@akirakyle akirakyle force-pushed the bases-api-v3 branch 2 times, most recently from 16ab274 to 65c226c Compare April 20, 2025 01:56
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.

1 participant