JuliaLinearAlgebra / HierarchicalMatrices.jl

Julia package for hierarchical matrices
Other
26 stars 5 forks source link

Different name for partial-update functions? #2

Open tkelman opened 7 years ago

tkelman commented 7 years ago

The signatures of A_mul_B! and scale! and similar here that take start indices that don't match the signatures used by those functions in base don't really need to use the same name here, do they? It might be clearer to distinguish them by more than just the number of inputs, since Base is never going to lower to or call these signatures.

MikaelSlevinsky commented 7 years ago

I guess I could re-name to A_mul_B_with_indices_and_increments!, though with the importing it's technically harmless. I'm also open to suggestions.

The reason for their existence is that hierarchical matrices are defined block-wise and so for a Julia implementation to be on par with C or Fortran, I needed methods that implement (BLAS'ed) arithmetic on input vectors that don't start at the first index, and output to vectors that don't start at the first index either.

tkelman commented 7 years ago

_partial ?

you might be incurring a bit of splatting penalty with the local fallback to the base methods

MikaelSlevinsky commented 7 years ago

bit of splatting penalty with the local fallback to the base methods

Can you explain this a little more slowly? Do you mean that there may be an extra latency due to finding the right methods in Base's already large hash table for A_mul_B!?

tkelman commented 7 years ago

splatting can have a non negligible performance cost in some situations, so

    for op in (:A_mul_B!, :At_mul_B!, :Ac_mul_B!, :scale!)
        @eval begin
            $op(args...) = Base.$op(args...)
        end
    end

might not be zero cost, depending on whether or not the compiler is happy with you.