Skip to content

Assign operation #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 27, 2023
Merged

Assign operation #5

merged 5 commits into from
Jan 27, 2023

Conversation

jim22k
Copy link
Member

@jim22k jim22k commented Jan 27, 2023

This implements all of the assign operations:

  • assign vec to vec
  • assign mat to mat
  • assign vec to mat as row
  • assign vec to mat as col
  • assign scalar to vec
  • assign scalar to mat

The update function had to be improved to handle assign which essentially needs to treat assignment indices as a 2nd mask. Having two masks, combined with mask complement and replacement logic gets very tricky.

Three new implementations (beyond assign) are needed:

  • select_by_indices
  • build_iso_vector_from_indices
  • build_iso_matrix_from_indices
Note that it doesn't properly support updates, so only unmasked accumulations work correctly
select_by_indices is needed to properly implement assignment without accumulation
`assign` has indices that function similar to a mask, so providing a mask during update
causes a double mask challenge of figuring out what to keep, etc.
Add tests to cover all the cases.

Also allow scalar value in `build` to make an iso-valued tensor.
Allow BinaryOps to specify 0 or 1 to indicate the output
matches the dtype of input arg 0 or 1
@jim22k jim22k merged commit 36f6381 into python-graphblas:main Jan 27, 2023
@jim22k jim22k deleted the assign_op branch January 27, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant