kspread

KSpread::ValueCalc Class Reference

The ValueCalc class is used to perform all sorts of calculations. More...

#include <ValueCalc.h>

List of all members.

Public Member Functions

 ValueCalc (ValueConverter *c)
Value abs (const Value &a)
Value acos (const Value &number)
Value acosh (const Value &number)
Value add (Number a, const Value &b)
Value add (const Value &a, Number b)
Value add (const Value &a, const Value &b)
bool approxEqual (const Value &a, const Value &b)
void arrayWalk (QVector< Value > &range, Value &res, arrayWalkFunc func, Value param)
void arrayWalk (const Value &range, Value &res, arrayWalkFunc func, Value param)
Value asin (const Value &number)
Value asinh (const Value &number)
Value atan2 (const Value &y, const Value &x)
Value atg (const Value &number)
Value atgh (const Value &number)
Value avg (QVector< Value > range, bool full=true)
Value avg (const Value &range, bool full=true)
arrayWalkFunc awFunc (const QString &name)
Value base (const Value &val, int base=16, int prec=0, int minLength=0)
Value besseli (Value v, Value x)
Value besselj (Value v, Value x)
Value besselk (Value v, Value x)
Value besseln (Value v, Value x)
Value combin (Value n, Value k)
Value combin (int n, int k)
ValueConverterconv ()
Value cos (const Value &number)
Value cosh (const Value &number)
Value cotg (const Value &number)
int count (QVector< Value > range, bool full=true)
int count (const Value &range, bool full=true)
int countIf (const Value &range, const Condition &cond)
Value div (Number a, const Value &b)
Value div (const Value &a, Number b)
Value div (const Value &a, const Value &b)
Value eps ()
bool equal (Number a, const Value &b)
bool equal (const Value &a, Number b)
bool equal (const Value &a, const Value &b)
Value erf (Value x)
Value erfc (Value x)
Value exp (const Value &number)
Value fact (int which, int end=0)
Value fact (const Value &which, const Value &end)
Value fact (const Value &which)
Value factDouble (Value which)
Value factDouble (int which)
Value::Format format (Value a, Value b)
Value fromBase (const Value &val, int base=16)
Value gauss (Value xx)
Value gaussinv (Value xx)
Value gcd (const Value &a, const Value &b)
bool gequal (const Value &a, const Value &b)
Value GetBeta (Value _x, Value _alpha, Value _beta)
void getCond (Condition &cond, Value val)
Value GetGamma (Value _x)
Value GetGammaDist (Value _x, Value _alpha, Value _beta)
Value GetLogGamma (Value _x)
bool greater (Number a, const Value &b)
bool greater (const Value &a, Number b)
bool greater (const Value &a, const Value &b)
bool isEven (const Value &a)
bool isZero (const Value &a)
Value lcm (const Value &a, const Value &b)
Value ln (const Value &number)
Value log (const Value &number, Number base=10)
Value log (const Value &number, const Value &base)
bool lower (Number a, const Value &b)
bool lower (const Value &a, Number b)
bool lower (const Value &a, const Value &b)
bool matches (const Condition &cond, Value d)
Value max (QVector< Value > range, bool full=true)
Value max (const Value &range, bool full=true)
Value min (QVector< Value > range, bool full=true)
Value min (const Value &range, bool full=true)
Value mod (const Value &a, const Value &b)
Value mul (Number a, const Value &b)
Value mul (const Value &a, Number b)
Value mul (const Value &a, const Value &b)
bool naturalEqual (const Value &a, const Value &b, bool CS=true)
bool naturalGequal (const Value &a, const Value &b, bool CS=true)
bool naturalGreater (const Value &a, const Value &b, bool CS=true)
bool naturalLower (const Value &a, const Value &b, bool CS=true)
Value phi (Value x)
Value pi ()
Value pow (Number a, const Value &b)
Value pow (const Value &a, Number b)
Value pow (const Value &a, const Value &b)
Value product (QVector< Value > range, Value init, bool full=true)
Value product (const Value &range, Value init, bool full=true)
Value random (Value range)
Value random (Number range=1.0)
void registerAwFunc (const QString &name, arrayWalkFunc func)
Value round (const Value &a, int digits=0)
Value round (const Value &a, const Value &digits)
Value roundDown (const Value &a, int digits=0)
Value roundDown (const Value &a, const Value &digits)
Value roundUp (const Value &a, int digits=0)
Value roundUp (const Value &a, const Value &digits)
const CalculationSettingssettings () const
int sign (const Value &a)
Value sin (const Value &number)
Value sinh (const Value &number)
Value sqr (const Value &a)
Value sqrt (const Value &a)
Value stddev (QVector< Value > range, Value avg, bool full=true)
Value stddev (QVector< Value > range, bool full=true)
Value stddev (const Value &range, Value avg, bool full=true)
Value stddev (const Value &range, bool full=true)
Value stddevP (QVector< Value > range, Value avg, bool full=true)
Value stddevP (QVector< Value > range, bool full=true)
Value stddevP (const Value &range, Value avg, bool full=true)
Value stddevP (const Value &range, bool full=true)
bool strEqual (const Value &a, const Value &b, bool CS=true)
bool strGequal (const Value &a, const Value &b, bool CS=true)
bool strGreater (const Value &a, const Value &b, bool CS=true)
bool strLower (const Value &a, const Value &b, bool CS=true)
Value sub (Number a, const Value &b)
Value sub (const Value &a, Number b)
Value sub (const Value &a, const Value &b)
Value sum (QVector< Value > range, bool full=true)
Value sum (const Value &range, bool full=true)
Value sumIf (const Value &range, const Value &checkRange, const Condition &cond)
Value sumsq (const Value &range, bool full=true)
Value tg (const Value &number)
Value tgh (const Value &number)
void twoArrayWalk (QVector< Value > &a1, QVector< Value > &a2, Value &res, arrayWalkFunc func)
void twoArrayWalk (const Value &a1, const Value &a2, Value &res, arrayWalkFunc func)

