tmp/tmp5tse076e/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Algorithm and class requirements <a id="linalg.reqs.alg">[[linalg.reqs.alg]]</a>
|
| 2 |
+
|
| 3 |
+
[[linalg.reqs.alg]] lists common requirements for all algorithms and
|
| 4 |
+
classes in [[linalg]].
|
| 5 |
+
|
| 6 |
+
All of the following statements presume that the algorithm’s asymptotic
|
| 7 |
+
complexity requirements, if any, are satisfied.
|
| 8 |
+
|
| 9 |
+
- The function may make arbitrarily many objects of any linear algebra
|
| 10 |
+
value type, value-initializing or direct-initializing them with any
|
| 11 |
+
existing object of that type.
|
| 12 |
+
- The *triangular solve algorithms* in [[linalg.algs.blas2.trsv]],
|
| 13 |
+
[[linalg.algs.blas3.trmm]], [[linalg.algs.blas3.trsm]], and
|
| 14 |
+
[[linalg.algs.blas3.inplacetrsm]] either have a `BinaryDivideOp`
|
| 15 |
+
template parameter (see [[linalg.algs.reqs]]) and a binary function
|
| 16 |
+
object parameter `divide` of that type, or they have effects
|
| 17 |
+
equivalent to invoking such an algorithm. Triangular solve algorithms
|
| 18 |
+
interpret `divide(a, b)` as `a` times the multiplicative inverse of
|
| 19 |
+
`b`. Each triangular solve algorithm uses a sequence of evaluations of
|
| 20 |
+
`*`, `*=`, `divide`, unary `+`, binary `+`, `+=`, unary `-`, binary
|
| 21 |
+
`-`, `-=`, and `=` operators that would produce the result specified
|
| 22 |
+
by the algorithm’s *Effects* and *Remarks* when operating on elements
|
| 23 |
+
of a field with noncommutative multiplication. It is a precondition of
|
| 24 |
+
the algorithm that any addend, any subtrahend, any partial sum of
|
| 25 |
+
addends in any order (treating any difference as a sum with the second
|
| 26 |
+
term negated), any factor, any partial product of factors respecting
|
| 27 |
+
their order, any numerator (first argument of `divide`), any
|
| 28 |
+
denominator (second argument of `divide`), and any assignment is a
|
| 29 |
+
well-formed expression.
|
| 30 |
+
- Each function in [[linalg.algs.blas1]], [[linalg.algs.blas2]], and
|
| 31 |
+
[[linalg.algs.blas3]] that is not a triangular solve algorithm will
|
| 32 |
+
use a sequence of evaluations of `*`, `*=`, `+`, `+=`, and `=`
|
| 33 |
+
operators that would produce the result specified by the algorithm’s
|
| 34 |
+
*Effects* and *Remarks* when operating on elements of a semiring with
|
| 35 |
+
noncommutative multiplication. It is a precondition of the algorithm
|
| 36 |
+
that any addend, any partial sum of addends in any order, any factor,
|
| 37 |
+
any partial product of factors respecting their order, and any
|
| 38 |
+
assignment is a well-formed expression.
|
| 39 |
+
- If the function has an output `mdspan`, then all addends, subtrahends
|
| 40 |
+
(for the triangular solve algorithms), or results of the `divide`
|
| 41 |
+
parameter on intermediate terms (if the function takes a `divide`
|
| 42 |
+
parameter) are assignable and convertible to the output `mdspan`’s
|
| 43 |
+
`value_type`.
|
| 44 |
+
- The function may reorder addends and partial sums arbitrarily.
|
| 45 |
+
\[*Note 1*: Factors in each product are not reordered; multiplication
|
| 46 |
+
is not necessarily commutative. — *end note*]
|
| 47 |
+
|
| 48 |
+
[*Note 2*: The above requirements do not prohibit implementation
|
| 49 |
+
approaches and optimization techniques which are not user-observable. In
|
| 50 |
+
particular, if for all input and output arguments the `value_type` is a
|
| 51 |
+
floating-point type, implementers are free to leverage approximations,
|
| 52 |
+
use arithmetic operations not explicitly listed above, and compute
|
| 53 |
+
floating-point sums in any way that improves their
|
| 54 |
+
accuracy. — *end note*]
|
| 55 |
+
|
| 56 |
+
[*Note 3*:
|
| 57 |
+
|
| 58 |
+
For all functions in [[linalg]], suppose that all input and output
|
| 59 |
+
`mdspan` have as `value_type` a floating-point type, and any `Scalar`
|
| 60 |
+
template argument has a floating-point type. Then, functions can do all
|
| 61 |
+
of the following:
|
| 62 |
+
|
| 63 |
+
- compute floating-point sums in any way that improves their accuracy
|
| 64 |
+
for arbitrary input;
|
| 65 |
+
- perform additional arithmetic operations (other than those specified
|
| 66 |
+
by the function’s wording and [[linalg.reqs.alg]]) in order to improve
|
| 67 |
+
performance or accuracy; and
|
| 68 |
+
- use approximations (that might not be exact even if computing with
|
| 69 |
+
real numbers), instead of computations that would be exact if it were
|
| 70 |
+
possible to compute without rounding error;
|
| 71 |
+
|
| 72 |
+
as long as
|
| 73 |
+
|
| 74 |
+
- the function satisfies the complexity requirements; and
|
| 75 |
+
- the function is logarithmically stable, as defined in Demmel 2007.
|
| 76 |
+
Strassen’s algorithm for matrix-matrix multiply is an example of a
|
| 77 |
+
logarithmically stable algorithm.
|
| 78 |
+
|
| 79 |
+
— *end note*]
|
| 80 |
+
|