![]() |
![]()
| ![]() |
![]()
NAMEPDL::Type - Objects encapsulating datatypes for PDL transformations SYNOPSIS$p = pdl('1 2 3'); print $p->type; # double DESCRIPTIONThis module declares one class - of this class The type method of an ndarray returns a "PDL::Type" object. For further examples check again the type method. Comparison and stringification are overloaded so that you can compare and print type objects, e.g. $nofloat = 1 if $pdl->type < float; die "must be double" if $type != double; It has methods to access type information. METHODSenumReturns the number representing this datatype (see get_datatype). symbolReturns 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'. ctypeReturns the macro used to represent this type in C code (eg 'PDL_Long'). convertfuncLower-case version of the "shortctype". ppsymThe letter used to represent this type in PP code (eg 'U' for ushort). realctypeThe actual C type used to store this type. shortctypeThe value returned by "ctype" without the 'PDL_' prefix. badvalueThe special numerical value used to represent bad values for this type. See "badvalue" in PDL::Bad for more details. isnanGiven a string representing a C value, will return a C expression for this type that indicates whether that value is NaN (for complex values, if either is NaN). isfiniteGiven a string representing a C value, will return a C expression for this type that indicates whether that value is finite (for complex values, if both are finite). floatsuffixThe string appended to floating-point functions for this floating-point type. Returns "INVALID" if called on non-floating-point type. orig_badvalueThe default special numerical value used to represent bad values for this type. (You can change the value that represents bad values for each type during runtime.) See the orig_badvalue routine in PDL::Bad for more details. bswapReturns the appropriate "bswap*" from PDL::IO::Misc for the size of this type, including a no-op for types of size 1. Note this means a one-line construction means you must call the return value: $pdl->type->bswap->($pdl); realReturns whether the type is real-only (true) or can hold complex values (false). die "Real data only!" if !$pdl->type->real; unsignedReturns whether the type can hold signed values (false) or not (true). integerReturns whether the type can hold non-integer, a.k.a. floating-point, values (false) or not (true).
|