Protected Attributes

std::map< QString, arrayWalkFuncawFuncs
ValueConverterconverter

Detailed Description

The ValueCalc class is used to perform all sorts of calculations.

Usage of this class for simpler calculations is deprecated, as we now use the Number object directly for that. This class is to be used for computations of more complicated and ranged functions.

Definition at line 69 of file ValueCalc.h.


Constructor & Destructor Documentation

ValueCalc::ValueCalc ( ValueConverter c  )  [explicit]

Definition at line 197 of file ValueCalc.cpp.


Member Function Documentation

Value ValueCalc::abs ( const Value a  ) 

Definition at line 415 of file ValueCalc.cpp.

Value ValueCalc::acos ( const Value number  ) 

Definition at line 906 of file ValueCalc.cpp.

Value ValueCalc::acosh ( const Value number  ) 

Definition at line 982 of file ValueCalc.cpp.

Value KSpread::ValueCalc::add ( Number  a,
const Value b 
) [inline]

Definition at line 126 of file ValueCalc.h.

Value ValueCalc::add ( const Value a,
Number  b 
)

Definition at line 356 of file ValueCalc.cpp.

Value ValueCalc::add ( const Value a,
const Value b 
)

basic arithmetic operations

Definition at line 224 of file ValueCalc.cpp.

bool ValueCalc::approxEqual ( const Value a,
const Value b 
)

numerical comparison with a little epsilon tolerance

Definition at line 448 of file ValueCalc.cpp.

void ValueCalc::arrayWalk ( QVector< Value > &  range,
Value res,
arrayWalkFunc  func,
Value  param 
)

Walk the array in function-like style.

This method is here to avoid duplication in function handlers.

Definition at line 1762 of file ValueCalc.cpp.

void ValueCalc::arrayWalk ( const Value range,
Value res,
arrayWalkFunc  func,
Value  param 
)

array/range walking

Definition at line 1738 of file ValueCalc.cpp.

Value ValueCalc::asin ( const Value number  ) 

Definition at line 893 of file ValueCalc.cpp.

Value ValueCalc::asinh ( const Value number  ) 

Definition at line 969 of file ValueCalc.cpp.

