* GSL-1.2 gsl_eigen_symmv() Problem @ 2002-11-07 9:06 Adam Johansen 2002-11-07 9:15 ` Adam Johansen 0 siblings, 1 reply; 4+ messages in thread From: Adam Johansen @ 2002-11-07 9:06 UTC (permalink / raw) To: gsl-discuss; +Cc: A.M. Johansen Hello, I'm rather new to this list, so I hope you'll forgive me if this is outside it's normal scope or has been answered before (although I can't find any reference to anything similar in the archive). When calling gsl_eigen_symmv within a loop in the heart of a C program (which is still very much in the development stage, but is over 1000 lines long and hence not easy to include here) the program halts with an apparently infinite (certainly happy to continue running for 16hrs) loop within the symmv function (although gdb indicates that it switches between symmv and symm quite frequently). The problem is not a simple one, as I tried using the gsl_matrix_fwrite and gsl_matrix_fread functions to record the matrices being used in this program and then wrote a quick test program which loaded the matrices from disk and then ran gsl_eigen_symmv on them. This program ran quite happily and found the eigenvalues of these matrices. My question, I suppose, is whether there is any known interaction between this function and any other elements of the gsl or standard libraries (no nonstandard libraries are being used, although I am using electricfence for debuggin) which could lead to this sort of behaviour. I'm reasonably sure that there are no incorrect memory accesses within the loop (I've used MALLOC_CHECK_=2 and electric fence to check this...) although something like that is always possible, I suppose. Many thanks, in advance, Adam Johansen ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GSL-1.2 gsl_eigen_symmv() Problem 2002-11-07 9:06 GSL-1.2 gsl_eigen_symmv() Problem Adam Johansen @ 2002-11-07 9:15 ` Adam Johansen 2002-11-07 9:22 ` Atakan Gurkan 0 siblings, 1 reply; 4+ messages in thread From: Adam Johansen @ 2002-11-07 9:15 UTC (permalink / raw) To: gsl-discuss [-- Attachment #1: Type: TEXT/PLAIN, Size: 829 bytes --] Hello Again, Further to my earlier email, I've managed to narrow the problem down somewhat. It would seem that if the log() function is called before a call to gsl_eigen_symmmv with a matrix similar to one which has already been solved (this is a rough summary which may not be entirely accurate, but I think contains the relevant details) then that routine goes into an apparently infinite loop. I've attached a short piece of code which demonstrates this problem and I'd be interested to know whether it is a general one or is confined to systems like my own (or indeed, is due to a corrupt library and is only happening to me...). Many apologies if this is a known problem, or if there's some obvious reason why using the C libraries log function in conjunction with gsl isn't a reasonable thing to do.... Adam Johansen [-- Attachment #2: The offending code --] [-- Type: TEXT/PLAIN, Size: 789 bytes --] #include <stdio.h> #include <gsl/gsl_eigen.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_vector.h> int main(int argc, char** argv) { double hmmm; gsl_eigen_symmv_workspace* wsp; gsl_matrix* in, *out; gsl_vector* vec; in = gsl_matrix_alloc(2,2); out = gsl_matrix_alloc(2,2); vec = gsl_vector_alloc(2); int i; int mi = 0; for(i = 1; i < 101; i++) { hmmm = log(1.2); for(mi = 0; mi < 6; mi++) { wsp = gsl_eigen_symmv_alloc(2); gsl_matrix_set(in, 0, 0, i); gsl_matrix_set(in, 0, 1, i - 1); gsl_matrix_set(in, 1, 0, i - 1); gsl_matrix_set(in, 1, 1, i - 0.5); printf("Solving matrix %i in iteration %i...\n", mi, i); gsl_eigen_symmv(in, vec, out, wsp); gsl_eigen_symmv_free(wsp); } } } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GSL-1.2 gsl_eigen_symmv() Problem 2002-11-07 9:15 ` Adam Johansen @ 2002-11-07 9:22 ` Atakan Gurkan 2002-11-07 15:18 ` Adam Johansen 0 siblings, 1 reply; 4+ messages in thread From: Atakan Gurkan @ 2002-11-07 9:22 UTC (permalink / raw) To: gsl-discuss On Thu, Nov 07, 2002 at 05:06:04PM +0000, Adam Johansen wrote: > #include <stdio.h> > > #include <gsl/gsl_eigen.h> > #include <gsl/gsl_matrix.h> > #include <gsl/gsl_vector.h> > > int main(int argc, char** argv) { > double hmmm; > gsl_eigen_symmv_workspace* wsp; > gsl_matrix* in, *out; > gsl_vector* vec; > > in = gsl_matrix_alloc(2,2); > out = gsl_matrix_alloc(2,2); > vec = gsl_vector_alloc(2); > int i; > > int mi = 0; > > for(i = 1; i < 101; i++) { > hmmm = log(1.2); > > for(mi = 0; mi < 6; mi++) { > wsp = gsl_eigen_symmv_alloc(2); > > gsl_matrix_set(in, 0, 0, i); > gsl_matrix_set(in, 0, 1, i - 1); > gsl_matrix_set(in, 1, 0, i - 1); > gsl_matrix_set(in, 1, 1, i - 0.5); > > printf("Solving matrix %i in iteration %i...\n", mi, i); > gsl_eigen_symmv(in, vec, out, wsp); > > gsl_eigen_symmv_free(wsp); > } > } > } himm, shouldn't you include math.h? since log does not return int this might cause a problem. BTW, your code doesn't compile with a C compiler, you might want to move those int statements a few lines earlier. ato ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GSL-1.2 gsl_eigen_symmv() Problem 2002-11-07 9:22 ` Atakan Gurkan @ 2002-11-07 15:18 ` Adam Johansen 0 siblings, 0 replies; 4+ messages in thread From: Adam Johansen @ 2002-11-07 15:18 UTC (permalink / raw) Cc: gsl-discuss On Thu, 7 Nov 2002, Atakan Gurkan wrote: > himm, shouldn't you include math.h? since log does not return int this might > cause a problem. BTW, your code doesn't compile with a C compiler, you might > want to move those int statements a few lines earlier. > > ato > Thanks. You are, of course, completely right. I've just spent 4 days debugging one program and it's amazing how easy it is to miss the obvious. Many apologies for wasting your time.... AMJ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-11-07 17:22 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-11-07 9:06 GSL-1.2 gsl_eigen_symmv() Problem Adam Johansen 2002-11-07 9:15 ` Adam Johansen 2002-11-07 9:22 ` Atakan Gurkan 2002-11-07 15:18 ` Adam Johansen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).