Skip to content

Commit

Permalink
Merge branch 'master' into mbaran/abstract-size
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Jul 7, 2023
2 parents 02acfd6 + 71f85b6 commit 2c516eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1010,18 +1010,23 @@ function show(
::MIME"text/plain",
B::CachedBasis{𝔽,T,D},
) where {𝔽,T<:AbstractBasis,D}
vectors = _get_vectors(B)
print(
io,
"Cached basis of type $T with $(length(vectors)) basis vector$(length(vectors) == 1 ? "" : "s"):",
)
return _show_basis_vector_range_noheader(
io,
vectors;
max_vectors = 4,
pre = " ",
sym = " E",
)
try
vectors = _get_vectors(B)
print(
io,
"Cached basis of type $T with $(length(vectors)) basis vector$(length(vectors) == 1 ? "" : "s"):",
)
return _show_basis_vector_range_noheader(
io,
vectors;
max_vectors = 4,
pre = " ",
sym = " E",
)
catch e
# in case _get_vectors(B) is not defined
print(io, "Cached basis of type $T")
end
end
function show(
io::IO,
Expand Down
6 changes: 6 additions & 0 deletions test/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ DiagonalizingBasisProxy() = DiagonalizingOrthonormalBasis([1.0, 0.0, 0.0])

M = DefaultManifold(3)

@test sprint(
show,
"text/plain",
CachedBasis(NonBasis(), NonBroadcastBasisThing([])),
) == "Cached basis of type NonBasis"

@testset "Constructors" begin
@test DefaultBasis{ℂ,TangentSpaceType}() === DefaultBasis(ℂ)
@test DefaultOrthogonalBasis{ℂ,TangentSpaceType}() === DefaultOrthogonalBasis(ℂ)
Expand Down

0 comments on commit 2c516eb

Please sign in to comment.