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 |
The C and Fortran syntax for S3L_print_sparse are shown below.
#include <s3l/s3l-c.h> #include <s3l/s3l_errno-c.h> int S3L_print_sparse(A) S3L_array_t A |
include `s3l/s3l-f.h' include `s3l/s3l_errno-f.h' subroutine S3L_print_sparse(A, ier) integer*8 A integer*4 ier |
A - S3L internal array handle for the global general sparse matrix that is produced by a prior call to one of the following sparse routines:
S3L_declare_sparse
S3L_read_sparse
S3L_rand_sparse
S3L_print_sparse uses the following argument for output:
ier (Fortran only) - When called from a Fortran program, S3L_print_sparse returns error status in ier.
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.
S3L_ERR_ARG_NULL - The value specified for A is invalid; no such S3L sparse matrix has been defined.
../examples/s3l/sparse/ex_sparse.c ../examples/s3l/sparse/ex_sparse2.c ../examples/s3l/sparse-f/ex_sparse.f
S3L_declare_sparse(3) S3L_read_sparse(3) S3L_rand_sparse(3)