PDL::Type(3pm)
PDL::Type ๐ (from the User Contributed Perl Documentation, bestie)
okay so welcome to PDL::Type, the little class that holds all the datatype tea for your PDL ndarrays. it's giving "type info but make it an object." ๐
โจ NAME โจ
PDL::Type โ objects that encapsulate datatypes for PDL transformations. periodt. ๐
๐ฆ SYNOPSIS ๐ฆ
$p = pdl('1 2 3');
print $p->type;
# double
๐ธ DESCRIPTION ๐ธ
so like, this class is literally the type-info holder for PDL ndarrays. when you call the type method on an ndarray, it hands you back a PDL::Type object. want more examples? go peek at the type method again, it ate. ๐ฅ
comparison and stringification are overloaded, which means you can compare and print type objects like it's nothing, e.g.
$nofloat = 1 if $pdl->type < float;
die "must be double" if $type != double;
and yeah, it's got methods to get at all that type info. let's go. ๐
๐ METHODS ๐
enum
returns the number that represents this datatype (check get_datatype for the deets). ๐ข
symbol
returns one of 'PDL_SB', 'PDL_B', 'PDL_S', 'PDL_US', 'PDL_L', 'PDL_UL', 'PDL_IND', 'PDL_ULL', 'PDL_LL', 'PDL_F', 'PDL_D', 'PDL_LD', 'PDL_CF', 'PDL_CD', or 'PDL_CLD'. ๐ท๏ธ
ctype
returns the macro used to represent this type in C code (eg 'PDL_Long'). ๐ป
convertfunc
lower-case version of the "shortctype". ๐ก
ppsym
the letter used to represent this type in PP code (eg 'U' for ushort). โจ
realctype
the actual C type used to store this type. ๐ฆ
shortctype
the value that "ctype" returns, but with the 'PDL_' prefix stripped off. โ๏ธ
badvalue
the special numerical value used to represent bad values for this type. see "badvalue" in PDL::Bad for more. ๐ญ
isnan
give it a string representing a C value, and it'll return a C expression for this type that says whether that value is NaN (for complex values, it's true if either one is NaN). ๐
isfinite
give it a string representing a C value, and it'll return a C expression for this type that says whether that value is finite (for complex values, it's true if both are finite). ๐
floatsuffix
the string that gets appended to floating-point functions for this floating-point type. returns "INVALID" if you call it on a non-floating-point type. โ ๏ธ
orig_badvalue
the default special numerical value used to represent bad values for this type. (you can change the value that represents bad values for each type while it's running, no biggie.) see the orig_badvalue routine in PDL::Bad for more. ๐ซ
bswap
returns the appropriate "bswap*" from PDL::IO::Misc for the size of this type, and it even includes a no-op for types of size 1. heads up tho: this means for a one-line construction you have to call the return value:
$pdl->type->bswap->($pdl);
don't forget the call, bestie. ๐ซถ
real
returns whether the type is real-only (true) or can hold complex values (false).
die "Real data only!" if !$pdl->type->real;
unsigned
returns whether the type can hold signed values (false) or not (true). ๐
integer
returns whether the type can hold non-integer, aka floating-point, values (false) or not (true). ๐งฎ
and that's the whole vibe check, bestie ๐ this was perl v5.42.3, dated 2026-08-20, straight from the User Contributed Perl Documentation โ slay, go type something cute ๐๐
๐ฆ where this page comes from
- ubuntu stonking: pdl 1:2.106-1build1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms