Skip to content

Row**s** or column**s** scaling #236

@syarra

Description

@syarra

PySparse has the ability to scale multiple rows/columns via the *= operand

from pysparse.sparse import PysparseMatrix as psp

J = psp(nrow=3, ncol=3)
J[0,0] = 1
J[1,1] = 2
J[2,2] = 3

# Scale two first rows:"
J[:2,:] *= -1.0

It is not possible to do that with CySparse. The same operation fails with error message:

TypeError: unsupported operand type(s) for *=: 'cysparse.sparse.ll_mat_views.ll_mat_view_INT64_t_FLOAT64_t.LLSparseMatrixView_INT64_t_FLOAT64_t' and 'float'

Is there a way to efficiently do the same operation? (without having to call J.row_scale multiple times)

@counterclocker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions