From 6b11b92c8a2f6fedbdee135b36128440d8444a03 Mon Sep 17 00:00:00 2001 From: Yuya Asano <64895419+sukeya@users.noreply.github.com> Date: Sat, 1 Jun 2024 17:11:37 +0900 Subject: [PATCH] =?UTF-8?q?linalg=20:=20scale=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yuya Asano <64895419+sukeya@users.noreply.github.com> --- reference/linalg.md | 2 +- reference/linalg/scale.md | 71 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 reference/linalg/scale.md diff --git a/reference/linalg.md b/reference/linalg.md index dbc935b30..81ecaf9e4 100644 --- a/reference/linalg.md +++ b/reference/linalg.md @@ -62,7 +62,7 @@ BLAS 1, 2, 3のアルゴリズムでテンプレートパラメータが特に | [`setup_givens_rotation`](linalg/setup_givens_rotation.md) | xLARTG: ギブンス回転をセットアップする (function template) | C++26 | | [`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` | xSCAL: ベクトル/行列の要素にスカラ値を乗算する (function template) | C++26 | +| [`scale`](linalg/scale.md) | xSCAL: ベクトル/行列の要素にスカラ値を乗算する (function template) | C++26 | | `copy` | xCOPY: ベクトル/行列の要素をコピーする (function template) | C++26 | | `add` | xAXPY: 2つのベクトル/行列の要素を加算する (function template) | C++26 | | `dot` | xDOT, xDOTU: 2つのベクトルのドット積を求める (function template) | C++26 | diff --git a/reference/linalg/scale.md b/reference/linalg/scale.md new file mode 100644 index 000000000..4f44d419b --- /dev/null +++ b/reference/linalg/scale.md @@ -0,0 +1,71 @@ +# scale + +* [mathjax enable] +* linalg[meta header] +* function template[meta id-type] +* std::linalg[meta namespace] +* cpp26[meta cpp] + + +```cpp +namespace std::linalg { + template + void scale(Scalar alpha, + InOutObj x); // (1) + + template + void scale(ExecutionPolicy&& exec, + Scalar alpha, + InOutObj x); // (2) +} +``` + + +## 概要 +以下のように、ベクトル`x`を`alpha`倍したものを`x`に代入する。 + +$$ +\mathbf{x}\leftarrow\alpha\mathbf{x} +$$ + + +## 効果 +ベクトル`x`を`alpha`倍する。 + +- (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: cscal`](https://netlib.org/lapack/explore-html/d2/de8/group__scal_gacce468103c83fa18bae078d5f49fefe2.html#gacce468103c83fa18bae078d5f49fefe2) +