naginterfaces.library.matop.real_​addsub

naginterfaces.library.matop.real_addsub(transa, transb, m, n, alpha, a, beta, b)[source]

real_addsub adds two float matrices, each one optionally transposed and multiplied by a scalar.

For full information please refer to the NAG Library document for f01ct

https://www.nag.com/numeric/nl/nagdoc_28.4/flhtml/f01/f01ctf.html

Parameters
transastr, length 1

and must specify whether or not the matrix and the matrix , respectively, are to be transposed before addition.

or

The matrix will not be transposed.

or or

The matrix will be transposed.

transbstr, length 1

and must specify whether or not the matrix and the matrix , respectively, are to be transposed before addition.

or

The matrix will not be transposed.

or or

The matrix will be transposed.

mint

, the number of rows of the matrices and or their transposes. Also the number of rows of the matrix .

nint

, the number of columns of the matrices and or their transposes. Also the number of columns of the matrix .

alphafloat

The scalar , by which matrix is multiplied before addition.

afloat, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; otherwise: .

Note: the required extent for this argument in dimension 2 is determined as follows: if : ; otherwise: .

If , the elements of array need not be assigned. If , then if , the leading part of must contain the matrix , otherwise the leading part of must contain the matrix .

betafloat

The scalar , by which matrix is multiplied before addition.

bfloat, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; otherwise: .

Note: the required extent for this argument in dimension 2 is determined as follows: if : ; otherwise: .

If , the elements of array need not be assigned. If , then if , the leading part of must contain the matrix , otherwise the leading part of must contain the matrix .

Returns
cfloat, ndarray, shape

The elements of the matrix .

Raises
NagValueError
(errno )

On entry, .

Constraint: , or .

(errno )

On entry, .

Constraint: , or .

(errno )

On entry, and .

Constraint: and .

(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, and .

Constraint: if , .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

real_addsub performs one of the operations

,

,

or

,

where , and are matrices, and and are scalars. For efficiency, the function contains special code for the cases when one or both of , is equal to zero, unity or minus unity. The matrices, or their transposes, must be compatible for addition. and are either or matrices, depending on whether they are to be transposed before addition. is an matrix.