Skip to content

Commit

Permalink
linalg : copyを追加。(#1233)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuya Asano <64895419+sukeya@users.noreply.github.com>
  • Loading branch information
sukeya committed Jun 1, 2024
1 parent 3382e49 commit 2ec4f19
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
2 changes: 1 addition & 1 deletion reference/linalg.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BLAS 1, 2, 3のアルゴリズムでテンプレートパラメータが特に
| [`apply_givens_rotation`](linalg/apply_givens_rotation.md) | xROT: ベクトルにギブンス回転を適用する (function template) | C++26 |
| [`swap_elements`](linalg/swap_elements.md) | xSWAP: 2つのベクトル/行列の要素を交換する (function template) | C++26 |
| [`scale`](linalg/scale.md) | xSCAL: ベクトル/行列の要素にスカラ値を乗算する (function template) | C++26 |
| `copy` | xCOPY: ベクトル/行列の要素をコピーする (function template) | C++26 |
| [`copy`](linalg/copy.md) | xCOPY: ベクトル/行列の要素をコピーする (function template) | C++26 |
| `add` | xAXPY: 2つのベクトル/行列の要素を加算する (function template) | C++26 |
| `dot` | xDOT, xDOTU: 2つのベクトルのドット積を求める (function template) | C++26 |
| `dotc` | xDOTC: 2つのベクトルの複素共役ドット積を求める (function template) | C++26 |
Expand Down
81 changes: 81 additions & 0 deletions reference/linalg/copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# copy

* [mathjax enable]
* linalg[meta header]
* function template[meta id-type]
* std::linalg[meta namespace]
* cpp26[meta cpp]


```cpp
namespace std::linalg {
template<in-object InObj,
out-object OutObj>
void copy(InObj x,
OutObj y); // (1)

template<class ExecutionPolicy,
in-object InObj,
out-object OutObj>
void copy(ExecutionPolicy&& exec,
InObj x,
OutObj y); // (2)
}
```
## 概要
同じサイズの行列またはベクトルの`x`と`y`に対して、`x`を`y`にコピーする。
## テンプレートパラメータ制約
`x`と`y`の次元が等しくなければならない。
- `x.rank() == y.rank()`
## 適格要件
- 0以上`x.rank()`未満の整数rに対して、[`compatible-static-extents`](/reference/linalg/compatible-static-extents.md)`<InVec, OutVec>(r,r)`が`true`
## 事前条件
`x`と`y`の各次元の要素数が等しくなければならない。
- `x.extents() == y.extents()`
## 効果
`x`の各成分を`y`にコピーする。
- (1): 逐次実行する。
- (2): 指定された実行ポリシーに応じて実行する。
## 戻り値
なし
## 例
### 出力
## バージョン
### 言語
- C++26
### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??
## 関連項目
- [`execution`](/reference/execution.md)
- [`mdspan`](/reference/mdspan.md)
## 参照
- [P0788R3 Standard Library Specification in a Concepts and Contracts World](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0788r3.pdf)
- [`LAPACK: ccopy`](https://netlib.org/lapack/explore-html/d5/d2b/group__copy_gab395a30db1137d3deabe520b8e73097d.html#gab395a30db1137d3deabe520b8e73097d)

0 comments on commit 2ec4f19

Please sign in to comment.