@@ -1944,16 +1944,16 @@ end
1944
1944
B12118 = sparse ([1 ,2 ,4 ,5 ], [1 ,2 ,3 ,5 ], [2 ,1 ,- 1 ,- 2 ])
1945
1945
1946
1946
@test A12118 + B12118 == sparse ([1 ,2 ,3 ,4 ,4 ,5 ], [1 ,2 ,3 ,3 ,4 ,5 ], [3 ,3 ,3 ,- 1 ,4 ,3 ])
1947
- @test typeof (A12118 + B12118) == SparseMatrixCSC{Int,Int}
1947
+ @test typeof (A12118 + B12118) == SparseMatrixCSC{Int,Int,Int }
1948
1948
1949
1949
@test A12118 - B12118 == sparse ([1 ,2 ,3 ,4 ,4 ,5 ], [1 ,2 ,3 ,3 ,4 ,5 ], [- 1 ,1 ,3 ,1 ,4 ,7 ])
1950
- @test typeof (A12118 - B12118) == SparseMatrixCSC{Int,Int}
1950
+ @test typeof (A12118 - B12118) == SparseMatrixCSC{Int,Int,Int }
1951
1951
1952
1952
@test max .(A12118, B12118) == sparse ([1 ,2 ,3 ,4 ,5 ], [1 ,2 ,3 ,4 ,5 ], [2 ,2 ,3 ,4 ,5 ])
1953
- @test typeof (max .(A12118, B12118)) == SparseMatrixCSC{Int,Int}
1953
+ @test typeof (max .(A12118, B12118)) == SparseMatrixCSC{Int,Int,Int }
1954
1954
1955
1955
@test min .(A12118, B12118) == sparse ([1 ,2 ,4 ,5 ], [1 ,2 ,3 ,5 ], [1 ,1 ,- 1 ,- 2 ])
1956
- @test typeof (min .(A12118, B12118)) == SparseMatrixCSC{Int,Int}
1956
+ @test typeof (min .(A12118, B12118)) == SparseMatrixCSC{Int,Int,Int }
1957
1957
end
1958
1958
1959
1959
@testset " unary minus for SparseMatrixCSC{Bool}" begin
@@ -2053,19 +2053,19 @@ end
2053
2053
B13024 = sparse ([1 ,2 ,4 ,5 ], [1 ,2 ,3 ,5 ], fill (true ,4 ))
2054
2054
2055
2055
@test broadcast (& , A13024, B13024) == sparse ([1 ,2 ,5 ], [1 ,2 ,5 ], fill (true ,3 ))
2056
- @test typeof (broadcast (& , A13024, B13024)) == SparseMatrixCSC{Bool,Int}
2056
+ @test typeof (broadcast (& , A13024, B13024)) == SparseMatrixCSC{Bool,Int,Int }
2057
2057
2058
2058
@test broadcast (| , A13024, B13024) == sparse ([1 ,2 ,3 ,4 ,4 ,5 ], [1 ,2 ,3 ,3 ,4 ,5 ], fill (true ,6 ))
2059
- @test typeof (broadcast (| , A13024, B13024)) == SparseMatrixCSC{Bool,Int}
2059
+ @test typeof (broadcast (| , A13024, B13024)) == SparseMatrixCSC{Bool,Int,Int }
2060
2060
2061
2061
@test broadcast (⊻ , A13024, B13024) == sparse ([3 ,4 ,4 ], [3 ,3 ,4 ], fill (true ,3 ), 5 , 5 )
2062
- @test typeof (broadcast (⊻ , A13024, B13024)) == SparseMatrixCSC{Bool,Int}
2062
+ @test typeof (broadcast (⊻ , A13024, B13024)) == SparseMatrixCSC{Bool,Int,Int }
2063
2063
2064
2064
@test broadcast (max, A13024, B13024) == sparse ([1 ,2 ,3 ,4 ,4 ,5 ], [1 ,2 ,3 ,3 ,4 ,5 ], fill (true ,6 ))
2065
- @test typeof (broadcast (max, A13024, B13024)) == SparseMatrixCSC{Bool,Int}
2065
+ @test typeof (broadcast (max, A13024, B13024)) == SparseMatrixCSC{Bool,Int,Int }
2066
2066
2067
2067
@test broadcast (min, A13024, B13024) == sparse ([1 ,2 ,5 ], [1 ,2 ,5 ], fill (true ,3 ))
2068
- @test typeof (broadcast (min, A13024, B13024)) == SparseMatrixCSC{Bool,Int}
2068
+ @test typeof (broadcast (min, A13024, B13024)) == SparseMatrixCSC{Bool,Int,Int }
2069
2069
2070
2070
for op in (+ , - )
2071
2071
@test op (A13024, B13024) == op (Array (A13024), Array (B13024))
@@ -2095,9 +2095,9 @@ end
2095
2095
A = A* transpose (A)
2096
2096
@test ! Base. USE_GPL_LIBS || abs (det (factorize (Symmetric (A)))) ≈ abs (det (factorize (Array (A))))
2097
2097
@test factorize (triu (A)) == triu (A)
2098
- @test isa (factorize (triu (A)), UpperTriangular{Float64, SparseMatrixCSC{Float64, Int}})
2098
+ @test isa (factorize (triu (A)), UpperTriangular{Float64, SparseMatrixCSC{Float64,Int, Int}})
2099
2099
@test factorize (tril (A)) == tril (A)
2100
- @test isa (factorize (tril (A)), LowerTriangular{Float64, SparseMatrixCSC{Float64, Int}})
2100
+ @test isa (factorize (tril (A)), LowerTriangular{Float64, SparseMatrixCSC{Float64,Int, Int}})
2101
2101
C, b = A[:, 1 : 4 ], fill (1. , size (A, 1 ))
2102
2102
@test ! Base. USE_GPL_LIBS || factorize (C)\ b ≈ Array (C)\ b
2103
2103
@test_throws ErrorException eigen (A)
@@ -2317,15 +2317,15 @@ end
2317
2317
@testset " show" begin
2318
2318
io = IOBuffer ()
2319
2319
show (io, MIME " text/plain" (), spzeros (Float64, Int64, 0 , 0 ))
2320
- @test String (take! (io)) == " 0×0 SparseArrays.SparseMatrixCSC{Float64, Int64} with 0 stored entries"
2320
+ @test String (take! (io)) == " 0×0 SparseArrays.SparseMatrixCSC{Float64, Int64, Int64 } with 0 stored entries"
2321
2321
show (io, MIME " text/plain" (), sparse (Int64[1 ], Int64[1 ], [1.0 ]))
2322
- @test String (take! (io)) == " 1×1 SparseArrays.SparseMatrixCSC{Float64, Int64} with 1 stored entry:\n 1.0"
2322
+ @test String (take! (io)) == " 1×1 SparseArrays.SparseMatrixCSC{Float64, Int64, Int64 } with 1 stored entry:\n 1.0"
2323
2323
show (io, MIME " text/plain" (), spzeros (Float32, Int64, 2 , 2 ))
2324
- @test String (take! (io)) == " 2×2 SparseArrays.SparseMatrixCSC{Float32, Int64} with 0 stored entries:\n ⋅ ⋅ \n ⋅ ⋅ "
2324
+ @test String (take! (io)) == " 2×2 SparseArrays.SparseMatrixCSC{Float32, Int64, Int64 } with 0 stored entries:\n ⋅ ⋅ \n ⋅ ⋅ "
2325
2325
2326
2326
A = sparse (Int64[1 , 1 ], Int64[1 , 2 ], [1.0 , 2.0 ])
2327
2327
show (io, MIME " text/plain" (), A)
2328
- @test String (take! (io)) == " 1×2 SparseArrays.SparseMatrixCSC{Float64, Int64} with 2 stored entries:\n 1.0 2.0"
2328
+ @test String (take! (io)) == " 1×2 SparseArrays.SparseMatrixCSC{Float64, Int64, Int64 } with 2 stored entries:\n 1.0 2.0"
2329
2329
_show_with_braille_patterns (convert (IOContext, io), A)
2330
2330
@test String (take! (io)) == " ⠉"
2331
2331
@@ -2344,13 +2344,13 @@ end
2344
2344
2345
2345
A = sparse (Int64[1 , 2 , 4 , 2 , 3 ], Int64[1 , 1 , 1 , 2 , 2 ], Int64[1 , 1 , 1 , 1 , 1 ], 4 , 2 )
2346
2346
show (io, MIME " text/plain" (), A)
2347
- @test String (take! (io)) == " 4×2 SparseArrays.SparseMatrixCSC{Int64, Int64} with 5 stored entries:\n 1 ⋅\n 1 1\n ⋅ 1\n 1 ⋅"
2347
+ @test String (take! (io)) == " 4×2 SparseArrays.SparseMatrixCSC{Int64, Int64, Int64 } with 5 stored entries:\n 1 ⋅\n 1 1\n ⋅ 1\n 1 ⋅"
2348
2348
_show_with_braille_patterns (convert (IOContext, io), A)
2349
2349
@test String (take! (io)) == " ⡳"
2350
2350
2351
2351
A = sparse (Int64[1 , 3 , 2 , 4 ], Int64[1 , 1 , 2 , 2 ], Int64[1 , 1 , 1 , 1 ], 7 , 3 )
2352
2352
show (io, MIME " text/plain" (), A)
2353
- @test String (take! (io)) == " 7×3 SparseArrays.SparseMatrixCSC{Int64, Int64} with 4 stored entries:\n 1 ⋅ ⋅\n ⋅ 1 ⋅\n 1 ⋅ ⋅\n ⋅ 1 ⋅\n ⋅ ⋅ ⋅\n ⋅ ⋅ ⋅\n ⋅ ⋅ ⋅"
2353
+ @test String (take! (io)) == " 7×3 SparseArrays.SparseMatrixCSC{Int64, Int64, Int64 } with 4 stored entries:\n 1 ⋅ ⋅\n ⋅ 1 ⋅\n 1 ⋅ ⋅\n ⋅ 1 ⋅\n ⋅ ⋅ ⋅\n ⋅ ⋅ ⋅\n ⋅ ⋅ ⋅"
2354
2354
_show_with_braille_patterns (convert (IOContext, io), A)
2355
2355
@test String (take! (io)) == " ⢕" * Char (10240 ) * " \n " * Char (10240 )^ 2
2356
2356
@@ -2360,7 +2360,7 @@ end
2360
2360
@test String (take! (io)) == brailleString
2361
2361
2362
2362
# Issue #30589
2363
- @test repr (" text/plain" , sparse ([true true ])) == " 1×2 SparseArrays.SparseMatrixCSC{Bool, $Int } with 2 stored entries:\n 1 1"
2363
+ @test repr (" text/plain" , sparse ([true true ])) == " 1×2 SparseArrays.SparseMatrixCSC{Bool, $Int , $Int } with 2 stored entries:\n 1 1"
2364
2364
2365
2365
function _filled_sparse (m:: Integer , n:: Integer )
2366
2366
C = CartesianIndices ((m, n))[:]
@@ -2422,9 +2422,9 @@ end
2422
2422
@testset " similar with type conversion" begin
2423
2423
local A = sparse (1.0 I, 5 , 5 )
2424
2424
@test size (similar (A, ComplexF64, Int)) == (5 , 5 )
2425
- @test typeof (similar (A, ComplexF64, Int)) == SparseMatrixCSC{ComplexF64, Int}
2425
+ @test typeof (similar (A, ComplexF64, Int)) == SparseMatrixCSC{ComplexF64,Int, Int}
2426
2426
@test size (similar (A, ComplexF64, Int8)) == (5 , 5 )
2427
- @test typeof (similar (A, ComplexF64, Int8)) == SparseMatrixCSC{ComplexF64, Int8}
2427
+ @test typeof (similar (A, ComplexF64, Int8)) == SparseMatrixCSC{ComplexF64,Int8, Int8}
2428
2428
@test similar (A, ComplexF64,(6 , 6 )) == spzeros (ComplexF64, 6 , 6 )
2429
2429
@test convert (Matrix, A) == Array (A) # lolwut, are you lost, test?
2430
2430
end
@@ -2440,14 +2440,14 @@ end
2440
2440
@test length (nonzeros (simA)) == length (nonzeros (A))
2441
2441
# test similar with entry type specification (preserves stored-entry structure)
2442
2442
simA = similar (A, Float32)
2443
- @test typeof (simA) == SparseMatrixCSC{Float32,eltype (getcolptr (A))}
2443
+ @test typeof (simA) == SparseMatrixCSC{Float32,eltype (getcolptr (A)), eltype ( rowvals (A)) }
2444
2444
@test size (simA) == size (A)
2445
2445
@test getcolptr (simA) == getcolptr (A)
2446
2446
@test rowvals (simA) == rowvals (A)
2447
2447
@test length (nonzeros (simA)) == length (nonzeros (A))
2448
2448
# test similar with entry and index type specification (preserves stored-entry structure)
2449
2449
simA = similar (A, Float32, Int8)
2450
- @test typeof (simA) == SparseMatrixCSC{Float32,Int8}
2450
+ @test typeof (simA) == SparseMatrixCSC{Float32,Int8,Int8 }
2451
2451
@test size (simA) == size (A)
2452
2452
@test getcolptr (simA) == getcolptr (A)
2453
2453
@test rowvals (simA) == rowvals (A)
@@ -2461,14 +2461,14 @@ end
2461
2461
@test length (nonzeros (simA)) == length (nonzeros (A))
2462
2462
# test similar with entry type and Dims{2} specification (preserves storage space only)
2463
2463
simA = similar (A, Float32, (6 ,6 ))
2464
- @test typeof (simA) == SparseMatrixCSC{Float32,eltype (getcolptr (A))}
2464
+ @test typeof (simA) == SparseMatrixCSC{Float32,eltype (getcolptr (A)), eltype ( rowvals (A)) }
2465
2465
@test size (simA) == (6 ,6 )
2466
2466
@test getcolptr (simA) == fill (1 , 6 + 1 )
2467
2467
@test length (rowvals (simA)) == length (rowvals (A))
2468
2468
@test length (nonzeros (simA)) == length (nonzeros (A))
2469
2469
# test similar with entry type, index type, and Dims{2} specification (preserves storage space only)
2470
2470
simA = similar (A, Float32, Int8, (6 ,6 ))
2471
- @test typeof (simA) == SparseMatrixCSC{Float32, Int8}
2471
+ @test typeof (simA) == SparseMatrixCSC{Float32, Int8, Int8 }
2472
2472
@test size (simA) == (6 ,6 )
2473
2473
@test getcolptr (simA) == fill (1 , 6 + 1 )
2474
2474
@test length (rowvals (simA)) == length (rowvals (A))
0 commit comments