Fortran-vector-and-matrix-multiplication
提供:Dev Guides
Fortran-ベクトルおよび行列乗算関数
次の表に、ベクトルと行列の乗算関数を示します。
Function | Description |
---|---|
dot_product(vector_a, vector_b) | This function returns a scalar product of two input vectors, which must have the same length. |
matmul (matrix_a, matrix_b) | It returns the matrix product of two matrices, which must be consistent, i.e. have the dimensions like (m, k) and (k, n) |
例
次の例は、内積を示しています。
上記のコードをコンパイルして実行すると、次の結果が生成されます。
- 例 *
次の例は、行列の乗算を示しています。
上記のコードをコンパイルして実行すると、次の結果が生成されます。