Skip to content

Commit 6cbe36f

Browse files
author
Miha Zgubic
committed
first few
1 parent dbc8134 commit 6cbe36f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

test/rulesets/LinearAlgebra/structured.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,23 @@
22
@testset "/ and \\ on Square Matrixes" begin
33
@testset "//, $T on the RHS" for T in (Diagonal, UpperTriangular, LowerTriangular)
44
RHS = T(randn(T == Diagonal ? 10 : (10, 10)))
5-
Y = randn(5, 10)
6-
= randn(size(/(Y, RHS))...)
7-
rrule_test(/, Ȳ, (Y, randn(size(Y))), (RHS, randn(size(RHS))))
5+
test_rrule(/, randn(5, 10), RHS)
86
end
97

108
@testset "\\ $T on LHS" for T in (Diagonal, UpperTriangular, LowerTriangular)
119
LHS = T(randn(T == Diagonal ? 10 : (10, 10)))
12-
y = randn(10)
13-
= randn(size(\(LHS, y))...)
14-
rrule_test(\, ȳ, (LHS, randn(size(LHS))), (y, randn(10)))
15-
Y = randn(10, 10)
16-
= randn(10, 10)
17-
rrule_test(\, Ȳ, (LHS, randn(size(LHS))), (Y, randn(size(Y))))
10+
test_rrule(\, LHS, y = randn(10))
11+
test_rrule(\, LHS, y = randn(10, 10))
1812
end
1913
end
2014

2115
@testset "Diagonal" begin
2216
N = 3
23-
rrule_test(Diagonal, randn(N, N), (randn(N), randn(N)))
17+
test_rrule(Diagonal, randn(N))
2418
D = Diagonal(randn( N))
25-
rrule_test(Diagonal, D, (randn(N), randn(N)))
19+
test_rrule(Diagonal, randn(N); output_tangent=D)
2620
# Concrete type instead of UnionAll
27-
rrule_test(typeof(D), D, (randn(N), randn(N)))
21+
test_rrule(typeof(D), randn(N); output_tangent=D)
2822

2923
# TODO: replace this with a `rrule_test` once we have that working
3024
# see https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/24

0 commit comments

Comments
 (0)