Value ValueCalc::atan2 ( const Value y,
const Value x 
)

Definition at line 932 of file ValueCalc.cpp.

Value ValueCalc::atg ( const Value number  ) 

Definition at line 919 of file ValueCalc.cpp.

Value ValueCalc::atgh ( const Value number  ) 

Definition at line 995 of file ValueCalc.cpp.

Value ValueCalc::avg ( QVector< Value range,
bool  full = true 
)

Definition at line 1946 of file ValueCalc.cpp.

Value ValueCalc::avg ( const Value range,
bool  full = true 
)

Definition at line 1938 of file ValueCalc.cpp.

arrayWalkFunc ValueCalc::awFunc ( const QString name  ) 

Definition at line 1815 of file ValueCalc.cpp.

Value ValueCalc::base ( const Value val,
int  base = 16,
int  prec = 0,
int  minLength = 0 
)

base conversion 10 -> base

Definition at line 815 of file ValueCalc.cpp.

Value ValueCalc::besseli ( Value  v,
Value  x 
)

bessel functions - may also end up being separated from here

Definition at line 1703 of file ValueCalc.cpp.

Value ValueCalc::besselj ( Value  v,
Value  x 
)

Definition at line 1708 of file ValueCalc.cpp.

Value ValueCalc::besselk ( Value  v,
Value  x 
)

Definition at line 1713 of file ValueCalc.cpp.

Value ValueCalc::besseln ( Value  v,
Value  x 
)

Definition at line 1718 of file ValueCalc.cpp.

Value ValueCalc::combin ( Value  n,
Value  k 
)

Definition at line 773 of file ValueCalc.cpp.

Value ValueCalc::combin ( int  n,
int  k 
)

combinations

Definition at line 762 of file ValueCalc.cpp.

ValueConverter* KSpread::ValueCalc::conv (  )  [inline]

Definition at line 73 of file ValueCalc.h.

Value ValueCalc::cos ( const Value number  ) 

Definition at line 863 of file ValueCalc.cpp.

Value ValueCalc::cosh ( const Value number  ) 

Definition at line 949 of file ValueCalc.cpp.

Value ValueCalc::cotg ( const Value number  ) 

Definition at line 883 of file ValueCalc.cpp.

int ValueCalc::count ( QVector< Value range,
bool  full = true 
)

Definition at line 1905 of file ValueCalc.cpp.

int ValueCalc::count ( const Value range,
bool  full = true 
)

Definition at line 1898 of file ValueCalc.cpp.

int ValueCalc::countIf ( const Value range,
const Condition cond 
)

Definition at line 1912 of file ValueCalc.cpp.

Value KSpread::ValueCalc::div ( Number  a,
const Value b 
) [inline]

Definition at line 129 of file ValueCalc.h.

Value ValueCalc::div ( const Value a,
Number  b 
)

Definition at line 389 of file ValueCalc.cpp.

Value ValueCalc::div ( const Value a,
const Value b 
)

Definition at line 271 of file ValueCalc.cpp.

Value ValueCalc::eps (  ) 

Definition at line 696 of file ValueCalc.cpp.

bool KSpread::ValueCalc::equal ( Number  a,
const Value b 
) [inline]

Definition at line 135 of file ValueCalc.h.

bool KSpread::ValueCalc::equal ( const Value a,
Number  b 
) [inline]

Definition at line 132 of file ValueCalc.h.

bool ValueCalc::equal ( const Value a,
const Value b 
)

numerical comparison

Definition at line 437 of file ValueCalc.cpp.

Value ValueCalc::erf ( Value  x  ) 

error functions (see: man erf)

Definition at line 1726 of file ValueCalc.cpp.

Value ValueCalc::erfc ( Value  x  ) 

Definition at line 1731 of file ValueCalc.cpp.

Value ValueCalc::exp ( const Value number  ) 

Definition at line 683 of file ValueCalc.cpp.

Value ValueCalc::fact ( int  which,
int  end = 0 
)

Definition at line 729 of file ValueCalc.cpp.

Value ValueCalc::fact ( const Value which,
const Value end 
)

