Sun S3L 3.0 Programming and Reference Guide

S3L_print_sparse

Description

S3L_print_sparse prints all nonzero values of a global general sparse matrix and their corresponding row and column indices to standard output.

For example, the following 4x6 sample matrix

 3.14       0          0        20.04        0          0
 0         27          0          0         -0.6        0
 0          0         -0.01       0          0          0
-0.031      0          0          0.08       0        314.0

could be printed by a C program in the following manner.

4       6       8
0       0       3.14000
0       3       200.040000
1       1       27.000000
1       4      -0.600000
2       2      -0.010000
3       0      -0.031000
3       3       0.080000
3       5       314.000000

Note that, for C-language applications, zero-based indices are used. When S3L_print_sparse is called from a Fortran program,one-basedindices are used, as shown below.

4       6       8
1       1       3.14000
1       4       200.040000
2       2       27.000000
2       5      -0.600000
3       3      -0.010000
4       1      -0.031000
4       4       0.080000
4       6       314.000000

Syntax

The C and Fortran syntax for S3L_print_sparse are shown below.

C/C++ Syntax


Example 8-21

#include <s3l/s3l-c.h>
#include <s3l/s3l_errno-c.h>
int
S3L_print_sparse(A)
    S3L_array_t        A

F77/F90 Syntax


Example 8-22

include `s3l/s3l-f.h'
include `s3l/s3l_errno-f.h'
subroutine
S3L_print_sparse(A, ier)
    integer*8          A
    integer*4          ier

Input

Output

S3L_print_sparse uses the following argument for output:

Error Handling

On success, S3L_print_sparse returns S3L_SUCCESS.

The S3L_print_sparse routine performs generic checking of the validity of the arrays it accepts 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.

On error, it returns the following code.

Examples

../examples/s3l/sparse/ex_sparse.c
../examples/s3l/sparse/ex_sparse2.c
../examples/s3l/sparse-f/ex_sparse.f

Related Functions

S3L_declare_sparse(3)
S3L_read_sparse(3)
S3L_rand_sparse(3)