Skip to content

Commit

Permalink
add unexported symvec2string and braces kwarg to `prettyprint_sym…
Browse files Browse the repository at this point in the history
…metryvector`
  • Loading branch information
thchr committed May 6, 2021
1 parent e247c5e commit ea199a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Crystalline"
uuid = "ae5e2be0-a263-11e9-351e-f94dad1eb351"
authors = ["Thomas Christensen <tchr@mit.edu>"]
version = "0.3.6"
version = "0.3.7"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
19 changes: 15 additions & 4 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,19 @@ end


# --- BandRep ---
function prettyprint_symmetryvector(io::IO, irvec::AbstractVector{<:Real}, irlabs::Vector{String})
function prettyprint_symmetryvector(
io::IO,
irvec::AbstractVector{<:Real},
irlabs::Vector{String};
braces::Bool=true)

Nⁱʳʳ = length(irlabs)
Nⁱʳʳ′ = length(irvec)
if !(Nⁱʳʳ′ == Nⁱʳʳ || Nⁱʳʳ′ == Nⁱʳʳ+1)
# we allow irvec to exceed the dimension of irlabs by 1, in case it includes dim(BR)
throw(DimensionMismatch("irvec and irlabs must have matching dimensions"))
end
print(io, '[')
braces && print(io, '[')

first_nz = true
group_klab = klabel(first(irlabs))
Expand Down Expand Up @@ -358,9 +363,15 @@ function prettyprint_symmetryvector(io::IO, irvec::AbstractVector{<:Real}, irlab
print(io, absc)
end
end
print(io, irlab)
print(io, irlab)
end
print(io, ']')
braces && print(io, ']')
end
function symvec2string(irvec::AbstractVector{<:Real}, irlabs::Vector{String};
braces::Bool=true)
io = IOBuffer()
prettyprint_symmetryvector(io, irvec, irlabs; braces=braces)
return String(take!(io))
end

summary(io::IO, BR::BandRep) = print(io, dim(BR), "-band BandRep (", label(BR), " at ", wyck(BR), ")")
Expand Down
5 changes: 4 additions & 1 deletion src/symeigs2irrep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function find_representation(symvals::AbstractVector{<:Number},
# check that imaginary part is numerically zero and that all entries are representible
# in type assert_return_T
msℝ = real.(ms)
if !isapprox(msℝ, ms, atol=atol)
if !isapprox(msℝ, ms, atol=atol)
if verbose
@info """non-negligible imaginary components found in irrep multicity; returning
`nothing` as sentinel""" maximum(imag, ms)
Expand All @@ -114,6 +114,9 @@ function find_representation(symvals::AbstractVector{<:Number},
end

elseif assert_return_T <: AbstractFloat
# TODO: not sure why we wouldn't want to check for `atol` distance from nearest
# integer here (returning `nothing` in the negative case) - should check if
# we ever actually rely on this
return convert.(assert_return_T, msℝ)
end

Expand Down

2 comments on commit ea199a2

@thchr
Copy link
Owner Author

@thchr thchr commented on ea199a2 May 7, 2021

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/36242

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.7 -m "<description of version>" ea199a207c0874f81c0cc1a85e3779d06d4f4297
git push origin v0.3.7

Please sign in to comment.