Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce warnings and fix bugs in ?readrhs #83

Merged
merged 3 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions SRC/creadMM.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,15 @@ creadMM(FILE *fp, int *m, int *n, int_t *nonz,

static void creadrhs(int m, complex *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");

int i;

if ( !fp ) {
fprintf(stderr, "creadrhs: file does not exist\n");
exit(-1);
}
for (i = 0; i < m; ++i)
fscanf(fp, "%f%f\n", &b[i].r, &b[i].i);

fclose(fp);
}


4 changes: 0 additions & 4 deletions SRC/creadtriple.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ at the top-level directory.

#include "slu_cdefs.h"


void
creadtriple(int *m, int *n, int_t *nonz,
complex **nzval, int_t **rowind, int_t **colptr)
Expand Down Expand Up @@ -140,10 +139,8 @@ creadtriple(int *m, int *n, int_t *nonz,

void creadrhs(int m, complex *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");
int i;
/*int j;*/

if ( !fp ) {
fprintf(stderr, "dreadrhs: file does not exist\n");
Expand All @@ -152,6 +149,5 @@ void creadrhs(int m, complex *b)
for (i = 0; i < m; ++i)
fscanf(fp, "%f%f\n", &b[i].r, &b[i].i);

/* readpair_(j, &b[i]);*/
fclose(fp);
}
8 changes: 2 additions & 6 deletions SRC/dreadMM.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,15 @@ dreadMM(FILE *fp, int *m, int *n, int_t *nonz,

static void dreadrhs(int m, double *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");

int i;

if ( !fp ) {
fprintf(stderr, "dreadrhs: file does not exist\n");
exit(-1);
}
for (i = 0; i < m; ++i)
fscanf(fp, "%lf\n", &b[i]);
/*fscanf(fp, "%d%lf\n", &j, &b[i]);*/
/* readpair_(j, &b[i]);*/

fclose(fp);
}


3 changes: 0 additions & 3 deletions SRC/dreadtriple.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ dreadtriple(int *m, int *n, int_t *nonz,

void dreadrhs(int m, double *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");
int i;
/*int j;*/

if ( !fp ) {
fprintf(stderr, "dreadrhs: file does not exist\n");
Expand All @@ -152,6 +150,5 @@ void dreadrhs(int m, double *b)
for (i = 0; i < m; ++i)
fscanf(fp, "%lf\n", &b[i]);

/* readpair_(j, &b[i]);*/
fclose(fp);
}
7 changes: 3 additions & 4 deletions SRC/sreadMM.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,15 @@ sreadMM(FILE *fp, int *m, int *n, int_t *nonz,

static void sreadrhs(int m, float *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");

int i;

if ( !fp ) {
fprintf(stderr, "sreadrhs: file does not exist\n");
exit(-1);
}
for (i = 0; i < m; ++i)
fscanf(fp, "%f\n", &b[i]);

fclose(fp);
}


3 changes: 0 additions & 3 deletions SRC/sreadtriple.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ sreadtriple(int *m, int *n, int_t *nonz,

void sreadrhs(int m, float *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");
int i;
/*int j;*/

if ( !fp ) {
fprintf(stderr, "dreadrhs: file does not exist\n");
Expand All @@ -152,6 +150,5 @@ void sreadrhs(int m, float *b)
for (i = 0; i < m; ++i)
fscanf(fp, "%f\n", &b[i]);

/* readpair_(j, &b[i]);*/
fclose(fp);
}
4 changes: 1 addition & 3 deletions SRC/zreadMM.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ zreadMM(FILE *fp, int *m, int *n, int_t *nonz,

static void zreadrhs(int m, doublecomplex *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");

int i;
Expand All @@ -232,7 +231,6 @@ static void zreadrhs(int m, doublecomplex *b)
}
for (i = 0; i < m; ++i)
fscanf(fp, "%lf%lf\n", &b[i].r, &b[i].i);

fclose(fp);
}


3 changes: 0 additions & 3 deletions SRC/zreadtriple.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ zreadtriple(int *m, int *n, int_t *nonz,

void zreadrhs(int m, doublecomplex *b)
{
FILE *fopen();
FILE *fp = fopen("b.dat", "r");
int i;
/*int j;*/

if ( !fp ) {
fprintf(stderr, "dreadrhs: file does not exist\n");
Expand All @@ -152,6 +150,5 @@ void zreadrhs(int m, doublecomplex *b)
for (i = 0; i < m; ++i)
fscanf(fp, "%lf%lf\n", &b[i].r, &b[i].i);

/* readpair_(j, &b[i]);*/
fclose(fp);
}