GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Types::PDL(3) User Contributed Perl Documentation Types::PDL(3)

Types::PDL - PDL types using Type::Tiny

version 0.04

  use Types::PDL -types;
  use Type::Params qw[ validate ];
  use PDL;
  validate( [ pdl ], NDArray );

This module provides Type::Tiny compatible types for PDL.

Types which accept parameters (see "Parameters") will list them.

"NDArray" | "Piddle" (deprecated)

Allows an object blessed into the class "PDL", e.g.

  validate( [pdl], NDarray );

It accepts the following parameters:

  null
  empty
  ndims
  ndims_min
  ndims_max
  shape
  type

"NDArray0D" | "Piddle0D" (deprecated)

Allows an object blessed into the class "PDL" with "ndims" = 0. It accepts the following parameters:

  null
  type

"NDArray1D" | "Piddle1D" (deprecated)

Allows an object blessed into the class "PDL" with "ndims" = 1. It accepts the following parameters:

  null
  empty
  shape
  type

"NDArray2D" | "Piddle2D" (deprecated)

Allows an object blessed into the class "PDL" with "ndims" = 2. It accepts the following parameters:

  null
  empty
  shape
  type

"NDArray3D" | "Piddle3D" (deprecated)

Allows an object blessed into the class "PDL" with "ndims" = 3. It accepts the following parameters:

  null
  empty
  shape
  type

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.

  NDArray->plus_coercions( NDArrayFromAny );

"NDArrayFromAny" | "PiddleFromAny" (deprecated)

Uses "topdl" in PDL::Core to coerce the value into a PDL object.

Some types take optional parameters which add additional constraints on the object. For example, to indicate that only empty PDL objects are accepted:

  validate( [pdl], NDArray[ empty => 1 ] );

The available parameters are:

"empty"

This accepts a boolean value; if true the PDL object must be empty (i.e. the "isempty" method returns true), if false, it must not be empty.

"null"

This accepts a boolean value; if true the PDL object must be a null PDL object, if false, it must not be null.

"ndims"

This specifies a fixed number of dimensions which the PDL object must have. Don't mix use this with "ndims_min" or "ndims_max".

"ndims_min"

The minimum number of dimensions the PDL object may have. Don't specify this with "ndims".

"ndims_max"

The maximum number of dimensions the PDL object may have. Don't specify this with "ndims".

"shape"

The shape of the PDL object.

The value is a list of specifications for dimensions, expressed either as elements in a Perl array or as comma-delimited fields in a string.

The specifications are reminiscent of regular expressions. A specification is composed of an extent size followed by an optional quantifier indicating the number of dimensions it should match.

Extent sizes may be

1.
A non-zero positive integer representing the extent of the dimension.
2.
The strings "X" or ":" indicating that any extent is accepted for that dimension

Quantifiers may be

  *           Match 0 or more times
  +           Match 1 or more times
  ?           Match 1 or 0 times
  {n}         Match exactly n times
  {n,}        Match at least n times
  {n,m}       Match at least n but not more than m times

Here are some example specifications and the shapes they might match (in the match, "X" means any extent):

  2,2     => (2,2)
  3,3,3   => (3,3,3)
  3{3}    => (3,3,3)
  3{2,3}  => (3,3),  (3,3,3)
  1,X     => (1,X)
  1,X+    => (1,X), (1,X,X),  (1,X,X,X), ...
  1,X{1,} => (1,X), (1,X,X),  (1,X,X,X), ...
  1,X?,3   => (1,X,3), (1,3)
  1,2,X*   => (1,2), (1,2,X),  (1,2,X,X), ...
  1,2,3*,5   => (1,2,5), (1,2,3,5),  (1,2,3,3,5), ...

"type"

The type of the PDL object. The value may be a PDL::Type object or a string containing the name of a type (e.g., "double"). For a complete list of types, run this command:

  perl -MPDL::Types=mapfld,ppdefs \
    -E 'say mapfld( $_ => 'ppsym' => 'ioname' )  for ppdefs'

Please report any bugs or feature requests to bug-types-pdl@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Types-PDL

Source is available at

  https://gitlab.com/djerius/types-pdl

and may be cloned from

  https://gitlab.com/djerius/types-pdl.git

Please see those modules/websites for more information related to this module.

package 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
2021-10-22 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.