Module ops_inplace

Source
Expand description

Provides scalar, vector, vector-vector, vector-matrix and matrix-matrix operations.

Most of the operations are optimized using the underlying BLAS implementation. For each function it is explicitly documented whether or not BLAS is used.

§Examples

The following example adds two vectors using BLAS and stores the result in the first vector.

use rustml::*;

let mut a = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
let b = [3.0, 6.0, 2.0, 3.0, 6.0, 9.0];
a.iadd(&b);
assert_eq!(a, [4.0, 8.0, 5.0, 7.0, 11.0, 15.0]);

Traits§

FunctionsInPlace
Trait for common mathematical functions for scalars, vectors and matrices.
MatrixMatrixOpsInPlace
Trait for matrix-matrix operations.
MatrixScalarOpsInPlace
Trait for matrix-scalar operations.
VectorVectorOpsInPlace
Trait for inplace vector-vector operations.

Functions§

d_axpy
Computes alpha * x + y and stores the result in y. (optimized via BLAS)
d_gemm
Computes alpha * op(A) * op(B) + beta * C and stores the result in C. (optimized via BLAS)
d_gemv
Computes alpha * A * x + beta * y or alpha * A^T * x + beta * y and stores the result in y. (optimized via BLAS)
d_nrm2
Computes the L2 norm (euclidean norm) of a vector. (optimized via BLAS)
s_axpy
Computes alpha * x + y and stores the result in y. (optimized via BLAS)
s_gemm
Computes alpha * op(A) * op(B) + beta * C and stores the result in C. (optimized via BLAS)
s_gemv
Computes alpha * A * x + beta * y or alpha * A^T * x + beta * y and stores the result in y. (optimized via BLAS)
s_nrm2
Computes the L2 norm (euclidean norm) of a vector. (optimized via BLAS)