easytensor-2.1.1.0: Pure, type-indexed haskell vector, matrix, and tensor library.
Safe HaskellNone
LanguageHaskell2010

Numeric.Basics

Synopsis

Constants

pattern M_E :: (Eq a, Fractional a) => Fractional a => a Source #

\( e \)

pattern M_LOG2E :: (Eq a, Fractional a) => Fractional a => a Source #

\( \log_2 e \)

pattern M_LOG10E :: (Eq a, Fractional a) => Fractional a => a Source #

\( \log_{10} e \)

pattern M_LN2 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \log_e 2 \)

pattern M_LN10 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \log_e 10 \)

pattern M_SQRT2 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \sqrt{2} \)

pattern M_SQRT1_2 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{1}{\sqrt{2}} \)

pattern M_PI :: (Eq a, Fractional a) => Fractional a => a Source #

\( \pi \)

pattern M_PI_2 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{\pi}{2} \)

pattern M_PI_3 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{\pi}{3} \)

pattern M_PI_4 :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{\pi}{4} \)

pattern M_1_PI :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{1}{\pi} \)

pattern M_2_PI :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{2}{\pi} \)

pattern M_2_SQRTPI :: (Eq a, Fractional a) => Fractional a => a Source #

\( \frac{2}{\sqrt{\pi}} \)

class (Eq a, Floating a) => Epsilon a where Source #

Define a meaningful precision for complex floating-point operations.

Methods

epsilon :: a Source #

A small positive number that depends on the type of a. Compare your values to epsilon to tell if they are near zero.

Instances

Instances details
Epsilon Double Source # 
Instance details

Defined in Numeric.Basics

Epsilon Float Source # 
Instance details

Defined in Numeric.Basics

Methods

epsilon :: Float Source #

Epsilon (DFBackend t ds) => Epsilon (DataFrame t ds) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

epsilon :: DataFrame t ds Source #

(Epsilon (DataFrame ts ('[] :: [Nat])), KnownBackends ts ('[] :: [Nat]), Eq (DataFrame ts ('[] :: [XNat]))) => Epsilon (DataFrame ts ('[] :: [XNat])) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

epsilon :: DataFrame ts '[] Source #

pattern M_EPS :: Epsilon a => a Source #

A small positive number that depends on the type of a.

Functions

class (Real a, PrimBytes a) => RealExtras a where Source #

Extra functions for Real types.

Minimal complete definition

Nothing

Methods

copysign :: a -> a -> a Source #

copysign x y returns a value with the magnitude of x and the sign of y.

NB: in future, this function is to reimplemented using primops and should behave the same way as its C analogue.

Instances

Instances details
RealExtras Double Source # 
Instance details

Defined in Numeric.Basics

RealExtras Float Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Float -> Float -> Float Source #

RealExtras Int Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Int -> Int -> Int Source #

RealExtras Int8 Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Int8 -> Int8 -> Int8 Source #

RealExtras Int16 Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Int16 -> Int16 -> Int16 Source #

RealExtras Int32 Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Int32 -> Int32 -> Int32 Source #

RealExtras Int64 Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Int64 -> Int64 -> Int64 Source #

RealExtras Word Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Word -> Word -> Word Source #

RealExtras Word8 Source # 
Instance details

Defined in Numeric.Basics

Methods

copysign :: Word8 -> Word8 -> Word8 Source #

RealExtras Word16 Source # 
Instance details

Defined in Numeric.Basics

RealExtras Word32 Source # 
Instance details

Defined in Numeric.Basics

RealExtras Word64 Source # 
Instance details

Defined in Numeric.Basics

RealExtras (DFBackend t ds) => RealExtras (DataFrame t ds) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

copysign :: DataFrame t ds -> DataFrame t ds -> DataFrame t ds Source #

(RealExtras (DataFrame t ('[] :: [Nat])), KnownBackend t ('[] :: [Nat]), Eq t) => RealExtras (DataFrame t ('[] :: [XNat])) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

copysign :: DataFrame t '[] -> DataFrame t '[] -> DataFrame t '[] Source #

class (Epsilon a, RealExtras a, RealFloat a) => RealFloatExtras a where Source #

Extra functions for RealFrac types.

Minimal complete definition

maxFinite

Methods

hypot :: a -> a -> a Source #

\( \sqrt{ x^2 + y^2 } \).

NB: in future, this function is to reimplemented using primops and should behave the same way as its C analogue.

maxFinite :: a Source #

Maximum finite number representable by this FP type.

Instances

Instances details
RealFloatExtras Double Source # 
Instance details

Defined in Numeric.Basics

RealFloatExtras Float Source # 
Instance details

Defined in Numeric.Basics

RealFloatExtras (DFBackend t ds) => RealFloatExtras (DataFrame t ds) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

hypot :: DataFrame t ds -> DataFrame t ds -> DataFrame t ds Source #

maxFinite :: DataFrame t ds Source #

(RealFloatExtras (DataFrame t ('[] :: [Nat])), KnownBackend t ('[] :: [Nat]), Eq t) => RealFloatExtras (DataFrame t ('[] :: [XNat])) Source # 
Instance details

Defined in Numeric.DataFrame.Type

Methods

hypot :: DataFrame t '[] -> DataFrame t '[] -> DataFrame t '[] Source #

maxFinite :: DataFrame t '[] Source #

negateUnless :: Num t => Bool -> t -> t Source #

Negate if False. This is a useful alternative to signum, when signum 0 == 0 causing some troubles.

Exceptions

type IterativeMethod = HasCallStack Source #

This is just an alias for the HasCallStack constraint. It servers two goals:

  1. Document functions that use iterative methods and can fail (supposedly in extremely rare cases).
  2. Provide a call stack in case of failure.

Use tooManyIterations function where necessary if you implement an iterative algorithm and annotate your implementation function with IterativeMethod constraint.

data TooManyIterations Source #

Typically, this exception can occur in an iterative algorithm; when the number of iterations exceeds a pre-defined limit, but the stop condition is not fulfilled.

Use the IterativeMethod constraint to annotate functions that throw this exception.

tooManyIterations Source #

Arguments

:: IterativeMethod 
=> String

Label (e.g. function name)

-> a 

Throw a TooManyIterations exception.