Skip to content

283 provide the implementation of the masked outer product#301

Open
aleksamilisavljevic wants to merge 47 commits into
developfrom
283-provide-the-implementation-of-the-masked-outer-product
Open

283 provide the implementation of the masked outer product#301
aleksamilisavljevic wants to merge 47 commits into
developfrom
283-provide-the-implementation-of-the-masked-outer-product

Conversation

@aleksamilisavljevic

@aleksamilisavljevic aleksamilisavljevic commented Feb 9, 2024

Copy link
Copy Markdown
Contributor

Closes #283

Depends on #317

@byjtew byjtew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation, the openMP implementation is pretty quick and easy.
Good job 👍

Also, it would be nice to have a (maybe separate) unit test with a user-provided size of the matrix instead of a single predefined one.

Comment thread include/graphblas/reference/blas3.hpp
Comment thread include/graphblas/reference/blas3.hpp Outdated
Comment thread include/graphblas/reference/blas3.hpp Outdated
Comment thread include/graphblas/reference/blas3.hpp Outdated
Comment thread include/graphblas/reference/blas3.hpp Outdated
Comment thread tests/unit/CMakeLists.txt Outdated
Comment thread tests/unit/maskedOuter.cpp Outdated
Comment thread include/graphblas/reference/blas3.hpp
@byjtew

byjtew commented Feb 16, 2024

Copy link
Copy Markdown
Collaborator

By the way, why do you call the function maskedOuter and not simply outer, since the arguments are different it wouldn't collide with the non-masked implementation

@byjtew

byjtew commented Feb 16, 2024

Copy link
Copy Markdown
Collaborator

I also realised that you were only checking against the structure of the mask (coordinates), but never its values (which is tricky when allowing void & non-void)

Comment thread tests/unit/maskedOuter.cpp Outdated
Comment thread tests/unit/maskedOuter.cpp Outdated
@aleksamilisavljevic

aleksamilisavljevic commented Feb 16, 2024

Copy link
Copy Markdown
Contributor Author

I also realised that you were only checking against the structure of the mask (coordinates), but never its values (which is tricky when allowing void & non-void)

Yes, I was actually implementing the structural mask. @byjtew, if the structural descriptor isn't set, is it intended that values evaluate to true iff mask_raw.getValue(...) returns something that evaluates to true?

@byjtew

byjtew commented Feb 16, 2024

Copy link
Copy Markdown
Collaborator

I also realised that you were only checking against the structure of the mask (coordinates), but never its values (which is tricky when allowing void & non-void)

Yes, I was actually implementing the structural mask. @byjtew, if the structural descriptor isn't set, is it intended that values evaluate to true iff mask_raw.getValue(...) returns something that evaluates to true?

Not that simple, you should use utils::interpretMask<descr, T> instead, it will interpret the mask value to true or false and handle the void case for you.

@aleksamilisavljevic

Copy link
Copy Markdown
Contributor Author

I also realised that you were only checking against the structure of the mask (coordinates), but never its values (which is tricky when allowing void & non-void)

Yes, I was actually implementing the structural mask. @byjtew, if the structural descriptor isn't set, is it intended that values evaluate to true iff mask_raw.getValue(...) returns something that evaluates to true?

Not that simple, you should use utils::interpretMask<descr, T> instead, it will interpret the mask value to true or false and handle the void case for you.

The descriptors should now be properly handled.

Comment thread include/graphblas/base/blas3.hpp Outdated
@aleksamilisavljevic aleksamilisavljevic marked this pull request as draft February 20, 2024 14:56
@byjtew

byjtew commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator

Feel free to mark the MR as "ready" if the tests pass.

@aleksamilisavljevic

Copy link
Copy Markdown
Contributor Author

Feel free to mark the MR as "ready" if the tests pass.

Ok, but now I'm wondering if the structural_complement descriptor should be supported at all. I guess that the similar case could be made for forbidding it as in #242

@aleksamilisavljevic aleksamilisavljevic marked this pull request as ready for review February 21, 2024 12:23
@byjtew

byjtew commented Feb 22, 2024

Copy link
Copy Markdown
Collaborator

Running the test in the internal GitLab
@aleksamilisavljevic


FAILING TESTS for all backends

  • tests/unit/maskedOuter_ndebug_<backend>
  • tests/unit/maskedOuter_debug_<backend>

@anyzelman

Copy link
Copy Markdown
Member

Feel free to mark the MR as "ready" if the tests pass.

Ok, but now I'm wondering if the structural_complement descriptor should be supported at all. I guess that the similar case could be made for forbidding it as in #242

I would agree-- structurally inverting any sparse matrix seems never a good idea

@aleksamilisavljevic

Copy link
Copy Markdown
Contributor Author

Running the test in the internal GitLab @aleksamilisavljevic

FAILING TESTS for all backends

* `tests/unit/maskedOuter_ndebug_<backend>`

* `tests/unit/maskedOuter_debug_<backend>`

There was a bug in the way the test status was reported. It should be fine now, but I don't have access to the internal GitLab to check it.

Thanks to @aristeidis-mastoras for helping with the debug.

@anyzelman

Copy link
Copy Markdown
Member

This actually seems ready, so I provisionally slot it for v0.8

@anyzelman anyzelman added this to the v0.8 milestone Oct 17, 2025
@GiovaGa

GiovaGa commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator

Currently maskedOuter unit test is failing. I will look into it.

I noticed that this should be merged only after #317 !
Changes in include/graphblas/utils.hpp are due to the implementation of some features from there. Some manual context fixes may be needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide the implementation of the maskedOuter(Matrix result, Matrix mask, Vector u, Vector v)

4 participants