Skip to content

Commit 9a105ee

Browse files
committed
More tests
1 parent 1a05656 commit 9a105ee

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

test/test_blocksparsearrays.jl

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
using Adapt: adapt
2-
using BlockArrays: Block, BlockRange, mortar
2+
using BlockArrays: Block, BlockRange, blockedrange, blockisequal, mortar
33
using BlockSparseArrays:
4-
BlockIndexVector, BlockSparseArray, BlockSparseMatrix, blockrange, blocksparse, blocktype
4+
BlockIndexVector,
5+
BlockSparseArray,
6+
BlockSparseMatrix,
7+
blockrange,
8+
blocksparse,
9+
blocktype,
10+
eachblockaxis
511
using FillArrays: Eye, SquareEye
612
using JLArrays: JLArray
7-
using KroneckerArrays: KroneckerArray, , ×, arg1, arg2
13+
using KroneckerArrays: KroneckerArray, , ×, arg1, arg2, cartesianrange
814
using LinearAlgebra: norm
915
using MatrixAlgebraKit: svd_compact, svd_trunc
1016
using StableRNGs: StableRNG
@@ -17,6 +23,15 @@ arrayts = (Array, JLArray)
1723
arrayts,
1824
elt in elts
1925

26+
# BlockUnitRange with CartesianProduct blocks
27+
r = blockrange([2 × 3, 3 × 4])
28+
@test r[Block(1)] cartesianrange(2 × 3, 1:6)
29+
@test r[Block(2)] cartesianrange(3 × 4, 7:18)
30+
@test eachblockaxis(r)[1] cartesianrange(2, 3)
31+
@test eachblockaxis(r)[2] cartesianrange(3, 4)
32+
@test blockisequal(arg1(r), blockedrange([2, 3]))
33+
@test blockisequal(arg2(r), blockedrange([3, 4]))
34+
2035
dev = adapt(arrayt)
2136
r = blockrange([2 × 2, 3 × 3])
2237
d = Dict(

0 commit comments

Comments
 (0)