FastRaw(3pm)

πŸ“¦
version 1.24.1 Β· 5 versions
, in debian trixie, ubuntu resolute

πŸ’– FastRaw πŸ’–

okay bestie, sit down, hydrate, because we're about to talk about FastRaw β€” that's the short name, and the full government name is PDL::CCS::IO::FastRaw. It lives in the User Contributed Perl Documentation corner of the manual, and it is literally the PDL::IO::FastRaw wrappers for PDL::CCS::Nd. That's it. That's the whole vibe. πŸ¦‹


✨ NAME ✨

PDL::CCS::IO::FastRaw β€” PDL::IO::FastRaw wrappers for PDL::CCS::Nd. no cap, that's the name. πŸ’…


🌸 SYNOPSIS 🌸

use PDL;
use PDL::CCS::Nd;
use PDL::CCS::IO::FastRaw;

$ccs = PDL::CCS::Nd->newFromWhich($which,$nzvals);

ccs_writefraw($ccs,$fname);     # write a pair of raw files
$ccs2 = ccs_readfraw($fname);   # read a pair of raw files

$ccs3 = ccs_mapfraw($fname,{ReadOnly=>1}); # mmap a pair of files, don't read yet

look at her go. write a pair, read a pair, mmap a pair. iconic behavior. πŸ‘‘


πŸŽ€ I/O Utilities πŸŽ€

🧚 ccs_writefraw

she writes a pair of raw binary files using PDL::IO::FastRaw::writefraw(). queen stuff. ✨

ccs_writefraw($ccs,$fname)
ccs_writefraw($ccs,$fname,\%opts)

Options in %opts:

Header      => $Header,       ##-- default="$fname.hdr"
ixFile      => $ixFile,       ##-- default="$fname.ix"
ixHeader    => $ixHeader,     ##-- default="$ixFile.hdr"
nzFile      => $nzFile,       ##-- default="$fname.nz"
nzHeader    => $nzHeader,     ##-- default="$nzFile.hdr"

every one of those defaults is right there in the comments, bestie, don't @ me. πŸ’–


πŸ¦‹ ccs_readfraw

she reads a pair of raw binary files using PDL::IO::FastRaw::readfraw(). the reverse of the above, lowkey elegant. 🫢

$ccs = ccs_readfraw($fname)
$ccs = ccs_readfraw($fname,\%opts)

Options in %opts:

Header   => $Header,      ##-- default="$fname.hdr"
ixFile   => $ixFile,      ##-- default="$fname.ix"
ixHeader => $ixHeader,    ##-- default="$ixFile.hdr"
nzFile   => $nzFile,      ##-- default="$fname.nz"
nzHeader => $nzHeader,    ##-- default="$nzFile.hdr"
sorted   => $bool,        ##-- is data on disk already sorted? (default=1)

so sorted is asking is the data on disk already sorted? and yes bestie, the default is 1. 🌸


πŸ’œ ccs_mapfraw

she reads a pair of raw binary files using PDL::IO::FastRaw::readfraw(). mmap energy. ✨

$ccs = ccs_mapfraw($fname)
$ccs = ccs_mapfraw($fname,\%opts)

Global options in %opts:

Header    => $Header,   ##-- default="$fname.hdr"
ReadOnly  => $bool,     ##-- read-only mode?
Dims      => \@dims,    ##-- logical dimensions (~ \@pdims)
Datatype  => $type,     ##-- CCS::Nd datatype
Creat     => $bool,     ##-- create file(s)?
Trunc     => $bool,     ##-- truncate file(s)?

CCS::Nd options in %opts:

flags     => $flags,    ##-- CCS::Nd flags
nnz       => $nnz,      ##-- CCS::Nd nnz
pdims     => \@pdims,   ##-- CCS::Nd physical dimensions
vdims     => \@vdims,   ##-- CCS::Nd virtual dimensions
sorted    => $bool,     ##-- is data on disk sorted? (default=1)

Component options in %opts, for ${c} in qw(ix nz):

"${c}${opt}" => $cValue,   ##-- override global option ${opt}
"${c}File"   => $cFile,    ##-- default="$fname.${c}"
"${c}Header" => $cHeader,  ##-- default="$cFile.hdr"

so yeah, for each component c in qw(ix nz) you can override the global option ${opt}, and the file/header defaults follow the same pattern as always. the way that it's consistent... obsessed. πŸ’…


🌈 ACKNOWLEDGEMENTS 🌈

  • Perl by Larry Wall.
  • PDL by Karl Glazebrook, Tuomas J. Lukka, Christian Soeller, and others.

giving credit where credit is due, as she should. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Bryan Jurish <moocow@cpan.org>


Copyright (C) 2015-2024, Bryan Jurish. All rights reserved.

This package is free software, and entirely without warranty. You may redistribute it and/or modify it under the same terms as Perl itself.

fr fr: "entirely without warranty" is not a drill, bestie. that's the actual legal vibe. πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

perl, PDL, PDL::CCS::Nd, PDL::CCS::IO::FITS, PDL::CCS::IO::MatrixMarket, PDL::CCS::IO::LDAC, ...


that's the whole page, bestie. this doc is shipped with perl v5.40.0 and dated 2025-01-04, and it's giving main character energy from start to finish. go forth and mmap responsibly. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from