Skip to content

Commit

Permalink
fix tensor functions 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Apr 8, 2020
1 parent 688eb91 commit de6209a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ os:
- linux
- osx
julia:
- 1.0
# - 1.0
- 1.4
- nightly
env:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ HalfIntegers = "1"
WignerSymbols = "1"
TensorOperations = "2.1"
LRUCache = "1.0.2"
julia = "1"
julia = "1.4, ~1.0.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment:
matrix:
- julia_version: 1.0
# - julia_version: 1.0
- julia_version: 1.4
- julia_version: nightly

Expand Down
6 changes: 3 additions & 3 deletions src/tensors/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ for f in (:cos, :sin, :tan, :cot, :cosh, :sinh, :tanh, :coth, :atan, :acot, :asi
return TensorMap(data, codomain(t), domain(t))
else
if eltype(t) <: Real
data = SectorDict{G,T}(c=>real($f(b)) for (c,b) in blocks(t))
datadict = SectorDict{G,T}(c=>real($f(b)) for (c,b) in blocks(t))
else
data = SectorDict{G,T}(c=>$f(b) for (c,b) in blocks(t))
datadict = SectorDict{G,T}(c=>$f(b) for (c,b) in blocks(t))
end
return TensorMap(data, codomain(t), domain(t))
return TensorMap(datadict, codomain(t), domain(t))
end
end
end
Expand Down
43 changes: 21 additions & 22 deletions test/tensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -371,35 +371,34 @@ for (G,V) in ((Trivial, Vtr), (ℤ₂, Vℤ₂), (ℤ₃, Vℤ₃), (U₁, VU₁
@test reshape(convert(Array, sqrt(t^2)), (s,s))
sqrt(reshape(convert(Array, t^2), (s,s)))

@test exp(@inferred log(expt)) expt
@test reshape(convert(Array, log(expt)), (s,s))
log(reshape(convert(Array, expt), (s,s)))


@test (@inferred cos(t))^2 + (@inferred sin(t))^2 id(W)
@test (@inferred tan(t)) sin(t)/cos(t)
@test (@inferred cot(t)) cos(t)/sin(t)
@test (@inferred cosh(t))^2 - (@inferred sinh(t))^2 id(W)
@test (@inferred tanh(t)) sinh(t)/cosh(t)
@test (@inferred coth(t)) cosh(t)/sinh(t)

@static if VERSION >= v"1.0.6"
@test exp(@inferred log(expt)) expt
@test reshape(convert(Array, log(expt)), (s,s))
log(reshape(convert(Array, expt), (s,s)))

t1 = sin(t)
@test sin(@inferred asin(t1)) t1
t2 = cos(t)
@test cos(@inferred acos(t2)) t2
t3 = sinh(t)
@test sinh(@inferred asinh(t3)) t3
t4 = cosh(t)
@test cosh(@inferred acosh(t4)) t4
t5 = tan(t)
@test tan(@inferred atan(t5)) t5
t6 = cot(t)
@test cot(@inferred acot(t6)) t6
t7 = tanh(t)
@test tanh(@inferred atanh(t7)) t7
t8 = coth(t)
@test coth(@inferred acoth(t8)) t8
end
t1 = sin(t)
@test sin(@inferred asin(t1)) t1
t2 = cos(t)
@test cos(@inferred acos(t2)) t2
t3 = sinh(t)
@test sinh(@inferred asinh(t3)) t3
t4 = cosh(t)
@test cosh(@inferred acosh(t4)) t4
t5 = tan(t)
@test tan(@inferred atan(t5)) t5
t6 = cot(t)
@test cot(@inferred acot(t6)) t6
t7 = tanh(t)
@test tanh(@inferred atanh(t7)) t7
t8 = coth(t)
@test coth(@inferred acoth(t8)) t8
end
end
@testset TimedTestSet "Tensor product: test via norm preservation" begin
Expand Down

2 comments on commit de6209a

@Jutho
Copy link
Owner Author

@Jutho Jutho commented on de6209a Apr 8, 2020

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/12600

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.0 -m "<description of version>" de6209abb4a011f0c52207236c32f28118ce3cd8
git push origin v0.3.0

Please sign in to comment.