uniqueness-periods-vector-filters-0.1.1.0: A library allows to change the structure of the 'RealFrac' function output.

Copyright(c) OleksandrZhabenko 2020
LicenseMIT
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Languages.UniquenessPeriods.Vector.Filters

Contents

Description

Maintainer : olexandr543@yahoo.com

A module allows to change the structure of the function output for the functions of elements from RealFrac class. At the moment only the equal intervals are supported.

Synopsis

One interval used

intervalNRealFrac :: RealFrac b => b -> b -> Int -> b -> Int Source #

Given the minimum and maximum elements, a quantity of equal intervals, and an element in between the first two arguments (or equal to one of them), finds out the index of the interval, to which the element belongs (starting from 1). The minimum element belongs to the interval with the index 1.

unsafeTransfer1I5 :: RealFrac b => b -> b -> b -> b -> b -> b Source #

Moves (if needed) the given value so that its result divides the new [min..max] interval in the same proportion as the starting one. Is intended to be used for the arguments satisfying some additional constraints, but they are not checked (hence, its name prefix "unsafe"). For example, the second argument must be greater than the first one, the fourth -- than the third one, and the fifth must be located in between the first two. Then the result is also located in between the third and fourth arguments similarly.

transfer1IEq3 :: RealFrac b => b -> b -> b -> b Source #

A variant of the unsafeTransfer1I5 where the lengths of the both intervals (the old and the new ones) are equal.

Several intervals

unsafeRearrangeIG :: RealFrac b => b -> b -> Int -> Vector (Int, Int) -> b -> b Source #

Makes a complex interval-based transformation moving the value from its own interval to the corresponding by the Vector of tuples second element of the respective pair with the first element being the starting number of the interval (numeration of them begins at 1). The Vector argument must be sorted by the first argument in the ascending order. Usually, its first elements in the tuples are from the range [1..n]. Number of the intervals are given as the third argument and for many cases should not be greater than 10. There do exist several semantical constraints for the possible accurate arguments, but they are not checked. For example, the first argument must be less than the second one; the fifth argument must be located between the first two ones; the Int argument must be greater than zero.

unsafeRearrangeIGV :: RealFrac b => b -> b -> Int -> Vector Int -> b -> b Source #

An unzipped variant of the unsafeRearrangeIG function where the Vector argument is internally zipped as the second argument with the Vector [1..n]. This allows to shorten the time of the arguments writing given only the resulting backpermutted indexes in the Vector.