Skip to content
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

__sec_reduce_{all,any}_{zero,nonzero} semantics for empty sections #25

Open
jeffhammond opened this issue May 26, 2016 · 2 comments
Open
Labels

Comments

@jeffhammond
Copy link
Member

(I'm looking at http://wiki.edg.com/pub/CPLEX/MeetingApr252016/sections.html)

Reduction operation Result value Result type Result value when the argument is an empty section
__sec_reduce_all_zero One if all argument values are zero; zero otherwise int One
__sec_reduce_all_nonzero One if all argument values are nonzero; zero otherwise int One
__sec_reduce_any_zero One if any argument value is zero; zero otherwise int Zero
__sec_reduce_any_nonzero One if any argument value is nonzero; zero otherwise int Zero

Why is it that an empty section is defined to be (1) "all zero", (2) "all nonzero", (3) "not any zero", and (4) "not any nonzero"? The latter two make sense, because any empty set doesn't have anything in it. But why is an empty set both all zero and all nonzero?

Maybe I missed something, either in the CPLEX text or in set theory.

@phalpern
Copy link

Because __sec_reduce_all_zero(A[:]) should always be equal to !
__sec_reduce_any_nonzero(A[:]). It would be odd if N == 0 were a
special case.

Put another way, the first two operations are logical AND operations and
the latter two are logical OR operations. The identity value for AND is
one and for OR is zero.

Put a third way, imagine you have an array A of N elements, to compute
__sec_reduce_all_zero(A) as a loop, you would write:

_Bool result = true;
for (size_t i = 0; i < N && result; i++)
result &&= (A[i] == 0);
return result;

What is the result when N == 0 (i.e., an empty array)?

-Pablo

On 05/26/16 10:46, Jeff Hammond wrote:

(I'm looking at
http://wiki.edg.com/pub/CPLEX/MeetingApr252016/sections.html)

Reduction operation Result value Result type Result value when the
argument is an empty section
|__sec_reduce_all_zero| One if all argument values are zero; zero
otherwise |int| One
|__sec_reduce_all_nonzero| One if all argument values are nonzero;
zero otherwise |int| One
|__sec_reduce_any_zero| One if any argument value is zero; zero
otherwise |int| Zero
|__sec_reduce_any_nonzero| One if any argument value is nonzero; zero
otherwise |int| Zero

Why is it that an empty section is defined to be (1) "all zero", (2)
"all nonzero", (3) "not any zero", and (4) "not any nonzero"? The
latter two make sense, because any empty set doesn't have anything in
it. But why is an empty set both all zero and all nonzero?

Maybe I missed something, either in the CPLEX text or in set theory.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/wg14-cplex/epp/issues/25Web Bug from
https://github.com/notifications/beacon/AA8FY6cSL5-B2fzEXture8e9ET4tD-eBks5qFbJfgaJpZM4Innki.gif

@jeffhammond
Copy link
Member Author

Thanks. That makes sense.

Jeff Hammond
[email protected]
http://jeffhammond.github.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants