Skip to content

Commit 42d1762

Browse files
Merge pull request #505 from JoshuaLampert/format
Run formatter
2 parents 5271d8b + 4df8f6b commit 42d1762

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

src/array_partition.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,4 +636,4 @@ end
636636

637637
function Adapt.adapt_structure(to, ap::ArrayPartition)
638638
ArrayPartition(map(x -> Adapt.adapt(to, x), ap.x)...)
639-
end
639+
end

src/named_array_partition.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ end
151151

152152
#Overwrite ArrayInterface zeromatrix to work with NamedArrayPartitions & implicit solvers within OrdinaryDiffEq
153153
function ArrayInterface.zeromatrix(A::NamedArrayPartition)
154-
B = ArrayPartition(A)
155-
x = reduce(vcat,vec.(B.x))
154+
B = ArrayPartition(A)
155+
x = reduce(vcat, vec.(B.x))
156156
x .* x' .* false
157157
end
158158

test/basic_indexing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ u[1, [1, 3], 2] .= [7.0, 9.0]
182182

183183
# 3D inner arrays (tensors) with ragged third dimension
184184
u = VectorOfArray([zeros(2, 1, n) for n in (2, 3)])
185-
@test size(view(u, :, :, :, 1)) == (2, 1, 2)
186-
@test size(view(u, :, :, :, 2)) == (2, 1, 3)
185+
@test size(view(u,:,:,:,1)) == (2, 1, 2)
186+
@test size(view(u,:,:,:,2)) == (2, 1, 3)
187187
# assign into a slice of the second inner array using last index Int
188188
u[2, 1, :, 2] .= [7.0, 8.0, 9.0]
189189
@test vec(u.u[2][2, 1, :]) == [7.0, 8.0, 9.0]

test/gpu/arraypartition_gpu.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ b = ArrayPartition(([0.0f0] |> cu, [0.0f0] |> cu, [0.0f0] |> cu))
2424

2525
# Test adapt from ArrayPartition with CuArrays to ArrayPartition with CPU arrays
2626

27-
a = CuArray(Float64.([1., 2., 3., 4.]))
28-
b = CuArray(Float64.([1., 2., 3., 4.]))
27+
a = CuArray(Float64.([1.0, 2.0, 3.0, 4.0]))
28+
b = CuArray(Float64.([1.0, 2.0, 3.0, 4.0]))
2929
part_a_gpu = ArrayPartition(a, b)
3030
part_a = adapt(Array{Float32}, part_a_gpu)
3131

32-
c = Float32.([1., 2., 3., 4.])
33-
d = Float32.([1., 2., 3., 4.])
32+
c = Float32.([1.0, 2.0, 3.0, 4.0])
33+
d = Float32.([1.0, 2.0, 3.0, 4.0])
3434
part_b = ArrayPartition(c, d)
3535

3636
@test part_a == part_b # Test equality
@@ -42,7 +42,7 @@ for i in 1:length(part_a.x)
4242
@test typeof(sub_a) === typeof(sub_b) # Test type equality
4343
end
4444

45-
x = ArrayPartition((CUDA.zeros(2),CUDA.zeros(2)))
45+
x = ArrayPartition((CUDA.zeros(2), CUDA.zeros(2)))
4646
@test ArrayInterface.zeromatrix(x) isa CuMatrix
47-
@test size(ArrayInterface.zeromatrix(x)) == (4,4)
48-
@test maximum(abs, x) == 0f0
47+
@test size(ArrayInterface.zeromatrix(x)) == (4, 4)
48+
@test maximum(abs, x) == 0.0f0

test/named_array_partition_tests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ using RecursiveArrayTools, ArrayInterface, Test
1010
@test typeof(x .+ x[1:end]) <: Vector # test broadcast precedence
1111
@test all(x .== x[1:end])
1212
@test ArrayInterface.zeromatrix(x) isa Matrix
13-
@test size(ArrayInterface.zeromatrix(x)) == (30,30)
13+
@test size(ArrayInterface.zeromatrix(x)) == (30, 30)
1414
y = copy(x)
1515
@test zero(x, (10, 20)) == zero(x) # test that ignoring dims works
1616
@test typeof(zero(x)) <: NamedArrayPartition
1717
@test (y .*= 2).a[1] 2 # test in-place bcast
18-
1918

2019
@test length(Array(x)) == 30
2120
@test typeof(Array(x)) <: Array

test/partitions_test.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,13 @@ end
329329
end
330330

331331
# Test adapt on ArrayPartition from Float64 to Float32 arrays
332-
a = Float64.([1., 2., 3., 4.])
333-
b = Float64.([1., 2., 3., 4.])
332+
a = Float64.([1.0, 2.0, 3.0, 4.0])
333+
b = Float64.([1.0, 2.0, 3.0, 4.0])
334334
part_a_64 = ArrayPartition(a, b)
335335
part_a = adapt(Array{Float32}, part_a_64)
336336

337-
c = Float32.([1., 2., 3., 4.])
338-
d = Float32.([1., 2., 3., 4.])
337+
c = Float32.([1.0, 2.0, 3.0, 4.0])
338+
d = Float32.([1.0, 2.0, 3.0, 4.0])
339339
part_b = ArrayPartition(c, d)
340340

341341
@test part_a == part_b # Test equality of partitions
@@ -345,4 +345,4 @@ for i in 1:length(part_a.x)
345345
sub_b = part_b.x[i]
346346
@test sub_a == sub_b # Test for value equality
347347
@test typeof(sub_a) === typeof(sub_b) # Test type equality
348-
end
348+
end

0 commit comments

Comments
 (0)