我要评分
获取效率
正确性
完整性
易理解

?omatcopy

That is, .

The value of op(X) may be . alpha is a multiplication coefficient, and A is an m*n matrix.

Interface Definition

C interface:

void cblas_somatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const float alpha, const float *A, const BLASINT lda, float *B, const BLASINT ldb);

void cblas_domatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const double alpha, const double *A, const BLASINT lda, double *B, const BLASINT ldb);

void cblas_comatcopy(const enum CBLAS_ORDER sOrder, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const float *alpha, const float *A, const BLASINT lda, float *B, const BLASINT ldb);

void cblas_zomatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const double *alpha, const double *A, const BLASINT lda, double *B, const BLASINT ldb);

Fortran interface:

CALL SOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)

CALL DOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)

CALL COMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)

CALL ZOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

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

Input

Trans

Enumeration type CBLAS_TRANSPOSE

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

  • If Trans = CblasNoTrans, .
  • If Trans = CblasTrans, .
  • If Trans = CblasConjTrans, .
  • If Trans = CblasConjNoTrans, .

Input

M

Integer

Number of rows in matrix A.

Input

N

Integer

Number of columns in matrix A.

Input

alpha

  • Single-precision floating-point type for somatcopy
  • Double-precision floating-point type for domatcopy
  • Single-precision complex type for comatcopy
  • Double-precision complex type for zomatcopy

Multiplication coefficient.

Input

A

  • Single-precision floating-point type for somatcopy
  • Double-precision floating-point type for domatcopy
  • Single-precision complex type for comatcopy
  • Double-precision complex type for zomatcopy

Matrix A.

Input

lda

Integer

  • If the matrix 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

B

  • Single-precision floating-point type for somatcopy
  • Double-precision floating-point type for domatcopy
  • Single-precision complex type for comatcopy
  • Double-precision complex type for zomatcopy

Matrix B.

Output

ldb

Integer

  • If the matrix is column store and TransA = CblasNoTrans, ldb is at least max(1, m); otherwise, ldb 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

Dependency

#include "kblas.h"

Examples

C interface:

    int m = 4;
    int k = 3;
    int lda = 4;
    int ldb = 4;
    float alpha[2] = {1.0, 2.0};
    /** 
     *    A: 
     *         0.340188, -0.105617,  -0.222225, 0.053970,  0.135712, 0.217297 
     *         0.283099, 0.298440,  -0.022603, 0.128871,  -0.358397, 0.106969 
     *         0.411647, -0.302449,  -0.135216, 0.013401,  -0.483699, -0.257113 
     *         -0.164777, 0.268230,  0.452230, 0.416195,  -0.362768, 0.304177 
     */
    float a[24] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230, 
                   -0.222225, 0.053970, -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195, 
                   0.135712, 0.217297, -0.358397, 0.109, -0.483699, -0.257113, -0.362768, 0.304177};
    float b[24] = {0};

    cblas_comatcopy(CblasColMajor, CblasNoTrans, m, k, alpha, a, lda, b, lda);
    /** 
     * Output B: 
     *        0.551422, 0.574759, -0.313781, 0.864638, 1.016545, 0.520845
     *         -0.701237, -0.061324, -0.330165, -0.390480, -0.280345, 0.083665 
     *         -0.162018, -0.257031, -0.380160, 1.320655, -0.298882, 0.488721 
     *         -0.576397, -0.607794, 0.030527, -1.224511, -0.971122, -0.421359 
     */

Fortran interface:

      PROGRAM OMATCOPY
      INTEGER :: M=4, K=3
      INTEGER :: LDA=4, LDB=4
      COMPLEX(4) :: ALPHA=(1.0, 2.0)
      COMPLEX(4) :: A(4, 3), B(4, 3)
      DATA A/(0.340188, -0.105617), (0.283099, 0.298440),
     $       (0.411647, -0.302449), (-0.164777, 0.268230),
     $       (-0.222225, 0.053970), (-0.022603, 0.128871),
     $       (-0.135216, 0.013401), (0.452230, 0.416195),
     $       (0.135712, 0.217297), (-0.358397, 0.109),
     $       (-0.483699, -0.257113), (-0.362768, 0.304177)/
      EXTERNAL COMATCOPY
      CALL COMATCOPY('C', 'N', M, K, ALPHA, A, LDA, B, LDB)
      END

*     Output B: 
*             (0.551422000, 0.574759007)          (-0.313781023, 0.864637971)            (1.01654494, 0.520844996)
*             (-0.701236963, -6.132400036E-02)    (-0.330164999, -0.390479982)           (-0.280344993, 8.366499841E-02)
*             (-0.162018001, -0.257030994)        (-0.380160004, 1.32065499)             (-0.298882008, 0.488721013)
*             (-0.576397002,-0.607794046)        (3.052702546E-02,-1.22451103)         (-0.971121967,-0.421359003)