Am Freitag, den 09.11.2007, 15:27 +0100 schrieb Jo_Jo:
> Hi help-gsl,
> 
> Please run these program. Runtime error, Segmentation fault. Why?

Pointers don't reserve space for the underlying variable. If you want a
pointer to an int, you must reserver space for an int.

Diff attached. 

        Thomas


diff -r 4b52c6f94470 QRPT_decomp.c
--- a/QRPT_decomp.c	Fri Nov 09 16:20:02 2007 +0100
+++ b/QRPT_decomp.c	Fri Nov 09 16:23:15 2007 +0100
@@ -32,7 +32,7 @@ int main (void)
        
        double temp;
        int M =4, N =4, i, j ;
-       int * signum ;
+       int  signum ;
        gsl_matrix_view A = gsl_matrix_view_array (a_data, M, N);
        gsl_vector *norm = gsl_vector_alloc (M);
        gsl_vector *tau  = gsl_vector_alloc (GSL_MIN(M,N) );
@@ -98,7 +98,7 @@ printf("\n but \n ");
 
 printf("\n in output: runtime error Segmentation fault \n\n\n");
 
- ( void) gsl_linalg_QRPT_decomp(QRPT,tau, p, signum, norm ) ;    
+ ( void) gsl_linalg_QRPT_decomp(QRPT,tau, p, &signum, norm ) ;    
    
        printf ("vector tau = \n");
        gsl_vector_fprintf (stdout, tau, "%f");
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to