AndroMeta  2.0.0
Public Member Functions | Static Public Member Functions
Meta::MLib Class Reference

A library of static functions callable from M. More...

#include <MLib.h>

Inheritance diagram for Meta::MLib:
Meta::MLibBase Meta::MObject Meta::MProcessor Meta::MObjectBase

List of all members.

Public Member Functions

 MLib ()
virtual ~MLib ()
virtual mnode process (mnode n, uint32_t flags=0)

Static Public Member Functions

static mvar toVar (mnode n, bool codeData=false)
static mvar fromStr (const mstr &str, bool literal=true, bool exact=false)
static void srand (uint64_t seed)
static double uniform ()
static double uniform (double a, double b)
static double exponential (double x)
static double normal (double m, double s)
static double erlang (double n, double x)
static double pareto (double k, double a)
static double lognormal (double a, double b)
static double chisquare (double n)
static long bernoulli (double p)
static long equilikely (long a, long b)
static long binomial (long n, double p)
static long geometric (double p)
static long bpascal (long n, double p)
static long poisson (double m)
static const mvarchoice (const mvar &seq)
static mvec randomSequence (long a, long b)
static mvar mixedDistribution (const mvar &v)
static mvar degrees (const mvar &d)
static double pi ()
static double sqrt (double v)
static double pow (double v, double exponent)
static double abs (double v)
static double log10 (double v)
static double cos (double v)
static double acos (double v)
static double cosh (double v)
static double sin (double v)
static double asin (double v)
static double sinh (double v)
static double tan (double v)
static double atan (double v)
static double atan2 (double y, double x)
static double tanh (double v)
static double inf ()
static double negInf ()
static double floor (double v)
static double ceil (double v)
static double round (double v, double precision=1)
static bool nearInteger (double v, mvar &n)
static double distance (const mvar &u, const mvar &v)
static mvar scaleVector (const mvar &u, double magnitude)
static mvec vectorRange (const mvar &b)
static mvec vectorRange (const mvar &a, const mvar &b)
static mvec vectorRange (const mvar &a, const mvar &b, const mvar &inc)
static mlist listRange (const mvar &b)
static mlist listRange (const mvar &a, const mvar &b)
static mlist listRange (const mvar &a, const mvar &b, const mvar &inc)
static mvar clamp (const mvar &v, const mvar &min, const mvar &max)
static void sleep (double secs)
static void print (const mstr &str)
static mstr repeatString (const mstr &str, int n)
static mvar mergeSymbolicMaps (const mvar &m1, const mvar &m2)
static bool hasArg (const mvar &key)
static mvar args ()
static void setArgs (const mvar &args)
static mvar arg (const mvar &key)
static mvar arg (const mvar &key, const mvar &def)
static void setArg (const mvar &key, const mvar &value)
static void argDefault (const mvar &key, const mvar &value)
static double systemTime ()
static mstr formatTime (double t, const mstr &format)
static void setDefaultPrecision (size_t bits)
static mstr formatTime (double t)
static mvec crossProduct (const mvec &u, const mvec &v)
static mvar dotProduct (const mvec &u, const mvec &v)

Detailed Description

A library of static functions callable from M.


Constructor & Destructor Documentation

Constructor.

virtual Meta::MLib::~MLib ( ) [virtual]

Destructor.


Member Function Documentation

static double Meta::MLib::abs ( double  v) [inline, static]

Absolute value.

static double Meta::MLib::acos ( double  v) [inline, static]

Arccosine.

static mvar Meta::MLib::arg ( const mvar key) [inline, static]
static mvar Meta::MLib::arg ( const mvar key,
const mvar def 
) [inline, static]
static void Meta::MLib::argDefault ( const mvar key,
const mvar value 
) [inline, static]
static mvar Meta::MLib::args ( ) [inline, static]
static double Meta::MLib::asin ( double  v) [inline, static]

Arcsine.

static double Meta::MLib::atan ( double  v) [inline, static]

Arctangent.

static double Meta::MLib::atan2 ( double  y,
double  x 
) [inline, static]

Arctangent 2.

static long Meta::MLib::bernoulli ( double  p) [static]
static long Meta::MLib::binomial ( long  n,
double  p 
) [static]
static long Meta::MLib::bpascal ( long  n,
double  p 
) [static]
static double Meta::MLib::ceil ( double  v) [inline, static]

Ceiling function.

static double Meta::MLib::chisquare ( double  n) [static]
static const mvar& Meta::MLib::choice ( const mvar seq) [static]
Returns:
A random element from sequence seq.
static mvar Meta::MLib::clamp ( const mvar v,
const mvar min,
const mvar max 
) [inline, static]

Clamp.

static double Meta::MLib::cos ( double  v) [inline, static]

Cosine.

static double Meta::MLib::cosh ( double  v) [inline, static]

Hyperbolic cosine.

static mvec Meta::MLib::crossProduct ( const mvec u,
const mvec v 
) [static]
Returns:
The cross product of the 3D vectors u and v.
static mvar Meta::MLib::degrees ( const mvar d) [inline, static]

Convert radians to degrees.

