Sun S3L 3.0 Programming and Reference Guide

S3L_mat_mult

Description

Sun S3L provides 18 matrix multiplication routines that compute one or more instances of matrix products. For each instance, these routines perform the operations listed in Table 8-5.


Note -

In these descriptions, AT and AH denote A transpose and A Hermitian, respectively.


Table 8-5 S3L Matrix Multiplication Operations

Routine 

Operation 

Data Type 

S3L_mat_mult

C = C + AB

real or complex 

S3L_mat_mult_noadd

C = AB

real or complex 

S3L_mat_mult_addto

C = D + AB

real or complex 

S3L_mat_mult_t1

C = C + ATB

real or complex 

S3L_mat_mult_t1_noadd

C = ATB

real or complex 

S3L_mat_mult_t1_addto

C = D + ATB

real or complex 

S3L_mat_mult_h1

C = C + AHB

complex only 

S3L_mat_mult_h1_noadd

C = AHB

complex only 

S3L_mat_mult_h1_addto

C = D + AHB

complex only 

S3L_mat_mult_t2

C = C + ABT

real or complex 

S3L_mat_mult_t2_noadd

C = ABT

real or complex 

S3L_mat_mult_t2_addto

C = D + ABT

real or complex 

S3L_mat_mult_h2

C = C + ABH

complex only 

S3L_mat_mult_h2_noadd

C = ABH

complex only 

S3L_mat_mult_h2_addto

C = D + ABH

complex only 

S3L_mat_mult_t1_t2

C = C + ATBT

real or complex 

S3L_mat_mult_t1_t2

C = C + ATBT

real or complex 

S3L_mat_mult_t1_t2_noadd

C = ATBT

real or complex 

S3L_mat_mult_t1_t2_addto

C = D + ATBT

real or complex 

The algorithm used depends on the axis lengths of the variables supplied.

For calls that do not transpose either matrix A or B, the variables conform correctly with the axis lengths for row_axis and col_axis shown in Table 8-6.

Table 8-6 Recommended row_axis and col_axis Values When Matrix A and Matrix B Are Not Transposed

Variable 

row_axis Length

col_axis Length

For calls that transpose the matrix A (AT), the variables conform correctly with the axis lengths for row_axis and col_axis shown in Table 8-7.

Table 8-7 Recommended row_axis and col_axis Values When Matrices Are Transposed

Variable 

row_axis Length

col_axis Length

For calls that transpose the matrix B (BT), the variables conform correctly with the axis lengths for row_axis and col_axis shown in Table 8-8.

Table 8-8 Recommended row_axis and col_axis Values When Matrix B Is Transposed

Variable 

row_axis Length

col_axis Length

For calls that transpose both A and B (ATBT), the variables conform correctly with the axis lengths for row_axis and col_axis shown in Table 8-9.

Table 8-9 Recommended row_axis and col_axis Values When Both Matrix A and Matrix B Are Transposed

Variable 

row_axis Length

col_axis Length

A

B

C

D

The algorithm is numerically stable.

Syntax

The C and Fortran syntax for S3L_mat_mult are shown below.

C/C++ Syntax


Example 8-5

#include <s3l/s3l-c.h>
#include <s3l/s3l_errno-c.h>
int
S3L_mat_mult(C, A, B, row_axis, col_axis)
S3L_mat_mult_noadd(C, A, B, row_axis, col_axis)
S3L_mat_mult_addto(C, A, B, D, row_axis, col_axis)
S3L_mat_mult_t1(C, A, B, row_axis, col_axis)
S3L_mat_mult_t1_noadd(C, A, B, row_axis, col_axis)
S3L_mat_mult_t1_addto(C, A, B, D, row_axis, col_axis)
S3L_mat_mult_h1(C, A, B, row_axis, col_axis)
S3L_mat_mult_h1_noadd(C,
A, B, row_axis, col_axis)
S3L_mat_mult_h1_addto(C, A, B, D, row_axis, col_axis)
S3L_mat_mult_t2(C, A, B, row_axis, col_axis)
S3L_mat_mult_t2_noadd(C, A, B, row_axis, col_axis)
S3L_mat_mult_t2_addto(C, A, B, D, row_axis, col_axis)
S3L_mat_mult_h2(C, A, B, row_axis, col_axis)
S3L_mat_mult_h2_noadd(C, A, B, row_axis, col_axis)
S3L_mat_mult_h2_addto(C, A, B, D, row_axis, col_axis)
S3L_mat_mult_t1_t2(C, A, B, row_axis, col_axis)
S3L_mat_mult_t1_t2_noadd(C,
A, B, row_axis, col_axisb)
S3L_mat_mult_t1_t2_addto(C, A, B, D, row_axis, col_axis)
    S3L_array_t        C
    S3L_array_t        A
    S3L_array_t        B
    S3L_array_t        D
    int                row_axis
    int                col_axis

F77/F90 Syntax


Example 8-6

include `s3l/s3l-f.h'
include `s3l/s3l_errno-f.h'
subroutine
S3L_mat_mult(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_noadd(C, A,
B, row_axis, col_axis, ier)
S3L_mat_mult_addto(C, A, B, D, row_axis, col_axis, ier)
S3L_mat_mult_t1(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_t1_noadd(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_t1_addto(C, A, B, D, row_axis, col_axis, ier)
S3L_mat_mult_h1(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_h1_noadd(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_h1_addto(C, A, B, D, row_axis, col_axis, ier)
S3L_mat_mult_t2(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_t2_nodto(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_t2_addto(C, A, B, D, row_axis, col_axis, ier)
S3L_mat_mult_h2(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_h2_noadd(C, A, B, row_axis, col_axis, ier)
S3L_mat_mult_h2_addto(C, A, B, D, row_axis, col_axis, ier)
S3L_mat_mult_t1_t2(C, A,
B, row_axis, col_axis, ier)
S3L_mat_mult_t1_t2_noadd(C, A, B, row_axis, col_axisb, ier)
S3L_mat_mult_t1_t2_addto(C, A, B, D, row_axis, col_axis, ier)
    integer*8          C
    integer*8          A
    integer*8          B
    integer*8          D
    integer*4          row_axis
    integer*4          col_axis
    integer*4          ier

Input

Note: The argument can be identical with the argument C in all matrix multiply _addto routines except _t1_t2_addto.

Output

These functions use the following arguments for output:

Error Handling

On success, the S3L_mat_mult routines return S3L_SUCCESS.

The S3L_mat_mult routines perform generic checking of the validity of the arrays they accept as arguments. If an array argument contains an invalid or corrupted value, the function terminates and an error code indicating which value of the array handle was invalid is returned. See Appendix A of this manual for a detailed list of these error codes.

In addition, the following conditions will cause these functions to terminate and return the associated error code:

Examples

../examples/s3l/dense_matrix_ops/matmult.c
../examples/s3l/dense_matrix_ops-f/matmult.f

Related Functions

S3L_inner_prod(3)
S3L_2_norm(3)
S3L_outer_prod(3)
S3L_mat_vec_mult(3)