Rate This Document
Findability
Accuracy
Completeness
Readability

?syrk

Perform a rank-k matrix-matrix operation for a symmetric matrix.

or

alpha and beta are multiplication coefficients, and C is an n x n symmetric matrix. In a first case, A is an n x k matrix. In the second case, A is a k x n general matrix.

Interface Definition

C interface:

void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const float alpha, const float *A, const BLASINT lda, const float beta, float *C, const BLASINT ldc);

void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const double alpha, const double *A, const BLASINT lda, const double beta, double *C, const BLASINT ldc);

void cblas_csyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const void *alpha, const void *A, const BLASINT lda, const void *beta, void *C, const BLASINT ldc);

void cblas_zsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const void *alpha, const void *A, const BLASINT lda, const void *beta, void *C, const BLASINT ldc);

Fortran interface:

CALL SSYRK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)

CALL DSYRK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)

CALL CSYRK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)

CALL ZSYRK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, 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

Uplo

Enumeration type CBLAS_UPLO

Storage mode of matrix C

Input

Trans

Enumeration type CBLAS_TRANSPOSE

Whether matrices A and B are general, transpose, or conjugate matrices.

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

Input

N

Integer

Order of matrix C

Input

K

Integer

If Trans = CblasNoTrans, K indicates the number of columns in matrix A; otherwise, K indicates the number of columns in matrix A.

Input

alpha

  • For ssyrk, alpha is of single-precision floating-point type.
  • For dsyrk, alpha is of double-precision floating-point type.
  • For csyrk, alpha is of single-precision complex number type.
  • For zsyrk, alpha is of double-precision complex type.

Multiplication coefficient

Input

A

  • For ssyrk, A is of single-precision floating-point type.
  • For dsyrk, A is of double-precision floating-point type.
  • For csyrk, A is of the single-precision complex number type.
  • For zsyrk, A is of the double-precision complex type.

Matrix A (lda, ka).

If Trans = CblasNoTrans, ka = k; otherwise, ka = n.

Input

lda

Integer

If Trans = CblasNoTrans, lda must be at least max(1, n); otherwise, lda must be at least max(1, k).

Input

beta

  • For ssyrk, beta is of the single-precision floating-point type.
  • For dsyrk, beta is of the double-precision floating-point type.
  • For csyrk, beta is of the single-precision complex number type.
  • For zsyrk, beta is of the double-precision complex type.

Multiplication coefficient

Input

C

  • For ssyrk, C is of the single-precision floating-point type.
  • For dsyrk, C is of the double-precision floating-point type.
  • For csyrk, C is of the single-precision complex number type.
  • For zsyrk, C is of the double-precision complex type.

Symmetric matrix C

Input/Output

ldc

Integer

The value of ldc is at least max(1, n).

Input

Dependencies

#include "kblas.h"

Examples

C interface:

    int n = 2, lda = 3, k = 2,  ldc = 3; 
    float alpha = 2.0, beta = 2.0;  
    /** 
     *                   | 4.0   1.0  | 
     *    A(3 * 2)    =  | 3.0   4.0  | 
     *                   |  .     .   | 
     * 
     *                    |  3.0   2.0  .| 
     *     C(3 * 3)    =  | -1.0  -6.0  .| 
     *                    |   .     .   .| 
     */ 
    float a[6] = {4.0, 3.0, 0, 1.0, 4.0, 0}; 
    float c[6] = {3.0, -1.0, 0, 2.0, -6.0, 0}; 
 
    cblas_ssyrk(CblasColMajor, CblasUpper, CblasNoTrans, n, k, alpha, a, lda, beta, c, ldc); 
    /** 
     * Output C 
     *                   |  40.0  36.0  .| 
     *    C(3 * 3)    =  |  30.0  38.0  .| 
     *                   |   .      .   .| 
     * 
     */

Fortran interface:

      INTEGER :: N=2, K=2 
      INTEGER :: LDA=3, LDC=3 
      REAL(4) :: ALPHA=2.0, BETA=2.0 
      REAL(4) :: A(3, 2), C(3, 3) 
      DATA A/4.0, 3.0, 0, 1.0, 4.0, 0/ 
      DATA C/3.0, -1.0, 0, 2.0, -6.0, 0/ 
      EXTERNAL SSYRK 
      CALL SSYRK('U', 'N', N, K, ALPHA, A, LDA, BETA, C, LDC) 
 
*     Output C 
*                       |  40.0  36.0  .| 
*        C(3 * 3)    =  |  30.0  38.0  .| 
*                       |   .      .   .|