Segmentation Fault, (core dumped) during Gauss elimination?

It looks like the matrix A is not assigned. I think you need this after allocating a.

Up vote 0 down vote favorite share g+ share fb share tw.

During the running of this program, I get a segmentation fault. Im trying to solve a linear equation, with numbers received from a . Dat file.

I can get to the part right before the gauss function, but it dumps afterwards. Any help? Thanks.

Void prob2(void) { FILE *matrix; matrix=fopen("matrix. Dat", "r"); double a1, a2, a3, a4, **A, *a, *rhs, length; int k, row; A=(double **)malloc(4*sizeof(double *)); printf("\n"); for(k=1;k=0; row--) { for(col=row+1; col.

It looks like the matrix A is not assigned. I think you need this after allocating a: Ak-1 = a.

Thank you – Dave Smith Mar 8 '11 at 1:05 @Dave: In the prob2() function. The loop that reads in the 4 rows allocates an array for a but then doesn't do anything with it after filling it (as far as I can see). – Mark Wilkins Mar 8 '11 at 1:07 @Dave There's only one use of k in the code you posted, and it isn't in gauss.

– Jim Balter Mar 8 '11 at 1:13.

This usually happens when the algorithm encounters a 0 on the diagonal. You need to use pivoting to avoid this. See the Wikipedia article on Gaussian elimination for details.

That would not produce a segvio. – Jim Balter Mar 8 '11 at 1:06.

You never store anything in A. You malloc in your k = 1 ... 4 loop but you never save what you malloc.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions