Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change type signature for Base.:+ square args #709

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mtsokol
Copy link
Member

@mtsokol mtsokol commented Mar 10, 2025

Hi @willow-ahrens,

I noticed that for:

using Finch
using LinearAlgebra

A_ref = [1 2 0 4 0; 0 -2 1 0 1]
A = Tensor(Dense(SparseList(Element(0))), A_ref)
norm(A, 1) == norm(A_ref, 1)
norm(A, 2) == norm(A_ref, 2)  # fails
norm(A, 3) == norm(A_ref, 3)

the square option fails with an error:

ERROR: MethodError: no method matching +(::Finch.Square{Int64, Float64}, ::Finch.Square{Float64, Float64})

Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...)
   @ Base operators.jl:587
  +(::T, ::T) where T<:Finch.Square
   @ Finch ~/Finch.jl/src/interface/lazy.jl:424

This PR fixes it.

@mtsokol mtsokol self-assigned this Mar 10, 2025
@mtsokol
Copy link
Member Author

mtsokol commented Mar 11, 2025

Ok, looking at the CI I don't think my fix is the right one. But the issue described here is still relevant for computing vector norms with p=2.

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.

1 participant