Definition at line 720 of file ValueCalc.cpp.

Value ValueCalc::fact ( const Value which  ) 

some computational functions

Definition at line 713 of file ValueCalc.cpp.

Value ValueCalc::factDouble ( Value  which  ) 

Definition at line 757 of file ValueCalc.cpp.

Value ValueCalc::factDouble ( int  which  ) 

Number factorial (every other number multiplied).

Definition at line 742 of file ValueCalc.cpp.

Value::Format ValueCalc::format ( Value  a,
Value  b 
)

return formatting for the result, based on formattings of input values

Definition at line 2072 of file ValueCalc.cpp.

Value ValueCalc::fromBase ( const Value val,
int  base = 16 
)

base conversion base -> 10

Definition at line 842 of file ValueCalc.cpp.

Value ValueCalc::gauss ( Value  xx  ) 

Definition at line 1026 of file ValueCalc.cpp.

Value ValueCalc::gaussinv ( Value  xx  ) 

Definition at line 1076 of file ValueCalc.cpp.

Value ValueCalc::gcd ( const Value a,
const Value b 
)

greatest common divisor

Definition at line 780 of file ValueCalc.cpp.

bool ValueCalc::gequal ( const Value a,
const Value b 
)

numerical comparison - greater or equal

Definition at line 465 of file ValueCalc.cpp.

Value ValueCalc::GetBeta ( Value  _x,
Value  _alpha,
Value  _beta 
)

Definition at line 1466 of file ValueCalc.cpp.

void ValueCalc::getCond ( Condition cond,
Value  val 
)

This method parses the condition in string text to the condition cond.

It sets the condition's type and value.

Definition at line 2089 of file ValueCalc.cpp.

Value ValueCalc::GetGamma ( Value  _x  ) 

Definition at line 1253 of file ValueCalc.cpp.

Value ValueCalc::GetGammaDist ( Value  _x,
Value  _alpha,
Value  _beta 
)

Definition at line 1348 of file ValueCalc.cpp.

Value ValueCalc::GetLogGamma ( Value  _x  ) 

Definition at line 1269 of file ValueCalc.cpp.

bool KSpread::ValueCalc::greater ( Number  a,
const Value b 
) [inline]

Definition at line 136 of file ValueCalc.h.

bool KSpread::ValueCalc::greater ( const Value a,
Number  b 
) [inline]

Definition at line 133 of file ValueCalc.h.

bool ValueCalc::greater ( const Value a,
const Value b 
)

numerical comparison

Definition at line 458 of file ValueCalc.cpp.

bool ValueCalc::isEven ( const Value a  ) 

Definition at line 427 of file ValueCalc.cpp.

bool ValueCalc::isZero ( const Value a  ) 

comparison and related

Definition at line 421 of file ValueCalc.cpp.

Value ValueCalc::lcm ( const Value a,
const Value b 
)

lowest common multiplicator

Definition at line 798 of file ValueCalc.cpp.

Value ValueCalc::ln ( const Value number  ) 

Definition at line 657 of file ValueCalc.cpp.

Value ValueCalc::log ( const Value number,
Number  base = 10 
)

Definition at line 667 of file ValueCalc.cpp.

Value ValueCalc::log ( const Value number,
const Value base 
)

logarithms and exponentials

Definition at line 639 of file ValueCalc.cpp.

bool KSpread::ValueCalc::lower ( Number  a,
const Value b 
) [inline]

Definition at line 137 of file ValueCalc.h.

bool KSpread::ValueCalc::lower ( const Value a,
Number  b 
) [inline]

Definition at line 134 of file ValueCalc.h.

bool ValueCalc::lower ( const Value a,
const Value b 
)

numerical comparison

Definition at line 470 of file ValueCalc.cpp.

bool ValueCalc::matches ( const Condition cond,
Value  d 
)

Returns true if value d matches the condition cond, built with getCond().

Otherwise, it returns false.

Definition at line 2155 of file ValueCalc.cpp.

Value ValueCalc::max ( QVector< Value range,
bool  full = true 
)

Definition at line 1961 of file ValueCalc.cpp.

