-- Brute Force Polynomial Multiplication in Serialization

module BruteForce.MultPoly
(
  mult_poly_num
, add_polys
, mult_polys
) where

mult_poly_num :: [Double] -> Double -> [Double]
mult_poly_num [] _ = []
mult_poly_num (p:ps) num = (p * num) : (mult_poly_num ps num)

add_polys :: [Double] -> [Double] -> [Double]
add_polys x [] = x
add_polys [] y = y
add_polys (x:xs) (y:ys) = (x + y) : (add_polys xs ys)

mult_polys :: [Double] -> [Double] -> [Double]
mult_polys _ [] = []
mult_polys x (y:ys) = add_polys (mult_poly_num x y) (0 : mult_polys x ys)
