From Jason Turner

[linalg.helpers.concepts]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9fzhbkwl/{from.md → to.md} +76 -0
tmp/tmp9fzhbkwl/{from.md → to.md} RENAMED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Argument concepts <a id="linalg.helpers.concepts">[[linalg.helpers.concepts]]</a>
2
+
3
+ The exposition-only concepts defined in this section constrain the
4
+ algorithms in [[linalg]].
5
+
6
+ ``` cpp
7
+ template<class T>
8
+ constexpr bool is-mdspan = false;
9
+
10
+ template<class ElementType, class Extents, class Layout, class Accessor>
11
+ constexpr bool is-mdspan<mdspan<ElementType, Extents, Layout, Accessor>> = true;
12
+
13
+ template<class T>
14
+ concept in-vector =
15
+ is-mdspan<T> && T::rank() == 1;
16
+
17
+ template<class T>
18
+ concept out-vector =
19
+ is-mdspan<T> && T::rank() == 1 &&
20
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
21
+
22
+ template<class T>
23
+ concept inout-vector =
24
+ is-mdspan<T> && T::rank() == 1 &&
25
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
26
+
27
+ template<class T>
28
+ concept in-matrix =
29
+ is-mdspan<T> && T::rank() == 2;
30
+
31
+ template<class T>
32
+ concept out-matrix =
33
+ is-mdspan<T> && T::rank() == 2 &&
34
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
35
+
36
+ template<class T>
37
+ concept inout-matrix =
38
+ is-mdspan<T> && T::rank() == 2 &&
39
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
40
+
41
+ template<class T>
42
+ constexpr bool is-layout-blas-packed = false; // exposition only
43
+
44
+ template<class Triangle, class StorageOrder>
45
+ constexpr bool is-layout-blas-packed<layout_blas_packed<Triangle, StorageOrder>> = true;
46
+
47
+ template<class T>
48
+ concept possibly-packed-inout-matrix =
49
+ is-mdspan<T> && T::rank() == 2 &&
50
+ is_assignable_v<typename T::reference, typename T::element_type> &&
51
+ (T::is_always_unique() || is-layout-blas-packed<typename T::layout_type>);
52
+
53
+ template<class T>
54
+ concept in-object =
55
+ is-mdspan<T> && (T::rank() == 1 || T::rank() == 2);
56
+
57
+ template<class T>
58
+ concept out-object =
59
+ is-mdspan<T> && (T::rank() == 1 || T::rank() == 2) &&
60
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
61
+
62
+ template<class T>
63
+ concept inout-object =
64
+ is-mdspan<T> && (T::rank() == 1 || T::rank() == 2) &&
65
+ is_assignable_v<typename T::reference, typename T::element_type> && T::is_always_unique();
66
+ ```
67
+
68
+ If a function in [[linalg]] accesses the elements of a parameter
69
+ constrained by `in-vector`, `in-matrix`, or `in-object`, those accesses
70
+ will not modify the elements.
71
+
72
+ Unless explicitly permitted, any `inout-vector`, `inout-matrix`,
73
+ `inout-object`, `out-vector`, `out-matrix`, `out-object`, or
74
+ `possibly-packed-inout-matrix` parameter of a function in [[linalg]]
75
+ shall not overlap any other `mdspan` parameter of the function.
76
+