Rate This Document
Findability
Accuracy
Completeness
Readability

?syr2k

Perform a rank-2 of the symmetric matrix C.

or .

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

Interface Definition

C interface:

void cblas_ssyr2k(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 *B, const BLASINT ldb, const float beta, float *C, const BLASINT ldc);

void cblas_dsyr2k(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 *B, const BLASINT ldb, const double beta, double *C, const BLASINT ldc);

void cblas_csyr2k(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 *B, const BLASINT ldb, const void *beta, void *C, const BLASINT ldc);

void cblas_zsyr2k(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 *B, const BLASINT ldb, const void *beta, void *C, const BLASINT ldc);

Fortran interface:

CALL SSYR2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)

CALL DSYR2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)

CALL CSYR2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)

CALL ZSYR2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, 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

The matrices A and B are conventional matrices, transpose matrices, 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 matrices A and B; otherwise, K indicates the number of rows in matrices A and B.

Input

alpha

  • For ssyr2k, alpha is of single-precision floating-point type.
  • For dsyr2k, alpha is of double-precision floating-point type.
  • For csyr2k, alpha is of single-precision complex number type.
  • For zsyr2k, alpha is of double-precision complex number type.

Multiplication coefficient

Input

A

  • For ssyr2k, A is of single-precision floating-point type.
  • For dsyr2k, A is of double-precision floating-point type.
  • For csyr2k, A is of single-precision complex number type.
  • For zsyr2k, A is of double-precision complex number type.

Matrix A (lda, ka).

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

Input

lda

Integer

  • If the matrix is column store and Trans = CblasNoTrans, lda must be at least max(1, n). Otherwise, lda must be at least max(1, k).
  • If the matrix is row store and Trans = CblasNoTrans, lda must be at least max(1, k). Otherwise, lda must be at least max(1, n).

Input

B

  • For ssyr2k, B is of single-precision floating-point type.
  • For dsyr2k, B is of double-precision floating-point type.
  • For csyr2k, B is of single-precision complex number type.
  • For zsyr2k, B is of double-precision complex number type.

Matrix B (ldb, kb).

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

Input

ldb

Integer

  • If the matrix is column store and Trans = CblasNoTrans, ldb must be at least max(1, n). Otherwise, ldb must be at least max(1, k).
  • If the matrix is row store and Trans = CblasNoTrans, ldb must be at least max(1, k). Otherwise, ldb must be at least max(1, n).

Input

beta

  • For ssyr2k, beta is of single-precision floating-point type.
  • For dsyr2k, beta is of double-precision floating-point type.
  • For csyr2k, beta is of single-precision complex number type.
  • For zsyr2k, beta is of double-precision complex number type.

Multiplication coefficient

Input

C

  • For ssyr2k, C is of single-precision floating-point type.
  • For dsyr2k, C is of double-precision floating-point type.
  • For csyr2k, C is of single-precision complex number type.
  • For zsyr2k, C is of double-precision complex number 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, ldb =3, ldc = 3; 
    float alpha = 2.0, beta = 2.0;  
    /** 
     *                   | 4.0   1.0  | 
     *    A(3 * 2)    =  | 3.0   4.0  | 
     *                   |  .     .   | 
     * 
     *     B(2 * 2)    =  | 2.0   3.0  | 
     *                    | 11.0  -2.0 | 
     * 
     *                    |  3.0   2.0 | 
     *     C(3 * 2)    =  | -1.0  -6.0 | 
     *                    |   .     .  | 
     */ 
    float a[6] = {4.0, 3.0, 0, 1.0, 4.0, 0}; 
    float b[4] = {2.0, 11.0, 3.0, -2.0}; 
    float c[6] = {3.0, -1.0, 0, 2.0, -6.0, 0}; 
 
    cblas_ssyr2k(CblasColMajor, CblasUpper, CblasNoTrans, n, k, alpha, a, lda, b, ldb, beta, c, ldc); 
    /** 
     * Output C 
     *                   |  30.0  96.0 | 
     *    C(3 * 2)    =  | -1.0   184.0 | 
     *                   |   .      .   | 
     * 
     */

Fortran interface:

      INTEGER :: N=2, K=2 
      INTEGER :: LDA=3, LDB=3, LDC=3 
      REAL(4) :: ALPHA=2.0, BETA=2.0 
      REAL(4) :: A(3, 2), B(2, 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 SSYR2K 
      CALL SSYR2K('U', 'N', N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC) 
 
*     Output C 
*                       |  30.0  96.0 | 
*        C(3 * 2)    =  | -1.0   184.0 | 
*                       |   .      .   |