Statis...torBase(3pm)

πŸ“¦
version 1.6611 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 Statis...torBase(3pm) β€” Statistics::Basic::_OneVectorBase πŸ’…

okay bestie, so this is a Perl manpage from the User Contributed Perl Documentation collection, living in section 3pm (that's the module section, iykyk). It's the base class for objects like Mean β€” the little engine that holds a vector and does math on it. ✨


πŸŽ€ NAME πŸŽ€

Statistics::Basic::_OneVectorBase β€” base class for objects like Mean. It's giving "mom of the family," fr fr. 🌸


πŸ’– METHODS πŸ’–

✨ query() ✨

Ask the object for its value. That's it, that's the whole vibe. 🫢

Heads up though: it will return the undefined value until there's actually something to calculate β€” or until the vector is full when nofill is in effect. So don't come for her before she's ready, okay? 😭

✨ insert() ✨

Drops new values into the vector. Lowkey the main character move.

$object_instance->insert( 4, 3 ); # insert a 3 and a 4

And the bestie perk: this function returns the object itself, for chaining purposes. πŸ’…

✨ append() / ginsert() ✨

The growing insert. It adds new elements and grows the max size of the vector to accommodate them β€” but only if necessary, she's not doing extra work for nobody. πŸ‘‘

$object_instance->ginsert( 4, 3 ); # append a 3 and a 4

Yep, this one also returns the object itself, for chaining purposes. ⭐

✨ query_size() ✨

The current size of the vector β€” and no, that's not the max size. The max size is a whole separate thing set by set_size(). Don't mix them up, bestie. πŸ™ˆ

✨ query_vector() ✨

Hands you back the Statistics::Basic::Vector object that the computational object is using. It's the actual vector, the real one, the one doing the work. πŸ¦‹

✨ set_size() ✨

Sets the maximum size for the underlying Statistics::Basic::Vector object. This function requires one argument. Exactly one. She said what she said. πŸ’€

Unless nofill is set, the vector will be filled with 0s on the oldest side of the vector (assuming the vector wouldn't otherwise be full) β€” so an insert will push off one of the filled-zeros. Very "make room for the new era" of it. 🌈

And yes: this function returns the object itself, for chaining purposes. πŸŽ€

✨ set_vector() ✨

Give it a vector or an array ref, and this will set the contents (and the size) of the vector used for the object computations. One stop shop. πŸ“

And you already know: this function returns the object itself, for chaining purposes. πŸ’œ


πŸ”₯ OVERLOADS πŸ”₯

This class provides overloads. Periodt.

  • If evaluated as a string, it will attempt to print a pretty value for the object β€” or "n/a", see query() above, if there's nothing to print yet. The resulting string can be tuned, in terms of precision, see ipres for further information. ✨
  • If evaluated as a number, it will try to return the raw result of query(), possibly turning the resulting undef (if applicable) into a 0 in the process β€” and note that Perl does this 0-izing, not the overload. Just so we're clear on who's responsible. 😌
  • The eq and == operators are also overloaded, trying to do the right thing. Also see toler for further information. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Paul Miller <jettero@cpan.org> β€” icon, legend, the moment. πŸ’–


Copyright 2012 Paul Miller -- Licensed under the LGPL


🌟 SEE ALSO 🌟

  • perl(1)
  • Statistics::Basic
  • Statistics::Basic::Vector

and that's the whole page, bestie!! πŸŽ€ this one's from perl v5.36.0, dated 2022-11-19 β€” so when you're citing it in your group chat, you know exactly which era of the lore you're working with. slay, go compute something. πŸ’…βœ¨