forsyde-shallow-3.4.0.0: ForSyDe's Haskell-embedded Domain Specific Language.

Copyright(c) ForSyDe Group KTH 2007-2008
LicenseBSD-style (see the file LICENSE)
Maintainerforsyde-dev@ict.kth.se
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

ForSyDe.Shallow.Utility.PolyArith

Contents

Description

This is the polynomial arithematic library. The arithematic operations include addition, multiplication, division and power. However, the computation time is not optimized for multiplication and is O(n2), which could be considered to be optimized by FFT algorithms later on.

Synopsis

Polynomial data type

data Poly a Source #

Polynomial data type.

Constructors

Poly [a] 
PolyPair (Poly a, Poly a) 
Instances
Eq a => Eq (Poly a) Source # 
Instance details

Defined in ForSyDe.Shallow.Utility.PolyArith

Methods

(==) :: Poly a -> Poly a -> Bool #

(/=) :: Poly a -> Poly a -> Bool #

Addition, DmMultiplication, division and power operations

addPoly :: (Num a, Eq a) => Poly a -> Poly a -> Poly a Source #

Addition operations of polynomials.

mulPoly :: Num a => Poly a -> Poly a -> Poly a Source #

Multiplication operation of polynomials.

divPoly :: Num a => Poly a -> Poly a -> Poly a Source #

Division operation of polynomials.

powerPoly :: Num a => Poly a -> Int -> Poly a Source #

Power operation of polynomials.

Some helper functions

getCoef :: Num a => Poly a -> ([a], [a]) Source #

Some helper functions below.

To get the coefficients of the polynomial.

scalePoly :: Num a => a -> Poly a -> Poly a Source #

addPolyCoef :: Num a => [a] -> [a] -> [a] Source #

subPolyCoef :: RealFloat a => [a] -> [a] -> [a] Source #

scalePolyCoef :: Num a => a -> [a] -> [a] Source #