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

Pauli Virtanen pav@iki...
Thu Oct 6 07:30:04 CDT 2011


06.10.2011 11:33, Pauli Virtanen kirjoitti:
[clip]
>> Currently, the first input has to be an array 'data' where every row
>> corresponds to a diagonal - which one is specified in the next input, 'diags'. However,
>> as the diagonals have different length, the actual values have to be zero-padded on
>> either the left or right end to fit the array.
> [clip]
> 
> I was just thinking about the same thing: the way it works now is a bit
> of a pain.

After a moment of thought, I believe the semantics of `spdiags` cannot
be changed without also affecting the meaning of:

    sparse.spdiags([[1,2,3]], [1], 4, 4)

The remaining options are either to add a keyword flag to the function,
or to add a separate function (maybe called `diags` or something) to
toggle the more convenient offset semantics.

-- 
Pauli Virtanen



More information about the SciPy-Dev mailing list