Skip to content

Commit

Permalink
Add rounding to printing
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pl committed Jul 30, 2018
1 parent 4fb901c commit 5507461
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ summary(io::IO, x::Ket) = print(io, "Ket(dim=$(length(x.basis)))\n basis: $(x.b
function show(stream::IO, x::Ket)
summary(stream, x)
if !_std_order
Base.print_array(stream, x.data)
Base.print_array(stream, round.(x.data; digits=machineprecorder))
else
showarray_stdord(stream, x.data, x.basis.shape, false, header=false)
showarray_stdord(stream, round.(x.data; digits=machineprecorder), x.basis.shape, false, header=false)
end
end

summary(io::IO, x::Bra) = print(io, "Bra(dim=$(length(x.basis)))\n basis: $(x.basis)\n")
function show(stream::IO, x::Bra)
summary(stream, x)
if !_std_order
Base.print_array(stream, x.data)
Base.print_array(stream, round.(x.data; digits=machineprecorder))
else
showarray_stdord(stream, x.data, x.basis.shape, false, header=false)
showarray_stdord(stream, round.(x.data; digits=machineprecorder), x.basis.shape, false, header=false)
end
end

Expand All @@ -122,9 +122,9 @@ function show(stream::IO, x::DenseOperator)
summary(stream, x)
print(stream, "\n")
if !_std_order
Base.print_array(stream, x.data)
Base.print_array(stream, round.(x.data; digits=machineprecorder))
else
showarray_stdord(stream, x.data, x.basis_l.shape, x.basis_r.shape, false, header=false)
showarray_stdord(stream, round.(x.data; digits=machineprecorder), x.basis_l.shape, x.basis_r.shape, false, header=false)
end
end

Expand All @@ -134,9 +134,9 @@ function show(stream::IO, x::SparseOperator)
print(stream, "\n []")
else
if !_std_order
show(stream, x.data)
show(stream, round.(x.data; digits=machineprecorder))
else
showsparsearray_stdord(stream, x.data, x.basis_l.shape, x.basis_r.shape)
showsparsearray_stdord(stream, round.(x.data; digits=machineprecorder), x.basis_l.shape, x.basis_r.shape)
end
end
end
Expand Down

0 comments on commit 5507461

Please sign in to comment.