Hi James, On Tuesday 27 December 2005 10:07 am, [EMAIL PROTECTED] wrote: > Quoting Ivan Adzhubey <[EMAIL PROTECTED]>: > > What is the best way to read vector/matrix data from a file? The > > ... > > > i.e., one vector per line, comma-separated vector elements. The idea is > > to read the whole block of data in and then loop over it (creating vector > > views?) doing calculations. > > Hi Ivan, > > You are right that GSL has a very minimal I/O. It isn't so much for > reading data in <your> format, as providing a quick way to dump stuff to > file and then read it back.
I sort of figured it out myself but some hints in the documentation would be nice, don't you think? > The idea is to use routines like getline(), > strtod(), strchr(), scanf() and so on to get the job done. Have it working now with a simple fgets()/sscanf() loop. It's really for testing purposes only, now I need to add Postgresql bindings for the real thing. I also tried to benchmark GSL a bit with my own code and was surprised to see it only marginally (e.g. 50%) faster than R (www.r-project.org), which I use routinely. The main goal of recoding my vector functions in C/GSL was to have things calculate faster but it seems it's not gonna happen ;-(. Now, R being an interpreted language, still uses BLAS hooks to do all matrix arithmetic so I probably should not be expecting too much improvement in speed. Thanks! -- Ivan _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
