VectorValued(3pm)

πŸ’… PDL::VectorValued β€” bestie edition ✨

okay so, this is PDL::VectorValued β€” it's the module that handles utilities for vector-valued PDLs. Like, PDL but the values are whole vectors and we treat them as one lil data unit. iconic behavior honestly 🫢


✨ SYNOPSIS ✨

use PDL;
use PDL::VectorValued;

##---------------------------------------------------------------------
## ... stuff happens

(yes the "stuff happens" is literally in the source, we love an honest doc πŸ’€)


🌸 DESCRIPTION 🌸

So basically PDL::VectorValued hands you generalizations of a handful of elementary PDL functions, but leveled up to higher-order PDLs β€” the kind that treat vectors as "data values". It's giving "your scalar functions but they went to college" πŸ’…


πŸŽ€ ALIASES πŸŽ€

Okay so here's the lore. To make it easier to fold selected vector-valued functions into the PDL core, all the PDL:PP-, XS-, C-, and perl-level functions that this module defines inside the PDL::VectorValued::Utils package namespace rock a vv_ prefix β€” and that's been true as of PDL::VectorValued v1.0.19. Before v1.0.19, a lot of these functions (like cmpvec(), for example) were defined by this module with no vv_ prefix at all. glow-up moment ✨

For PDL::VectorValued >= v1.0.19 and PDL > v2.079, most vector-valued functions are expected to live in the PDL core instead. For these so-called "moving" functions FUNC, the PDL core implementations get imported into the PDL::VectorValued namespace as both FUNC and vv_FUNC, and they clobber any local implementation hanging out in the PDL::VectorValued::Utils namespace. Meanwhile, local implementations vv_FUNC that were previously defined and exported as FUNC, or that have no binding for *PDL::FUNC at all, get bound to both *PDL::VectorValued::FUNC and *PDL::FUNC, and exported by default β€” for backwards-compatibility reasons, obviously. it's giving legacy support 🫑

Functions expected to move to the PDL core are:

  • New code should use FUNC() or PDL::FUNC().
  • Backwards-compatible code can use FUNC() or PDL::VectorValued::FUNC().
  • Direct use of PDL::VectorValued::Utils::vv_FUNC() is deprecated.
  • Direct use of PDL::VectorValued::Utils::FUNC() is likely broken as of PDL::VectorValued v1.0.19. 😭
not me warning you twice β€” seriously, don't call the broken one, bestie.

πŸ”₯ FUNCTIONS πŸ”₯

vv_uniqvec πŸ‘‘

Signature: (v(N,M); [o]vu(N,MU))

Drop-in replacement for the broken uniqvec(), except this one uses vv_qsortvec(). Aside from that it's copied straight from PDL::Primitive::primitive.pd.

See also: PDL::VectorValued::Utils::vv_qsortvec, PDL::Primitive::uniqvec.


πŸ¦‹ Higher-Order Run-Length Encoding and Decoding πŸ¦‹

The following functions generalize the builtin PDL functions rle() and rld() for higher-order "values".

See also: PDL::VectorValued::Utils::vv_rlevec(), PDL::VectorValued::Utils::vv_rldvec().

vv_rleND 🌈

Signature: (data(@vdims,N); int [o]counts(N); [o]elts(@vdims,N))

Run-length encode a set of (sorted) n-dimensional values.

It's a generalization of rle() and vv_rlevec(): hand it a set of values $data, and it generates a vector $counts with the number of occurrences of each element β€” where an "element" is a matrix of dimensions @vdims occurring as a sequential run over the final dimension in $data β€” plus a set of vectors $elts containing the elements which begin a run. Really it's just a wrapper for clump() and rlevec(). lowkey elegant πŸ’…

See also: PDL::Slices::rle, PDL::Ngrams::VectorValued::Utils::vv_rlevec.

vv_rldND πŸ’œ

Signature: (int counts(N); elts(@vdims,N); [o]data(@vdims,N);)

Run-length decode a set of (sorted) n-dimensional values.

Generalization of rld() and rldvec(): give it a vector $counts() holding the number of occurrences of each @vdims-dimensioned element, plus a set $elts() of @vdims-dimensioned elements, and it run-length decodes that into $data().

Really just a wrapper for clump() and rldvec(), no cap.

See also: PDL::Slices::rld, PDL::VectorValued::Utils::rldvec


⭐ Datatype Utilities ⭐

vv_indx πŸŽ€

Signature: vv_indx()

Returns the PDL::Type subclass used for indices. If it was built with PDL < v2.007, this should return PDL::long; otherwise it should return PDL::indx. it's giving "know your version" ✨


🌸 Low-Level Functions 🌸

Some additional low-level functions are provided in the PDL::VectorValued::Utils package. See PDL::VectorValued::Utils for details. iykyk 🫢


🫢 ACKNOWLEDGEMENTS 🫢

perl by Larry Wall. the OG. periodt πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Bryan Jurish <moocow@cpan.org>

PDL by Karl Glazebrook, Tuomas J. Lukka, Christian Soeller, and others. absolute legends, all of them 🌟


Copyright (c) 2007-2022, Bryan Jurish. All rights reserved.

This package is free software. You may redistribute it and/or modify it under the same terms as Perl itself. slay, free software πŸ’…


🌈 SEE ALSO 🌈

perl(1), PDL(3perl), PDL::VectorValued::Utils(3perl)


okay that's the whole page, bestie πŸŽ€ this doc shipped as perl v5.42.3 dated 2026-08-21, and the page itself is VectorValued(3pm). go forth and vector-value responsibly πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from