File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,58 @@ namespace std::linalg {
5757
5858
5959## 例
60+ **[注意] 処理系にあるコンパイラで確認していないため、間違っているかもしれません。**
61+
62+ ```cpp example
63+ #include <cmath>
64+ #include <execution>
65+ #include <iostream>
66+ #include <linalg>
67+ #include <mdspan>
68+ #include <vector>
69+
70+
71+ template <class Vector>
72+ bool IsEqual(Vector a, Vector b) {
73+ if (a.extent(0) != b.extent(0)) {
74+ return false;
75+ }
76+ for (int i = 0; i < a.extent(0); ++i) {
77+ if (a[i] != b[i]) {
78+ return false;
79+ }
80+ }
81+ return true;
82+ }
83+
84+
85+ int main()
86+ {
87+ constexpr size_t N = 3;
88+
89+ std::vector<double> a_vec({1, 2, 3});
90+ std::mdspan a(a_vec.data(), N);
91+
92+ std::vector<double> b_vec(N);
93+ std::mdspan b(b_vec.data(), N);
94+
95+ // (1)
96+ std::linalg::copy(a, b);
97+ assert(IsEqual(a, b));
98+
99+ // (2)
100+ std::linalg::copy(std::execution::par, a, b);
101+ assert(IsEqual(a, b));
102+
103+ return 0;
104+ }
105+ ```
106+ * std::linalg::copy[ color ff0000]
60107
61108
62109### 出力
110+ ```
111+ ```
63112
64113
65114## バージョン
You can’t perform that action at this time.
0 commit comments