Skip to content

Commit 12afe43

Browse files
committed
Set up libs/*/test/runtests.jl
1 parent ac2e2c9 commit 12afe43

File tree

14 files changed

+206
-157
lines changed

14 files changed

+206
-157
lines changed

libs/ArrayInterfaceBandedMatrices/Project.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@ BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
99
[compat]
1010
ArrayInterfaceCore = "0.1"
1111
BandedMatrices = "0.17"
12+
julia = "1.6"
1213

14+
[extras]
15+
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
16+
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
17+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
18+
19+
[targets]
20+
test = ["ArrayInterfaceCore","BandedMatrices","Test"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
using ArrayInterfaceCore
3+
using ArrayInterfaceBandedMatrices
4+
using BandedMatrices
5+
using Test
6+
7+
B=BandedMatrix(Ones(5,5), (-1,2))
8+
B[band(1)].=[1,2,3,4]
9+
B[band(2)].=[5,6,7]
10+
@test ArrayInterfaceCore.has_sparsestruct(B)
11+
rowind,colind=ArrayInterfaceCore.findstructralnz(B)
12+
@test [B[rowind[i],colind[i]] for i in 1:length(rowind)]==[5,6,7,1,2,3,4]
13+
B=BandedMatrix(Ones(4,6), (-1,2))
14+
B[band(1)].=[1,2,3,4]
15+
B[band(2)].=[5,6,7,8]
16+
rowind,colind=ArrayInterfaceCore.findstructralnz(B)
17+
@test [B[rowind[i],colind[i]] for i in 1:length(rowind)]==[5,6,7,8,1,2,3,4]
18+
@test ArrayInterfaceCore.isstructured(typeof(B))
19+
@test ArrayInterfaceCore.fast_matrix_colors(typeof(B))
20+

libs/ArrayInterfaceBlockBandedMatrices/Project.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ version = "0.1.0"
55

66
[deps]
77
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
8-
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
8+
ArrayInterfaceBandedMatrices = "2e50d22c-5be1-4042-81b1-c572ed69783d"
99
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
10+
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
1011

1112
[compat]
1213
ArrayInterfaceCore = "0.1"
14+
ArrayInterfaceBandedMatrices = "0.1"
1315
BlockBandedMatrices = "0.11"
1416
BlockArrays = "0.16"
17+
julia = "1.6"
18+
19+
[extras]
20+
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
21+
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
22+
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
23+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1524

25+
[targets]
26+
test = ["ArrayInterfaceCore","BlockArrays","BlockBandedMatrices","Test"]

libs/ArrayInterfaceBlockBandedMatrices/src/ArrayInterfaceBlockBandedMatrices.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module ArrayInterfaceBlockBandedMatrices
22

33
using ArrayInterfaceCore
4+
using ArrayInterfaceBandedMatrices
45
using BlockArrays
56
using BlockBandedMatrices
67

7-
struct BlockBandedMatrixIndex <: MatrixIndex
8+
struct BlockBandedMatrixIndex <: ArrayInterfaceCore.MatrixIndex
89
count::Int
910
refinds::Array{Int,1}
1011
refcoords::Array{Int,1}# storing col or row inds at ref points
@@ -14,8 +15,8 @@ Base.firstindex(i::BlockBandedMatrixIndex) = 1
1415
Base.lastindex(i::BlockBandedMatrixIndex) = i.count
1516
Base.length(i::BlockBandedMatrixIndex) = lastindex(i)
1617
function BlockBandedMatrixIndex(nrowblock, ncolblock, rowsizes, colsizes, l, u)
17-
blockrowind = BandedMatrixIndex(nrowblock, ncolblock, l, u, true)
18-
blockcolind = BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
18+
blockrowind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, true)
19+
blockcolind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
1920
sortedinds = sort(
2021
[(blockrowind[i], blockcolind[i]) for i = 1:length(blockrowind)],
2122
by = x -> x[1],
@@ -95,11 +96,11 @@ function ArrayInterfaceCore.findstructralnz(x::BlockBandedMatrices.BlockBandedMa
9596
u,
9697
)
9798
end
98-
struct BandedBlockBandedMatrixIndex <: MatrixIndex
99+
struct BandedBlockBandedMatrixIndex <: ArrayInterfaceCore.MatrixIndex
99100
count::Int
100101
refinds::Array{Int,1}
101102
refcoords::Array{Int,1}# storing col or row inds at ref points
102-
reflocalinds::Array{BandedMatrixIndex,1}
103+
reflocalinds::Array{ArrayInterfaceBandedMatrices.BandedMatrixIndex,1}
103104
isrow::Bool
104105
end
105106
Base.firstindex(i::BandedBlockBandedMatrixIndex) = 1
@@ -127,8 +128,8 @@ function BandedBlockBandedMatrixIndex(
127128
lambda,
128129
mu,
129130
)
130-
blockrowind = BandedMatrixIndex(nrowblock, ncolblock, l, u, true)
131-
blockcolind = BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
131+
blockrowind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, true)
132+
blockcolind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
132133
sortedinds = sort(
133134
[(blockrowind[i], blockcolind[i]) for i = 1:length(blockrowind)],
134135
by = x -> x[1],
@@ -142,14 +143,14 @@ function BandedBlockBandedMatrixIndex(
142143
refinds = Array{Int,1}()
143144
refrowcoords = Array{Int,1}()
144145
refcolcoords = Array{Int,1}()
145-
reflocalrowinds = Array{BandedMatrixIndex,1}()
146-
reflocalcolinds = Array{BandedMatrixIndex,1}()
146+
reflocalrowinds = Array{ArrayInterfaceBandedMatrices.BandedMatrixIndex,1}()
147+
reflocalcolinds = Array{ArrayInterfaceBandedMatrices.BandedMatrixIndex,1}()
147148
for ind in sortedinds
148149
rowind, colind = ind
149150
localrowind =
150-
BandedMatrixIndex(rowsizes[rowind], colsizes[colind], lambda, mu, true)
151+
ArrayInterfaceBandedMatrices.BandedMatrixIndex(rowsizes[rowind], colsizes[colind], lambda, mu, true)
151152
localcolind =
152-
BandedMatrixIndex(rowsizes[rowind], colsizes[colind], lambda, mu, false)
153+
ArrayInterfaceBandedMatrices.BandedMatrixIndex(rowsizes[rowind], colsizes[colind], lambda, mu, false)
153154
push!(refinds, currenti)
154155
push!(refrowcoords, rowheights[rowind])
155156
push!(refcolcoords, colwidths[colind])
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
using ArrayInterfaceBlockBandedMatrices
3+
using ArrayInterfaceCore
4+
using BlockBandedMatrices
5+
using Test
6+
7+
BB=BlockBandedMatrix(Ones(10,10),[1,2,3,4],[4,3,2,1],(1,0))
8+
BB[Block(1,1)].=[1 2 3 4]
9+
BB[Block(2,1)].=[5 6 7 8;9 10 11 12]
10+
rowind,colind=ArrayInterfaceCore.findstructralnz(BB)
11+
@test [BB[rowind[i],colind[i]] for i in 1:length(rowind)]==
12+
[1,5,9,2,6,10,3,7,11,4,8,12,
13+
1,1,1,1,1,1,1,1,1,1,1,1,1,1,
14+
1,1,1,1,1,1,1,1,1,1,1,1,1,1,
15+
1,1,1,1,1]
16+
@test ArrayInterfaceCore.isstructured(typeof(BB))
17+
@test ArrayInterfaceCore.has_sparsestruct(typeof(BB))
18+
@test ArrayInterfaceCore.fast_matrix_colors(typeof(BB))
19+
20+
dense=collect(Ones(8,8))
21+
for i in 1:8
22+
dense[:,i].=[1,2,3,4,5,6,7,8]
23+
end
24+
BBB=BandedBlockBandedMatrix(dense, [4, 4] ,[4, 4], (1, 1), (1, 1))
25+
rowind,colind=ArrayInterfaceCore.findstructralnz(BBB)
26+
@test [BBB[rowind[i],colind[i]] for i in 1:length(rowind)]==
27+
[1,2,3,1,2,3,4,2,3,4,5,6,7,5,6,7,8,6,7,8,
28+
1,2,3,1,2,3,4,2,3,4,5,6,7,5,6,7,8,6,7,8]
29+
@test ArrayInterfaceCore.isstructured(typeof(BBB))
30+
@test ArrayInterfaceCore.has_sparsestruct(typeof(BBB))
31+
@test ArrayInterfaceCore.fast_matrix_colors(typeof(BBB))
32+

libs/ArrayInterfaceCUDA/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
1111
[compat]
1212
Adapt = "3"
1313
ArrayInterfaceCore = "0.1"
14-
CUDA = "3"
14+
CUDA = "3.9"
1515
julia = "1.6"
1616

libs/ArrayInterfaceCore/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
1515
Compat = "3.37"
1616
IfElse = "0.1"
1717
Static = "0.6"
18-
julia = "1.2"
18+
julia = "1.6"

libs/ArrayInterfaceCuArrays/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
1010
[compat]
1111
Adapt = "3"
1212
ArrayInterfaceCore = "0.1"
13-
CuArrays = "2"
13+
CuArrays = "2.2"
1414
julia = "1.6"
1515

libs/ArrayInterfaceOffsetArrays/Project.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ version = "0.1.0"
44

55
[deps]
66
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
7-
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
87
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
8+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
99

1010
[compat]
1111
ArrayInterfaceCore = "0.1"
1212
OffsetArrays = "1.11"
1313
Static = "0.6"
1414
julia = "1.6"
15+
16+
[extras]
17+
ArrayInterfaceCore = "30b0a656-2188-435a-8636-2ec0e6a096e2"
18+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
19+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
20+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
21+
22+
[targets]
23+
test = ["ArrayInterfaceCore","OffsetArrays","Static","Test"]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
using ArrayInterfaceCore
3+
using ArrayInterfaceOffsetArrays
4+
using OffsetArrays
5+
using Static
6+
using Test
7+
8+
A = zeros(3, 4, 5);
9+
O = OffsetArray(A, 3, 7, 10);
10+
Op = PermutedDimsArray(O,(3,1,2));
11+
@test @inferred(ArrayInterfaceCore.offsets(O)) === (4, 8, 11)
12+
@test @inferred(ArrayInterfaceCore.offsets(Op)) === (11, 4, 8)
13+
14+
@test @inferred(ArrayInterfaceCore.offsets((1,2,3))) === (StaticInt(1),)
15+
o = OffsetArray(vec(A), 8);
16+
@test @inferred(ArrayInterfaceCore.offset1(o)) === 9
17+
18+
@test @inferred(ArrayInterfaceCore.device(OffsetArray(view(PermutedDimsArray(A, (3,1,2)), 1, :, 2:4)', 3, -173))) === ArrayInterfaceCore.CPUPointer()
19+
@test @inferred(ArrayInterfaceCore.device(view(OffsetArray(A,2,3,-12), 4, :, -11:-9))) === ArrayInterfaceCore.CPUPointer()
20+
@test @inferred(ArrayInterfaceCore.device(view(OffsetArray(A,2,3,-12), 3, :, [-11,-10,-9])')) === ArrayInterfaceCore.CPUIndex()
21+
22+
@test @inferred(ArrayInterfaceCore.indices(OffsetArray(view(PermutedDimsArray(A, (3,1,2)), 1, :, 2:4)', 3, -173),1)) === Base.Slice(ArrayInterfaceCore.OptionallyStaticUnitRange(4,6))
23+
@test @inferred(ArrayInterfaceCore.indices(OffsetArray(view(PermutedDimsArray(A, (3,1,2)), 1, :, 2:4)', 3, -173),2)) === Base.Slice(ArrayInterfaceCore.OptionallyStaticUnitRange(-172,-170))
24+
25+
@test @inferred(ArrayInterfaceCore.device(OffsetArray(1:10))) === ArrayInterfaceCore.CPUIndex()
26+
@test @inferred(ArrayInterfaceCore.device(OffsetArray(@view(reshape(1:8, 2,2,2)[1,1:2,:]),-3,4))) === ArrayInterfaceCore.CPUIndex()
27+
@test @inferred(ArrayInterfaceCore.device(OffsetArray(zeros(2,2,2),8,-2,-5))) === ArrayInterfaceCore.CPUPointer()
28+

0 commit comments

Comments
 (0)