quantizer-0.2.1.1: Library to provide the behaviour similar to quantum states superposition.
Copyright(c) OleksandrZhabenko 2022-2023
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

TwoQuantizer

Description

A module to provide the simple version of the obtaining from the list of values the list of other values, the pre-defined ones. Provides both pure functions and monadic versions. Contrary to ListQuantizer module, the results in every function here depend on the two values, which the point is located in between. Defined for just positive real numbers of Double type.

Synopsis

Documentation

round2 Source #

Arguments

:: Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is when the square of the third paremeter is equal to the product of the second one and the fourth one.

-> Double 
-> Double

This one should lie between the other two similar parameters — the one before and the one after it.

-> Double 
-> Maybe Double

The numeric value (in Just case) can be equal just to the one of the two first arguments.

round2L Source #

Arguments

:: Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> [Double] 
-> Double 
-> Double 

twoQuantizer Source #

Arguments

:: Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> [Double] 
-> [Double] 
-> [Double] 

round2G Source #

Arguments

:: Ord a 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> Ordering) 
-> a 
-> a 
-> a 
-> Maybe a

The a value (in Just case) can be equal just to the one of the two first a arguments.

round2GL Source #

Arguments

:: Ord a 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> Ordering) 
-> [a] 
-> a 
-> a 

twoQuantizerG Source #

Arguments

:: (Ord a, Floating a, Integral a) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> Ordering) 
-> [a] 
-> [a] 
-> [a] 

round2GM Source #

Arguments

:: (Ord a, Monad m) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> m Ordering) 
-> a 
-> a 
-> a 
-> m (Maybe a) 

round2GLM Source #

Arguments

:: (Ord a, Monad m) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> m Ordering) 
-> [a] 
-> a 
-> m a 

meanF2 :: (Floating a, Integral a) => [a] -> a -> a -> a Source #

Simple arithmetic mean. Is vulnerable to floating point rounding error so if possible use just for double-precision values.

twoQuantizerGM Source #

Arguments

:: (Ord a, Floating a, Integral a, Monad m) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value. The ambigous situation is defined by the second argument.

-> (a -> a -> a -> m Ordering) 
-> [a] 
-> [a] 
-> m [a]