Value ValueCalc::max ( const Value range,
bool  full = true 
)

Definition at line 1954 of file ValueCalc.cpp.

Value ValueCalc::min ( QVector< Value range,
bool  full = true 
)

Definition at line 1975 of file ValueCalc.cpp.

Value ValueCalc::min ( const Value range,
bool  full = true 
)

Definition at line 1968 of file ValueCalc.cpp.

Value ValueCalc::mod ( const Value a,
const Value b 
)

Definition at line 290 of file ValueCalc.cpp.

Value KSpread::ValueCalc::mul ( Number  a,
const Value b 
) [inline]

Definition at line 128 of file ValueCalc.h.

Value ValueCalc::mul ( const Value a,
Number  b 
)

Definition at line 378 of file ValueCalc.cpp.

Value ValueCalc::mul ( const Value a,
const Value b 
)

Definition at line 256 of file ValueCalc.cpp.

bool ValueCalc::naturalEqual ( const Value a,
const Value b,
bool  CS = true 
)

string or numerical comparison

Definition at line 513 of file ValueCalc.cpp.

bool ValueCalc::naturalGequal ( const Value a,
const Value b,
bool  CS = true 
)

string or numerical comparison - greater or equal

Definition at line 539 of file ValueCalc.cpp.

bool ValueCalc::naturalGreater ( const Value a,
const Value b,
bool  CS = true 
)

string or numerical comparison

Definition at line 526 of file ValueCalc.cpp.

bool ValueCalc::naturalLower ( const Value a,
const Value b,
bool  CS = true 
)

string or numerical comparison

Definition at line 544 of file ValueCalc.cpp.

Value ValueCalc::phi ( Value  x  ) 

some statistical stuff TODO: we may want to move these over to a separate class or something, as the functions are mostly big

Definition at line 1008 of file ValueCalc.cpp.

Value ValueCalc::pi (  ) 

constants

Definition at line 688 of file ValueCalc.cpp.

Value KSpread::ValueCalc::pow ( Number  a,
const Value b 
) [inline]

Definition at line 130 of file ValueCalc.h.

Value ValueCalc::pow ( const Value a,
Number  b 
)

Definition at line 404 of file ValueCalc.cpp.

Value ValueCalc::pow ( const Value a,
const Value b 
)

Definition at line 325 of file ValueCalc.cpp.

Value ValueCalc::product ( QVector< Value range,
Value  init,
bool  full = true 
)

Definition at line 1996 of file ValueCalc.cpp.

Value ValueCalc::product ( const Value range,
Value  init,
bool  full = true 
)

Definition at line 1982 of file ValueCalc.cpp.

Value ValueCalc::random ( Value  range  ) 

Definition at line 708 of file ValueCalc.cpp.

Value ValueCalc::random ( Number  range = 1.0  ) 

random number from <0.0, range)

Definition at line 703 of file ValueCalc.cpp.

void ValueCalc::registerAwFunc ( const QString name,
arrayWalkFunc  func 
)

Definition at line 1822 of file ValueCalc.cpp.

Value ValueCalc::round ( const Value a,
int  digits = 0 
)

Definition at line 608 of file ValueCalc.cpp.

Value ValueCalc::round ( const Value a,
const Value digits 
)

Definition at line 559 of file ValueCalc.cpp.

Value ValueCalc::roundDown ( const Value a,
int  digits = 0 
)

Definition at line 564 of file ValueCalc.cpp.

Value ValueCalc::roundDown ( const Value a,
const Value digits 
)

rounding

Definition at line 549 of file ValueCalc.cpp.

Value ValueCalc::roundUp ( const Value a,
int  digits = 0 
)

Definition at line 586 of file ValueCalc.cpp.

Value ValueCalc::roundUp ( const Value a,
const Value digits 
)

Definition at line 554 of file ValueCalc.cpp.

const CalculationSettings * ValueCalc::settings (  )  const

Definition at line 219 of file ValueCalc.cpp.

int ValueCalc::sign ( const Value a  ) 

Definition at line 630 of file ValueCalc.cpp.

