For the Compleat Fan
			
		
		
			
				
																			
								hds1 							 
									
		Posts:  28  		Joined:  Thu Mar 20, 2014 5:02 pm 		
		
						
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by hds1   »  Wed Jul 05, 2017 11:43 am 
			
			
			
			
			The example for (gsl:CholeskyD) throws an error, newlisp v.10.7.1, libgsl.so.19 on XUBUNTU, gsl Ver 2.1:
All other examples are working.
Code: Select all 
(gsl:CholeskyD '((4 2 -2) (2 10 2) (-2 2 5))))
ERR: mismatch in number of arguments
called from user function gsl:(CholeskyD '((4 2 -2) (2 10 2) (-2 2 5)))
Debug output:
Code: Select all 
-----
(define (CholeskyD MAIN:A)
  (letn (MAIN:Ar (MAIN:get-matrix-from-list MAIN:A) MAIN:Aptr (MAIN:Ar 0) MAIN:m 
    (MAIN:Ar 1) MAIN:n 
    (MAIN:Ar 2) MAIN:result 0) 
   (set 'MAIN:result (MAIN:gsl_linalg_cholesky_decomp MAIN:Aptr)) 
   (unless (zero? MAIN:result) 
    (throw-error (MAIN:gsl_strerror MAIN:result))) 
   (for (MAIN:i 0 (- MAIN:m 2)) 
    (for (MAIN:j (+ MAIN:i 1) (- MAIN:n 1)) 
     #(MAIN:gsl_matrix_set MAIN:Aptr MAIN:i MAIN:j 0 MAIN:.0)#)) 
   (set 'MAIN:result (MAIN:get-list-from-matrix MAIN:Ar)) 
   (MAIN:gsl_matrix_free MAIN:Aptr) MAIN:result))
[-> 6 gsl] s|tep n|ext c|ont q|uit > s
ERR: mismatch in number of arguments
called from user function gsl:(CholeskyD '((4 2 -2) (2 10 2) (-2 2 5)))
Process newlisp speicherzugriffsfehler
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
		
			
				
																			
								ralph.ronnquist 							 
									
		Posts:  228  		Joined:  Mon Jun 02, 2014 1:40 am 		
		
											Location:  Melbourne, Australia 
							
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by ralph.ronnquist   »  Wed Jul 05, 2017 10:41 pm 
			
			
			
			
			#(MAIN:gsl_matrix_set MAIN:Aptr MAIN:i MAIN:j 0 MAIN:.0)#))
Apparently the input "0.0" gets broken up into the two tokens "0" and ".0" with the latter being a symbol when the module is loaded. Odd.
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
		
			
				
																			
								Lutz 							 
									
		Posts:  5289  		Joined:  Thu Sep 26, 2002 4:45 pm 		
		
																Location:  Pasadena, California 
							
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by Lutz   »  Wed Jul 05, 2017 11:19 pm 
			
			
			
			
			The string "Process newlisp speicherzugriffsfehler" in your output seems to indicate you are running a German localization of your operating system either change the 0.0  in gsl.lsp to 0,0  in the definition of gsl:CholeskyD  or use a different locale or change to (float 0)  to make the code work on all locales. 
 
In a newLISP shell type (set-locale "")  to find out what locale and decimal separator your are using.
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
		
			
				
																			
								hds1 							 
									
		Posts:  28  		Joined:  Thu Mar 20, 2014 5:02 pm 		
		
						
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by hds1   »  Thu Jul 06, 2017 6:45 am 
			
			
			
			
			Thks for pointing to this one. It is indeed the locale setting. This works.
Code: Select all 
(set-locale "en_US.utf8")
(load "/usr/local/share/newlisp/modules/gsl.lsp")
(trace (open "trace.txt" "write"))
(gsl:CholeskyD '((4 2 -2) (2 10 2) (-2 2 5)))
> ((2 0 0) (1 3 0) (-1 1 1.732050807568877))
Setting (set-locale "de_DE.utf8") results in the error.