in reply to (cLive ;-) Re: Fast Matrix Load
in thread Fast Matrix Load

Well, that might help, except that there's one caveat. I'm passing this matrix to a C routine. Here's how it works, once I build the matrix @matrix as shown earlier:
anglecast (@matrix); sub anglecast (\@) { my $avMatrix = shift (@_); my $packedMatrix= ""; my @recycleBin; my $width= @{$avMatrix->[0]}; for my $avRow(@$avMatrix) { $width= @$avRow if @$avRow<$width; my $packedRow= pack("f$width", @$avRow); push @recycleBin, \$packedRow; $packedMatrix .= pack("P", $packedRow); } return CAST(0+@$avMatrix, $width, $packedMatrix); } Anyone know how to modify this if I want to use references? Or maybe +there's a more efficient way to load a matrix? Thanks again, Evan

Replies are listed 'Best First'.
(cLive ;-) Re: Fast Matrix Load
by cLive ;-) (Prior) on Feb 17, 2002 at 05:08 UTC
    The quickest solution I can think of (without trying to understand your code), is to dereference the array as you send it to the sub, ie:
    anglecast (@{$matrix});

    cLive ;-)

    --
    seek(JOB,$$LA,0);