Adapted from the "dreadhb.c" routine written by Xiaoye Li <xiaoye@nersc.gov> for SuperLU v2.0.
-- SuperLU routine (version 2.0) -- Univ. of California Berkeley, Xerox Palo Alto Research Center, and Lawrence Berkeley National Lab. November 15, 1997
Updated: August 2, 2001 by rich vuduc <richie@cs.berkeley.edu>
Updated: November 10, 2002 by rich vuduc <richie@cs.berkeley.edu>
Updated: October 2004 by rich vuduc <richie@cs.berkeley.edu>
Updated: November 2004 by rich vuduc <richie@cs.berkeley.edu>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oski/common.h>
#include <oski/matrix.h>
#include <oski/matcreate.h>
#include "array_util.h"
#include "readhbpat.h"
Functions | |
static void | dDumpLine (FILE *fp) |
Eat up the rest of the current line. | |
static void | dParseIntFormat (const char *buf, size_t *num, size_t *size) |
Parse a Fortran-style integer format string. | |
static void | dReadVector (FILE *fp, size_t n, oski_index_t *where, size_t perline, size_t persize) |
Read a stream of formatted integers from an input file. | |
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. | |
static int | is_csc_lower_tri (oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, oski_index_t base) |
Returns 1 <==> the given CSC matrix array pattern corresponds to that of a lower triangular matrix, and 0 otherwise. | |
static int | is_csc_upper_tri (oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, oski_index_t base) |
Returns 1 <==> the given CSC matrix array pattern corresponds to that of a upper triangular matrix, and 0 otherwise. | |
static void | ResetDiagImag (oski_index_t m, oski_index_t *ptr, oski_index_t *ind, oski_value_t *val, oski_index_t indbase) |
Sets the imaginary part of the diagonal elements to 0. | |
static void | reduce_offdiag_values (oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, oski_value_t *val, oski_index_t indbase) |
Reduce off-diagonal values by a factor of 2*n Main purpose of this routine is to make triangular matrices better-conditioned. | |
static oski_index_t | count_diag_elems (oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, oski_index_t indbase) |
Returns the number of diagonal elements. | |
oski_matrix_t | readhb_pattern_matrix (const char *matfile, 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 *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. |
|
Eat up the rest of the current line. Reads characters one by one from 'fp' beginning at the current file position until a new-line ('\n') or carriage-return ('\r') is encountered.
|
|
Parse a Fortran-style integer format string. This routine parses integer format strings given by the regular expression: .* \( [0-9]* [Ii] [0-9]+ e.g., "(5I7)" (5 integers, each of maximum width 7), "(I14junk" (1 integer, of maximum width 14).
|
|
Read a stream of formatted integers from an input file.
|
|
Read the raw pattern of a sparse matrix stored in Harwell-Boeing formatted file in compressed-sparse column format.
Second character
Third character
|
|
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].
|
|
Sets the imaginary part of the diagonal elements to 0. This routine is used primarily to ensure that the diagonal of a Hermitian matrix is pure real. |