Statis...torBase(3pm)

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

πŸ’– NAME πŸ’–

Statistics::Basic::_TwoVectorBase β€” it's the base class for the two-vector girlies, like Correlation. Basically the blueprint other objects are built on, iykyk.


✨ METHODS ✨

  • query() β€” asks the object what its value is rn. Bestie, it will hand you back the undefined value until there's actually something to calculate. No numbers yet? No tea. πŸ«–
  • insert() β€” drops two new new values into the vectors (yes the original says "new new", we love a typo moment πŸ’…). This one must be given precisely two arguments, and honestly those arguments probably shouldn't be undefined values in most cases.
# insert a 4 in one vector and a 3 in the other
$object_instance->insert( 4, 3 );
  • append(), ginsert() β€” the growing insert 🌱. It adds new elements and grows the max size of the vector to accommodate them (if necessary). Same rules as above: precisely two arguments, and they probably shouldn't be undefined values in most cases.
# append a 4 in one vector and a 3 in the other
$object_instance->ginsert( 4, 3 );
  • query_size() β€” the current size of the vectors, periodt. This is regardless of their max size (the one you'd set with "set_size()"). Heads up: it returns a list, so like:
my @s = $obj->query_size; # two values
my $s = $obj->query_size; # the right hand value of the list
  • set_size() β€” sets the maximum size for the underlying Statistics::Basic::Vector objects. Requires two arguments. Two. Not one, not three. πŸŽ€
  • set_vector() β€” sets the vector objects used to calculate the object's value. Takes two arguments β€” and those can be either arrayrefs or Statistics::Basic::Vector objects. They must have the same number of elements (matching vibes only 🌈).
my $v1 = vector
my $v2 = $v1->copy;
$example_correlation->set_vector($v1, $v2);

πŸ”₯ OVERLOADS πŸ”₯

This class provides overloads, and they're giving main character energy.

If you evaluate it as a string, it will attempt to print a pretty value for the object (or "n/a" β€” see "query()" above). The resulting string can be tuned, in terms of precision β€” see ipres for further information. ✨

If you evaluate it 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. Lowkey important: Perl does this 0-izing, not the overload. Don't blame the overload, bestie. 😭

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>"


Copyright 2012 Paul Miller -- Licensed under the LGPL


πŸ¦‹ SEE ALSO πŸ¦‹

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


okay that's the whole page, no notes πŸ’œ huge slay to you for reading docs fr fr β€” this was perl v5.36.0, dated 2022-11-19, mwah 🫢