fma
説明
例
融合積和演算を使用した 3 つの入力の乗算と加算
この例では、融合積和演算法を使用して、関数 fma
を使用して を計算する方法を説明します。
入力を定義し、関数 fma
を使用して積和演算を計算します。
a = half(10); b = half(10); c = half(2); x = fma(a, b, c)
x = half 102
関数 fma
の結果を、積を計算してから総和を計算する 2 段階の方法と比較します。
temp = a * b; x = temp + c
x = half 102
入力引数
A
— 入力配列
スカラー | ベクトル | 行列 | 多次元配列
入力配列。浮動小数点スカラー、ベクトル、行列または多次元配列として指定します。A
と B
が行列の場合、fma
は要素単位の乗算を実行してから加算を実行します。
データ型: single
| double
| half
B
— 入力配列
スカラー | ベクトル | 行列 | 多次元配列
入力配列。浮動小数点スカラー、ベクトル、行列または多次元配列として指定します。A
と B
が行列の場合、fma
は要素単位の乗算を実行してから加算を実行します。
データ型: single
| double
| half
C
— 入力配列
スカラー | ベクトル | 行列 | 多次元配列
入力配列。浮動小数点スカラー、ベクトル、行列または多次元配列として指定します。
データ型: single
| double
| half
出力引数
X
— 乗算と加算の結果
スカラー | ベクトル | 行列 | 多次元配列
乗算と加算の結果、A.*B+C。スカラー、ベクトル、行列、または多次元配列として返されます。
バージョン履歴
R2019a で導入
参考
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)