ForSyDe-3.1.1: ForSyDe's Haskell-embedded Domain Specific Language.

Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se

ForSyDe.Shallow.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 Num a => Poly a Source

Polynomial data type.

Constructors

Poly [a] 
PolyPair (Poly a, Poly a) 

Instances

Num a => Eq (Poly a) 

Addition, DmMultiplication, division and power operations

addPoly :: Num a => Poly a -> Poly a -> Poly aSource

Addition operations of polynomials.

mulPoly :: Num a => Poly a -> Poly a -> Poly aSource

Multiplication operation of polynomials.

divPoly :: Num a => Poly a -> Poly a -> Poly aSource

Division operation of polynomials.

powerPoly :: Num a => Poly a -> Int -> Poly aSource

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 aSource

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

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

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