Subject: clarification of reduce with complex datatypes

From: [email-masked] (Steve Huss-Lederman)
Date: Fri, 15 Jul 94 11:42:40 EDT

Hello MPIers,

The discussion of how to do reduce on complex values seems to have
slowed down on mpi-core.  I propose the following clarification to the
MPI standard text (I call it a clarification instead of a change since
the current text is vague).  I don't think (hope :-) that this
requires a vote.  I believe it is consistent with the discussion.  I
am posting to mpi-comm to make sure everyone interested will see this.
As always, I welcome comments.

Steve
----------------------------------------------------------------------
Proposed insertion of text on p. 113 line 40 of April 21 version:

MPI_MAX and MPI_MIN on complex datatype values use the modulus
(absolute value) to determine the ordering.  The result returned in
recvbuf is the complex value for which the maximum or minimum occurred.

\rationale{
Unlike other datatypes, the maximum/minimum of a complex value is of a
different datatype (floating point) and value than the input.  Since
the maximum/minimum can easily be determined from the complex value
but the inverse operation is not unique, it was decided to return the
complex value.  As a result, the user is not returned the actual
maximum/minimum for complex values as is true for the other datatypes.
}

A further consideration with complex arguments is what value to return
when the modulus is the same for two input arguments.  For other
datatypes, the output value would be the same if the maximum/minimum
were equal.  For this case with complex values, MPI_MAX and MPI_MIN
are defined as:

If $|a| = |b|$ then  $\rm{Max}(a,b) = a$ and $\rm{Min}(a,b) = a$.

Thus, the first entry (lowest rank) with the maximum/minimum modulus
will be returned.  This definition means that MPI_MAXLOC and
MPI_MINLOC will return the same value as MPI_MAX and MPI_MIN when two
input values have the same modulus.
----------------------------------------------------------------------
Change to p. 112 line 20:

All predefined operations are also assumed to be commutative

should become

All predefined operations are also assumed to be commutative with the
exception of max and min on complex datatypes.
----------------------------------------------------------------------
Insertion to p. 115 line 17:

If MPI_MAXLOC or MPI_MINLOC is applied to a complex value then $u > v$
becomes $ |u| < |v|$ and similarly for $u = v$ and $u < v$ in the
above definitions.
----------------------------------------------------------------------

---

From: [email-masked] (James Cownie)
Date: Fri, 15 Jul 1994 17:13:41 +0000

Steve, 

I think you are making an unnecessary distinction when you say 

" As a result, the user is not returned the actual maximum/minimum for
complex values as is true for the other datatypes."

If we just say that we always return the input element which has the
maximum or minimum value, then complex is no different from any other
type. The difference is just that the comparison is based on a
function of the input value (in this case its modulus), rather than
the input value itself.

This doesn't actually change anything, because for all the other types
the input element which has the max or min value IS identically the
max or min value. 

-- Jim 
James Cownie 
Meiko Limited			Meiko Inc.
650 Aztec West			130C Baker Avenue Ext.
Bristol BS12 4SD		Concord
England				MA 01742

Phone : +44 454 616171		+1 508 371 0088
FAX   : +44 454 618188		+1 508 371 7516
E-Mail: [email-masked]   or    [email-masked]
WWW   : http://www.meiko.com:8080/welcome.html