Rate This Document
Findability
Accuracy
Completeness
Readability

?omatadd

Perform scaling and sum of two matrices including their out-of-place transposition/copying.

That is, .

Interface Definition

C interface:

void cblas_somatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const float alpha, float *A, const BLASINT lda, const float beta, float *B, const BLASINT ldb, float *C, const BLASINT ldc);

void cblas_domatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const double alpha, double *A, const BLASINT lda, const double beta, double *B, const BLASINT ldb, double *C, const BLASINT ldc);

void cblas_comatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const float *alpha, float *A, const BLASINT lda, const float *beta, float *B, const BLASINT ldb, float *C, const BLASINT ldc);

void cblas_zomatadd(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const double *alpha, double *A, const BLASINT lda, const double *beta, double *B, const BLASINT ldb, double *C, const BLASINT ldc);

Fortran interface:

CALL SOMATADD(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, BETA, B, LDB, C, LDC)

CALL DOMATADD(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, BETA, B, LDB, C, LDC)

CALL COMATADD(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, BETA, B, LDB, C, LDC)

CALL ZOMATADD(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, BETA, B, LDB, C, LDC)

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

Indicates whether the matrix is in row- or column-major order.

Input

TransA

Enumeration type CBLAS_TRANSPOSE

Indicates whether matrix A is a conventional matrix, a transpose matrix, a conjugate matrix, or a conjugate transpose matrix.

  • If TransA = CblasNoTrans, op(A) = A.
  • If TransA = CblasTrans, op(A) = A'.
  • If TransA = CblasConjNoTrans, op(A) = conj(A).
  • If TransA = CblasConjTrans, op(A) = conj(A').

Input

TransB

Enumeration type CBLAS_TRANSPOSE

Indicates whether matrix B is a conventional matrix, a transpose matrix, a conjugate matrix, or a conjugate transpose matrix.

  • If TransB = CblasNoTrans, op(B) = B.
  • If TransB = CblasTrans, op(B) = B'.
  • If TransB = CblasConjNoTrans, op(B) = conj(B).
  • If TransB = CblasConjTrans, op(B) = conj(B').

Input

M

Integer

Number of rows of matrices op (A), op (B), and C.

Input

N

Integer

Number of columns of matrices op (A), op (B), and C.

Input

alpha

  • Single-precision floating-point type for somatadd
  • Double-precision floating-point type for domatadd
  • Single-precision complex type for comatadd
  • Double-precision complex type for zomatadd

Multiplication coefficient.

Input

A

  • Single-precision floating-point type for somatadd
  • Double-precision floating-point type for domatadd
  • Single-precision complex type for comatadd
  • Double-precision complex type for zomatadd

Matrix A.

Input

lda

Integer

  • If matrix A is column store and TransA = CblasNoTrans, lda is at least max(1, m); otherwise, lda is at least max(1, n).
  • If matrix A is row store and TransA = CblasNoTrans, lda is at least max(1, n); otherwise, lda is at least max(1, m).

Input

beta

  • Single-precision floating-point type for somatadd
  • Double-precision floating-point type for domatadd
  • Single-precision complex type for comatadd
  • Double-precision complex type for zomatadd

Multiplication coefficient.

Input

B

  • Single-precision floating-point type for somatadd
  • Double-precision floating-point type for domatadd
  • Single-precision complex type for comatadd
  • Double-precision complex type for zomatadd

Matrix B.

Input

ldb

Integer

  • If the matrix is column store and TransB = CblasNoTrans, ldb is at least max(1, m); otherwise, ldb is at least max(1, n).
  • If the matrix is row store and TransB = CblasNoTrans, ldb is at least max(1, n); otherwise, ldb is at least max(1, m).

Input

C

  • Single-precision floating-point type for somatadd
  • Double-precision floating-point type for domatadd
  • Single-precision complex type for comatadd
  • Double-precision complex type for zomatadd

Matrix C.

Output

ldc

Integer

If the matrix is column store, ldc must be at least max(1, m). Otherwise, ldc must be at least max(1, n).

Input

Dependency

#include "kblas.h"

Examples

C interface:

    int m = 4;
    int n = 3;
    int lda = 4;
    int ldb = 4;
    int ldc = 4;
    float alpha = 2.0;
    float beta = 1.0;

    /** 
     *    A: 
     *         0.558402, 0.691866, 0.533786,   
     *         0.670904, 0.655601, 0.542604,
     *         0.743670, 0.965085, 0.993501,
     *         0.623749, 0.587617, 0.966428  
     *    B: 
     *         0.730575, 0.624083, 0.526782,   
     *         0.804889, 0.677061, 0.529442,
     *         0.785305, 0.802311, 0.508981,
     *         0.574068, 0.646785, 0.717143
     *    C: 
     *         0, 0, 0
     *         0, 0, 0
     *         0, 0, 0
     *         0, 0, 0
     */

    float a[12] = {0.558402, 0.691866, 0.533786,   
                   0.670904, 0.655601, 0.542604,
                   0.743670, 0.965085, 0.993501,
                   0.623749, 0.587617, 0.966428
    };

    float b[12] = {0.730575, 0.624083, 0.526782,
                   0.804889, 0.677061, 0.529442,
                   0.785305, 0.802311, 0.508981,
                   0.574068, 0.646785, 0.717143,
    };

    float c[12] = {0};

    cblas_somatadd(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, alpha, a, lda, beta, b, ldb, c, ldc);

    /** 
     * Output C: 
     *        1.847379, 2.007814, 1.594354,
     *        2.146696, 1.988263, 1.614650,
     *        2.272644, 2.732482, 2.495982, 
     *        1.821566, 1.822019, 2.649999 
     */

Fortran interface:

      PROGRAM OMATADD
      INTEGER :: M=4, N=3
      INTEGER :: LDA=4, LDB=4, LDC=4
      REAL(4) :: ALPHA=2.0
      REAL(4) :: BETA=1.0
      REAL(4) :: A(4, 3), B(4, 3), C(4, 3)
      DATA A/0.558402, 0.691866, 0.533786,
             0.670904, 0.655601, 0.542604,
             0.743670, 0.965085, 0.993501,
             0.623749, 0.587617, 0.966428/
      DATA B/0.730575, 0.624083, 0.526782,
             0.804889, 0.677061, 0.529442,
             0.785305, 0.802311, 0.508981,
             0.574068, 0.646785, 0.717143/
      DATA C/0.0, 0.0, 0.0,
             0.0, 0.0, 0.0,
             0.0, 0.0, 0.0/
      EXTERNAL SOMATADD
      CALL SOMATADD('C', 'N', 'N', M, N, ALPHA, A, LDA, BETA, B, LDB, C, LDC)
      END

     * Output C: 
     *        1.847379, 2.007814, 1.594354,
     *        2.146696, 1.988263, 1.614650,
     *        2.272644, 2.732482, 2.495982,
     *        1.821566, 1.822019, 2.649999