Skip to content

Commit 4d86ca0

Browse files
committed
fix norm with NaN
1 parent f198e76 commit 4d86ca0

File tree

2 files changed

+5
-2
lines changed
  • NDTensors/src/lib

2 files changed

+5
-2
lines changed

NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using BlockArrays:
1515
blocksizes,
1616
mortar
1717
using Compat: @compat
18-
using LinearAlgebra: Adjoint, mul!
18+
using LinearAlgebra: Adjoint, mul!, norm
1919
using NDTensors.BlockSparseArrays:
2020
@view!,
2121
BlockSparseArray,
@@ -94,6 +94,9 @@ include("TestBlockSparseArraysUtils.jl")
9494
iszero(a[I])
9595
end
9696
end
97+
98+
a[3, 3] = NaN
99+
@test isnan(norm(a))
97100
end
98101
@testset "Tensor algebra" begin
99102
a = BlockSparseArray{elt}(undef, ([2, 3], [3, 4]))

NDTensors/src/lib/SparseArrayInterface/src/sparsearrayinterface/map.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ end
115115
function sparse_mapreduce(f, op, a::AbstractArray; init=reduce_init(f, op, a), kwargs...)
116116
output = mapreduce(f, op, sparse_storage(a); init, kwargs...)
117117
f_notstored = apply_notstored(f, a)
118-
@assert op(output, eltype(output)(f_notstored)) == output
118+
@assert isequal(op(output, eltype(output)(f_notstored)), output)
119119
return output
120120
end

0 commit comments

Comments
 (0)