get_dataref#

Return a reference to the scalar holding the ndarray’s raw bytes.

my $ref = $pdl->get_dataref; # SCALAR ref

The scalar holds the ndarray’s data in machine format - the same bytes you would find in a file written by PDL::IO::FastRaw. For all but the smallest ndarrays (up to 32 bytes of data) it IS the data: writing into $$ref writes the ndarray. Call $pdl->upd_data afterwards in either case; it tells views of $pdl about the change, and copies the bytes back for a small ndarray, whose scalar is a copy.

The ndarray is made physical first, so a slice or other view yields the bytes of its own elements rather than its parent’s.