module RemiMath

Extended Modules

Defined in:

remilib/math/arraymath.cr
remilib/math/math.cr

Constant Summary

FOUR_PI = ::Math::PI * 4.0

The value of pi multiplied by 4.

HALF_PI = ::Math::PI / 2.0

The value of pi divided by 2.

QUARTER_PI = ::Math::PI / 4.0

The value of pi divided by 4.

TWO_PI = ::Math::PI * 2.0

The value of pi multiplied by 2.

Instance Method Summary

Instance Method Detail

def fastAtan(x : Float64) : Float64 #

A version of arc tangent that trades accuracy for speed. The intended domain is [-1, 1]. The maximum error in this range is about 0.0015089 radians.


[View source]
def fastCos(val) #

A version of cosine that trades accuracy for speed. The intended domain is [0, pi/2].


[View source]
def fasterCos(val) #

A version of cosine that trades even more accuracy for speed. The intended domain is [0, pi/2].


[View source]
def fasterInvTan(val) #

A version of inverse tangent that trades even more accuracy for speed. The intended domain is [-1, 1]


[View source]
def fasterSin(val) #

A version of sine that trades even more accuracy for speed. The intended domain is [0, pi/2].


[View source]
def fasterTan(val) #

A version of tangent that trades even more accuracy for speed. The intended domain is [0, pi/4].


[View source]
def fastInvCos(val) #

A version of inverse cosine that trades accuracy for speed. The intended domain is [0, 1]


[View source]
def fastInvSin(val) #

A version of inverse sine that trades accuracy for speed. The intended domain is [0, 1]


[View source]
def fastInvTan(val) #

A version of inverse tangent that trades accuracy for speed. The intended domain is [-1, 1]


[View source]
def fastSin(val) #

A version of sine that trades accuracy for speed. The intended domain is [0, pi/2].


[View source]
def fastTan(val) #

A version of tangent that trades accuracy for speed. The intended domain is [0, pi/4].


[View source]
def fastTanh(x : Float64) : Float64 #

A version of inverse hyperbolic tangent that trades accuracy for speed. The intended domain is [-3, 3]. The minimum error in this range is about 0.0, and the maximum error is about 0.024.

Note: This enforces its intended domain. If x is less than -3, then this always returns -1.0. Likewise, if x is greater than 3, this always returns 1.0.


[View source]
def multiplyAdd(a : T, x1 : Array(T), x2 : Array(T), dest1 : Array(T), dest2 : Array(T)) forall T #

Implements a multiply-accumulate operation over two arrays at the same time.


[View source]
def multiplyAdd(a : T, x1 : Slice(T), x2 : Slice(T), dest1 : Slice(T), dest2 : Slice(T)) forall T #

Implements a multiply-accumulate operation over two arrays at the same time.


[View source]
def multiplyAdd(a : T, step : T, x : Array(T), dest : Array(T)) forall T #

Implements a multiply-accumulate operation that applies a step to the accumulator a each iteration.


[View source]
def multiplyAdd(a : T, step : T, x : Slice(T), dest : Slice(T)) forall T #

Implements a multiply-accumulate operation that applies a step to the accumulator a each iteration.


[View source]
def multiplyAdd(a : T, x : Array(T), dest : Array(T)) forall T #

Implements a multiply-accumulate operation.


[View source]
def multiplyAdd(a : T, x : Slice(T), dest : Slice(T)) forall T #

Implements a multiply-accumulate operation.


[View source]
def multiplyAdd!(a : T, x1 : Array(T), x2 : Array(T), dest1 : Array(T), dest2 : Array(T)) forall T #

Implements a multiply-accumulate operation over two arrays at the same time. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]
def multiplyAdd!(a : T, x1 : Slice(T), x2 : Slice(T), dest1 : Slice(T), dest2 : Slice(T)) forall T #

Implements a multiply-accumulate operation over two arrays at the same time. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]
def multiplyAdd!(a : T, step : T, x : Array(T), dest : Array(T)) forall T #

Implements a multiply-accumulate operation that applies a step to the accumulator a each iteration. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]
def multiplyAdd!(a : T, step : T, x : Slice(T), dest : Slice(T)) forall T #

Implements a multiply-accumulate operation that applies a step to the accumulator a each iteration. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]
def multiplyAdd!(a : T, x : Array(T), dest : Array(T)) forall T #

Implements a multiply-accumulate operation. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]
def multiplyAdd!(a : T, x : Slice(T), dest : Slice(T)) forall T #

Implements a multiply-accumulate operation. This is an unsafe version that uses Array#unsafe_fetch and Array#unsafe_put internally for greater performance.


[View source]