Function rustml::ops_inplace::d_gemm
[−]
[src]
pub fn d_gemm(alpha: f64, a: &Matrix<f64>, b: &Matrix<f64>, beta: f64, c: &mut Matrix<f64>, transa: bool, transb: bool)
Computes alpha * op(A) * op(B) + beta * C
and stores the result in C
. (optimized via BLAS)
If transa
is true
the function op(A)
returns the transpose of A
,
otherwise A
is returned. If transb
is true
the function op(B)
returns the
transpose of B
, otherwise B
is returned.
Panics if the dimensions of the matrices do not match.
use rustml::ops_inplace::*; use rustml::matrix::*; let a = mat![ 1.0, 2.0, 3.0; 4.0, 5.0, 6.0 ]; let b = mat![ 2.0, 5.0, 2.0, 3.0; 1.0, 9.0, 5.0, 4.0; 4.0, 6.0, 8.0, 7.0 ]; let mut c = mat![ 3.0, 4.0, 1.0, 8.0; 4.0, 2.0, 6.0, 6.0 ]; d_gemm(2.0, &a, &b, 3.0, &mut c, false, false); assert_eq!( c.buf(), &vec![41.0, 94.0, 75.0, 88.0, 86.0, 208.0, 180.0, 166.0] );