Use Perl arrays for float* arguments in CBLAS routines
Note: we allocate some memory for the C array
AND for a structure to be able to push back the results
in the perl Array when the parameter is an IN/OUT parameter.
In order to archive this, the struture is placed before
$1 (because $1 is used directly in the C function call
so it must point to the C array)
Tests have been adapted to send arrays instead of single values.
NOTE2: I'm not sure this is the right Perl API. Indeed, if we
follow this path, each CBLAS routine will require some Perl->C
array conversions and back for the result. This can be very
inefficient if we want to make several calls to CBLAS routines
in a row.
Perhaps, a good Perl interface would be something as:
my $opaque_C_array=CBLAS::Array->new( [ 2, 3, 5, 6.7] );
CBLAS::sdsdot(2.3, $opaque_C_array, 1, $opaque_C_array, 1);
CBLAS::sdsdot(2.3, $opaque_C_array, 1, $opaque_C_array, 1);
...
my $result=$opaque_C_array->get_perl_array();
for $val (@{$result}) { ... }
Ie: C array are encapsulated in opaque perl objects (with
constructors, accessors and destructors) and can be reused
with several CBLAS invocations ?
Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>