arithmoi-0.13.1.0: Efficient basic number-theoretic functions.
Copyright(c) 2018 Andrew Lelechenko
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.ArithmeticFunctions.Moebius

Description

Values of Möbius function.

Synopsis

Documentation

data Moebius Source #

Represents three possible values of Möbius function.

Instances

Instances details
Monoid Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Semigroup Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Show Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Eq Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Methods

(==) :: Moebius -> Moebius -> Bool #

(/=) :: Moebius -> Moebius -> Bool #

Ord Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Unbox Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Vector Vector Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Methods

basicUnsafeFreeze :: Mutable Vector s Moebius -> ST s (Vector Moebius)

basicUnsafeThaw :: Vector Moebius -> ST s (Mutable Vector s Moebius)

basicLength :: Vector Moebius -> Int

basicUnsafeSlice :: Int -> Int -> Vector Moebius -> Vector Moebius

basicUnsafeIndexM :: Vector Moebius -> Int -> Box Moebius

basicUnsafeCopy :: Mutable Vector s Moebius -> Vector Moebius -> ST s ()

elemseq :: Vector Moebius -> Moebius -> b -> b

MVector MVector Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

Methods

basicLength :: MVector s Moebius -> Int

basicUnsafeSlice :: Int -> Int -> MVector s Moebius -> MVector s Moebius

basicOverlaps :: MVector s Moebius -> MVector s Moebius -> Bool

basicUnsafeNew :: Int -> ST s (MVector s Moebius)

basicInitialize :: MVector s Moebius -> ST s ()

basicUnsafeReplicate :: Int -> Moebius -> ST s (MVector s Moebius)

basicUnsafeRead :: MVector s Moebius -> Int -> ST s Moebius

basicUnsafeWrite :: MVector s Moebius -> Int -> Moebius -> ST s ()

basicClear :: MVector s Moebius -> ST s ()

basicSet :: MVector s Moebius -> Moebius -> ST s ()

basicUnsafeCopy :: MVector s Moebius -> MVector s Moebius -> ST s ()

basicUnsafeMove :: MVector s Moebius -> MVector s Moebius -> ST s ()

basicUnsafeGrow :: MVector s Moebius -> Int -> ST s (MVector s Moebius)

newtype Vector Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

newtype Vector Moebius = V_Moebius (Vector Int8)
newtype MVector s Moebius Source # 
Instance details

Defined in Math.NumberTheory.ArithmeticFunctions.Moebius

newtype MVector s Moebius = MV_Moebius (MVector s Int8)

runMoebius :: Num a => Moebius -> a Source #

Convert to any numeric type.

sieveBlockMoebius :: Word -> Word -> Vector Moebius Source #

Evaluate the Möbius function over a block. Value of f at 0, if zero falls into block, is undefined.

Based on the sieving algorithm from p. 3 of Computations of the Mertens function and improved bounds on the Mertens conjecture by G. Hurst. It is approximately 5x faster than sieveBlockUnboxed.

>>> sieveBlockMoebius 1 10
[MoebiusP,MoebiusN,MoebiusN,MoebiusZ,MoebiusN,MoebiusP,MoebiusN,MoebiusZ,MoebiusZ,MoebiusP]