# Coordinate (Coord) FormatΒΆ

This standard data format consists of the following data:

integer           :: m     ! number of rows (unsymmetric only)
integer           :: n     ! number of columns
integer           :: ne    ! number of entries in matrix (may have type long)
integer, size(ne) :: row   ! row indices
integer, size(ne) :: col   ! column indices
real,    size(ne) :: val   ! numerical values


The arrays should be set such that the k-th entry is in row row(k) and column col(k) with value val(k). Entries that are zero, including those on the diagonal, need not be specified.

For symmetric matrices, only the lower or upper triangular entries of $$A$$ should be supplied. For unsymmetric matrices, all entries in the matrix should be supplied. Duplicate entries will be summed and out-of-range entries will be ignored.

Some SPRAL routines offer only input in CSC format, you may need to use routines from the spral_matrix_util package to convert data from Coordinate to CSC format.

To illustrate the Coordinate format, the matrix

$\begin{split}\left( \begin{array}{ccccc} 1.1 & 2.2 & & 3.3 & \\ 2.2 & & 4.4 & & \\ & 4.4 & 5.5 & & 6.6 \\ 3.3 & & & 7.7 & 8.8 \\ & & 6.6 & 8.8 & 9.9 \end{array} \right)\end{split}$

is described by the following data:

n = 5
ne = 9
row(1:9) = (/ 1,   2,   3,   4,   3,   5,   4,   5,   5 /)
col(1:9) = (/ 1,   1,   2,   1,   3,   3,   4,   4,   5 /)
val(1:9) = (/ 1.1, 2.2, 4.4, 3.3, 5.5, 6.6, 7.7, 8.8, 9.9 /)