Types::PDL - PDL types using Type::Tiny
version 0.01
use Types::PDL -types; use Type::Params qw[ validate ]; use PDL; validate( [ pdl ], Piddle );
This module provides Type::Tiny compatible types for PDL.
Types which accept parameters (see "Parameters") will list them.
Piddle
Allows an object blessed into the class PDL, e.g.
PDL
validate( [pdl], Piddle );
It accepts the following parameters:
null empty ndims ndims_min ndims_max
Piddle0D
Allows an object blessed into the class PDL with ndims = 0. It accepts the following parameters:
ndims
null
Piddle1D
Allows an object blessed into the class PDL with ndims = 1. It accepts the following parameters:
null empty
Piddle2D
Allows an object blessed into the class PDL with ndims = 2. It accepts the following parameters:
Piddle3D
Allows an object blessed into the class PDL with ndims = 3. It accepts the following parameters:
The following coercions are provided, and may be applied via a type object's "plus_coercions" in Type::Tiny or "plus_fallback_coercions" in Type::Tiny methods, e.g.
Piddle->plus_coercions( PiddleFromAny );
PiddleFromAny
Uses "topdl" in PDL::Core to coerce the value into a piddle.
Some types take optional parameters which add additional constraints on the object. For example, to indicate that only empty piddles are accepted:
validate( [pdl], Piddle[ empty => 1 ] );
The available parameters are:
empty
This accepts a boolean value; if true the piddle must be empty (i.e. the isempty method returns true), if false, it must not be empty.
isempty
This accepts a boolean value; if true the piddle must be a null piddle, if false, it must not be null.
This specifies a fixed number of dimensions which the piddle must have. Don't mix use this with ndims_min or ndims_max.
ndims_min
ndims_max
The minimum number of dimensions the piddle may have. Don't specify this with ndims.
The maximum number of dimensions the piddle may have. Don't specify this with ndims.
You can make new bug reports, and view existing ones, through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=Types-PDL.
Diab Jerius <djerius@cpan.org>
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
To install Types::PDL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Types::PDL
CPAN shell
perl -MCPAN -e shell install Types::PDL
For more information on module installation, please visit the detailed CPAN module installation guide.