Skip to content

Commit a66b5d3

Browse files
authored
bump versions of OMEinsum and Mods (#78)
* bump versions of Ge OMEinsum and Mods * bump version, fix random seed * fix test * fix tests dependency
1 parent 2c6c388 commit a66b5d3

19 files changed

+766
-19
lines changed

Project.toml

Lines changed: 3 additions & 12 deletions
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 <cacate0129@gmail.com> and contributors"]
4-
version = "1.4.1"
4+
version = "1.5.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -12,7 +12,6 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1212
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1313
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
LuxorGraphPlot = "1f49bdf2-22a7-4bc4-978b-948dc219fbbc"
15-
Mods = "7475f97c-0381-53b1-977b-4c60186c8d62"
1615
OMEinsum = "ebe7aa44-baf0-506c-a96f-8464559b3922"
1716
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
1817
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
@@ -39,8 +38,7 @@ FFTW = "1.4"
3938
Graphs = "1.7"
4039
LinearAlgebra = "1"
4140
LuxorGraphPlot = "0.3"
42-
Mods = "1.3"
43-
OMEinsum = "0.7"
41+
OMEinsum = "0.8"
4442
Polynomials = "4"
4543
Primes = "0.5"
4644
Printf = "1"
@@ -49,11 +47,4 @@ SIMDTypes = "0.1"
4947
Serialization = "1"
5048
StatsBase = "0.33, 0.34, 0.35"
5149
TropicalNumbers = "0.4, 0.5, 0.6"
52-
julia = "1.9"
53-
54-
[extras]
55-
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
56-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
57-
58-
[targets]
59-
test = ["Test", "Documenter", "CUDA"]
50+
julia = "1.9"

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Pkg
22
using GenericTensorNetworks
3-
using GenericTensorNetworks: TropicalNumbers, Polynomials, Mods, OMEinsum, OMEinsum.OMEinsumContractionOrders, LuxorGraphPlot
3+
using GenericTensorNetworks: TropicalNumbers, Polynomials, OMEinsum, OMEinsum.OMEinsumContractionOrders, LuxorGraphPlot
44
using Documenter
55
using DocThemeIndigo
66
using Literate
@@ -17,7 +17,7 @@ indigo = DocThemeIndigo.install(GenericTensorNetworks)
1717
DocMeta.setdocmeta!(GenericTensorNetworks, :DocTestSetup, :(using GenericTensorNetworks); recursive=true)
1818

1919
makedocs(;
20-
modules=[GenericTensorNetworks, TropicalNumbers, Mods, OMEinsum, OMEinsumContractionOrders, LuxorGraphPlot],
20+
modules=[GenericTensorNetworks, TropicalNumbers, OMEinsum, OMEinsumContractionOrders, LuxorGraphPlot],
2121
authors="Jinguo Liu",
2222
repo="https://github.com/QuEraComputing/GenericTensorNetworks.jl/blob/{commit}{path}#{line}",
2323
sitename="GenericTensorNetworks.jl",

docs/src/ref.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ is_commutative_semiring
9292
TropicalNumbers.Tropical
9393
TropicalNumbers.CountingTropical
9494
ExtendedTropical
95-
Mods.Mod
95+
GenericTensorNetworks.Mods.Mod
9696
TruncatedPoly
9797
Max2Poly
9898
ConfigEnumerator

src/GenericTensorNetworks.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using LuxorGraphPlot
1010
import Polynomials
1111
using Polynomials: Polynomial, LaurentPolynomial, printpoly, fit
1212
using FFTW
13-
using Mods, Primes
13+
using Primes
1414
using DocStringExtensions
1515
using Base.Cartesian
1616
import AbstractTrees: children, printnode, print_tree
@@ -65,6 +65,10 @@ export show_graph, spring_layout!, show_gallery, show_einsum
6565

6666
project_relative_path(xs...) = normpath(joinpath(dirname(dirname(pathof(@__MODULE__))), xs...))
6767

68+
# Mods.jl fixed to v1.3.4
69+
include("Mods.jl/src/Mods.jl")
70+
using .Mods
71+
6872
include("utils.jl")
6973
include("bitvector.jl")
7074
include("arithematics.jl")

src/Mods.jl/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Files generated by invoking Julia with --code-coverage
2+
*.jl.cov
3+
*.jl.*.cov
4+
5+
# Files generated by invoking Julia with --track-allocation
6+
*.jl.mem
7+
8+
# System-specific files and directories generated by the BinaryProvider and BinDeps packages
9+
# They contain absolute paths specific to the host computer, and so should not be committed
10+
deps/deps.jl
11+
deps/build.log
12+
deps/downloads/
13+
deps/usr/
14+
deps/src/
15+
16+
# Build artifacts for creating documentation generated by the Documenter package
17+
docs/build/
18+
docs/site/
19+
20+
# File generated by Pkg, the package manager, based on a corresponding Project.toml
21+
# It records a fixed state of all packages used by the project. As such, it should not be
22+
# committed for packages, but should be committed for applications that require a static
23+
# environment.
24+
Manifest.toml
25+
26+
.vscode/*

src/Mods.jl/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Ed Scheinerman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

src/Mods.jl/Project.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name = "Mods"
2+
uuid = "7475f97c-0381-53b1-977b-4c60186c8d62"
3+
author = ["Edward Scheinerman <ers@jhu.edu>"]
4+
version = "2.1.1"
5+
6+
[compat]
7+
julia = "1"
8+
9+
[extras]
10+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
11+
12+
[targets]
13+
test = ["Test"]

src/Mods.jl/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Mods
2+
3+
Modular arithmetic for Julia.
4+
5+
This folder is a copy of v1.3.4 of the package `Mods.jl` by Ed Scheinerman, which is available at:
6+
https://github.com/scheinerman/Mods.jl
7+
8+
We will switch back to the Github repo when the package becomes compatible with `GenericTensorNetworks.jl`.

src/Mods.jl/src/GaussMods.jl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import Base: mod, real, imag, reim, conj, promote_rule
2+
3+
export GaussMod, AbstractMod
4+
5+
# mod support for Gaussian integers until officially adopted into Base
6+
mod(z::Complex{<:Integer}, n::Integer) = Complex(mod(real(z), n), mod(imag(z), n))
7+
8+
"""
9+
`GaussMod{N,T}` is an alias of `Mod{N,Complex{T}}`.
10+
It is for computing Gaussian Modulus.
11+
"""
12+
const GaussMod{N,T} = Mod{N,Complex{T}}
13+
GaussMod{N}(x::T) where {N,T<:Integer} = Mod{N,Complex{T}}(x)
14+
GaussMod{N}(x::T) where {N,T<:Complex} = Mod{N,T}(x)
15+
Mod{N}(x::Complex{Rational{T}}) where {N,T} = Mod{N}(real(x)) + Mod{N}(imag(x)) * im
16+
Mod{N}(re::Integer, im::Integer) where {N} = Mod{N}(Complex(re, im))
17+
18+
reim(x::AbstractMod) = (real(x), imag(x))
19+
real(x::Mod{N}) where {N} = Mod{N}(real(x.val))
20+
imag(x::Mod{N}) where {N} = Mod{N}(imag(x.val))
21+
conj(x::Mod{N}) where {N} = Mod{N}(conj(x.val))
22+
23+
# ARITHMETIC
24+
function (+)(x::GaussMod{N,T}, y::GaussMod{N,T}) where {N,T}
25+
xx = widen(x.val)
26+
yy = widen(y.val)
27+
zz = mod(xx + yy, N)
28+
return GaussMod{N,T}(zz)
29+
end
30+
31+
(-)(x::GaussMod{N}) where {N} = Mod{N}(-x.val)
32+
33+
function (*)(x::GaussMod{N,T}, y::GaussMod{N,T}) where {N,T}
34+
xx = widen(x.val)
35+
yy = widen(y.val)
36+
zz = mod(xx * yy, N)
37+
return GaussMod{N,T}(zz)
38+
end
39+
40+
function inv(x::GaussMod{N}) where {N}
41+
try
42+
a, b = reim(x)
43+
bot = inv(a * a + b * b)
44+
aa = a * bot
45+
bb = -b * bot
46+
return aa + bb * im
47+
catch
48+
error("$x is not invertible")
49+
end
50+
end
51+
52+
is_invertible(x::GaussMod) = is_invertible(real(x * x'))
53+
rand(::Type{GaussMod{N}}, args::Integer...) where {N} = rand(GaussMod{N,Int}, args...)

0 commit comments

Comments
 (0)