[SciPy-Dev] scipy.sparse spdiags/dia_matrix additional calling mode

Pauli Virtanen pav at iki.fi
Thu Oct 6 09:26:14 EDT 2011


06.10.2011 15:10, Tony Stillfjord kirjoitti:
[clip]
> I'm more in favour of a keyword flag rather than a new function. spdiags
> feels like the accepted name for what is to be done, and then how to do it more
> specifically should be an option within this framework (function). Maybe
> 'padding = False/True' or 'exact_length = False/True'?

Adding a new function for new semantics, rather than using a keyword
argument, feels to me like a clearer design choice here.

I think adding a new function called `diags` could be justified here.
Numpy already has a function called `diag`, and with the new semantics
one would have

    diags([a, b, c], [i, j, k]) == diag(a, i) + diag(b, j) + diag(c, k)

which hangs together nicely.

-- 
Pauli Virtanen




More information about the SciPy-Dev mailing list