@@ -2,7 +2,6 @@ using ArrayInterfaceCore
22using ArrayInterfaceCore: zeromatrix, undefmatrix
33import ArrayInterfaceCore: has_sparsestruct, findstructralnz, fast_scalar_indexing, lu_instance,
44 parent_type, zeromatrix, IndicesInfo
5- using Base: setindex
65using LinearAlgebra
76using Random
87using SparseArrays
190189 @test ! @inferred(ArrayInterfaceCore. issingular(Tridiagonal([1 ,2 ,3 ],[1 ,2 ,3 ,4 ],[4 ,5 ,6 ])))
191190end
192191
193- @testset " setindex" begin
194- @testset " $(typeof(x)) " for x in [
195- zeros(3 ),
196- falses(3 ),
197- spzeros(3 ),
198- ]
199- y = setindex(x, true , 1 )
200- @test iszero(x) # x is not mutated
201- @test y[1 ] == true
202- @test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1 )]])
203-
204- y2 = setindex(x, one.(x), :)
205- @test iszero(x)
206- @test all(isone, y2)
207- end
208-
209- @testset " $(typeof(x)) " for x in [
210- zeros(3 , 3 ),
211- falses(3 , 3 ),
212- spzeros(3 , 3 ),
213- ]
214- y = setindex(x, true , 1 , 1 )
215- @test iszero(x) # x is not mutated
216- @test y[1 , 1 ] == true
217- @test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1 , 1 )]])
218-
219- y2 = setindex(x, one.(x), :, :)
220- @test iszero(x)
221- @test all(isone, y2)
222- end
223-
224- @testset " $(typeof(x)) " for x in [
225- zeros(3 , 3 , 3 ),
226- falses(3 , 3 , 3 ),
227- ]
228- y = setindex(x, true , 1 , 1 , 1 )
229- @test iszero(x) # x is not mutated
230- @test y[1 , 1 , 1 ] == true
231- @test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1 , 1 , 1 )]])
232-
233- y2 = setindex(x, one.(x), :, :, :)
234- @test iszero(x)
235- @test all(isone, y2)
236- end
237-
238- @testset " string" begin
239- x = fill(" a" , 2 , 3 )
240- @test setindex(x, " b" , 2 , 1 ) == setindex(x, " b" , CartesianIndex(2 , 1 )) == [" a" " a" " a" ;" b" " a" " a" ]
241- end
242- end
243-
244192@testset " Sparsity Structure" begin
245193 D= Diagonal([1 ,2 ,3 ,4 ])
246194 @test has_sparsestruct(D)
0 commit comments