Hi,
I am a bit new to PDL so if the answer is obvious I have missed it some
how...
I have around 1 million vectors of about 1 million elements long each
element is one byte in size
The information is streamed in, one vector at a time with input data - the
data itself is not read from a file its real life information collected so
every time I run the program I get something else.
I found that initializing the vectors with zeros takes long time, seems
that zeros iterates on all the cells settings them to zero
so I created any empty pdl with zeros and each time I need to create a PDL
I use
this methos
# this is done once
my $pdl_template = zeros(byte, $size);
my $buffer_template = $pdl_template->get_dataref;
# now when getting the information
my $pdl = PDL->new_from_specification(byte, $size);
my $ptr_buffer = $pdl ->get_dataref;
$$ptr_buffer = ${$buffer_template};
$pdl->upd_data;
This is about 7 times faster than zeros, however it would be better if
zeros (and also ones) had some optimization to clear an empty vector even
faster using c's memset function when applicable (bytes. shorts integer
etc.)
As this seems very useful I wonder if I missed something ?
Thanks
Roey
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl