-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuya Asano <64895419+sukeya@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# dotc | ||
|
||
* [mathjax enable] | ||
* linalg[meta header] | ||
* function template[meta id-type] | ||
* std::linalg[meta namespace] | ||
* cpp26[meta cpp] | ||
|
||
|
||
```cpp | ||
namespace std::linalg { | ||
template<in-vector InVec1, | ||
in-vector InVec2, | ||
class Scalar> | ||
Scalar dotc(InVec1 v1, | ||
InVec2 v2, | ||
Scalar init); // (1) | ||
|
||
template<class ExecutionPolicy, | ||
in-vector InVec1, | ||
in-vector InVec2, | ||
class Scalar> | ||
Scalar dotc(ExecutionPolicy&& exec, | ||
InVec1 v1, | ||
InVec2 v2, | ||
Scalar init); // (2) | ||
|
||
template<in-vector InVec1, | ||
in-vector InVec2> | ||
auto dotc(InVec1 v1, | ||
InVec2 v2); // (3) | ||
|
||
template<class ExecutionPolicy, | ||
in-vector InVec1, | ||
in-vector InVec2> | ||
auto dotc(ExecutionPolicy&& exec, | ||
InVec1 v1, | ||
InVec2 v2); // (4) | ||
} | ||
``` | ||
## 概要 | ||
2つのベクトル`v1`、`v2`のエルミート内積を計算する。 | ||
## 適格要件 | ||
2つのベクトルの静的な要素数が同じであること。 | ||
- [`compatible-static-extents`](compatible-static-extents.md)`<InVec1, InVec2>(0, 0) == true` | ||
## 事前条件 | ||
2つのベクトルの次元が同じであること。 | ||
- `v1.extent(0) == v2.extent(0)` | ||
## 効果 | ||
- (1): [`dot`](dot.md)`(`[`conjugated`](conjugated.md)`(v1), v2, init)`を返す。 | ||
- (2): `dot(std::forward<ExecutionPolicy>(exec), conjugated(v1), v2, init)`を返す。 | ||
- (3), (4): `T`を各ベクトルの値型の積の型`decltype(conj-if-needed(declval<typename InVec1::value_type>()) * declval<typename InVec2::value_type>())`とする。 | ||
+ (3): `dotc(v1, v2, T{})`を返す。 | ||
+ (4): `dotc(std::forward<ExecutionPolicy>(exec), v1, v2, T{})`を返す。 | ||
## 戻り値 | ||
2つのベクトルの次元を`N`とする。 | ||
- (1): もし`N`が0なら`init`を返す。そうでない場合は、共役を取らない内積、つまり以下の式の`Scalar`型の値を返す。 | ||
$$ | ||
\verb|init| + \sum_{i = 0}^{N - 1} \overline{\verb|v1|[i]} * \verb|v2|[i] | ||
$$ | ||
- (2): (1)の並列アルゴリズム版。 | ||
- (3): (1)の`init`を和の各項の型のデフォルト値に置き換えて計算する。 | ||
- (4): (3)の並列アルゴリズム版。 | ||
## 例 | ||
### 出力 | ||
## バージョン | ||
### 言語 | ||
- C++11 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [ICC](/implementation.md#icc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
## 関連項目 | ||
- [`dot`](dot.md) | ||
- [`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: cdotc`](https://netlib.org/lapack/explore-html/d1/dcc/group__dot_ga5c189335a4e6130a2206c190579b1571.html#ga5c189335a4e6130a2206c190579b1571) | ||
2db36f3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1233