MKL BLAS functions

The accelerate.mkl.blas module contains a subset of BLAS functions implemented by means of the underlying Intel MKL library.

Reference

accelerate.mkl.blas.dot(x, y)

Compute and return the vector dot product of x and y.

Parameters:
  • x – one-dimensional array
  • y – one-dimensional array
Return type:

result

Note:

the input arguments may be copied to adjust their types.

accelerate.mkl.blas.axpy(alpha, x, y)

\(y \leftarrow alpha*x + y\)

Parameters:
  • alpha – a scalar
  • x – one-dimensional array
  • y – one-dimensional array
Return type:

one-dimensional array

Note:

the input arguments may be copied to adjust their types.

Note:

y is modified in-place only if it has the appropriate type. See this example.

accelerate.mkl.blas.gemv(trans, alpha, A, x, beta=0., y=None)

Generalized matrix-vector multiplication:

\(y \leftarrow alpha*trans(A)*x + beta*y\)

Parameters:
  • trans
    ‘n’, ‘N’:\(trans(A)=A\)
    ‘t’, ‘T’:\(trans(A)=A^T\) (transpose of A)
    ‘c’, ‘C’:\(trans(A)=A^*\) (Hermitian transpose of A)
  • alpha – a scalar
  • x – one-dimensional array
  • beta – a scalar
  • y – one-dimensional array
Return type:

one-dimensional array

Note:

the input arguments may be copied to adjust their types, as well as dimension-ordering to column-major.

Note:

y is modified in-place only if it has the appropriate type. See this example. The result is undefined if y aliases A or x.

accelerate.mkl.blas.gemm(transa, transb, alpha, A, B, beta=0., C=None)

Generalized matrix-matrix multiplication:

\(C \leftarrow alpha*transa(A)*transb(B) + beta*C\)

Parameters:
  • transa
    ‘n’, ‘N’:\(transa(A)=A\)
    ‘t’, ‘T’:\(transa(A)=A^T\) (transpose of A)
    ‘c’, ‘C’:\(transa(A)=A^*\) (Hermitian transpose of A)
  • transb
    ‘n’, ‘N’:\(transb(B)=B\)
    ‘t’, ‘T’:\(transb(B)=B^T\) (transpose of B)
    ‘c’, ‘C’:\(transb(B)=B^*\) (Hermitian transpose of B)
  • alpha – a scalar
  • A – two-dimensional array
  • B – two-dimensional array
  • beta – a scalar
  • C – two-dimensional array
Return type:

two-dimensional array

Note:

the input arguments may be copied to adjust their types, as well as dimension-ordering to column-major.

Note:

C is modified in-place only if it has the appropriate type. See this example. The result is undefined if C aliases A or B.

Example

alpha = 1.+1.j
A = np.arange(16, dtype=np.float64).reshape(4,4)
x = np.arange(4, dtype=np.float64)
beta = 0.
y = np.arange(4, dtype=np.float64)
result = blas.gemv('N', alpha, A, x, beta, y)

As alpha is complex, the result of \(alpha*A*x + beta*y\) will be complex, too, and thus can’t be stored in y. Therefore y can’t be modified in-place.