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

Numeric.Basics

Contents

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
 Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Epsilon (DFBackend t ds) => Epsilon (DataFrame t ds) Source # Instance detailsDefined in Numeric.DataFrame.Type Methodsepsilon :: DataFrame t ds Source # (Epsilon (DataFrame ts ('[] :: [Nat])), KnownBackends ts ('[] :: [Nat]), Eq (DataFrame ts ('[] :: [XNat]))) => Epsilon (DataFrame ts ('[] :: [XNat])) Source # Instance detailsDefined in Numeric.DataFrame.Type Methodsepsilon :: 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
 Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methodscopysign :: Int -> Int -> Int Source # Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods RealExtras (DFBackend t ds) => RealExtras (DataFrame t ds) Source # Instance detailsDefined in Numeric.DataFrame.Type Methodscopysign :: 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 detailsDefined in Numeric.DataFrame.Type Methodscopysign :: 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
 Source # Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics Methods RealFloatExtras (DFBackend t ds) => RealFloatExtras (DataFrame t ds) Source # Instance detailsDefined in Numeric.DataFrame.Type Methodshypot :: DataFrame t ds -> DataFrame t ds -> DataFrame t ds Source # (RealFloatExtras (DataFrame t ('[] :: [Nat])), KnownBackend t ('[] :: [Nat]), Eq t) => RealFloatExtras (DataFrame t ('[] :: [XNat])) Source # Instance detailsDefined in Numeric.DataFrame.Type Methodshypot :: 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

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.

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.

#### Instances

Instances details
 Source # Note, this instance ignores oodCallStack Instance detailsDefined in Numeric.Basics Methods Source # Note, this instance ignores oodCallStack Instance detailsDefined in Numeric.Basics Methods Source # Instance detailsDefined in Numeric.Basics MethodsshowList :: [TooManyIterations] -> ShowS # Source # Instance detailsDefined in Numeric.Basics Methods

Arguments

 :: IterativeMethod => String Label (e.g. function name) -> a

Throw a TooManyIterations exception.