readhbpat.h File Reference


Detailed Description

Defines utility routine to read a matrix pattern from a Harwell-Boeing formatted file.

#include <oski/common.h>
#include <oski/mangle.h>
#include <oski/matrix.h>

Go to the source code of this file.

Name mangling.

#define readhb_pattern   MANGLE_(readhb_pattern)
#define readhb_pattern_matrix   MANGLE_(readhb_pattern_matrix)
#define readhb_pattern_matrix_nnz   MANGLE_(readhb_pattern_matrix_nnz)
#define readhb_expand_symm   MANGLE_(readhb_expand_symm)

Defines

#define INC_READHBPAT_H
 readhbpat.h included.

Functions

int readhb_pattern (const char *filename, oski_index_t *p_m, oski_index_t *p_n, oski_index_t *p_nnz, oski_index_t **p_ptr, oski_index_t **p_ind, char *mattype)
 Read the raw pattern of a sparse matrix stored in Harwell-Boeing formatted file in compressed-sparse column format.
int readhb_expand_symm (oski_index_t n, oski_index_t base, int is_herm, const oski_index_t *Sptr, const oski_index_t *Sind, const oski_value_t *Sval, oski_index_t **p_Aptr, oski_index_t **p_Aind, oski_value_t **p_Aval)
 Expand a raw CSR/CSC matrix to full storage.
oski_matrix_t readhb_pattern_matrix (const char *filename, oski_index_t *p_m, oski_index_t *p_n, char *p_mattype, int expand_symm)
 Read the pattern of a sparse matrix from a Harwell-Boeing formatted file, and return it as a tunable matrix handle.
oski_matrix_t readhb_pattern_matrix_nnz (const char *filename, oski_index_t *p_m, oski_index_t *p_n, oski_index_t *p_nnz_stored, oski_index_t *p_nnz_true, char *p_mattype, int expand_symm)
 Read the pattern of a sparse matrix from a Harwell-Boeing formatted file, and return it as a tunable matrix handle.


Function Documentation

int readhb_pattern const char *  filename,
oski_index_t *  p_m,
oski_index_t *  p_n,
oski_index_t *  p_nnz,
oski_index_t **  p_ptr,
oski_index_t **  p_ind,
char *  mattype
 

Read the raw pattern of a sparse matrix stored in Harwell-Boeing formatted file in compressed-sparse column format.

Parameters:
[in] filename Name of the Harwell-Boeing file.
[out] p_m Number of rows in the matrix.
[out] p_n Number of columns in the matrix.
[out] p_nnz Number of logical (NOT stored) non-zeros.
[out] p_ptr Stores the column pointers.
[out] p_ind Stores the row indices.
[out] mattype Pointer to a buffer of size 4, used to return the Harwell-Boeing matrix type (see Note below).
Returns:
0 on success, or an error code with a call to the error handler. If an error occurs, then none of the output parameters are changed.
Precondition:
The file must be in [RP][RUSH]A format. Harwell-Boeing format: a line-by-line accounting of a matrix stored in Harwell-Boeing format.
  1. (A72,A8)
    • Col. 1 - 72: Title (TITLE)
    • Col. 73 - 80: Key (KEY)
  2. (5I14)
    • Col. 1 - 14: Total number of lines excluding header (TOTCRD)
    • Col. 15 - 28: Number of lines for pointers (PTRCRD)
    • Col. 29 - 42: Number of lines for row (or variable) indices (INDCRD)
    • Col. 43 - 56: Number of lines for numerical values (VALCRD)
    • Col. 57 - 70: Number of lines for right-hand sides (RHSCRD). This includes starting guesses and solution vectors if present, or zero to indicate no right-hand side data are present.
  3. (A3, 11X, 4I14)
    • Col. 1 - 3: Matrix type (see below) (MXTYPE)
    • Col. 15 - 28: Number of rows (or variables) (NROW)
    • Col. 29 - 42: Number of columns (or elements) (NCOL)
    • Col. 43 - 56: Number of row (or variable) indices (NNZERO) (equal to number of entries for assembled matrices)
    • Col. 57 - 70 Number of elemental matrix entries (NELTVL) (zero in the case of assembled matrices)
  4. (2A16, 2A20)
    • Col. 1 - 16: Format for pointers (PTRFMT)
    • Col. 17 - 32: Format for row (or variable) indices (INDFMT)
    • Col. 33 - 52: Format for numerical values of coefficient matrix (VALFMT)
    • Col. 53 - 72 Format for numerical values of right-hand sides (RHSFMT)
  5. (A3, 11X, 2I14) Only present if there are right-hand sides present
    • Col. 1: Right-hand side type: F for full storage or M for same format as matrix
    • Col. 2: G if a starting vector(s) (Guess) is supplied. (RHSTYP)
    • Col. 3: X if an exact solution vector(s) is supplied.
    • Col. 15 - 28: Number of right-hand sides (NRHS)
    • Col. 29 - 42: Number of row indices (NRHSIX) (ignored in case of unassembled matrices)

Note:
The three character type field on line 3 describes the matrix type. The following table lists the permitted values for each of the three characters. As an example of the type field, 'RSA' denotes that the matrix is real, symmetric, and assembled.
  1. First character
    • R Real matrix
  • C Complex matrix
  • P Pattern only (no numerical values supplied)

Second character

  • S Symmetric
  • U Unsymmetric
  • H Hermitian
  • Z Skew symmetric
  • R Rectangular

Third character

  • A Assembled
  • E Elemental matrices (unassembled) The type is returned through the string 'mattype', using all uppercase letters.

oski_matrix_t readhb_pattern_matrix_nnz const char *  matfile,
oski_index_t *  p_m,
oski_index_t *  p_n,
oski_index_t *  p_nnz_stored,
oski_index_t *  p_nnz_true,
char *  p_mattype,
int  expand_symm
 

Read the pattern of a sparse matrix from a Harwell-Boeing formatted file, and return it as a tunable matrix handle.

The non-zero values are replaced by random numbers in the interval (0,1].

Parameters:
[in] matfile File to read.
[in,out] p_m Pointer to scalar integer in which to return the number of matrix rows. May set to NULL if this information is not desired.
[in,out] p_n Pointer to scalar integer in which to return the number of matrix columns. May set to NULL if this information is not desired.
[in,out] p_nnz_stored Pointer to scalar integer in which to return the number of stored non-zeros.
[in,out] p_nnz_true Pointer to scalar integer in which to return the number of true non-zeros.
[in,out] p_mattype String buffer of length >= 3 in which to store the matrix type. May set to NULL if this information is not desired. This routine does NOT NULL-terminate mattype on return.
Returns:
A tunable matrix handle. On error, aborts the program with exit code 1, leaving *p_m, *p_n, and p_mattype unchanged. Only the first 3 characters of p_mattype are changed, and p_mattype is NOT NULL-terminated by this routine.


Generated on Wed Sep 19 16:41:23 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6