-
Notifications
You must be signed in to change notification settings - Fork 15
New property for "extremal" monoids? #387
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
Comments
Another example of extremal monoid is greatest common divisor, or |
I don't understand the difference between extremal and terminal. They look the same to me from your description |
How about times on int8? The identity value is 1 and the 'terminal value' (my terminology) is zero. Isn't that also an extremal monoid? |
Your definition of extremal:
is the same as my definition of a terminal monoid, whose terminal value is x. |
Perhaps. My definition isn't strict/complete yet (note I didn't say Maybe I should change my definition of extremal to say that that property should hold for all possible sets Having a terminal value seems weaker--what if there is a sentinel value like |
But for all possible sets, the terminal value x has that same property as your extremal value. Technically, the PLUS monoid on FP32 is terminal, with the terminal value of NAN, but it's not worth exploiting since it would be rare in practice, so I ignore it. Are you wanting to place all the elements in the domain in some kind of order? First, second 3rd, ....last, where " < " can be applied, first < 2nd < 3rd < ... < last, and where "first" is the identity and "last" is the terminal value? Or visa versa? That would be fine for some data types but not all (complex numbers cannot be ordered). For the NAN terminal value of PLUS on FP32, you cannot say that NAN appears anywhere in the order of all possible 2^32 floating point values: -INF, -INF+eps, ..., 0, eps, .... , +INF. |
No it doesn't. By my construction,
No, that shouldn't be necessary. Here's an example of what I want: when reducing a symmetric matrix, I want to know if I can get the same result by e.g. reducing just the lower triangle. This is coming up a fair amount for computing and caching properties in |
Oh, I see. Then you want to know if a monoid has the form "given a set S, pick one of the items, and that's the result of applying the monoid to reduce that set S to a scalar"? So the PLUS or TIMES monoid would not have that property. MIN and MAX would. I guess boolean AND and OR would too. The bitwise BAND and BOR would not have this property. I don't understand why "extremal" is the word to use since to me that implies something else. Is that the property you're looking for? |
I think that's close. I would like to include BAND and BOR though, which means the result |
heh, okay, so maybe this isn't the most intuitive property. I'll just special-case what I want in Thanks for chiming in @DrTimothyAldenDavis. |
Let me try a different explanation that is closer to what I actually want this for. A monoid |
I see. Then it would hold for the MAX, MIN, LAND, LOR, BAND, BOR, moniods, and ANY if you like (why not ... the definition of ANY would be fine with that since the set of choices are the same). It would not hold for PLUS, TIMES, LXOR, BXOR, LXNOR, BXNOR monoids. I don't know what the name "foo" would be, but "extremal" would be confusing. This categorization seems most useful on your side, not inside GraphBLAS, since I can't detect this condition (that I'm reducing a set with duplicates in it). I don't keep track of whether or not my matrices are symmetric for example. I DO keep track of the iso property, and exploit it heavily for all monoids, semirings, and binary ops. In particular, reducing a matrix with N entries to a scalar takes O(log N) time, for any monoid (with "foo" property or not): That's a very special set where all the values are identical (n copies of the value a). Some monoids (those that are "foo") could do that in O(1) time, but O(log(N)) is fast enough, and the method works for all monoids, even user-defined ones. |
Yeah, I agree "extremal" is a terrible name. I believe |
In
graphblas_algorithms
, I would sometimes like to know whether the operator I'm using is "extremal" (explained later) when computing cached values.Example operators:
band
,bor
,land
,lor
,max
,min
, and maybeany
(b/cany
is a "special" monoid).For example, for an undirected graph, I can compute the min element via
A.reduce_scalar(min)
or byL.reduce_scalar(min)
. Using the lower diagonal matrixL
would be preferred if it's available, because it should be faster.What's a good name for this property? I describe it as extremal, because it has the following behavior:
Suppose we reduce a set of values
S = {s_0, s_1, ...}
with a monoidop
and get the resultx
.x
is "extremal" ifop(x, s_i) == x
for alls_i
inS
.@DrTimothyAldenDavis, is there a good mathematical term for this property? These extremal monoids also have the property that their identity and terminal values are the boundaries of their domains.
@jim22k, what do you think of adding e.g.
gb.monoid.min.is_extremal
property to monoids?The text was updated successfully, but these errors were encountered: