Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed Jun 20, 2024
1 parent f5c2d39 commit d0dcb4d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions NDTensors/test/test_blocksparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ using Test: @test, @test_throws, @testset
@allowscalar for I in eachindex(C)
@test C[I] == A[I] + B[I]
end
Cp = NDTensors.map_diag((i -> i* 2), C)
Cp = NDTensors.map_diag((i -> i * 2), C)
@allowscalar for i in 1:diaglength(Cp)
@test Cp[i,i] == 2.0 * C[i,i]
@test Cp[i, i] == 2.0 * C[i, i]
end

Ap = permutedims(A, (2, 1))
Expand Down
6 changes: 3 additions & 3 deletions NDTensors/test/test_dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ NDTensors.dim(i::MyInd) = i.dim
randn!(B)
C = copy(A)
C = permutedims!!(C, B, (1, 2), +)
Cp = NDTensors.map_diag((i->i * 2), C)
Cp = NDTensors.map_diag((i -> i * 2), C)
@allowscalar for i in 1:diaglength(Cp)
@test Cp[i,i] == 2.0 * C[i,i]
@test Cp[i, i] == 2.0 * C[i, i]
end

Ap = permutedims(A, (2, 1))
Expand Down Expand Up @@ -311,4 +311,4 @@ end

nothing
end
w
w
7 changes: 3 additions & 4 deletions NDTensors/test/test_diag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using LinearAlgebra: dot
# @allowscalar for i in 1:diaglength(S)
# @test S[i,i] == 2.0 * D[i,i]
# end

vr = rand(elt, d)
D = dev(tensor(Diag(vr), (d, d)))
Da = Array(D)
Expand All @@ -62,11 +62,10 @@ using LinearAlgebra: dot
end
end
end
S = NDTensors.map_diag((i->i * 2), dev(D))
S = NDTensors.map_diag((i -> i * 2), dev(D))
@allowscalar for i in 1:diaglength(S)
@test S[i,i] == 2.0 * D[i,i]
@test S[i, i] == 2.0 * D[i, i]
end


# Regression test for https://github.com/ITensor/ITensors.jl/issues/1199
S = dev(tensor(Diag(randn(elt, 2)), (2, 2)))
Expand Down

0 comments on commit d0dcb4d

Please sign in to comment.