From Jason Turner

[linalg.algs.blas1.iamax]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmplo5za32d/{from.md → to.md} +34 -0
tmp/tmplo5za32d/{from.md → to.md} RENAMED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Index of maximum absolute value of vector elements <a id="linalg.algs.blas1.iamax">[[linalg.algs.blas1.iamax]]</a>
2
+
3
+ ``` cpp
4
+ template<in-vector InVec>
5
+ typename InVec::extents_type vector_idx_abs_max(InVec v);
6
+ template<class ExecutionPolicy, in-vector InVec>
7
+ typename InVec::extents_type vector_idx_abs_max(ExecutionPolicy&& exec, InVec v);
8
+ ```
9
+
10
+ [*Note 1*: These functions correspond to the BLAS function
11
+ `IxAMAX`. — *end note*]
12
+
13
+ Let `T` be
14
+
15
+ ``` cpp
16
+ decltype(abs-if-needed(real-if-needed(declval<typename InVec::value_type>())) +
17
+ abs-if-needed(imag-if-needed(declval<typename InVec::value_type>())))
18
+ ```
19
+
20
+ *Mandates:* `declval<T>() < declval<T>()` is a valid expression.
21
+
22
+ *Returns:*
23
+
24
+ - `numeric_limits<typename InVec::size_type>::max()` if `v` has zero
25
+ elements;
26
+ - otherwise, the index of the first element of `v` having largest
27
+ absolute value, if `InVec::value_type` is an arithmetic type;
28
+ - otherwise, the index of the first element `vₑ` of `v` for which
29
+ ``` cpp
30
+ abs-if-needed(real-if-needed($v_e$)) + abs-if-needed(imag-if-needed($v_e$))
31
+ ```
32
+
33
+ has the largest value.
34
+