SGESUM(3S)SGESUM(3S)NAME
SGESUM, DGESUM, CGESUM, ZGESUM - Adds a scalar multiple of a real or
complex matrix to a scalar multiple of another real or complex matrix
SYNOPSIS
Single precision
Fortran:
CALL SGESUM (trans, m, n, alpha, a, lda, beta, b, ldb)
C/C++:
#include <scsl_blas.h>
void sgesum (char *trans, int m, int n, float alpha, float *a,
int lda, float beta, float *b, int ldb);
Double precision
Fortran:
CALL DGESUM (trans, m, n, alpha, a, lda, beta, b, ldb)
C/C++:
#include <scsl_blas.h>
void dgesum (char *trans, int m, int n, double alpha, double
*a, int lda, double beta, double *b, int ldb);
Single precision complex
Fortran:
CALL CGESUM (trans, m, n, alpha, a, lda, beta, b, ldb)
C/C++:
#include <scsl_blas.h>
void cgesum (char *trans, int m, int n, scsl_complex *alpha,
scsl_complex *a, int lda, scsl_complex *beta, scsl_complex *b,
int ldb);
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void cgesum (char *trans, int m, int n, complex<float> *alpha,
complex<float> *a, int lda, complex<float> *beta,
complex<float> *b, int ldb);
Double precision complex
Fortran:
CALL ZGESUM (trans, m, n, alpha, a, lda, beta, b, ldb)
C/C++:
#include <scsl_blas.h>
void zgesum (char *trans, int m, int n, scsl_zomplex *alpha,
Page 1
SGESUM(3S)SGESUM(3S)
scsl_zomplex *a, int lda, scsl_zomplex *beta, scsl_zomplex *b,
int ldb);
C++ STL:
#include <complex.h>
#include <scsl_blas.h>
void zgesum (char *trans, int m, int n, complex<double> *alpha,
complex<double> *a, int lda, complex<double> *beta,
complex<double> *b, int ldb);
IMPLEMENTATION
These routines are part of the SCSL Scientific Library and can be loaded
using either the -lscs or the -lscs_mp option. The -lscs_mp option
directs the linker to use the multi-processor version of the library.
When linking to SCSL with -lscs or -lscs_mp, the default integer size is
4 bytes (32 bits). Another version of SCSL is available in which integers
are 8 bytes (64 bits). This version allows the user access to larger
memory sizes and helps when porting legacy Cray codes. It can be loaded
by using the -lscs_i8 option or the -lscs_i8_mp option. A program may use
only one of the two versions; 4-byte integer and 8-byte integer library
calls cannot be mixed.
The C and C++ prototypes shown above are appropriate for the 4-byte
integer version of SCSL. When using the 8-byte integer version, the
variables of type int become long long and the <scsl_blas_i8.h> header
file should be included.
DESCRIPTION
SGESUM and DGESUM add two real matrices with optional scaling; CGESUM and
ZGESUM add two complex matrices.
B <- alpha op(A) + beta B
where
* op(A) represents A, its transpose AT, or its conjugate transpose AH
* op(A) and B are m-by-n matrices
* alpha and beta are scalars.
beta=0 is a special case, used to copy alpha*op(A) to B.
alpha=0 is a special case, used to scale B.
These routines have the following arguments:
trans Character. (input)
Specifies whether the matrix A is transposed.
Page 2
SGESUM(3S)SGESUM(3S)
trans = 'N' or 'n': op(A) = A
trans = 'T' or 't': op(A) = A T
trans = 'C' or 'c': op(A) = AT (SGESUM, DGESUM), or
op(A) = AH (CGESUM, ZGESUM)
For C/C++, a pointer to this character is passed.
m Integer. (input)
Specifies the number of rows in matrix op(A) and in matrix B.
n Integer. (input)
Specifies the number of columns in matrix op(A) and in matrix
B.
alpha Scalar alpha. (input)
SGESUM: Single precision.
DGESUM: Double precision.
CGESUM: Single precision complex.
ZGESUM: Double precision complex.
For C/C++, a pointer to this scalar is passed when alpha is
complex; otherwise, alpha is passed by value.
a Array of dimension (lda,k). (input)
SGESUM: Single precision array.
DGESUM: Double precision array.
CGESUM: Single precision complex array.
ZGESUM: Double precision complex array.
When trans = 'N' or 'n', k is n; otherwise, it is m. When
trans = 'N' or 'n', the leading m-by-n part of the array a
contains matrix A. When trans = 'T' or 't' or trans = 'C' or
'c', the leading n-by-m part or the array a contains matrix A,
whose transpose or conjugate transpose will be used in the
matrix sum. If alpha = 0, a need not be specified on entry.
lda Integer. (input)
Specifies the first dimension of a as declared in the calling
program. When trans = 'N' or 'n', lda >= MAX(1,m); otherwise,
lda >= MAX(1,n).
beta Scalar beta. (input)
SGESUM: Single precision.
DGESUM: Double precision.
CGESUM: Single precision complex.
ZGESUM: Double precision complex.
Page 3
SGESUM(3S)SGESUM(3S)
For C/C++, a pointer to this scalar is passed when beta is
complex; otherwise, beta is passed by value.
b Array of dimension (ldb,n). (input/output)
SGESUM: Single precision array.
DGESUM: Double precision array.
CGESUM: Single precision complex array.
ZGESUM: Double precision complex array.
On entry, if beta is not equal to 0, the m-by-n matrix b
contains B. (If beta = 0, b need not be specifed on entry.)
On exit, b is overwritten with the matrix sum (alpha*op(A) +
beta*B).
ldb Integer. (input)
The leading dimension of array b. ldb >= MAX(1,m).
NOTES
These routines are extensions to the Level 2 BLAS.
The following data types are described in this documentation:
Term Used Data type
Fortran:
Array dimensioned n x(n)
Array of dimensions (m,n) x(m,n)
Character CHARACTER
Integer INTEGER (INTEGER*8 for -lscs_i8[_mp])
Single precision REAL
Double precision DOUBLE PRECISION
Single precision complex COMPLEX
Double precision complex DOUBLE COMPLEX
C/C++:
Array dimensioned n x[n]
Array of dimensions (m,n) x[m*n]
Character char
Integer int (long long for -lscs_i8[_mp])
Page 4
SGESUM(3S)SGESUM(3S)
Single precision float
Double precision double
Single precision complex scsl_complex
Double precision complex scsl_zomplex
C++ STL:
Array dimensioned n x[n]
Array of dimensions (m,n) x[m*n]
Character char
Integer int (long long for -lscs_i8[_mp])
Single precision float
Double precision double
Single precision complex complex<float>
Double precision complex complex<double>
Note that you can explicitly declare multidimensional C/C++ arrays
provided that the array dimensions are swapped with respect to the
Fortran declaration (e.g., x[n][m] in C/C++ versus x(m,n) in Fortran).
To avoid a compiler type mismatch error in C++ (or a compiler warning
message in C), however, the array should be cast to a pointer of the
appropriate type when passed as an argument to a SCSL routine.
EXAMPLES
An important use of these routines is to copy an array to another array,
in which the second array may be a temporary workspace that has a better
data layout than the first array. For example, suppose array A was
declared as follows in the main program:
REAL A(1024, 1024)
The following call to SGESUM copies a 64-by-64 block of A to B:
CALL SGESUM ('N', 64, 64 1.0, A(1,1), 1024, 0.0, B(1,1), 80)
Similarly, the following call copies a 64-by-64 block of the transpose of
A to B:
CALL SGESUM ('T', 64, 64, 1.0, A(1,1), 1024, 0.0, B(1,1), 80)
Page 5
SGESUM(3S)SGESUM(3S)SEE ALSOINTRO_SCSL(3S), INTRO_BLAS2(3S), SAXPBY(3S)INTRO_CBLAS(3S) for information about using the C interface to Fortran 77
Basic Linear Algebra Subprograms (legacy BLAS) set forth by the Basic
Linear Algebra Subprograms Technical Forum.
Page 6