Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMath Class Reference

Description

Collection of mathematical utility functions.

Inheritance diagram for kMath:
Inheritance graph

Public Member Functions

kStatus kMath_Abs32s (const k32s *vIn, k32s *vOut, kSize count)
 Calculates the absolute value of each element in an input array and stores the result in an output array. More...
 
kStatus kMath_Abs64f (const k64f *vIn, k64f *vOut, kSize count)
 Calculates the absolute value of each element in an input array and stores the result in an output array. More...
 
kStatus kMath_Add32s (const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
 Adds the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_Add64f (const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
 Adds the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_AddC32s (const k32s *vIn, k32s *vOut, kSize count, k32s value)
 Adds a constant to each element in an input array and stores the result in an output array. More...
 
kStatus kMath_AddC64f (const k64f *vIn, k64f *vOut, kSize count, k64f value)
 Adds a constant to each element in an input array and stores the result in an output array. More...
 
kStatus kMath_Average32s (const k32s *v, kSize count, k64f *average)
 Calculates the average value for a numerical array. More...
 
kStatus kMath_Average64f (const k64f *v, kSize count, k64f *average)
 Calculates the average value for a numerical array. More...
 
kStatus kMath_Centroid32s (const k32s *v, kSize count, k64f *centroid)
 Calculates the center of gravity for a numerical array. More...
 
kStatus kMath_Centroid64f (const k64f *v, kSize count, k64f *centroid)
 Calculates the center of gravity for a numerical array. More...
 
kStatus kMath_ClampC32s (const k32s *vIn, k32s *vOut, kSize count, k32s minValue, k32s maxValue)
 Limits each element in an input array using a minimum and maximum value. More...
 
kStatus kMath_ClampC64f (const k64f *vIn, k64f *vOut, kSize count, k64f minValue, k64f maxValue)
 Limits each element in an input array using a minimum and maximum value. More...
 
kStatus kMath_CompareC32s (const k32s *vIn, kBool *vOut, kSize count, kComparison comparison, k32s value)
 Compares each element in an input array with a specified value and stores the results in an output array. More...
 
kStatus kMath_CompareC64f (const k64f *vIn, kBool *vOut, kSize count, kComparison comparison, k64f value)
 Compares each element in an input array with a specified value and stores the results in an output array. More...
 
kStatus kMath_Div32s (const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
 Divides the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_Div64f (const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
 Divides the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_DivC32s (const k32s *vIn, k32s *vOut, kSize count, k32s value)
 Divides each element in an input array by a constant and stores the result in an output array. More...
 
kStatus kMath_DivC64f (const k64f *vIn, k64f *vOut, kSize count, k64f value)
 Divides each element in an input array by a constant and stores the result in an output array. More...
 
kStatus kMath_FindFirst32s (const k32s *v, kSize count, kComparison comparison, k32s value, kSize *index)
 Compares each value in a numerical array with a specified value and returns the index of the first match. More...
 
kStatus kMath_FindFirst64f (const k64f *v, kSize count, kComparison comparison, k64f value, kSize *index)
 Compares each value in a numerical array with a specified value and returns the index of the first match. More...
 
kStatus kMath_FindLast32s (const k32s *v, kSize count, kComparison comparison, k32s value, kSize *index)
 Compares each value in a numerical array with a specified value and returns the index of the last match. More...
 
kStatus kMath_FindLast64f (const k64f *v, kSize count, kComparison comparison, k64f value, kSize *index)
 Compares each value in a numerical array with a specified value and returns the index of the last match. More...
 
kStatus kMath_FindMax32s (const k32s *v, kSize count, kSize *index)
 Finds the index of the maximum value within a numerical array. More...
 
kStatus kMath_FindMax32u (const k32u *v, kSize count, kSize *index)
 Finds the index of the maximum value within a numerical array. More...
 
kStatus kMath_FindMax64f (const k64f *v, kSize count, kSize *index)
 Finds the index of the maximum value within a numerical array. More...
 
kStatus kMath_FindMin32s (const k32s *v, kSize count, kSize *index)
 Finds the index of the minimum value within a numerical array. More...
 
kStatus kMath_FindMin32u (const k32u *v, kSize count, kSize *index)
 Finds the index of the minimum value within a numerical array. More...
 
kStatus kMath_FindMin64f (const k64f *v, kSize count, kSize *index)
 Finds the index of the minimum value within a numerical array. More...
 
kStatus kMath_Gcd32s (k32s a, k32s b, k32s *result)
 Returns the greatest common divisor of two integers. More...
 
kStatus kMath_Lcm32s (k32s a, k32s b, k32s *result)
 Returns the least common multiple of two integers. More...
 
k32u kMath_Log2Ceil32u (k32u a)
 Calculates the base-2 logarithm of the input, rounded up to the nearest integer. More...
 
kStatus kMath_Max32s (const k32s *v, kSize count, k32s *maxValue)
 Reports the maximum value in a numerical array. More...
 
kStatus kMath_Max32u (const k32u *v, kSize count, k32u *maxValue)
 Reports the maximum value in a numerical array. More...
 
kStatus kMath_Max64f (const k64f *v, kSize count, k64f *maxValue)
 Reports the maximum value in a numerical array. More...
 
kStatus kMath_Min32s (const k32s *v, kSize count, k32s *minValue)
 Reports the minimum value in a numerical array. More...
 
kStatus kMath_Min32u (const k32u *v, kSize count, k32u *minValue)
 Reports the minimum value in a numerical array. More...
 
kStatus kMath_Min64f (const k64f *v, kSize count, k64f *minValue)
 Reports the minimum value in a numerical array. More...
 
kStatus kMath_MovingAvg32s (const k32s *vIn, k32s *vOut, kSize count, kSize window)
 Calculates the moving average over an input array and stores the result in an output array. More...
 
kStatus kMath_MovingAvg64f (const k64f *vIn, k64f *vOut, kSize count, kSize window)
 Calculates the moving average over an input array and stores the result in an output array. More...
 
kStatus kMath_Mul32s (const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
 Multiplies the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_Mul64f (const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
 Multiplies the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_MulC32s (const k32s *vIn, k32s *vOut, kSize count, k32s value)
 Multiplies each element in an input array by a constant and stores the result in an output array. More...
 
kStatus kMath_MulC64f (const k64f *vIn, k64f *vOut, kSize count, k64f value)
 Multiplies each element in an input array by a constant and stores the result in an output array. More...
 
kBool kMath_NearlyEquals32f (k32f a, k32f b)
 Reports whether two single-precision values are approximately equal. More...
 
kBool kMath_NearlyEquals64f (k64f a, k64f b)
 Reports whether two double-precision values are approximately equal. More...
 
kStatus kMath_ReplaceC32s (const k32s *vIn, k32s *vOut, kSize count, kComparison comparison, k32s value, k32s replacement)
 Compares each element in an input array with a specified value, and replaces all matching values with another given value. More...
 
kStatus kMath_ReplaceC64f (const k64f *vIn, k64f *vOut, kSize count, kComparison comparison, k64f value, k64f replacement)
 Compares each element in an input array with a specified value, and replaces all matching values with another given value. More...
 
k64f kMath_Round64f (k64f a)
 Rounds the input up to the nearest integer. More...
 
kStatus kMath_Set32s (k32s *v, kSize count, k32s value)
 Sets all values in a numerical array to the given value. More...
 
kStatus kMath_Set64f (k64f *v, kSize count, k64f value)
 Sets all values in a numerical array to the given value. More...
 
k32s kMath_Sign (k32s a)
 Returns the sign. More...
 
kStatus kMath_Span32s (k32s *v, kSize count, k32s startValue, k32s endValue)
 Sets values in a numerical array to step between the specified start and end values. More...
 
kStatus kMath_Span64f (k64f *v, kSize count, k64f startValue, k64f endValue)
 Sets values in a numerical array to step between the specified start and end values. More...
 
kStatus kMath_Stdev32s (const k32s *v, kSize count, k64f *stdev)
 Calculates the standard deviation for a numerical array. More...
 
kStatus kMath_Stdev64f (const k64f *v, kSize count, k64f *stdev)
 Calculates the standard deviation for a numerical array. More...
 
kStatus kMath_Step32s (k32s *v, kSize count, k32s startValue, k32s increment)
 Sets values in a numerical array to increment from the specified starting value. More...
 
kStatus kMath_Step64f (k64f *v, kSize count, k64f startValue, k64f increment)
 Sets values in a numerical array to increment from the specified starting value. More...
 
kStatus kMath_Sub32s (const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
 Subtracts the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_Sub64f (const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
 Subtracts the values in two input arrays and stores the result in an output array. More...
 
kStatus kMath_SubC32s (const k32s *vIn, k32s *vOut, kSize count, k32s value)
 Subtracts a constant from each element in an input array and stores the result in an output array. More...
 
kStatus kMath_SubC64f (const k64f *vIn, k64f *vOut, kSize count, k64f value)
 Subtracts a constant from each element in an input array and stores the result in an output array. More...
 
kStatus kMath_Sum32s (const k32s *v, kSize count, k64s *sum)
 Calculates the sum of a numerical array. More...
 
kStatus kMath_Sum64f (const k64f *v, kSize count, k64f *sum)
 Calculates the sum of a numerical array. More...
 
- Public Member Functions inherited from kObject
kAlloc kObject_Alloc (kObject object)
 Gets the memory allocator associated with this object. More...
 
kStatus kObject_Clone (kObject *object, kObject source, kAlloc allocator)
 Constructs a new object by copying an existing object, including any aggregated child elements. More...
 
kStatus kObject_Destroy (kObject object)
 Destroys the object. More...
 
kStatus kObject_Dispose (kObject object)
 Destroys the object and any aggregated child elements. More...
 
kBool kObject_Equals (kObject object, kObject other)
 Determines whether the object is equal to another object. More...
 
kBool kObject_HasForeignData (kObject object)
 Reports whether the object, including aggregated child elements, contains any foreign memory references. More...
 
kSize kObject_HashCode (kObject object)
 Gets a hash code representing the state of this object. More...
 
kBool kObject_Is (kObject object, kType type)
 Determines whether this object is an instance of the specified type. More...
 
kBool kObject_IsShared (kObject object)
 Reports whether the object is currently shared (reference count greater than one). More...
 
kStatus kObject_SetPool (kObject object, kObjectPool pool)
 Sets the object pool associated with this object. More...
 
kStatus kObject_Share (kObject object)
 Increments the reference count associated with this object. More...
 
kSize kObject_Size (kObject object)
 Estimates the memory consumed by this object, including any aggregated child elements. More...
 
kType kObject_Type (kObject object)
 Returns the type of the object. More...
 

Related

#define kMATH_PI
 Mathematical constant pi.
 
#define kMATH_E
 Mathematical constant e.
 
#define kMATH_SQRT2
 Square root of 2.
 
#define kMATH_SQRT3
 Square root of 3.
 
#define kMath_RadToDeg_(RAD)
 Converts radians to degrees.
 
#define kMath_DegToRad_(DEG)
 Converts degrees to radians.
 
#define kMath_Abs_(A)
 Returns the absolute value of a number.
 
#define kMath_Min_(A, B)
 Returns the minimum of two numbers.
 
#define kMath_Max_(A, B)
 Returns the maximum of two numbers.
 
#define kMath_Sign_(A)
 Returns the sign of a number (-1, 0, +1).
 
#define kMath_Common_Residue_(A, B)
 Returns the common residue of A and B.
 
#define kMath_Clamp_(V, VMIN, VMAX)
 Returns a value limited to the given range.
 
#define kMath_Round8s_(A)
 Rounds a floating-point value and casts to an 8-bit signed integer.
 
#define kMath_Round8u_(A)
 Rounds a floating-point value and casts to an 8-bit unsigned integer.
 
#define kMath_Round16s_(A)
 Rounds a floating-point value and casts to an 16-bit signed integer.
 
#define kMath_Round16u_(A)
 Rounds a floating-point value and casts to an 16-bit unsigned integer.
 
#define kMath_Round32s_(A)
 Rounds a floating-point value and casts to an 32-bit signed integer.
 
#define kMath_Round32u_(A)
 Rounds a floating-point value and casts to an 32-bit unsigned integer.
 
#define kMath_Round64s_(A)
 Rounds a floating-point value and casts to an 64-bit signed integer.
 
#define kMath_Round64u_(A)
 Rounds a floating-point value and casts to an 64-bit unsigned integer.
 

Additional Inherited Members

- Protected Member Functions inherited from kObject
kStatus kObject_FreeMem (kObject object, void *mem)
 Protected method called by derived classes to free memory using the object's allocator. More...
 
kStatus kObject_FreeMemRef (kObject object, void *mem)
 Protected method called by derived classes to free memory (and reset the provided memory pointer to kNULL) using the object's allocator. More...
 
kStatus kObject_GetMem (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate memory using the object's allocator. More...
 
kStatus kObject_GetMemZero (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate and zero memory using the object's allocator. More...
 
kStatus kObject_Init (kObject object, kType type, kAlloc alloc)
 Protected method called by derived classes to initialize the kObject base class. More...
 
kStatus kObject_VDisposeItems (kObject object)
 Protected virtual method that destroys any aggregated child objects associated with a collection. More...
 
kBool kObject_VEquals (kObject object, kObject other)
 Protected virtual method that compares two objects for equality. More...
 
kBool kObject_VHasForeignData (kObject object)
 Protected virtual method that reports whether the object, including aggregated child elements, contains any foreign memory references. More...
 
kSize kObject_VHashCode (kObject object)
 Protected virtual method that calculates a hash code representing the object instance. More...
 
kStatus kObject_VInitClone (kObject object, kObject source, kAlloc allocator)
 Protected virtual method that clones (makes a deep copy of) the specified source object. More...
 
kStatus kObject_VRelease (kObject object)
 Protected virtual method that deallocates any resources owned by the object. More...
 
kSize kObject_VSize (kObject object)
 Protected virtual method that calculates the total size (in bytes) of the object instance. More...
 

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