Skip to content

[BUG] prune_numerical_zeros for sparse matrices behaves differently in 1.8.0 from previous versions #832

@JohnCSu

Description

@JohnCSu

Bug Description

Setting prune_numerical_zeros=False when creating a BSR matrix using the warp.sparse.bsr_from_triplets() does not function the same in versions 1.8.0 compared to 1.7.2. The following example will print an array of -1s in version 1.8.0. In 1.7.2 the sorted row indices are returned

import warp as wp
import warp.sparse as sparse
wp.init()

rows = wp.array([1,0,2,3],dtype =int)
cols = wp.array([0,1,2,3],dtype =int)
vals = wp.zeros(len(rows),dtype=float)

# Create BSR matrix

A = sparse.bsr_from_triplets(
    rows_of_blocks=12,      # Number of rows of blocks
    cols_of_blocks=12,      # Number of columns of blocks
    rows=rows,            # Row indices
    columns=cols,         # Column indices
    values=vals,           # Block values
    prune_numerical_zeros=False
)

print(A.uncompress_rows().numpy())

System Information

Warp version 1.8.0
Python 3.12.4
Window 10 OS

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions