Skip to content

[REQ] Storing a sparse matrix in a warp struct #574

@itsvismay

Description

@itsvismay

Description

I'm trying to create a warp struct that holds a sparse matrix:

@wp.struct
class NeohookeanElasticMaterial:
    sparse_hessian: wps.bsr_matrix_t(dtype=wp.types.matrix(shape=(9,9), dtype=wp.float32))

Context

Setting the sparse matrix shape during construction as follows;

neohookean_struct = NeohookeanElasticMaterial()
neohookean_struct.sparse_hessian = wps.bsr_zeros(
        N, N, block_type=wp.types.matrix(shape=(9, 9), dtype=wp.float32), device=device)

And finally setting its values within the hessian function as:
wps.bsr_set_diag(neohookean_struct.sparse_hessian,hessian_blocks)
I get an error saying:
AttributeError: 'StructInstance' object has no attribute 'copy_nnz_async'

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions