Skip to content

Commit

Permalink
remove all tensor cast stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed Apr 5, 2024
1 parent 1be857a commit fe5d5c1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Memoization = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
TSVD = "9449cd9e-2762-5aa3-a617-5413e99d722e"
TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
TransmuteDims = "24ddb15e-299a-5cc3-8414-dbddc482d9ca"
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"

[compat]
Expand All @@ -27,7 +25,6 @@ Memoization = "0.2.1"
NNlib = "0.9.13"
SparseArrays = "1.9"
TSVD = "0.4.4"
TensorCast = "0.4.7"
TensorOperations = "4"
cuTENSOR = "1.1.0"
julia = "1.9, 1.10"
Expand Down
2 changes: 1 addition & 1 deletion src/SpinGlassTensors.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SpinGlassTensors
using LinearAlgebra, MKL
using TensorOperations, TensorCast
using TensorOperations
using LowRankApprox, TSVD
using CUDA, CUDA.CUSPARSE
using cuTENSOR
Expand Down
5 changes: 4 additions & 1 deletion src/contractions/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ function update_reduced_env_right(RR::S, M0::S) where {S<:Tensor{<:Real,2}}
end

function contract_tensors43(B::Tensor{R,4}, A::Tensor{R,3}) where {R<:Real}
@matmul C[(x, y), (b, a), z] := sum(σ) B[y, z, a, σ] * A[x, b, σ]
# @matmul C[(x, y), (b, a), z] := sum(σ) B[y, z, a, σ] * A[x, b, σ]
@tensor C[x, y, b, a, z]:=B[y, z, a, σ] * A[x, b, σ]
C = reshape(C, size(C, 1) * size(C, 2), size(C, 3) * size(C, 4), size(C, 5))
return C
end

function corner_matrix(
Expand Down
6 changes: 3 additions & 3 deletions src/mps/canonise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function measure_spectrum(ψ::QMps{T}) where {T<:Real}
schmidt = Dict() # {Site =>AbstractArray}
for i reverse.sites)
B = permutedims(Array(ψ[i]), (1, 3, 2)) # [x, σ, α]
@matmul M[x, σ, y] := sum(α) B[x, σ, α] * R[α, y]
@tensor M[x, σ, y] := B[x, σ, α] * R[α, y]
# @cast M[x, (σ, y)] := M[x, σ, y] TODO: restore when deps merged
M = reshape(M, :, size(M, 2) * size(M, 3))
Dcut, tolS = 100000, 0.0
Expand Down Expand Up @@ -70,7 +70,7 @@ function _right_sweep!(
R = ψ.onGPU ? CUDA.ones(T, 1, 1) : ones(T, 1, 1)
for i ψ.sites
A = ψ[i]
@matmul M[x, y, σ] := sum(α) R[x, α] * A[α, y, σ]
@tensor M[x, y, σ] := R[x, α] * A[α, y, σ]
M = permutedims(M, (3, 1, 2)) # [σ, x, y]
# @cast M[(σ, x), y] := M[σ, x, y] TODO: restore when deps merged
M = reshape(M, size(M, 1) * size(M, 2), :)
Expand All @@ -91,7 +91,7 @@ function _left_sweep!(
R = ψ.onGPU ? CUDA.ones(T, 1, 1) : ones(T, 1, 1)
for i reverse.sites)
B = permutedims(ψ[i], (1, 3, 2)) # [x, σ, α]
@matmul M[x, σ, y] := sum(α) B[x, σ, α] * R[α, y]
@tensor M[x, σ, y] := B[x, σ, α] * R[α, y]
# @cast M[x, (σ, y)] := M[x, σ, y]
M = reshape(M, size(M, 1), size(M, 2) * size(M, 3))
R, Q = rq_fact(M, Dcut, tolS; toGPU = ψ.onGPU, kwargs...)
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using SpinGlassTensors
using TensorOperations
using TensorCast
using Logging
using LinearAlgebra
using CUDA
Expand Down

0 comments on commit fe5d5c1

Please sign in to comment.