|
Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
Teuchos version of MPI_MAXLOC. More...

Public Member Functions | |
| void | reduce (const Ordinal count, const std::pair< ScalarType, IndexType > inBuffer[], std::pair< ScalarType, IndexType > inoutBuffer[]) const |
| | |
Teuchos version of MPI_MAXLOC.
| Ordinal | The template parameter of Comm. |
| ScalarType | Type for which to find the maximum. |
| IndexType | Type indicating the index of the maximum. |
MPI_MAXLOC is a standard reduction operator provided by the MPI standard. According to the standard, MPI_MAXLOC combines the (value, index) pairs (u,i) and (v,j) into (w,j), where
, and
This class implements the MPI_MAXLOC reduction operator for the Teuchos communication wrappers. We need to define this separately from MPI for two reasons. First, the Teuchos comm wrappers do not currently expose taking an MPI_Op. Second, we need MaxLoc to be templated on the scalar and index types, in order to match Teuchos' MPI interface.
What happens to NaN ("Not a Number")? A NaN is neither less than, greater than, or equal to any floating-point number or any NaN. We can alter the above definition slightly so that a MaxLoc reduction has a well-defined result in case the array contains a NaN:
and
Defining MaxLoc in this way ensures that for any array containing a NaN, the value (w) returned is the first NaN, and the index (k) returned is the index of the first NaN.
Definition at line 106 of file Teuchos_TimeMonitor.cpp.
| void Teuchos::MaxLoc< Ordinal, ScalarType, IndexType >::reduce | ( | const Ordinal | count, |
| const std::pair< ScalarType, IndexType > | inBuffer[], | ||
| std::pair< ScalarType, IndexType > | inoutBuffer[] | ||
| ) | const [virtual] |
1.7.6.1