The functional style multiply, i.e. gb.semiring.plus_plus(A @ B) , appears to not respect the semiring choice when doing a triple product A @ B @ C.
Let:
A = gb.Matrix.from_coo([0, 0, 1], [0, 1, 1], [11, 22, 33], nrows=2, ncols=2)
left = gb.Matrix.from_coo([0, 0], [0, 1], [1, 1], nrows=1, ncols=2)
right = gb.Matrix.from_coo([0, 1], [0, 0], [1, 1], nrows=2, ncols=1)
A triple product using the plus_first semiring returns a 1x1 matrix with a count of nonzeros in A, which is 3. Indeed that is what the method style triple product returns:
left.mxm(A, op="plus_first").mxm(right, op="plus_first")
# returns `[[3]]` (correct)
However the functional-style triple product,
gb.semiring.plus_first(left @ A @ right)
# returns `[[66]]` (incorrect)
It appears that the plus_first semiring is only used for one of the multiplications, and plus_times for the other.
Application is to implement a triple product that creates a low resolution spy plot, like this:
See MatSpy.
The functional style multiply, i.e.
gb.semiring.plus_plus(A @ B), appears to not respect the semiring choice when doing a triple productA @ B @ C.Let:
A triple product using the
plus_firstsemiring returns a 1x1 matrix with a count of nonzeros in A, which is 3. Indeed that is what the method style triple product returns:However the functional-style triple product,
It appears that the
plus_firstsemiring is only used for one of the multiplications, andplus_timesfor the other.Application is to implement a triple product that creates a low resolution spy plot, like this:
See MatSpy.