Maybe small improvement for accuracy for cos for regular angles
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp
- 領域
- performance
調査の方向性
npsr/trig/high-inl.h の 35–43 行目から始め、SIMD ルーチン内のコサインの前処理パスを追跡します。既存の変換と、提案されている cos(x) = sin(π/2 - |x|) のアプローチを比較し、-pi から pi の間の入力に焦点を当てます。コサインのパスが精度を維持する変換を使用し、周辺のサイン/コサイン処理にリグレッションを生じさせないことが完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
@seiko2plus - Came here out of curiosity from https://github.com/numpy/numpy/pull/29699#issuecomment-3630501457, to see how things get done. For cos, the following transformation is done before any real calculation:
https://github.com/numpy/numpy-simd-routines/blob/1acd14571b9f58072d1f7f17886945000d78b56a/npsr/trig/high-inl.h#L35-L43
This would seem to loose some precision for the common case where angle input will be between -pi and pi, by moving those angles to pi/2 to 3*pi/2. Instead, one can move those angles to near zero and thus get optimal precision near both crossings by using that cos(x) = sin(pi/2 - |x|) , i.e. do something like,
// Transform cosine to sine using identity cos(x) = sin(π/2 - |x|)
// where |x| ensures optimal precision near both -pi/2 and pi/2.
const V half_pi = Set(d, data::kHalfPi<T>);
V x_trans = x;
if constexpr (OP == Operation::kCos) {
x_trans = And(abs_mask, x);
x_trans = Sub(half_pi, x_trans);
}
const V x_abs = And(abs_mask, x_trans);
const V x_sign = AndNot(x_abs, x_trans);
- 主要言語
- C++
- スター
- 10
- フォーク
- 3
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
numpy/numpy-simd-routines のほかの issue
-
Routinesオープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
numpy/numpy-simd-routines#2 · コメント 1 件 ·
numpy/numpy-simd-routines の issue をすべて見る
似ている issue
-
arrays bug error not reported ICE low priority
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 2 日以内に返信
-
Missing repro Platform: Android
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
software-mansion/react-native-reanimated#11554 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
521xueweihan/HelloGitHub#4529 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Niko1221/Strata#7211 · コメント 3 件 ·
メンテナーはふだん 5 日以内に返信