Skip to content

Commit

Permalink
linalg : scaleを追加。
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 90fce64 commit 6b11b92
Show file tree
Hide file tree
Showing 2 changed files with 72 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 @@ -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 |
Expand Down
71 changes: 71 additions & 0 deletions reference/linalg/scale.md
Original file line number Diff line number Diff line change
@@ -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<class Scalar,
inout-object InOutObj>
void scale(Scalar alpha,
InOutObj x); // (1)

template<class ExecutionPolicy,
class Scalar,
inout-object InOutObj>
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)

1 comment on commit 6b11b92

@sukeya
Copy link
Contributor Author

@sukeya sukeya commented on 6b11b92 Jun 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.