Skip to content

Commit

Permalink
fix norm with NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Nov 5, 2024
1 parent f198e76 commit 4d86ca0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using BlockArrays:
blocksizes,
mortar
using Compat: @compat
using LinearAlgebra: Adjoint, mul!
using LinearAlgebra: Adjoint, mul!, norm
using NDTensors.BlockSparseArrays:
@view!,
BlockSparseArray,
Expand Down Expand Up @@ -94,6 +94,9 @@ include("TestBlockSparseArraysUtils.jl")
iszero(a[I])
end
end

a[3, 3] = NaN
@test isnan(norm(a))
end
@testset "Tensor algebra" begin
a = BlockSparseArray{elt}(undef, ([2, 3], [3, 4]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ end
function sparse_mapreduce(f, op, a::AbstractArray; init=reduce_init(f, op, a), kwargs...)
output = mapreduce(f, op, sparse_storage(a); init, kwargs...)
f_notstored = apply_notstored(f, a)
@assert op(output, eltype(output)(f_notstored)) == output
@assert isequal(op(output, eltype(output)(f_notstored)), output)
return output
end

0 comments on commit 4d86ca0

Please sign in to comment.