Value ValueCalc::sin ( const Value number  ) 

goniometric functions

Definition at line 853 of file ValueCalc.cpp.

Value ValueCalc::sinh ( const Value number  ) 

hyperbolic functions

Definition at line 939 of file ValueCalc.cpp.

Value ValueCalc::sqr ( const Value a  ) 

Definition at line 340 of file ValueCalc.cpp.

Value ValueCalc::sqrt ( const Value a  ) 

Definition at line 346 of file ValueCalc.cpp.

Value ValueCalc::stddev ( QVector< Value range,
Value  avg,
bool  full = true 
)

Definition at line 2029 of file ValueCalc.cpp.

Value ValueCalc::stddev ( QVector< Value range,
bool  full = true 
)

Definition at line 2024 of file ValueCalc.cpp.

Value ValueCalc::stddev ( const Value range,
Value  avg,
bool  full = true 
)

Definition at line 2015 of file ValueCalc.cpp.

Value ValueCalc::stddev ( const Value range,
bool  full = true 
)

Definition at line 2010 of file ValueCalc.cpp.

Value ValueCalc::stddevP ( QVector< Value range,
Value  avg,
bool  full = true 
)

Definition at line 2057 of file ValueCalc.cpp.

Value ValueCalc::stddevP ( QVector< Value range,
bool  full = true 
)

Definition at line 2052 of file ValueCalc.cpp.

Value ValueCalc::stddevP ( const Value range,
Value  avg,
bool  full = true 
)

Definition at line 2043 of file ValueCalc.cpp.

Value ValueCalc::stddevP ( const Value range,
bool  full = true 
)

Definition at line 2038 of file ValueCalc.cpp.

bool ValueCalc::strEqual ( const Value a,
const Value b,
bool  CS = true 
)

string comparison

Definition at line 475 of file ValueCalc.cpp.

bool ValueCalc::strGequal ( const Value a,
const Value b,
bool  CS = true 
)

string comparison - greater or equal

Definition at line 497 of file ValueCalc.cpp.

bool ValueCalc::strGreater ( const Value a,
const Value b,
bool  CS = true 
)

string comparison

Definition at line 486 of file ValueCalc.cpp.

bool ValueCalc::strLower ( const Value a,
const Value b,
bool  CS = true 
)

string comparison

Definition at line 508 of file ValueCalc.cpp.

Value KSpread::ValueCalc::sub ( Number  a,
const Value b 
) [inline]

Definition at line 127 of file ValueCalc.h.

Value ValueCalc::sub ( const Value a,
Number  b 
)

Definition at line 367 of file ValueCalc.cpp.

Value ValueCalc::sub ( const Value a,
const Value b 
)

Definition at line 241 of file ValueCalc.cpp.

Value ValueCalc::sum ( QVector< Value range,
bool  full = true 
)

range functions using value lists

Definition at line 1836 of file ValueCalc.cpp.

Value ValueCalc::sum ( const Value range,
bool  full = true 
)

basic range functions

Definition at line 1829 of file ValueCalc.cpp.

Value ValueCalc::sumIf ( const Value range,
const Value checkRange,
const Condition cond 
)

Definition at line 1851 of file ValueCalc.cpp.

Value ValueCalc::sumsq ( const Value range,
bool  full = true 
)

Definition at line 1844 of file ValueCalc.cpp.

Value ValueCalc::tg ( const Value number  ) 

Definition at line 873 of file ValueCalc.cpp.

Value ValueCalc::tgh ( const Value number  ) 

Definition at line 959 of file ValueCalc.cpp.

void ValueCalc::twoArrayWalk ( QVector< Value > &  a1,
QVector< Value > &  a2,
Value res,
arrayWalkFunc  func 
)

Definition at line 1803 of file ValueCalc.cpp.

void ValueCalc::twoArrayWalk ( const Value a1,
const Value a2,
Value res,
arrayWalkFunc  func 
)

Definition at line 1770 of file ValueCalc.cpp.


Member Data Documentation

registered array-walk functions

Definition at line 293 of file ValueCalc.h.

Definition at line 290 of file ValueCalc.h.


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