<< lu DD: 16 bytes decimal arithmetics min >>

DD_QD (MuPAT) >> DD_QD (MuPAT) > DD: 16 bytes decimal arithmetics > max

max

maximal value of an array of DD numbers

Syntax

dd = max(DD)
DDrow = max(DD, "r"|1)
DDcol = max(DD, "c"|2)
[v, k] = max(DD..)

Parameters

DD

array of DD-encoded real numbers

dd

DD-encoded number.

DDrow

row of DD-encoded numbers.

DDcol

column of DD-encoded numbers.

v

One of the results dd, DDrow, DDcol, according to the used syntax.

k

vector: linearized index, indices of rows, or indices of columns in DD where the (first) maximum is found. Has the shape of v.

Description

v = max(DD), [v, k] = max(DD), and its input directional option v = max(DD,'r'|1|'c'|2) and [v, k] = max(DD,'r'|1|'c'|2) work for DD arrays as for usual decimal numbers. Please refer to the examples below and to the max() page to see details. "r" and 1 option values are equivalent ; "c" and 2 ones as well.

Please note that the syntax max(DD1,DD2,..) is not supported.

Examples

hi = grand(3,4,"uin",-2,2); lo = grand(3,4,"uin",0,9).*sign(hi);
d = dd(hi, lo*1e-18)

[v, k] = max(d)
[v, k] = max(d, "r")
[v, k] = max(d, "c")
--> hi = grand(3,4,"uin",-2,2); lo = grand(3,4,"uin",0,9).*sign(hi);
--> d = dd(hi, lo*1e-18)
 d  =
[d1]
  -2.   1.   0.   2.
  -1.   0.  -1.   2.
   1.   2.  -2.   1.

[d2] 10^-17 *
  -0.6   0.2   0.    0.1
  -0.9   0.   -0.7   0.7
   0.1   0.1  -0.5   0.7


--> [v, k] = max(d)
 k  =
   11.
 v  =
   2.000000000000000007000000000000E0

--> [v, k] = max(d, "r")
 k  =
   3.   3.   1.   2.

 v  =
[d1]
   1.   2.   0.   2.

[d2] 10^-17 *
   0.1   0.1   0.   0.7


--> [v, k] = max(d, "c")
 k  =
   4.
   4.
   2.

 v  =
[d1]
   2.
   2.
   2.
[d2] 10^-17 *
   0.1
   0.7
   0.1

See Also

Authors

Copyright (C) 2018 - Samuel GOUGEON

Report an issue
<< lu DD: 16 bytes decimal arithmetics min >>