Rate This Document
Findability
Accuracy
Completeness
Readability

?imatsub

Perform scaling and subtraction of two matrices including their in-place transposition/copying.

That is, .

Interface Definition

C interface:

void cblas_simatsub(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);

void cblas_dimatsub(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);

void cblas_cimatsub(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float *alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);

void cblas_zimatsub(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double *alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);

Fortran interface:

CALL SIMATSUB(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)

CALL DIMATSUB(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)

CALL CIMATSUB(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)

CALL ZIMATSUB(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

Whether the matrix is in row- or column-major order.

Input

TransA

Enumeration type CBLAS_TRANSPOSE

Whether matrix A is non-transposed, transposed, conjugated, or conjugate-transposed.

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

Input

M

Integer

Number of rows in matrices op(A) and BC.

Input

N

Integer

Number of columns in matrices op(A) and BC.

Input

alpha

  • Single-precision floating-point type for simatsub
  • Double-precision floating-point type for dimatsub
  • Single-precision complex type for cimatsub
  • Double-precision complex type for zimatsub

Multiplication coefficient.

Input

A

  • Single-precision floating-point type for simatsub
  • Double-precision floating-point type for dimatsub
  • Single-precision complex type for cimatsub
  • Double-precision complex type for zimatsub

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

BC

  • Single-precision floating-point type for simatsub
  • Double-precision floating-point type for dimatsub
  • Single-precision complex type for cimatsub
  • Double-precision complex type for zimatsub

Matrix BC.

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

Dependency

#include "kblas.h"

Examples

C interface:

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

    /** 
     *    A: 
     *         0.878666, 0.587949, 0.911689,   
     *         0.537057, 0.738171, 0.775693,
     *         0.933167, 0.700325, 0.563810,
     *         0.712020, 0.606780, 0.538903  
     *    BC: 
     *         0.780532, 0.649196, 0.703486,         
     *         0.854725, 0.511782, 0.570734,
     *         0.550857, 0.832913, 0.937889,
     *         0.838400, 0.885429, 0.970482
     */

    float a[12] = {0.878666, 0.587949, 0.911689,
                   0.537057, 0.738171, 0.775693,
                   0.933167, 0.700325, 0.563810,
                   0.712020, 0.606780, 0.538903
    };

    float bc[12] = {0.780532, 0.649196, 0.703486,
                   0.854725, 0.511782, 0.570734,
                   0.550857, 0.832913, 0.937889,
                   0.838400, 0.885429, 0.970482
    };

    float c[12] = {0};

    cblas_simatsub(CblasColMajor, CblasNoTrans, m, n, alpha, a, lda, bc, ldb);

    /** 
     * Output C: 
     *        -0.976800, -0.526701, -1.119892,      
     *        -0.219388, -0.964561, -0.980653,
     *        -1.315476, -0.567737, -0.189731, 
     *        -0.585641, -0.328131, -0.107325
     */

Fortran interface:

      PROGRAM IMATSUB
      INTEGER :: M=4, N=3
      INTEGER :: LDA=4, LDB=4
      REAL(4) :: ALPHA=2.0
      REAL(4) :: A(4, 3), BC(4, 3), C(4, 3)
      DATA A/0.878666, 0.587949, 0.911689,
             0.537057, 0.738171, 0.775693,
             0.933167, 0.700325, 0.563810,
             0.712020, 0.606780, 0.538903/
      DATA BC/0.780532, 0.649196, 0.703486,
             0.854725, 0.511782, 0.570734,
             0.550857, 0.832913, 0.937889,
             0.838400, 0.885429, 0.970482/
      EXTERNAL SIMATSUB
      CALL SIMATSUB('C', 'N', M, N, ALPHA, A, LDA, BC, LDB)
      END

     * Output BC: 
     *        0.694343, 0.882727, 0.822963,   
     *        0.859743, 0.543875, 0.927105,
     *        0.516767, 0.659971, 0.950618, 
     *        0.849312, 0.576374, 0.557569