static double Meta::MLib::distance ( const mvar u,
const mvar v 
) [inline, static]

Fast distance.

static mvar Meta::MLib::dotProduct ( const mvec u,
const mvec v 
) [static]
Returns:
The dot product of vectors u and v which must be of equal dimensions.
static long Meta::MLib::equilikely ( long  a,
long  b 
) [static]
static double Meta::MLib::erlang ( double  n,
double  x 
) [static]
static double Meta::MLib::exponential ( double  x) [static]
static double Meta::MLib::floor ( double  v) [inline, static]

Floor function.

static mstr Meta::MLib::formatTime ( double  t,
const mstr format 
) [inline, static]
static mstr Meta::MLib::formatTime ( double  t) [inline, static]
static mvar Meta::MLib::fromStr ( const mstr str,
bool  literal = true,
bool  exact = false 
) [inline, static]
Returns:
str parsed to an mvar.
static long Meta::MLib::geometric ( double  p) [static]
static bool Meta::MLib::hasArg ( const mvar key) [inline, static]
static double Meta::MLib::inf ( ) [inline, static]

Postive infinity.

static mlist Meta::MLib::listRange ( const mvar b) [inline, static]

List range.

static mlist Meta::MLib::listRange ( const mvar a,
const mvar b 
) [inline, static]

List range.

static mlist Meta::MLib::listRange ( const mvar a,
const mvar b,
const mvar inc 
) [inline, static]

List range.

static double Meta::MLib::log10 ( double  v) [inline, static]

Log base 10.

static double Meta::MLib::lognormal ( double  a,
double  b 
) [static]
static mvar Meta::MLib::mergeSymbolicMaps ( const mvar m1,
const mvar m2 
) [static]

Merge symbolic maps in m1 and m2, preserving m1's values in the case of duplicate keys in m2.

Returns:
The merged symbolic map of m1 and m2.
static mvar Meta::MLib::mixedDistribution ( const mvar v) [static]

Used to specify a uniformly weighted mixed distribution set.

Parameters:
ve.g: [[0.1,{normal(10,3)}],[0.9,{uniform(5,6)}]]
static bool Meta::MLib::nearInteger ( double  v,
mvar n 
) [inline, static]

Near integer.

static double Meta::MLib::negInf ( ) [inline, static]

Negative infinity.

static double Meta::MLib::normal ( double  m,
double  s 
) [static]
static double Meta::MLib::pareto ( double  k,
double  a 
) [static]
static double Meta::MLib::pi ( ) [inline, static]

Constant pi.

static long Meta::MLib::poisson ( double  m) [static]
static double Meta::MLib::pow ( double  v,
double  exponent 
) [inline, static]

Exponentiaton function.

static void Meta::MLib::print ( const mstr str) [static]

Print str.

virtual mnode Meta::MLib::process ( mnode  n,
uint32_t  flags = 0 
) [virtual]

Process method.

Reimplemented from Meta::MObject.

static mvec Meta::MLib::randomSequence ( long  a,
long  b 
) [static]
Returns:
A random sequence of elements from the sequence [a,b].
static mstr Meta::MLib::repeatString ( const mstr str,
int  n 
) [static]

Repeat string str n times.

static double Meta::MLib::round ( double  v,
double  precision = 1 
) [inline, static]

Round.

static mvar Meta::MLib::scaleVector ( const mvar u,
double  magnitude 
) [inline, static]

Scale a vector.

static void Meta::MLib::setArg ( const mvar key,
const mvar value 
) [inline, static]
static void Meta::MLib::setArgs ( const mvar args) [inline, static]
static void Meta::MLib::setDefaultPrecision ( size_t  bits) [inline, static]

See MMath::setDefaultPrecision().

static double Meta::MLib::sin ( double  v) [inline, static]

Sine.

static double Meta::MLib::sinh ( double  v) [inline, static]

Hyperbolic sine.

static void Meta::MLib::sleep ( double  secs) [inline, static]

Sleep for a number of seconds.

static double Meta::MLib::sqrt ( double  v) [inline, static]

Square root.

static void Meta::MLib::srand ( uint64_t  seed) [static]

Seed the global random number generator.

Parameters:
seed0..18446744073709551615
static double Meta::MLib::systemTime ( ) [inline, static]

System time in seconds since UNIX epoch.

static double Meta::MLib::tan ( double  v) [inline, static]

Tangent.

static double Meta::MLib::tanh ( double  v) [inline, static]

Hyperbolic tangent.

static mvar Meta::MLib::toVar ( mnode  n,
bool  codeData = false 
) [static]
Returns:
n converted to an mvar.
static double Meta::MLib::uniform ( ) [static]
static double Meta::MLib::uniform ( double  a,
double  b 
) [static]
static mvec Meta::MLib::vectorRange ( const mvar b) [inline, static]

Vector range.

static mvec Meta::MLib::vectorRange ( const mvar a,
const mvar b 
) [inline, static]

Vector range.

static mvec Meta::MLib::vectorRange ( const mvar a,
const mvar b,
const mvar inc 
) [inline, static]

Vector range.


The documentation for this class was generated from the following file: