Re: [pure-lang-users] case
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-08-28 22:24:14
|
Eddie Rucker wrote: > What about complex? So I still have to have a setter function for double > and complex, so I might as well include integers. Yes, sure. I didn't suggest that you should throw the int setter routine out of the window. You have an int setter routine that takes an int matrix and int values. Then you have a double setter routine which takes a double matrix and either an int (which gets promoted to double) or a double value. Etc., you get the idea. No need for that type argument to the setter routines. Coming to think of it, it's even better if you write a wrapper function for each type of matrix in C, which takes a list (as a pure_expr*) as argument and returns a matrix. That would execute *much* faster since you only have a single function call per matrix. (You don't initialize a big matrix with n^2 function calls in C either, or do you? If GSL doesn't provide a direct way to initialize a big matrix then that'd be a major performance hog.) Well, obviously I don't have an idea how you initialize a matrix in GSL. Can you point me to some C code which shows how to do this? Then I'll be able to sketch out how you can make it work using the Pure API. It should really be easy. > Now, if I could only find a portable way of determining the size of word > boundaries for different machines and OSs ... I still don't understand why you need that. Just to access the dimensions of the matrix? As I suggested earlier, all accesses to the matrix struct can and should be wrapped up in C routines, then you don't need that kind of hack. > I really hate to add a C > wrapper on top of a C interface and then a Pure wrapper on top of the C > wrapper but it's definitely looking to be the best route. Yes, it is. The Q modules work that way, too. When you have a complex C library, almost invariably you need some additional support routines for accessing the data, and that stuff is best written in C. Then you have a little Pure module which hides away all the complexity, loads the necessary C libraries and provides any high-level definitions (overloading operators etc.) that you want. All the Pure programmer ever sees is that Pure script. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |