> Oops, sorry about that.

Turns out it wasn't your fault. The GUID struct was declared with its  
Data1 field as "ulong", which is 8 bytes on LP64 platforms. Changing  
it to use Windows' ULONG typedef, which is always 4-byte, fixed the  
tests on 64-bit OS X. (There would be no problem either way on Windows  
since it's LLP64.) I also tried key-caps and joystick-demo on my XP  
box and they both work fine. I pushed the fix to my git repo.

> Yes, it would be nice to get specialized-arrays.complex-{float,double}
> out of this. I'm not sure the define-array functor is directly
> applicable, it might need to be generalized a bit. Functors are really
> a bit of a hack right now; let me know what your use-case is and I'll
> let you know if they're appropriate and if they need changes.

For most BLAS operations there are four variants for single, double,  
single-complex, and double-complex with similar names and the same  
call signature. The main difference between the methods on the *-blas- 
vector types is what underlying BLAS function they call. At a glance,  
it looks like you ought to be able to say something like this:

FUNCTOR: define-blas-matrix ( TYPE T -- )

MATRIX DEFINES ${TYPE}-blas-matrix
ARRAY DEFINES ${TYPE}-array
GEMM DEFINES cblas_${T}gemm
...

WHERE

TUPLE: MATRIX < ARRAY ... ;

METHOD: M. { MATRIX MATRIX }
        (setup-gemm-parameters) GEMM ;
...

;FUNCTOR

<<
"float" "s" define-blas-matrix
"double" "d" define-blas-matrix
"complex-float" "c" define-blas-matrix
"complex-double" "z" define-blas-matrix
 >>

One special case is with functions that return a scalar floating-point  
value, like the vector inner product functions. cblas has the real- 
number variants use the function's return value to return the result  
while the complex-number variants use an out pointer parameter to  
store the result. The inner and outer product functions also have  
straight and conjugate variants for complex parameters, which aren't  
needed for real parameters. If functors can call out to other  
functors, these could be handled with a base functor that covers the  
common cases and then real and complex functors which build off the  
base and write out the functions that differ.

-Joe

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to