Finch.jl
Finch.jl copied to clipboard
Exception when negating a fiber
Hi @willow-ahrens,
While running different configurations of levels I noticed that for negation I get an exception. Here's a code where I could reproduce it:
using Finch
A = [0.0 0.0 4.4; 1.1 0.0 0.0; 2.2 0.0 5.5; 3.3 0.0 0.0]
A_fbr = Tensor(Dense(Dense(Element(0.0))), A)
-A # works
-A_fbr # fails
ERROR: Finch.FinchProtocolError("Cannot initialize Element Levels to non-default values (have literal(0.0) expected -0.0)")
Is negation for sparse fibers done differently or is it a bug?
Oh, interesting. Here's my question: Should the fill value of -A
be 0.0
or -0.0
?
because
julia> A = [0.0 0.0 4.4; 1.1 0.0 0.0; 2.2 0.0 5.5; 3.3 0.0 0.0]
4×3 Matrix{Float64}:
0.0 0.0 4.4
1.1 0.0 0.0
2.2 0.0 5.5
3.3 0.0 0.0
julia> -A
4×3 Matrix{Float64}:
-0.0 -0.0 -4.4
-1.1 -0.0 -0.0
-2.2 -0.0 -5.5
-3.3 -0.0 -0.0
Somehow, it looks like the fill value isn't getting set correctly.
Could you work around this for now? I'm completely reorganizing these convenience functions to follow a different codepath (for the @compile
macro), so this may magically get fixed in the future.
Sure! It isn't a blocker for me, just wanted to share.
Thanks for filing the issue! I'll double check that it's fixed once I'm done.
Mateusz, I think the approach to try to fix this is to remove https://github.com/willow-ahrens/Finch.jl/blob/e6544d80f3da3973614634236cede0c360b0b493/src/symbolic/simplify_program.jl#L73C1-L73C50 and see if anything breaks terribly.