cubicbezier-0.4.0.2: Efficient manipulating of 2D cubic bezier curves.

Geom2D.CubicBezier.Numeric

Description

Some numerical computations used by the cubic bezier functions

Synopsis

# Documentation

sign :: (Ord a, Num a1, Num a) => a -> a1 Source

quadraticRoot :: Double -> Double -> Double -> [Double] Source

`quadraticRoot a b c` find the real roots of the quadratic equation `a x^2 + b x + c = 0`. It will return one, two or zero roots.

solveLinear2x2 :: (Eq a, Fractional a) => a -> a -> a -> a -> a -> a -> Maybe (a, a) Source

`solveLinear2x2 a b c d e f` solves the linear equation with two variables (x and y) and two systems:

```a x + b y + c = 0
d x + e y + f = 0```

Returns `Nothing` if no solution is found.

data SparseMatrix a Source

Constructors

 SparseMatrix (Vector Int) (Vector (Int, Int)) (Matrix a)

Arguments

 :: Unbox a => Vector Int The column index of the first element of each row. Should be ascending in order. -> Matrix a The adjacent coefficients in each row -> SparseMatrix a A sparse matrix.

Arguments

 :: (Num a, Unbox a) => SparseMatrix a The input system. -> Matrix a The resulting symmetric matrix as a sparse matrix. The first element of each row is the element on the diagonal.

Given a rectangular matrix M, calculate the symmetric square matrix MᵀM which can be used to find a least squares solution to the overconstrained system.

addMatrix :: (Num a, Unbox a) => Matrix a -> Matrix a -> Matrix a Source

addVec :: (Num a, Unbox a) => Vector a -> Vector a -> Vector a Source

sparseMulT :: (Num a, Unbox a) => Vector a -> SparseMatrix a -> Vector a Source

Multiply the vector by the transpose of the sparse matrix.

sparseMul :: (Num a, Unbox a) => SparseMatrix a -> Vector a -> Vector a Source

Sparse matrix * vector multiplication.

decompLDL :: (Fractional a, Unbox a) => Matrix a -> Matrix a Source

LDL* decomposition of the sparse hermitian matrix. The first element of each row is the diagonal component of the D matrix. The following elements are the elements next to the diagonal in the L* matrix (the diagonal components in L* are 1). For efficiency it mutates the matrix inplace.

Arguments

 :: (Fractional a, Unbox a) => SparseMatrix a sparse matrix -> Vector a Right hand side vector. -> Vector a Solution vector

`lsqSolve rowStart M y` Find a least squares solution x to the system xM = y.

Arguments

 :: (Fractional a, Unbox a) => SparseMatrix (a, a) sparse matrix -> Vector (a, a) Right hand side vector. -> Vector a Solution vector

`lsqSolveDist rowStart M y` Find a least squares solution of the distance between the points.