<< lu QD: 32 bytes decimal arithmetics min >>

DD_QD (MuPAT) >> DD_QD (MuPAT) > QD: 32 bytes decimal arithmetics > max

max

maximal value of an array of QD numbers

Syntax

qd = max(QD)
QDrow = max(QD, "r"|1)
QDcol = max(QD, "c"|2)
[v, k] = max(QD..)

Parameters

QD

array of QD-encoded real numbers

qd

QD-encoded number.

QDrow

row of QD-encoded numbers.

QDcol

column of QD-encoded numbers.

v

One of the results qd, QDrow, QDcol, according to the used syntax.

k

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

Description

v = max(QD), [v, k] = max(QD), and its input directional option v = max(QD,'r'|1|'c'|2) and [v, k] = max(QD,'r'|1|'c'|2) work for QD 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(QD1,QD2,..) is not supported.

Examples

h = grand(3,5,"uin",-1,1); d = grand(3,5,3,"uin",0,2);
s = sign(h); d = d.*cat(3, s, s, s);
q = qd(h, d(:,:,1)*1e-17, d(:,:,2)*1e-34, d(:,:,3)*1e-51)

[v, k] = max(q)
[v, k] = max(q, "r")
[v, k] = max(q, 2)
--> h = grand(3,5,"uin",-1,1); d = grand(3,5,3,"uin",0,2);
--> s = sign(h); d = d.*cat(3, s, s, s);
--> q = qd(h, d(:,:,1)*1e-17, d(:,:,2)*1e-34, d(:,:,3)*1e-51)
 q  = 
[d1]
   0.   0.   1.   1.   1.
   0.   1.   0.   0.   0.
  -1.   0.   1.   1.  -1.

[d2] 10^-17 *
   0.   0.   0.   1.   1.
   0.   0.   0.   0.   0.
  -1.   0.   0.   0.   0.

[d3] 10^-34 *
   0.   0.   0.   2.   0.
   0.   0.   0.   0.   0.
  -2.   0.   1.   2.   0.

[d4] 10^-51 *
   0.   0.   2.   1.   1.
   0.   2.   0.   0.   0.
  -1.   0.   1.   1.   0.


--> [v, k] = max(q)
 k  = 
   10.

 v  = 
   1.00000000000000001000000000000000091542424054621923162020134021E0


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

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

[d2] 10^-17 *
   0.   0.   0.   1.   1.

[d3] 10^-34 *
   0.   0.   1.   2.   0.

[d4] 10^-51 *
   0.   2.   1.   1.   1.


--> [v, k] = max(q, 2)
 k  = 
   4.
   2.
   4.

 v  = 
[d1]
   1.
   1.
   1.

[d2] 10^-17 *
   1.
   0.
   0.

[d3] 10^-34 *
   2.
   0.
   2.

[d4] 10^-51 *
   1.
   2.
   1.

See Also

Authors

Copyright (C) 2018 - Samuel GOUGEON

Report an issue
<< lu QD: 32 bytes decimal arithmetics min >>