Skip to content

Commit

Permalink
formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Dec 12, 2024
1 parent dea9c9d commit a4fcfc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions test/test_NamedDimsArraysTensorAlgebraExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
na_fused = fusedims(na, (k, i) => "a", (j, l) => "b")
# Fuse all dimensions.
@test unname(na_fused, ("a", "b"))
reshape(unname(na, (k, i, j, l)), (unname(k) * unname(i), unname(j) * unname(l)))
reshape(unname(na, (k, i, j, l)), (unname(k) * unname(i), unname(j) * unname(l)))
na_fused = fusedims(na, (k, i) => "a")
# Fuse a subset of dimensions.
@test unname(na_fused, ("a", "j", "l"))
reshape(unname(na, (k, i, j, l)), (unname(k) * unname(i), unname(j), unname(l)))
reshape(unname(na, (k, i, j, l)), (unname(k) * unname(i), unname(j), unname(l)))
end
@testset "splitdims" begin
a, b = named.((6, 20), ("a", "b"))
Expand All @@ -33,11 +33,11 @@ elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
# Split all dimensions.
na_split = splitdims(na, "a" => (k, i), "b" => (j, l))
@test unname(na_split, ("k", "i", "j", "l"))
reshape(unname(na, ("a", "b")), (unname(k), unname(i), unname(j), unname(l)))
reshape(unname(na, ("a", "b")), (unname(k), unname(i), unname(j), unname(l)))
# Split a subset of dimensions.
na_split = splitdims(na, "a" => (j, i))
@test unname(na_split, ("j", "i", "b"))
reshape(unname(na, ("a", "b")), (unname(j), unname(i), unname(b)))
reshape(unname(na, ("a", "b")), (unname(j), unname(i), unname(b)))
end
@testset "qr" begin
dims = (2, 2, 2, 2)
Expand Down
14 changes: 7 additions & 7 deletions test/test_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ using NamedDimsArrays:
@test axes(na) == (1:3, 1:4)
@test namedaxes(na) == (named(1:3, "i"), named(1:4, "j"))
@test randn(named(3, "i"), named(4, "j")) isa NamedDimsArray
@test na["i"=>1, "j"=>2] == a[1, 2]
@test na["j"=>2, "i"=>1] == a[1, 2]
na["j"=>2, "i"=>1] = 12
@test na["i" => 1, "j" => 2] == a[1, 2]
@test na["j" => 2, "i" => 1] == a[1, 2]
na["j" => 2, "i" => 1] = 12
@test na[1, 2] == 12
@test na[j=>1, i=>2] == a[2, 1]
@test na[aj=>1, ai=>2] == a[2, 1]
na[j=>1, i=>2] = 21
@test na[j => 1, i => 2] == a[2, 1]
@test na[aj => 1, ai => 2] == a[2, 1]
na[j => 1, i => 2] = 21
@test na[2, 1] == 21
na[aj=>1, ai=>2] = 2211
na[aj => 1, ai => 2] = 2211
@test na[2, 1] == 2211
na′ = align(na, ("j", "i"))
@test a == permutedims(unname(na′), (2, 1))
Expand Down

0 comments on commit a4fcfc4

Please sign in to comment.