Skip to content

Commit 0942d7a

Browse files
authored
Fix some tiny issues and bump version to 4.0.1 (#97)
* fix some tiny issues and bump version * fix doctest
1 parent cf42b92 commit 0942d7a

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GenericTensorNetworks"
22
uuid = "3521c873-ad32-4bb4-b63d-f4f178f42b49"
33
authors = ["GiggleLiu <[email protected]> and contributors"]
4-
version = "4.0.0"
4+
version = "4.0.1"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/Mods.jl/src/Mods.jl

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ function Mod{N}(x::T) where {T<:Complex{<:Integer},N}
3131
Mod{N,S}(v)
3232
end
3333

34-
35-
3634
# type casting
3735
Mod{N,T}(x::Mod{N,T2}) where {T,N,T2} = Mod{N,T}(T(x.val))
3836
Mod{N,T}(x::Mod{N,T}) where {T,N} = x
@@ -49,12 +47,12 @@ julia> modulus(a)
4947
13
5048
```
5149
"""
52-
modulus(a::Mod{N}) where {N} = N
50+
modulus(::Mod{N}) where {N} = N
5351

5452
"""
5553
`value(a::Mod)` returns the value of this `Mod` number.
5654
```
57-
julia> a = Mod{13}(11);
55+
julia> a = Mod{13}(24);
5856
5957
julia> value(a)
6058
11
@@ -73,7 +71,6 @@ end
7371
# Test for equality
7472
iszero(x::Mod{N}) where {N} = iszero(value(x))
7573
==(x::Mod, y::Mod) = modulus(x) == modulus(y) && value(x) == value(y)
76-
# ==(x::Mod{N}, y::Mod{N}) where {N} = iszero(value(x - y))
7774

7875
# Apporximate equality
7976
rtoldefault(::Type{Mod{N,T}}) where {N,T} = rtoldefault(T)

src/Mods.jl/test/runtests.jl

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ using GenericTensorNetworks.Mods
33

44
@testset "Constructors" begin
55
@test one(Mod{17}) == Mod{17}(1)
6+
@test one(Mod{17}) != Mod{17}(2)
7+
@test one(Mod{17}) == Mod{17}(18)
68
@test oneunit(Mod{17}) == Mod{17}(1)
79
@test zero(Mod{17}) == 0
810
@test iszero(zero(Mod{17}))

src/arithematics.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ Examples
9090
------------------------
9191
```jldoctest; setup=(using GenericTensorNetworks)
9292
julia> TruncatedPoly((1,2,3), 6)
93-
x^4 + 2*x^5 + 3*x^6
93+
x + 2*x + 3*x
9494
9595
julia> TruncatedPoly((1,2,3), 6) * TruncatedPoly((5,2,1), 3)
96-
20*x^7 + 8*x^8 + 3*x^9
96+
20*x + 8*x + 3*x
9797
9898
julia> TruncatedPoly((1,2,3), 6) + TruncatedPoly((5,2,1), 3)
99-
x^4 + 2*x^5 + 3*x^6
99+
x + 2*x + 3*x
100100
```
101101
"""
102102
struct TruncatedPoly{K,T,TO} <: Number
@@ -163,7 +163,7 @@ function Base.show(io::IO, ::MIME"text/plain", x::TruncatedPoly{K}) where K
163163
if isinf(x.maxorder)
164164
print(io, 0)
165165
else
166-
print(io, Polynomial(x))
166+
print(io, LaurentPolynomial(x))
167167
end
168168
end
169169
Polynomials.Polynomial(x::TruncatedPoly{K, T}) where {K, T} = Polynomial(vcat(zeros(T, Int(x.maxorder)-K+1), [x.coeffs...]))

0 commit comments

Comments
 (0)