Skip to content

Conversation

@davidschlegel
Copy link

To work with symbolic numbers.

To work with symbolic numbers.
@inline function increaseindex!(a::SparseArray{T,N}, v, I::CartesianIndex{N}) where {T,N}
@boundscheck checkbounds(a, I)
iszero(v) && return
v !== zero(v) && return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, should be v == zero(v) of course.

currentv = h.vals[index]
newv = currentv + convert(T, v)
if iszero(newv)
if v !== zero(newv)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, should be v == zero(v) of course.

d = SparseArray{T,N}(undef, size(a))
for I in CartesianIndices(a)
iszero(a[I]) && continue
v !== zero(a[I]) && continue
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, should be v == zero(v) of course.

@Jutho
Copy link
Member

Jutho commented Oct 11, 2024

Sorry for not responding sooner; could you briefly comment on why iszero does not work? Also, you replace !iszero with !== whereas in iszero with ==, but these two are not opposites. The negation of == is !=, whereas !== is the negation of ===. Is that intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants