Skip to content

Commit 9e55091

Browse files
authored
update to new registration process (#47), require Julia v1.0+
1 parent 7b43cd6 commit 9e55091

File tree

5 files changed

+41
-28
lines changed

5 files changed

+41
-28
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 0.7
87
- 1.0
98
- 1.1
9+
- 1.2
1010
- nightly
1111

1212
matrix:
1313
allow_failures:
14+
- julia: 1.2
1415
- julia: nightly
1516
notifications:
1617
email: false

Project.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name = "LinearMaps"
2+
uuid = "7a12625a-238d-50fd-b39a-03d52299707e"
3+
version = "2.4.0"
4+
5+
[deps]
6+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
7+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
8+
9+
[compat]
10+
julia = "≥ 1.0.0"
11+
12+
[extras]
13+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
14+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
15+
Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0"
16+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
17+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
18+
19+
[targets]
20+
test = ["LinearAlgebra", "SparseArrays", "Test", "BenchmarkTools", "Quaternions"]

REQUIRE

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/REQUIRE

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/runtests.jl

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@ using Test
22
using LinearMaps
33
using SparseArrays
44
using LinearAlgebra
5-
6-
# adopted from: https://discourse.julialang.org/t/way-to-return-the-number-of-allocations/5167/10
7-
macro numalloc(expr)
8-
return quote
9-
let
10-
local f
11-
function f()
12-
n1 = Base.gc_num()
13-
$(expr)
14-
n2 = Base.gc_num()
15-
diff = Base.GC_Diff(n2, n1)
16-
Base.gc_alloc_count(diff)
17-
end
18-
f()
19-
end
20-
end
21-
end
5+
using BenchmarkTools
226

237
A = 2 * rand(ComplexF64, (20, 10)) .- 1
248
v = rand(ComplexF64, 10)
@@ -61,7 +45,8 @@ AV = A * V
6145
@test M * v == Av
6246
@test N * v == Av
6347
@test @inferred mul!(copy(w), M, v) == mul!(copy(w), A, v)
64-
@test ((@allocated mul!(w, M, v)) == 0)
48+
b = @benchmarkable mul!(w, M, v)
49+
@test run(b, samples=3).allocs == 0
6550
@test @inferred mul!(copy(w), N, v) == Av
6651

6752
# mat-vec-mul
@@ -201,12 +186,13 @@ end
201186
CS! = LinearMap(cumsum!, 10; ismutating=true)
202187
v = rand(10)
203188
u = similar(v)
204-
mul!(u, CS!, v)
205-
@test ((@allocated mul!(u, CS!, v)) == 0)
189+
b = @benchmarkable mul!(u, CS!, v)
190+
@test run(b, samples=3).allocs == 0
206191
n = 10
207192
L = sum(fill(CS!, n))
208193
@test mul!(u, L, v) n * cumsum(v)
209-
@test ((@numalloc mul!(u, L, v)) <= 1)
194+
b = @benchmarkable mul!(u, L, v)
195+
@test run(b, samples=5).allocs <= 1
210196

211197
A = 2 * rand(ComplexF64, (10, 10)) .- 1
212198
B = rand(size(A)...)
@@ -215,8 +201,8 @@ N = LinearMap(B)
215201
LC = M + N
216202
v = rand(ComplexF64, 10)
217203
w = similar(v)
218-
mul!(w, M, v)
219-
@test ((@allocated mul!(w, M, v)) == 0)
204+
b = @benchmarkable mul!(w, M, v)
205+
@test run(b, samples=3).allocs == 0
220206
@testset "linear combinations" begin
221207
# @test_throws ErrorException LinearMaps.LinearCombination{ComplexF64}((M, N), (1, 2, 3))
222208
@test @inferred size(3M + 2.0N) == size(A)
@@ -420,10 +406,19 @@ end
420406
β = UniformScaling(Quaternion.(rand(4)...))
421407
L = LinearMap(A)
422408
@test Array(L) == A
409+
@test Array(L') == A'
410+
@test Array(transpose(L)) == transpose(A)
423411
@test Array* L) == α * A
424412
@test Array(L * α) == A * α
425413
@test Array* L) == α * A
426-
@test Array(L * α) == A * α
414+
@test Array(L * α ) == A * α
415+
@test Array* L') == α * A'
416+
@test Array((α * L')') * A')' A * conj(α)
417+
@test L * x A * x
418+
@test L' * x A' * x
419+
@test α * (L * x) α * (A * x)
420+
@test α * L * x α * A * x
421+
@test* L') * x * A') * x
427422
@test* L')' * x * A')' * x
428423
@test* L')' * v * A')' * v
429424
@test Array(@inferred adjoint* L * β)) conj(β) * A' * conj(α)

0 commit comments

Comments
 (0)