Skip to content

Commit 43a2756

Browse files
committed
comments
1 parent 81f85b7 commit 43a2756

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/rulesets/LinearAlgebra/norm.jl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
@testset "norm functions" begin
2+
3+
# First test the un-exported functions which norm(A,p) calls
4+
# ==========================================================
5+
26
@testset "$fnorm(x::Array{$T,$(length(sz))})" for
37
fnorm in (
48
LinearAlgebra.norm1,
@@ -61,6 +65,10 @@ println("... integer")
6165
@test unthunk(int_back(1.0)[2]) unthunk(float_back(1.0)[2])
6266
end
6367
end
68+
69+
# Next test norm(x, p=2) -- two methods
70+
# =====================================
71+
6472
@testset "norm(x::Array{$T,$(length(sz))})" for
6573
T in (Float64, ComplexF64),
6674
sz in [(0,), (3,), (3, 3), (3, 2, 1)]
@@ -142,7 +150,8 @@ println("starting p-norm p=$p, T=$T, sz=$sz")
142150
@test unthunk(int_back(1.0)[2]) unthunk(float_back(1.0)[2])
143151
end
144152
end
145-
@testset "norm($fdual(::Vector{$T}), p)" for
153+
# Extra test for norm(adjoint vector, p)
154+
@testset "norm($fdual(::Vector{$T}), 2.5)" for
146155
T in (Float64, ComplexF64),
147156
fdual in (adjoint, transpose)
148157
println("starting $fdual norm T=$T")
@@ -154,6 +163,10 @@ println("starting $fdual norm T=$T")
154163
= rand_tangent(norm(x, p))
155164
@test extern(rrule(norm, x, p)[2](ȳ)[2]) isa typeof(x)
156165
end
166+
167+
# Scalar norm(x, p)
168+
# =================
169+
157170
@testset "norm(x::$T, p)" for T in (Float64, ComplexF64)
158171
@testset "p = $p" for p in (-1.0, 2.0, 2.5)
159172
println("starting scalar p-norm tests, p=$p, T=$T")
@@ -181,6 +194,9 @@ println("starting 0-norm tests, T=$T")
181194
end
182195
end
183196

197+
# normalise(x, p) and normalise(A, p)
198+
# ===================================
199+
184200
@testset "normalize" begin
185201
@testset "x::Vector{$T}" for T in (Float64, ComplexF64)
186202
x = randn(T, 3)

0 commit comments

Comments
 (0)