Skip to content

Commit b813e99

Browse files
committed
add tests
1 parent a685ba8 commit b813e99

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

NDTensors/test/test_dense.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ NDTensors.dim(i::MyInd) = i.dim
8383
@test A[2, 2] == Aview[1, 1]
8484
end
8585

86+
## Testing A .= α .* B .+ β .* A
87+
C = copy(A)
88+
@allowscalar fill!(B, zero(elt))
89+
β = elt(2.0)
90+
α = elt(1.0)
91+
permutedims!!(A, B, (1,2), (a,b) -> +(*(β, a), *(α, b)))
92+
@allowscalar 2.0 .* C == A
93+
randn!(B)
94+
C = copy(A)
95+
A = permutedims!!(A, B, (1,2), (a,b) -> +(*(β, a), *(α, b)))
96+
@allowscalar for i in 1:3, j in 1:4
97+
@test A[i,j] == α * B[i,j] + β * C[i,j]
98+
end
99+
86100
## add elt around 2.0 to preserve the eltype of A.
87101
@test data(A * elt(2.0)) == data(elt(2.0) * A)
88102

0 commit comments

Comments
 (0)