-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Eigen C++ library (linear algebra: matrices, sparse matrices, vectors, numerical solvers).
--
-- This module provides Haskell binding for Eigen C++ library.
--
-- Eigen is versatile.
--
--
-- - It supports all matrix sizes, from small fixed-size matrices to
-- arbitrarily large dense matrices, and even sparse matrices.
-- - It supports all standard numeric types, including std::complex,
-- integers, and is easily extensible to custom numeric types.
-- - It supports various matrix decompositions and geometry
-- features.
-- - Its ecosystem of unsupported modules provides many
-- specialized features such as non-linear optimization, matrix
-- functions, a polynomial solver, FFT, and much more.
--
--
-- Eigen is fast.
--
--
-- - Expression templates allow to intelligently remove temporaries and
-- enable lazy evaluation, when that is appropriate.
-- - Explicit vectorization is performed for SSE 2/3/4, ARM
-- NEON, and AltiVec instruction sets, with graceful fallback to
-- non-vectorized code.
-- - Fixed-size matrices are fully optimized: dynamic memory allocation
-- is avoided, and the loops are unrolled when that makes sense.
-- - For large matrices, special attention is paid to
-- cache-friendliness.
--
--
-- Eigen is reliable.
--
--
-- - Algorithms are carefully selected for reliability. Reliability
-- trade-offs are clearly documented and extremely
-- safe decompositions are available.
-- - Eigen is thoroughly tested through its own test suite (over
-- 500 executables), the standard BLAS test suite, and parts of the
-- LAPACK test suite.
--
--
-- Eigen is elegant.
--
--
-- - The API is extremely clean and expressive while feeling
-- natural to C++ programmers, thanks to expression templates.
-- - Implementing an algorithm on top of Eigen feels like just copying
-- pseudocode.
--
--
-- Eigen has good compiler support as we run our test suite against many
-- compilers to guarantee reliability and work around any compiler bugs.
-- Eigen also is standard C++98 and maintains very reasonable compilation
-- times.
--
-- Eigen is licensed under the MPL2, which is a simple weak copyleft
-- license. Common questions about the MPL2 are answered in the official
-- MPL2 FAQ at http://www.mozilla.org/MPL/2.0/FAQ.html.
--
-- Note that currently, a few features in Eigen rely on third-party code
-- licensed under the LGPL: SimplicialCholesky, AMD ordering, and
-- constrained_cg. Such features are explicitly disabled by compiling
-- Eigen with the EIGEN_MPL2_ONLY preprocessor symbol defined.
--
-- Virtually any software may use Eigen. For example, closed-source
-- software may use Eigen without having to disclose its own source code.
-- Many proprietary and closed-source software projects are using Eigen
-- right now, as well as many BSD-licensed projects.
--
-- Documentation at the most extent replicates original Eigen
-- documentation.
@package eigen
@version 3.3.4.1
-- | This internal module is going to see a lot of refactoring. It is not
-- recommended to import this, as the API is likely to experience heavy
-- change.
module Data.Eigen.Internal
class (Num a, Cast a b, Cast b a, Storable b, Code b) => Elem a b | a -> b
class Cast a b
cast :: Cast a b => a -> b
-- | Complex number for FFI with the same memory layout as
-- std::complex<T>
data CComplex a
CComplex :: !a -> !a -> CComplex a
data CTriplet a
CTriplet :: !CInt -> !CInt -> !a -> CTriplet a
intSize :: Int
encodeInt :: CInt -> ByteString
decodeInt :: ByteString -> CInt
data CSparseMatrix a b
type CSparseMatrixPtr a b = Ptr (CSparseMatrix a b)
data CSolver a b
type CSolverPtr a b = Ptr (CSolver a b)
performIO :: IO a -> a
plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b
c_freeString :: CString -> IO ()
call :: IO CString -> IO ()
free :: Ptr a -> IO ()
c_setNbThreads :: CInt -> IO ()
c_getNbThreads :: IO CInt
class Code a
code :: Code a => a -> CInt
newtype MagicCode
MagicCode :: CInt -> MagicCode
magicCode :: Code a => a -> MagicCode
c_random :: CInt -> Ptr b -> CInt -> CInt -> IO CString
random :: forall b. Code b => Ptr b -> CInt -> CInt -> IO CString
c_identity :: CInt -> Ptr b -> CInt -> CInt -> IO CString
identity :: forall b. Code b => Ptr b -> CInt -> CInt -> IO CString
c_add :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
add :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_sub :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
sub :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_mul :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
mul :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_diagonal :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
diagonal :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_transpose :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
transpose :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_inverse :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
inverse :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_adjoint :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
adjoint :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_conjugate :: CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
conjugate :: forall b. Code b => Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_normalize :: CInt -> Ptr b -> CInt -> CInt -> IO CString
normalize :: forall b. Code b => Ptr b -> CInt -> CInt -> IO CString
c_sum :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
sum :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_prod :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
prod :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_mean :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
mean :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_norm :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
norm :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_trace :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
trace :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_squaredNorm :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
squaredNorm :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_blueNorm :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
blueNorm :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_hypotNorm :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
hypotNorm :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_determinant :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> IO CString
determinant :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> IO CString
c_rank :: CInt -> CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
rank :: forall b. Code b => CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
c_image :: CInt -> CInt -> Ptr (Ptr b) -> Ptr CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
image :: forall b. Code b => CInt -> Ptr (Ptr b) -> Ptr CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
c_kernel :: CInt -> CInt -> Ptr (Ptr b) -> Ptr CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
kernel :: forall b. Code b => CInt -> Ptr (Ptr b) -> Ptr CInt -> Ptr CInt -> Ptr b -> CInt -> CInt -> IO CString
c_solve :: CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
solve :: forall b. Code b => CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_relativeError :: CInt -> Ptr b -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
relativeError :: forall b. Code b => Ptr b -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> Ptr b -> CInt -> CInt -> IO CString
c_sparse_new :: CInt -> CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_new :: forall a b. Code b => CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_clone :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_clone :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_fromList :: CInt -> CInt -> CInt -> Ptr (CTriplet b) -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_fromList :: forall a b. Code b => CInt -> CInt -> Ptr (CTriplet b) -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_toList :: CInt -> CSparseMatrixPtr a b -> Ptr (CTriplet b) -> CInt -> IO CString
c_sparse_free :: CInt -> CSparseMatrixPtr a b -> IO CString
sparse_toList :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CTriplet b) -> CInt -> IO CString
sparse_free :: forall a b. Code b => CSparseMatrixPtr a b -> IO CString
c_sparse_makeCompressed :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_makeCompressed :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_uncompress :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_uncompress :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_isCompressed :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_isCompressed :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_transpose :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_transpose :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_adjoint :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_adjoint :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_pruned :: CInt -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_pruned :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_prunedRef :: CInt -> CSparseMatrixPtr a b -> Ptr b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_prunedRef :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_scale :: CInt -> CSparseMatrixPtr a b -> Ptr b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_scale :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_nonZeros :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_nonZeros :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_innerSize :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_innerSize :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_outerSize :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_outerSize :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_coeff :: CInt -> CSparseMatrixPtr a b -> CInt -> CInt -> Ptr b -> IO CString
sparse_coeff :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> CInt -> Ptr b -> IO CString
c_sparse_coeffRef :: CInt -> CSparseMatrixPtr a b -> CInt -> CInt -> Ptr (Ptr b) -> IO CString
sparse_coeffRef :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> CInt -> Ptr (Ptr b) -> IO CString
c_sparse_cols :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_cols :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_rows :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> IO CString
sparse_rows :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> IO CString
c_sparse_norm :: CInt -> CSparseMatrixPtr a b -> Ptr b -> IO CString
sparse_norm :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> IO CString
c_sparse_squaredNorm :: CInt -> CSparseMatrixPtr a b -> Ptr b -> IO CString
sparse_squaredNorm :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> IO CString
c_sparse_blueNorm :: CInt -> CSparseMatrixPtr a b -> Ptr b -> IO CString
sparse_blueNorm :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> IO CString
c_sparse_add :: CInt -> CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_add :: forall a b. Code b => CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_sub :: CInt -> CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_sub :: forall a b. Code b => CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_mul :: CInt -> CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_mul :: forall a b. Code b => CSparseMatrixPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_block :: CInt -> CSparseMatrixPtr a b -> CInt -> CInt -> CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_block :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> CInt -> CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_fromMatrix :: CInt -> Ptr b -> CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_fromMatrix :: forall a b. Code b => Ptr b -> CInt -> CInt -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_toMatrix :: CInt -> CSparseMatrixPtr a b -> Ptr b -> CInt -> CInt -> IO CString
sparse_toMatrix :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr b -> CInt -> CInt -> IO CString
c_sparse_values :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr b) -> IO CString
sparse_values :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr b) -> IO CString
c_sparse_outerStarts :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
sparse_outerStarts :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
c_sparse_innerIndices :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
sparse_innerIndices :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
c_sparse_innerNNZs :: CInt -> CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
c_sparse_setZero :: CInt -> CSparseMatrixPtr a b -> IO CString
sparse_innerNNZs :: forall a b. Code b => CSparseMatrixPtr a b -> Ptr CInt -> Ptr (Ptr CInt) -> IO CString
sparse_setZero :: forall a b. Code b => CSparseMatrixPtr a b -> IO CString
c_sparse_setIdentity :: CInt -> CSparseMatrixPtr a b -> IO CString
sparse_setIdentity :: forall a b. Code b => CSparseMatrixPtr a b -> IO CString
c_sparse_reserve :: CInt -> CSparseMatrixPtr a b -> CInt -> IO CString
sparse_reserve :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> IO CString
c_sparse_resize :: CInt -> CSparseMatrixPtr a b -> CInt -> CInt -> IO CString
sparse_resize :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> CInt -> IO CString
c_sparse_conservativeResize :: CInt -> CSparseMatrixPtr a b -> CInt -> CInt -> IO CString
sparse_conservativeResize :: forall a b. Code b => CSparseMatrixPtr a b -> CInt -> CInt -> IO CString
c_sparse_compressInplace :: CInt -> CSparseMatrixPtr a b -> IO CString
sparse_compressInplace :: forall a b. Code b => CSparseMatrixPtr a b -> IO CString
c_sparse_uncompressInplace :: CInt -> CSparseMatrixPtr a b -> IO CString
sparse_uncompressInplace :: forall a b. Code b => CSparseMatrixPtr a b -> IO CString
c_sparse_la_newSolver :: CInt -> CInt -> Ptr (CSolverPtr a b) -> IO CString
sparse_la_newSolver :: forall s a b. (Code s, Code b) => s -> Ptr (CSolverPtr a b) -> IO CString
c_sparse_la_freeSolver :: CInt -> CInt -> CSolverPtr a b -> IO CString
sparse_la_freeSolver :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> IO CString
c_sparse_la_factorize :: CInt -> CInt -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
sparse_la_factorize :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
c_sparse_la_analyzePattern :: CInt -> CInt -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
sparse_la_analyzePattern :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
c_sparse_la_compute :: CInt -> CInt -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
sparse_la_compute :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CSparseMatrixPtr a b -> IO CString
c_sparse_la_tolerance :: CInt -> CInt -> CSolverPtr a b -> Ptr CDouble -> IO CString
sparse_la_tolerance :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CDouble -> IO CString
c_sparse_la_setTolerance :: CInt -> CInt -> CSolverPtr a b -> CDouble -> IO CString
sparse_la_setTolerance :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CDouble -> IO CString
c_sparse_la_maxIterations :: CInt -> CInt -> CSolverPtr a b -> Ptr CInt -> IO CString
sparse_la_maxIterations :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CInt -> IO CString
c_sparse_la_setMaxIterations :: CInt -> CInt -> CSolverPtr a b -> CInt -> IO CString
sparse_la_setMaxIterations :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CInt -> IO CString
c_sparse_la_info :: CInt -> CInt -> CSolverPtr a b -> Ptr CInt -> IO CString
sparse_la_info :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CInt -> IO CString
c_sparse_la_error :: CInt -> CInt -> CSolverPtr a b -> Ptr CDouble -> IO CString
sparse_la_error :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CDouble -> IO CString
c_sparse_la_iterations :: CInt -> CInt -> CSolverPtr a b -> Ptr CInt -> IO CString
sparse_la_iterations :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CInt -> IO CString
c_sparse_la_solve :: CInt -> CInt -> CSolverPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_la_solve :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CSparseMatrixPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_la_matrixQ :: CInt -> CInt -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_la_matrixQ :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_la_matrixR :: CInt -> CInt -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_la_matrixR :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_la_setPivotThreshold :: CInt -> CInt -> CSolverPtr a b -> CDouble -> IO CString
sparse_la_setPivotThreshold :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CDouble -> IO CString
c_sparse_la_rank :: CInt -> CInt -> CSolverPtr a b -> Ptr CInt -> IO CString
sparse_la_rank :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr CInt -> IO CString
c_sparse_la_matrixL :: CInt -> CInt -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_la_matrixL :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_la_matrixU :: CInt -> CInt -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
sparse_la_matrixU :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr (CSparseMatrixPtr a b) -> IO CString
c_sparse_la_setSymmetric :: CInt -> CInt -> CSolverPtr a b -> CInt -> IO CString
sparse_la_setSymmetric :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> CInt -> IO CString
c_sparse_la_determinant :: CInt -> CInt -> CSolverPtr a b -> Ptr b -> IO CString
sparse_la_determinant :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr b -> IO CString
c_sparse_la_logAbsDeterminant :: CInt -> CInt -> CSolverPtr a b -> Ptr b -> IO CString
sparse_la_logAbsDeterminant :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr b -> IO CString
c_sparse_la_absDeterminant :: CInt -> CInt -> CSolverPtr a b -> Ptr b -> IO CString
sparse_la_absDeterminant :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr b -> IO CString
c_sparse_la_signDeterminant :: CInt -> CInt -> CSolverPtr a b -> Ptr b -> IO CString
sparse_la_signDeterminant :: forall s a b. (Code s, Code b) => s -> CSolverPtr a b -> Ptr b -> IO CString
instance GHC.Classes.Eq Data.Eigen.Internal.MagicCode
instance GHC.Show.Show a => GHC.Show.Show (Data.Eigen.Internal.CTriplet a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Eigen.Internal.CComplex a)
instance Data.Binary.Class.Binary Data.Eigen.Internal.MagicCode
instance Data.Eigen.Internal.Elem GHC.Types.Float Foreign.C.Types.CFloat
instance Data.Eigen.Internal.Elem GHC.Types.Double Foreign.C.Types.CDouble
instance Data.Eigen.Internal.Elem (Data.Complex.Complex GHC.Types.Float) (Data.Eigen.Internal.CComplex Foreign.C.Types.CFloat)
instance Data.Eigen.Internal.Elem (Data.Complex.Complex GHC.Types.Double) (Data.Eigen.Internal.CComplex Foreign.C.Types.CDouble)
instance Data.Eigen.Internal.Code Foreign.C.Types.CFloat
instance Data.Eigen.Internal.Code Foreign.C.Types.CDouble
instance Data.Eigen.Internal.Code (Data.Eigen.Internal.CComplex Foreign.C.Types.CFloat)
instance Data.Eigen.Internal.Code (Data.Eigen.Internal.CComplex Foreign.C.Types.CDouble)
instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Data.Eigen.Internal.CTriplet a)
instance Data.Eigen.Internal.Cast a b => Data.Eigen.Internal.Cast (Data.Eigen.Internal.CTriplet a) (GHC.Types.Int, GHC.Types.Int, b)
instance Data.Eigen.Internal.Cast a b => Data.Eigen.Internal.Cast (GHC.Types.Int, GHC.Types.Int, a) (Data.Eigen.Internal.CTriplet b)
instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Data.Eigen.Internal.CComplex a)
instance Data.Eigen.Internal.Cast (Data.Eigen.Internal.CComplex Foreign.C.Types.CFloat) (Data.Complex.Complex GHC.Types.Float)
instance Data.Eigen.Internal.Cast (Data.Complex.Complex GHC.Types.Float) (Data.Eigen.Internal.CComplex Foreign.C.Types.CFloat)
instance Data.Eigen.Internal.Cast (Data.Eigen.Internal.CComplex Foreign.C.Types.CDouble) (Data.Complex.Complex GHC.Types.Double)
instance Data.Eigen.Internal.Cast (Data.Complex.Complex GHC.Types.Double) (Data.Eigen.Internal.CComplex Foreign.C.Types.CDouble)
instance Data.Eigen.Internal.Cast Foreign.C.Types.CInt GHC.Types.Int
instance Data.Eigen.Internal.Cast GHC.Types.Int Foreign.C.Types.CInt
instance Data.Eigen.Internal.Cast Foreign.C.Types.CFloat GHC.Types.Float
instance Data.Eigen.Internal.Cast GHC.Types.Float Foreign.C.Types.CFloat
instance Data.Eigen.Internal.Cast Foreign.C.Types.CDouble GHC.Types.Double
instance Data.Eigen.Internal.Cast GHC.Types.Double Foreign.C.Types.CDouble
instance Foreign.Storable.Storable a => Data.Binary.Class.Binary (Data.Vector.Storable.Vector a)
module Data.Eigen.Matrix.Mutable
-- | Mutable matrix. You can modify elements
data MMatrix a b s
MMatrix :: Int -> Int -> MVector s b -> MMatrix a b s
[mm_rows] :: MMatrix a b s -> Int
[mm_cols] :: MMatrix a b s -> Int
[mm_vals] :: MMatrix a b s -> MVector s b
-- | Alias for single precision mutable matrix
type MMatrixXf = MMatrix Float CFloat
-- | Alias for double precision mutable matrix
type MMatrixXd = MMatrix Double CDouble
-- | Alias for single previsiom mutable matrix of complex numbers
type MMatrixXcf = MMatrix (Complex Float) (CComplex CFloat)
-- | Alias for double prevision mutable matrix of complex numbers
type MMatrixXcd = MMatrix (Complex Double) (CComplex CDouble)
type IOMatrix a b = MMatrix a b RealWorld
type STMatrix a b s = MMatrix a b s
-- | Create a mutable matrix of the given size and fill it with 0 as an
-- initial value.
new :: (PrimMonad m, Elem a b) => Int -> Int -> m (MMatrix a b (PrimState m))
-- | Create a mutable matrix of the given size and fill it with as an
-- initial value.
replicate :: (PrimMonad m, Elem a b) => Int -> Int -> a -> m (MMatrix a b (PrimState m))
-- | Verify matrix dimensions and memory layout
valid :: Elem a b => MMatrix a b s -> Bool
-- | Yield the element at the given position.
read :: (PrimMonad m, Elem a b) => MMatrix a b (PrimState m) -> Int -> Int -> m a
-- | Replace the element at the given position.
write :: (PrimMonad m, Elem a b) => MMatrix a b (PrimState m) -> Int -> Int -> a -> m ()
-- | Yield the element at the given position. No bounds checks are
-- performed.
unsafeRead :: (PrimMonad m, Elem a b) => MMatrix a b (PrimState m) -> Int -> Int -> m a
-- | Replace the element at the given position. No bounds checks are
-- performed.
unsafeWrite :: (PrimMonad m, Elem a b) => MMatrix a b (PrimState m) -> Int -> Int -> a -> m ()
-- | Set all elements of the matrix to the given value
set :: (PrimMonad m, Elem a b) => (MMatrix a b (PrimState m)) -> a -> m ()
-- | Copy a matrix. The two matrices must have the same size and may not
-- overlap.
copy :: (PrimMonad m, Elem a b) => (MMatrix a b (PrimState m)) -> (MMatrix a b (PrimState m)) -> m ()
-- | Copy a matrix. The two matrices must have the same size and may not
-- overlap however no bounds check performaned to it may SEGFAULT for
-- incorrect input.
unsafeCopy :: (PrimMonad m, Elem a b) => (MMatrix a b (PrimState m)) -> (MMatrix a b (PrimState m)) -> m ()
-- | Pass a pointer to the matrix's data to the IO action. Modifying data
-- through the pointer is unsafe if the matrix could have been frozen
-- before the modification.
unsafeWith :: Elem a b => IOMatrix a b -> (Ptr b -> CInt -> CInt -> IO c) -> IO c
module Data.Eigen.Matrix
-- | Matrix to be used in pure computations, uses column major memory
-- layout, features copy-free FFI with C++ Eigen library.
data Matrix a b
[Matrix] :: Elem a b => !Int -> !Int -> !(Vector b) -> Matrix a b
-- | Alias for single precision matrix
type MatrixXf = Matrix Float CFloat
-- | Alias for double precision matrix
type MatrixXd = Matrix Double CDouble
-- | Alias for single previsiom matrix of complex numbers
type MatrixXcf = Matrix (Complex Float) (CComplex CFloat)
-- | Alias for double prevision matrix of complex numbers
type MatrixXcd = Matrix (Complex Double) (CComplex CDouble)
class (Num a, Cast a b, Cast b a, Storable b, Code b) => Elem a b | a -> b
-- | Complex number for FFI with the same memory layout as
-- std::complex<T>
data CComplex a
-- | Verify matrix dimensions and memory layout
valid :: Elem a b => Matrix a b -> Bool
-- | Construct matrix from a list of rows, column count is detected as
-- maximum row length. Missing values are filled with 0
fromList :: Elem a b => [[a]] -> Matrix a b
-- | Convert matrix to a list of rows
toList :: Elem a b => Matrix a b -> [[a]]
-- | Build matrix of given dimensions and values from given list split on
-- rows. Invalid list length results in error.
fromFlatList :: Elem a b => Int -> Int -> [a] -> Matrix a b
-- | Convert matrix to a list by concatenating rows
toFlatList :: Elem a b => Matrix a b -> [a]
-- |
-- - generate rows cols (λ row col -> val)
--
--
-- Create matrix using generator function λ row col -> val
generate :: Elem a b => Int -> Int -> (Int -> Int -> a) -> Matrix a b
-- | Empty 0x0 matrix
empty :: Elem a b => Matrix a b
-- | Is matrix empty?
null :: Elem a b => Matrix a b -> Bool
-- | Is matrix square?
square :: Elem a b => Matrix a b -> Bool
-- | Matrix where all coeff are 0
zero :: Elem a b => Int -> Int -> Matrix a b
-- | Matrix where all coeff are 1
ones :: Elem a b => Int -> Int -> Matrix a b
-- | The identity matrix (not necessarily square).
identity :: Elem a b => Int -> Int -> Matrix a b
-- | Matrix where all coeffs are filled with given value
constant :: Elem a b => Int -> Int -> a -> Matrix a b
-- | The random matrix of a given size
random :: Elem a b => Int -> Int -> IO (Matrix a b)
-- | Number of columns for the matrix
cols :: Elem a b => Matrix a b -> Int
-- | Number of rows for the matrix
rows :: Elem a b => Matrix a b -> Int
-- | Mtrix size as (rows, cols) pair
dims :: Elem a b => Matrix a b -> (Int, Int)
-- | Matrix coefficient at specific row and col
(!) :: forall a b. (Elem a b) => Matrix a b -> (Int, Int) -> a
-- | Matrix coefficient at specific row and col
coeff :: Elem a b => Int -> Int -> Matrix a b -> a
-- | Unsafe version of coeff function. No bounds check performed so
-- SEGFAULT possible
unsafeCoeff :: Elem a b => Int -> Int -> Matrix a b -> a
-- | List of coefficients for the given col
col :: Elem a b => Int -> Matrix a b -> [a]
-- | List of coefficients for the given row
row :: Elem a b => Int -> Matrix a b -> [a]
-- | Extract rectangular block from matrix defined by startRow startCol
-- blockRows blockCols
block :: Elem a b => Int -> Int -> Int -> Int -> Matrix a b -> Matrix a b
-- | Top N rows of matrix
topRows :: Elem a b => Int -> Matrix a b -> Matrix a b
-- | Bottom N rows of matrix
bottomRows :: Elem a b => Int -> Matrix a b -> Matrix a b
-- | Left N columns of matrix
leftCols :: Elem a b => Int -> Matrix a b -> Matrix a b
-- | Right N columns of matrix
rightCols :: Elem a b => Int -> Matrix a b -> Matrix a b
-- | The sum of all coefficients of the matrix
sum :: Elem a b => Matrix a b -> a
-- | The product of all coefficients of the matrix
prod :: Elem a b => Matrix a b -> a
-- | The mean of all coefficients of the matrix
mean :: Elem a b => Matrix a b -> a
-- | The minimum coefficient of the matrix
minCoeff :: (Elem a b, Ord a) => Matrix a b -> a
-- | The maximum coefficient of the matrix
maxCoeff :: (Elem a b, Ord a) => Matrix a b -> a
-- | The trace of a matrix is the sum of the diagonal coefficients and can
-- also be computed as sum (diagonal m)
trace :: Elem a b => Matrix a b -> a
-- | For vectors, the l2 norm, and for matrices the Frobenius norm. In both
-- cases, it consists in the square root of the sum of the square of all
-- the matrix entries. For vectors, this is also equals to the square
-- root of the dot product of this with itself.
norm :: Elem a b => Matrix a b -> a
-- | For vectors, the squared l2 norm, and for matrices the Frobenius norm.
-- In both cases, it consists in the sum of the square of all the matrix
-- entries. For vectors, this is also equals to the dot product of this
-- with itself.
squaredNorm :: Elem a b => Matrix a b -> a
-- | The l2 norm of the matrix using the Blue's algorithm. A Portable
-- Fortran Program to Find the Euclidean Norm of a Vector, ACM TOMS, Vol
-- 4, Issue 1, 1978.
blueNorm :: Elem a b => Matrix a b -> a
-- | The l2 norm of the matrix avoiding undeflow and overflow. This version
-- use a concatenation of hypot calls, and it is very slow.
hypotNorm :: Elem a b => Matrix a b -> a
-- | The determinant of the matrix
determinant :: Elem a b => Matrix a b -> a
-- | Reduce matrix using user provided function applied to each element.
fold :: Elem a b => (c -> a -> c) -> c -> Matrix a b -> c
-- | Reduce matrix using user provided function applied to each element.
-- This is strict version of fold
fold' :: Elem a b => (c -> a -> c) -> c -> Matrix a b -> c
-- | Reduce matrix using user provided function applied to each element and
-- it's index
ifold :: Elem a b => (Int -> Int -> c -> a -> c) -> c -> Matrix a b -> c
-- | Reduce matrix using user provided function applied to each element and
-- it's index. This is strict version of ifold
ifold' :: Elem a b => (Int -> Int -> c -> a -> c) -> c -> Matrix a b -> c
-- | Reduce matrix using user provided function applied to each element.
fold1 :: Elem a b => (a -> a -> a) -> Matrix a b -> a
-- | Reduce matrix using user provided function applied to each element.
-- This is strict version of fold
fold1' :: Elem a b => (a -> a -> a) -> Matrix a b -> a
-- | Applied to a predicate and a matrix, all determines if all elements of
-- the matrix satisfies the predicate
all :: Elem a b => (a -> Bool) -> Matrix a b -> Bool
-- | Applied to a predicate and a matrix, any determines if any element of
-- the matrix satisfies the predicate
any :: Elem a b => (a -> Bool) -> Matrix a b -> Bool
-- | Returns the number of coefficients in a given matrix that evaluate to
-- true
count :: Elem a b => (a -> Bool) -> Matrix a b -> Int
-- | Adding two matrices by adding the corresponding entries together. You
-- can use (+) function as well.
add :: Elem a b => Matrix a b -> Matrix a b -> Matrix a b
-- | Subtracting two matrices by subtracting the corresponding entries
-- together. You can use (-) function as well.
sub :: Elem a b => Matrix a b -> Matrix a b -> Matrix a b
-- | Matrix multiplication. You can use (*) function as well.
mul :: Elem a b => Matrix a b -> Matrix a b -> Matrix a b
-- | Apply a given function to each element of the matrix.
--
-- Here is an example how to implement scalar matrix multiplication:
--
--
-- >>> let a = fromList [[1,2],[3,4]] :: MatrixXf
--
--
--
-- >>> a
-- Matrix 2x2
-- 1.0 2.0
-- 3.0 4.0
--
--
--
-- >>> map (*10) a
-- Matrix 2x2
-- 10.0 20.0
-- 30.0 40.0
--
map :: Elem a b => (a -> a) -> Matrix a b -> Matrix a b
-- | Apply a given function to each element of the matrix.
--
-- Here is an example how upper triangular matrix can be implemented:
--
--
-- >>> let a = fromList [[1,2,3],[4,5,6],[7,8,9]] :: MatrixXf
--
--
--
-- >>> a
-- Matrix 3x3
-- 1.0 2.0 3.0
-- 4.0 5.0 6.0
-- 7.0 8.0 9.0
--
--
--
-- >>> imap (\row col val -> if row <= col then val else 0) a
-- Matrix 3x3
-- 1.0 2.0 3.0
-- 0.0 5.0 6.0
-- 0.0 0.0 9.0
--
imap :: Elem a b => (Int -> Int -> a -> a) -> Matrix a b -> Matrix a b
-- | Filter elements in the matrix. Filtered elements will be replaced by 0
filter :: Elem a b => (a -> Bool) -> Matrix a b -> Matrix a b
-- | Filter elements in the matrix. Filtered elements will be replaced by 0
ifilter :: Elem a b => (Int -> Int -> a -> Bool) -> Matrix a b -> Matrix a b
-- | Diagonal of the matrix
diagonal :: Elem a b => Matrix a b -> Matrix a b
-- | Transpose of the matrix
transpose :: Elem a b => Matrix a b -> Matrix a b
-- | Inverse of the matrix
--
-- For small fixed sizes up to 4x4, this method uses cofactors. In the
-- general case, this method uses PartialPivLU decomposition
inverse :: Elem a b => Matrix a b -> Matrix a b
-- | Adjoint of the matrix
adjoint :: Elem a b => Matrix a b -> Matrix a b
-- | Conjugate of the matrix
conjugate :: Elem a b => Matrix a b -> Matrix a b
-- | Nomalize the matrix by deviding it on its norm
normalize :: Elem a b => Matrix a b -> Matrix a b
-- | Apply a destructive operation to a matrix. The operation will be
-- performed in place if it is safe to do so and will modify a copy of
-- the matrix otherwise.
modify :: Elem a b => (forall s. MMatrix a b s -> ST s ()) -> Matrix a b -> Matrix a b
-- | Convert matrix to different type using user provided element converter
convert :: (Elem a b, Elem c d) => (a -> c) -> Matrix a b -> Matrix c d
data TriangularMode
-- | View matrix as a lower triangular matrix.
Lower :: TriangularMode
-- | View matrix as an upper triangular matrix.
Upper :: TriangularMode
-- | View matrix as a lower triangular matrix with zeros on the diagonal.
StrictlyLower :: TriangularMode
-- | View matrix as an upper triangular matrix with zeros on the diagonal.
StrictlyUpper :: TriangularMode
-- | View matrix as a lower triangular matrix with ones on the diagonal.
UnitLower :: TriangularMode
-- | View matrix as an upper triangular matrix with ones on the diagonal.
UnitUpper :: TriangularMode
-- | Triangular view extracted from the current matrix
triangularView :: Elem a b => TriangularMode -> Matrix a b -> Matrix a b
-- | Lower trinagle of the matrix. Shortcut for triangularView
-- Lower
lowerTriangle :: Elem a b => Matrix a b -> Matrix a b
-- | Upper trinagle of the matrix. Shortcut for triangularView
-- Upper
upperTriangle :: Elem a b => Matrix a b -> Matrix a b
-- | Encode the matrix as a lazy byte string
encode :: Elem a b => Matrix a b -> ByteString
-- | Decode matrix from the lazy byte string
decode :: Elem a b => ByteString -> Matrix a b
-- | Yield a mutable copy of the immutable matrix
thaw :: Elem a b => PrimMonad m => Matrix a b -> m (MMatrix a b (PrimState m))
-- | Yield an immutable copy of the mutable matrix
freeze :: Elem a b => PrimMonad m => MMatrix a b (PrimState m) -> m (Matrix a b)
-- | Unsafely convert an immutable matrix to a mutable one without copying.
-- The immutable matrix may not be used after this operation.
unsafeThaw :: Elem a b => PrimMonad m => Matrix a b -> m (MMatrix a b (PrimState m))
-- | Unsafe convert a mutable matrix to an immutable one without copying.
-- The mutable matrix may not be used after this operation.
unsafeFreeze :: Elem a b => PrimMonad m => MMatrix a b (PrimState m) -> m (Matrix a b)
-- | Pass a pointer to the matrix's data to the IO action. The data may not
-- be modified through the pointer.
unsafeWith :: Elem a b => Matrix a b -> (Ptr b -> CInt -> CInt -> IO c) -> IO c
instance GHC.Read.Read Data.Eigen.Matrix.TriangularMode
instance GHC.Show.Show Data.Eigen.Matrix.TriangularMode
instance GHC.Enum.Enum Data.Eigen.Matrix.TriangularMode
instance GHC.Classes.Eq Data.Eigen.Matrix.TriangularMode
instance (Data.Eigen.Internal.Elem a b, GHC.Show.Show a) => GHC.Show.Show (Data.Eigen.Matrix.Matrix a b)
instance Data.Eigen.Internal.Elem a b => GHC.Num.Num (Data.Eigen.Matrix.Matrix a b)
instance Data.Eigen.Internal.Elem a b => Data.Binary.Class.Binary (Data.Eigen.Matrix.Matrix a b)
-- | The problem: You have a system of equations, that you have written as
-- a single matrix equation
--
--
-- Ax = b
--
--
-- Where A and b are matrices (b could be a vector, as a special case).
-- You want to find a solution x.
--
-- The solution: You can choose between various decompositions, depending
-- on what your matrix A looks like, and depending on whether you favor
-- speed or accuracy. However, let's start with an example that works in
-- all cases, and is a good compromise:
--
--
-- import Data.Eigen.Matrix
-- import Data.Eigen.LA
--
-- main = do
-- let
-- a :: MatrixXd
-- a = fromList [[1,2,3], [4,5,6], [7,8,10]]
-- b = fromList [[3],[3],[4]]
-- x = solve ColPivHouseholderQR a b
-- putStrLn "Here is the matrix A:" >> print a
-- putStrLn "Here is the vector b:" >> print b
-- putStrLn "The solution is:" >> print x
--
--
-- produces the following output
--
--
-- Here is the matrix A:
-- Matrix 3x3
-- 1.0 2.0 3.0
-- 4.0 5.0 6.0
-- 7.0 8.0 10.0
--
-- Here is the vector b:
-- Matrix 3x1
-- 3.0
-- 3.0
-- 4.0
--
-- The solution is:
-- Matrix 3x1
-- -2.0000000000000004
-- 1.0000000000000018
-- 0.9999999999999989
--
--
-- Checking if a solution really exists: Only you know what error margin
-- you want to allow for a solution to be considered valid.
--
-- You can compute relative error using norm (ax - b) /
-- norm b formula or use relativeError function which
-- provides the same calculation implemented slightly more efficient.
module Data.Eigen.LA
-- |
-- Decomposition Requirements on the matrix Speed Accuracy Rank Kernel Image
--
-- PartialPivLU Invertible ++ + - - -
-- FullPivLU None - +++ + + +
-- HouseholderQR None ++ + - - -
-- ColPivHouseholderQR None + ++ + - -
-- FullPivHouseholderQR None - +++ + - -
-- LLT Positive definite +++ + - - -
-- LDLT Positive or negative semidefinite +++ ++ - - -
-- JacobiSVD None - +++ + - -
--
--
-- The best way to do least squares solving for square matrices is with a
-- SVD decomposition (JacobiSVD)
data Decomposition
-- | LU decomposition of a matrix with partial pivoting.
PartialPivLU :: Decomposition
-- | LU decomposition of a matrix with complete pivoting.
FullPivLU :: Decomposition
-- | Householder QR decomposition of a matrix.
HouseholderQR :: Decomposition
-- | Householder rank-revealing QR decomposition of a matrix with
-- column-pivoting.
ColPivHouseholderQR :: Decomposition
-- | Householder rank-revealing QR decomposition of a matrix with full
-- pivoting.
FullPivHouseholderQR :: Decomposition
-- | Standard Cholesky decomposition (LL^T) of a matrix.
LLT :: Decomposition
-- | Robust Cholesky decomposition of a matrix with pivoting.
LDLT :: Decomposition
-- | Two-sided Jacobi SVD decomposition of a rectangular matrix.
JacobiSVD :: Decomposition
-- |
-- - x = solve d a b finds a solution x of ax =
-- b equation using decomposition d
--
solve :: Elem a b => Decomposition -> Matrix a b -> Matrix a b -> Matrix a b
-- |
-- - e = relativeError x a b computes norm (ax - b) / norm
-- b where norm is L2 norm
--
relativeError :: Elem a b => Matrix a b -> Matrix a b -> Matrix a b -> a
-- | The rank of the matrix
rank :: Elem a b => Decomposition -> Matrix a b -> Int
-- | Return matrix whose columns form a basis of the null-space of
-- A
kernel :: Elem a b => Decomposition -> Matrix a b -> Matrix a b
-- | Return a matrix whose columns form a basis of the column-space of
-- A
image :: Elem a b => Decomposition -> Matrix a b -> Matrix a b
-- |
-- - (coeffs, error) = linearRegression points computes multiple
-- linear regression y = a1 x1 + a2 x2 + ... + an xn + b using
-- ColPivHouseholderQR decomposition
--
--
--
-- - point format is [y, x1..xn]
-- - coeffs format is [b, a1..an]
-- - error is calculated using relativeError
--
--
--
-- import Data.Eigen.LA
-- main = print $ linearRegression [
-- [-4.32, 3.02, 6.89],
-- [-3.79, 2.01, 5.39],
-- [-4.01, 2.41, 6.01],
-- [-3.86, 2.09, 5.55],
-- [-4.10, 2.58, 6.32]]
--
--
-- produces the following output
--
--
-- ([-2.3466569233817127,-0.2534897541434826,-0.1749653335680988],1.8905965120153139e-3)
--
linearRegression :: [[Double]] -> ([Double], Double)
instance GHC.Read.Read Data.Eigen.LA.Decomposition
instance GHC.Show.Show Data.Eigen.LA.Decomposition
instance GHC.Enum.Enum Data.Eigen.LA.Decomposition
instance GHC.Classes.Eq Data.Eigen.LA.Decomposition
-- | Some Eigen's algorithms can exploit the multiple cores present in your
-- hardware. To this end, it is enough to enable OpenMP on your compiler,
-- for instance: GCC: -fopenmp. You can control the number of thread that
-- will be used using either the OpenMP API or Eiegn's API using the
-- following priority:
--
--
-- - OMP_NUM_THREADS=n ./my_program
-- - setNbThreads n
--
--
-- Unless setNbThreads has been called, Eigen uses the number of threads
-- specified by OpenMP. You can restore this behaviour by calling
-- setNbThreads n
--
-- Currently, the following algorithms can make use of multi-threading:
-- general matrix - matrix products PartialPivLU.
module Data.Eigen.Parallel
-- | Sets the max number of threads reserved for Eigen
setNbThreads :: Int -> IO ()
-- | Gets the max number of threads reserved for Eigen
getNbThreads :: IO Int
module Data.Eigen.SparseMatrix.Mutable
-- | Mutable version of sparse matrix. See SparseMatrix for details
-- about matrix layout.
data IOSparseMatrix a b
[IOSparseMatrix] :: Elem a b => !(ForeignPtr (CSparseMatrix a b)) -> IOSparseMatrix a b
-- | Alias for single precision mutable matrix
type IOSparseMatrixXf = IOSparseMatrix Float CFloat
-- | Alias for double precision mutable matrix
type IOSparseMatrixXd = IOSparseMatrix Double CDouble
-- | Alias for single previsiom mutable matrix of complex numbers
type IOSparseMatrixXcf = IOSparseMatrix (Complex Float) (CComplex CFloat)
-- | Alias for double prevision mutable matrix of complex numbers
type IOSparseMatrixXcd = IOSparseMatrix (Complex Double) (CComplex CDouble)
-- | Creates new matrix with the given size rows x cols
new :: Elem a b => Int -> Int -> IO (IOSparseMatrix a b)
-- | Preallocates space for non zeros. The matrix must be in compressed
-- mode.
reserve :: Elem a b => IOSparseMatrix a b -> Int -> IO ()
-- | Returns the number of rows of the matrix
rows :: Elem a b => IOSparseMatrix a b -> IO Int
-- | Returns the number of columns of the matrix
cols :: Elem a b => IOSparseMatrix a b -> IO Int
-- | Returns the number of rows (resp. columns) of the matrix if the
-- storage order column major (resp. row major)
innerSize :: Elem a b => IOSparseMatrix a b -> IO Int
-- | Returns the number of columns (resp. rows) of the matrix if the
-- storage order column major (resp. row major)
outerSize :: Elem a b => IOSparseMatrix a b -> IO Int
-- | The number of non zero coefficients
nonZeros :: Elem a b => IOSparseMatrix a b -> IO Int
-- | Returns whether this matrix is in compressed form.
compressed :: Elem a b => IOSparseMatrix a b -> IO Bool
-- | Turns the matrix into the compressed format.
compress :: Elem a b => IOSparseMatrix a b -> IO ()
-- | Turns the matrix into the uncompressed mode.
uncompress :: Elem a b => IOSparseMatrix a b -> IO ()
-- | Reads the value of the matrix at position i, j. This
-- function returns Scalar(0) if the element is an explicit
-- zero.
read :: Elem a b => IOSparseMatrix a b -> Int -> Int -> IO a
-- | Writes the value of the matrix at position i, j.
-- This function turns the matrix into a non compressed form if that was
-- not the case.
--
-- This is a O(log(nnz_j)) operation (binary search) plus the
-- cost of element insertion if the element does not already exist.
--
-- Cost of element insertion is sorted insertion in O(1) if the elements
-- of each inner vector are inserted in increasing inner index order, and
-- in O(nnz_j) for a random insertion.
write :: Elem a b => IOSparseMatrix a b -> Int -> Int -> a -> IO ()
-- | Removes all non zeros but keep allocated memory
setZero :: Elem a b => IOSparseMatrix a b -> IO ()
-- | Sets the matrix to the identity matrix
setIdentity :: Elem a b => IOSparseMatrix a b -> IO ()
-- | Resizes the matrix to a rows x cols matrix and initializes it to zero.
resize :: Elem a b => IOSparseMatrix a b -> Int -> Int -> IO ()
-- | Resizes the matrix to a rows x cols matrix leaving old values
-- untouched.
conservativeResize :: Elem a b => IOSparseMatrix a b -> Int -> Int -> IO ()
module Data.Eigen.SparseMatrix
-- | A versatible sparse matrix representation.
--
-- SparseMatrix is the main sparse matrix representation of Eigen's
-- sparse module. It offers high performance and low memory usage. It
-- implements a more versatile variant of the widely-used Compressed
-- Column (or Row) Storage scheme.
--
-- It consists of four compact arrays:
--
--
-- - values: stores the coefficient values of the
-- non-zeros.
-- - innerIndices: stores the row (resp. column) indices of the
-- non-zeros.
-- - outerStarts: stores for each column (resp. row) the index
-- of the first non-zero in the previous two arrays.
-- - innerNNZs: stores the number of non-zeros of each column
-- (resp. row). The word inner refers to an inner vector that is a column
-- for a column-major matrix, or a row for a row-major matrix. The word
-- outer refers to the other direction.
--
--
-- This storage scheme is better explained on an example. The following
-- matrix
--
--
-- 0 3 0 0 0
-- 22 0 0 0 17
-- 7 5 0 1 0
-- 0 0 0 0 0
-- 0 0 14 0 8
--
--
-- and one of its possible sparse, column major representation:
--
--
-- values: 22 7 _ 3 5 14 _ _ 1 _ 17 8
-- innerIndices: 1 2 _ 0 2 4 _ _ 2 _ 1 4
-- outerStarts: 0 3 5 8 10 12
-- innerNNZs: 2 2 1 1 2
--
--
-- Currently the elements of a given inner vector are guaranteed to be
-- always sorted by increasing inner indices. The "_" indicates available
-- free space to quickly insert new elements. Assuming no reallocation is
-- needed, the insertion of a random element is therefore in
-- O(nnz_j) where nnz_j is the number of nonzeros of
-- the respective inner vector. On the other hand, inserting elements
-- with increasing inner indices in a given inner vector is much more
-- efficient since this only requires to increase the respective
-- innerNNZs entry that is a O(1) operation.
--
-- The case where no empty space is available is a special case, and is
-- refered as the compressed mode. It corresponds to the widely used
-- Compressed Column (or Row) Storage schemes (CCS or CRS). Any
-- SparseMatrix can be turned to this form by calling the
-- compress function. In this case, one can remark that the
-- innerNNZs array is redundant with outerStarts because we
-- the equality: InnerNNZs[j] = OuterStarts[j+1]-OuterStarts[j].
-- Therefore, in practice a call to compress frees this buffer.
--
-- The results of Eigen's operations always produces compressed sparse
-- matrices. On the other hand, the insertion of a new element into a
-- SparseMatrix converts this later to the uncompressed mode.
--
-- For more infomration please see Eigen documentation page.
data SparseMatrix a b
[SparseMatrix] :: Elem a b => !(ForeignPtr (CSparseMatrix a b)) -> SparseMatrix a b
-- | Alias for single precision sparse matrix
type SparseMatrixXf = SparseMatrix Float CFloat
-- | Alias for double precision sparse matrix
type SparseMatrixXd = SparseMatrix Double CDouble
-- | Alias for single previsiom sparse matrix of complex numbers
type SparseMatrixXcf = SparseMatrix (Complex Float) (CComplex CFloat)
-- | Alias for double prevision sparse matrix of complex numbers
type SparseMatrixXcd = SparseMatrix (Complex Double) (CComplex CDouble)
-- | Stores the coefficient values of the non-zeros.
values :: Elem a b => SparseMatrix a b -> Vector b
-- | Stores the row (resp. column) indices of the non-zeros.
innerIndices :: Elem a b => SparseMatrix a b -> Vector CInt
-- | Stores for each column (resp. row) the index of the first non-zero in
-- the previous two arrays.
outerStarts :: Elem a b => SparseMatrix a b -> Vector CInt
-- | Stores the number of non-zeros of each column (resp. row). The word
-- inner refers to an inner vector that is a column for a column-major
-- matrix, or a row for a row-major matrix. The word outer refers to the
-- other direction
innerNNZs :: Elem a b => SparseMatrix a b -> Maybe (Vector CInt)
-- | Number of columns for the sparse matrix
cols :: Elem a b => SparseMatrix a b -> Int
-- | Number of rows for the sparse matrix
rows :: Elem a b => SparseMatrix a b -> Int
-- | Matrix coefficient at given row and col
coeff :: Elem a b => Int -> Int -> SparseMatrix a b -> a
-- | Matrix coefficient at given row and col
(!) :: Elem a b => SparseMatrix a b -> (Int, Int) -> a
-- | Get a row of a sparse matrix.
getRow :: Elem a b => Int -> SparseMatrix a b -> SparseMatrix a b
-- | Get a column of a sparse matrix.
getCol :: Elem a b => Int -> SparseMatrix a b -> SparseMatrix a b
-- | Get all rows of a sparse matrix.
getRows :: Elem a b => SparseMatrix a b -> [SparseMatrix a b]
-- | Get all columns of a sparse matrix.
getCols :: Elem a b => SparseMatrix a b -> [SparseMatrix a b]
-- | Get a subset of a square matrix.
squareSubset :: Elem a b => [Int] -> SparseMatrix a b -> SparseMatrix a b
-- | Construct sparse matrix of given size from the list of triplets (row,
-- col, val)
fromList :: Elem a b => Int -> Int -> [(Int, Int, a)] -> SparseMatrix a b
-- | Convert sparse matrix to the list of triplets (row, col, val).
-- Compressed elements will not be included
toList :: Elem a b => SparseMatrix a b -> [(Int, Int, a)]
-- | Construct sparse matrix of given size from the storable vector of
-- triplets (row, col, val)
fromVector :: Elem a b => Int -> Int -> Vector (CTriplet b) -> SparseMatrix a b
-- | Convert sparse matrix to the storable vector of triplets (row, col,
-- val). Compressed elements will not be included
toVector :: Elem a b => SparseMatrix a b -> Vector (CTriplet b)
-- | Construct sparse matrix of two-dimensional list of values. Matrix
-- dimensions will be detected automatically. Zero values will be
-- compressed.
fromDenseList :: (Elem a b, Eq a) => [[a]] -> SparseMatrix a b
-- | Convert sparse matrix to (rows X cols) dense list of values
toDenseList :: Elem a b => SparseMatrix a b -> [[a]]
-- | Construct sparse matrix from dense matrix. Zero elements will be
-- compressed
fromMatrix :: Elem a b => Matrix a b -> SparseMatrix a b
-- | Construct dense matrix from sparse matrix
toMatrix :: Elem a b => SparseMatrix a b -> Matrix a b
-- | Get the ones vector.
ones :: Int -> SparseMatrixXd
-- | Get the identity matrix.
ident :: Int -> SparseMatrixXd
-- | Transform a column into a diagonal matrix.
diagCol :: Elem a b => Int -> SparseMatrix a b -> SparseMatrix a b
-- | Transform a row into a diagonal matrix.
diagRow :: Elem a b => Int -> SparseMatrix a b -> SparseMatrix a b
-- | Get a matrix from a list of rows.
fromRows :: Elem a b => [SparseMatrix a b] -> SparseMatrix a b
-- | Get a matrix from a list of cols.
fromCols :: Elem a b => [SparseMatrix a b] -> SparseMatrix a b
-- | For vectors, the l2 norm, and for matrices the Frobenius norm. In both
-- cases, it consists in the square root of the sum of the square of all
-- the matrix entries. For vectors, this is also equals to the square
-- root of the dot product of this with itself.
norm :: Elem a b => SparseMatrix a b -> a
-- | For vectors, the squared l2 norm, and for matrices the Frobenius norm.
-- In both cases, it consists in the sum of the square of all the matrix
-- entries. For vectors, this is also equals to the dot product of this
-- with itself.
squaredNorm :: Elem a b => SparseMatrix a b -> a
-- | The l2 norm of the matrix using the Blue's algorithm. A Portable
-- Fortran Program to Find the Euclidean Norm of a Vector, ACM TOMS, Vol
-- 4, Issue 1, 1978.
blueNorm :: Elem a b => SparseMatrix a b -> a
-- | Extract rectangular block from sparse matrix defined by startRow
-- startCol blockRows blockCols
block :: Elem a b => Int -> Int -> Int -> Int -> SparseMatrix a b -> SparseMatrix a b
-- | Number of non-zeros elements in the sparse matrix
nonZeros :: Elem a b => SparseMatrix a b -> Int
-- | Minor dimension with respect to the storage order
innerSize :: Elem a b => SparseMatrix a b -> Int
-- | Major dimension with respect to the storage order
outerSize :: Elem a b => SparseMatrix a b -> Int
-- | Get all row sums.
getRowSums :: SparseMatrixXd -> SparseMatrixXd
-- | Get all column sums.
getColSums :: SparseMatrixXd -> SparseMatrixXd
-- | Get sum of matrix.
getSum :: SparseMatrixXd -> Double
-- | Adding two sparse matrices by adding the corresponding entries
-- together. You can use (+) function as well.
add :: Elem a b => SparseMatrix a b -> SparseMatrix a b -> SparseMatrix a b
-- | Subtracting two sparse matrices by subtracting the corresponding
-- entries together. You can use (-) function as well.
sub :: Elem a b => SparseMatrix a b -> SparseMatrix a b -> SparseMatrix a b
-- | Matrix multiplication. You can use (*) function as well.
mul :: Elem a b => SparseMatrix a b -> SparseMatrix a b -> SparseMatrix a b
-- | Suppresses all nonzeros which are much smaller than reference under
-- the tolerence epsilon
pruned :: Elem a b => a -> SparseMatrix a b -> SparseMatrix a b
-- | Multiply matrix on a given scalar
scale :: Elem a b => a -> SparseMatrix a b -> SparseMatrix a b
-- | Transpose of the sparse matrix
transpose :: Elem a b => SparseMatrix a b -> SparseMatrix a b
-- | Adjoint of the sparse matrix
adjoint :: Elem a b => SparseMatrix a b -> SparseMatrix a b
-- | Map over values of a sparse matrix.
_map :: Elem a b => (a -> a) -> SparseMatrix a b -> SparseMatrix a b
-- | Map over values of a sparse matrix with indices.
_imap :: Elem a b => (Int -> Int -> a -> a) -> SparseMatrix a b -> SparseMatrix a b
-- | The matrix in the compressed format
compress :: Elem a b => SparseMatrix a b -> SparseMatrix a b
-- | The matrix in the uncompressed mode
uncompress :: Elem a b => SparseMatrix a b -> SparseMatrix a b
-- | Is this in compressed form?
compressed :: Elem a b => SparseMatrix a b -> Bool
-- | Encode the sparse matrix as a lazy byte string
encode :: Elem a b => SparseMatrix a b -> ByteString
-- | Decode sparse matrix from the lazy byte string
decode :: Elem a b => ByteString -> SparseMatrix a b
-- | Yield a mutable copy of the immutable matrix
thaw :: Elem a b => SparseMatrix a b -> IO (IOSparseMatrix a b)
-- | Yield an immutable copy of the mutable matrix
freeze :: Elem a b => IOSparseMatrix a b -> IO (SparseMatrix a b)
-- | Unsafely convert an immutable matrix to a mutable one without copying.
-- The immutable matrix may not be used after this operation.
unsafeThaw :: Elem a b => SparseMatrix a b -> IO (IOSparseMatrix a b)
-- | Unsafe convert a mutable matrix to an immutable one without copying.
-- The mutable matrix may not be used after this operation.
unsafeFreeze :: Elem a b => IOSparseMatrix a b -> IO (SparseMatrix a b)
instance (Data.Eigen.Internal.Elem a b, GHC.Show.Show a) => GHC.Show.Show (Data.Eigen.SparseMatrix.SparseMatrix a b)
instance Data.Eigen.Internal.Elem a b => GHC.Num.Num (Data.Eigen.SparseMatrix.SparseMatrix a b)
instance Data.Eigen.Internal.Elem a b => Data.Binary.Class.Binary (Data.Eigen.SparseMatrix.SparseMatrix a b)
-- | This documentation is based on original Eigen page Solving Sparse
-- Linear Systems
--
-- Eigen currently provides a limited set of built-in MPL2 compatible
-- solvers. They are summarized in the following table:
--
--
-- Sparse solver Solver kind Matrix kind Notes
--
-- ConjugateGradient Classic iterative CG SPD Recommended for large symmetric
-- problems (e.g., 3D Poisson eq.)
-- BiCGSTAB Iterative stabilized Square
-- bi-conjugate gradient
-- SparseLU LU factorization Square Optimized for small and large problems
-- with irregular patterns
-- SparseQR QR factorization Any, rectangular Recommended for least-square problems,
-- has a basic rank-revealing feature
--
--
-- All these solvers follow the same general concept. Here is a typical
-- and general example:
--
--
-- let
-- a :: SparseMatrixXd
-- a = ... -- fill a
--
-- b :: SparseMatrixXd
-- b = ... -- fill b
--
-- validate msg = info >>= (when fail msg) . (/= Success)
--
-- // solve Ax = b
-- runSolverT solver $ do
-- compute a
-- validate "decomposition failed"
--
-- x <- solve b
-- validate "solving failed"
--
-- // solve for another right hand side
-- x1 <- solve b1
--
--
-- In the case where multiple problems with the same sparsity pattern
-- have to be solved, then the "compute" step can be decomposed as
-- follow:
--
--
-- runSolverT solver $ do
-- analyzePattern a1
-- factorize a1
-- x1 <- solve b1
-- x2 <- solve b2
--
-- factorize a2
-- x1 <- solve b1
-- x2 <- solve b2
--
--
-- Finally, each solver provides some specific features, such as
-- determinant, access to the factors, controls of the iterations, and so
-- on.
module Data.Eigen.SparseLA
class Code s => Solver s
-- | For direct methods, the solution is computed at the machine precision.
class Solver s => DirectSolver s
-- | Sometimes, the solution need not be too accurate. In this case, the
-- iterative methods are more suitable and the desired accuracy can be
-- set before the solve step using setTolerance.
class Solver s => IterativeSolver s
-- | Ordering methods for sparse matrices. They are typically used to
-- reduce the number of elements during the sparse matrix decomposition
-- (LLT, LU, QR). Precisely, in a
-- preprocessing step, a permutation matrix P is computed using
-- those ordering methods and applied to the columns of the matrix. Using
-- for instance the sparse Cholesky decomposition, it is expected that
-- the nonzeros elements in LLT(A*P) will be much smaller than
-- that in LLT(A).
data OrderingMethod
-- | The column approximate minimum degree ordering The matrix should be in
-- column-major and compressed format
COLAMDOrdering :: OrderingMethod
-- | The natural ordering (identity)
NaturalOrdering :: OrderingMethod
data Preconditioner
-- | A preconditioner based on the digonal entries
--
-- It allows to approximately solve for A.x = b problems assuming A is a
-- diagonal matrix. In other words, this preconditioner neglects all off
-- diagonal entries and, in Eigen's language, solves for:
-- A.diagonal().asDiagonal() . x = b This preconditioner is
-- suitable for both selfadjoint and general problems. The diagonal
-- entries are pre-inverted and stored into a dense vector.
--
-- A variant that has yet to be implemented would attempt to preserve the
-- norm of each column.
DiagonalPreconditioner :: Preconditioner
-- | A naive preconditioner which approximates any matrix as the identity
-- matrix
IdentityPreconditioner :: Preconditioner
-- | A conjugate gradient solver for sparse self-adjoint problems.
--
-- This class allows to solve for A.x = b sparse linear problems
-- using a conjugate gradient algorithm. The sparse matrix A
-- must be selfadjoint.
--
-- The maximal number of iterations and tolerance value can be controlled
-- via the setMaxIterations and setTolerance methods. The
-- defaults are the size of the problem for the maximal number of
-- iterations and epsilon for the tolerance
data ConjugateGradient
ConjugateGradient :: Preconditioner -> ConjugateGradient
-- | A bi conjugate gradient stabilized solver for sparse square problems.
--
-- This class allows to solve for A.x = b sparse linear problems
-- using a bi conjugate gradient stabilized algorithm. The vectors
-- x and b can be either dense or sparse.
--
-- The maximal number of iterations and tolerance value can be controlled
-- via the setMaxIterations and setTolerance methods. The
-- defaults are the size of the problem for the maximal number of
-- iterations and epsilon for the tolerance
data BiCGSTAB
BiCGSTAB :: Preconditioner -> BiCGSTAB
-- | Sparse supernodal LU factorization for general matrices.
--
-- This class implements the supernodal LU factorization for general
-- matrices. It uses the main techniques from the sequential SuperLU
-- package. It handles transparently real and complex arithmetics
-- with single and double precision, depending on the scalar type of your
-- input matrix. The code has been optimized to provide BLAS-3 operations
-- during supernode-panel updates. It benefits directly from the built-in
-- high-performant Eigen BLAS routines. Moreover, when the size of a
-- supernode is very small, the BLAS calls are avoided to enable a better
-- optimization from the compiler. For best performance, you should
-- compile it with NDEBUG flag to avoid the numerous bounds checking on
-- vectors.
--
-- An important parameter of this class is the ordering method. It is
-- used to reorder the columns (and eventually the rows) of the matrix to
-- reduce the number of new elements that are created during numerical
-- factorization. The cheapest method available is COLAMD. See
-- OrderingMethods module for the list of built-in and external
-- ordering methods.
data SparseLU
SparseLU :: OrderingMethod -> SparseLU
-- | Sparse left-looking rank-revealing QR factorization.
--
-- This class implements a left-looking rank-revealing QR decomposition
-- of sparse matrices. When a column has a norm less than a given
-- tolerance it is implicitly permuted to the end. The QR factorization
-- thus obtained is given by A*P = Q*R where R is upper
-- triangular or trapezoidal.
--
-- P is the column permutation which is the product of the
-- fill-reducing and the rank-revealing permutations.
--
-- Q is the orthogonal matrix represented as products of
-- Householder reflectors.
--
-- R is the sparse triangular or trapezoidal matrix. The later
-- occurs when A is rank-deficient.
data SparseQR
SparseQR :: OrderingMethod -> SparseQR
data ComputationInfo
-- | Computation was successful.
Success :: ComputationInfo
-- | The provided data did not satisfy the prerequisites.
NumericalIssue :: ComputationInfo
-- | Iterative procedure did not converge.
NoConvergence :: ComputationInfo
-- | The inputs are invalid, or the algorithm has been improperly called.
-- When assertions are enabled, such errors trigger an error.
InvalidInput :: ComputationInfo
type SolverT s a b m = ReaderT (s, ForeignPtr (CSolver a b)) m
runSolverT :: (Solver s, MonadIO m, Elem a b) => s -> SolverT s a b m c -> m c
-- | Initializes the iterative solver for the sparsity pattern of the
-- matrix A for further solving Ax=b problems.
analyzePattern :: (Solver s, MonadIO m, Elem a b) => SparseMatrix a b -> SolverT s a b m ()
-- | Initializes the iterative solver with the numerical values of the
-- matrix A for further solving Ax=b problems.
factorize :: (Solver s, MonadIO m, Elem a b) => SparseMatrix a b -> SolverT s a b m ()
-- | Initializes the iterative solver with the matrix A for
-- further solving Ax=b problems.
--
-- The compute method is equivalent to calling both
-- analyzePattern and factorize.
compute :: (Solver s, MonadIO m, Elem a b) => SparseMatrix a b -> SolverT s a b m ()
-- | An expression of the solution x of Ax=b using the
-- current decomposition of A.
solve :: (Solver s, MonadIO m, Elem a b) => SparseMatrix a b -> SolverT s a b m (SparseMatrix a b)
-- |
-- - Success if the iterations converged or computation was
-- succesful
-- - NumericalIssue if the factorization reports a numerical
-- problem
-- - NoConvergence if the iterations are not converged
-- - InvalidInput if the input matrix is invalid
--
info :: (Solver s, MonadIO m, Elem a b) => SolverT s a b m ComputationInfo
-- | The tolerance threshold used by the stopping criteria.
tolerance :: (IterativeSolver s, MonadIO m, Elem a b) => SolverT s a b m Double
-- | Sets the tolerance threshold used by the stopping criteria.
--
-- This value is used as an upper bound to the relative residual error:
-- |Ax-b|/|b|. The default value is the machine precision given
-- by epsilon
setTolerance :: (IterativeSolver s, MonadIO m, Elem a b) => Double -> SolverT s a b m ()
-- | The max number of iterations. It is either the value setted by
-- setMaxIterations or, by default, twice the number of columns of the
-- matrix.
maxIterations :: (IterativeSolver s, MonadIO m, Elem a b) => SolverT s a b m Int
-- | Sets the max number of iterations. Default is twice the number of
-- columns of the matrix.
setMaxIterations :: (IterativeSolver s, MonadIO m, Elem a b) => Int -> SolverT s a b m ()
-- | The tolerance error reached during the last solve. It is a close
-- approximation of the true relative residual error |Ax-b|/|b|.
error :: (IterativeSolver s, MonadIO m, Elem a b) => SolverT s a b m Double
-- | The number of iterations performed during the last solve
iterations :: (IterativeSolver s, MonadIO m, Elem a b) => SolverT s a b m Int
-- | Returns the b sparse upper triangular matrix R of
-- the QR factorization.
matrixR :: (MonadIO m, Elem a b) => SolverT SparseQR a b m (SparseMatrix a b)
-- | Returns the matrix Q as products of sparse Householder
-- reflectors.
matrixQ :: (MonadIO m, Elem a b) => SolverT SparseQR a b m (SparseMatrix a b)
-- | Returns the number of non linearly dependent columns as determined by
-- the pivoting threshold.
rank :: (MonadIO m, Elem a b) => SolverT SparseQR a b m Int
-- | Sets the threshold that is used to determine linearly dependent
-- columns during the factorization.
--
-- In practice, if during the factorization the norm of the column that
-- has to be eliminated is below this threshold, then the entire column
-- is treated as zero, and it is moved at the end.
setPivotThreshold :: (MonadIO m, Elem a b) => Double -> SolverT SparseQR a b m ()
-- | Indicate that the pattern of the input matrix is symmetric
setSymmetric :: (MonadIO m, Elem a b) => Bool -> SolverT SparseLU a b m ()
-- | Returns the matrix L
matrixL :: (MonadIO m, Elem a b) => SolverT SparseLU a b m (SparseMatrix a b)
-- | Returns the matrix U
matrixU :: (MonadIO m, Elem a b) => SolverT SparseLU a b m (SparseMatrix a b)
-- | The determinant of the matrix.
determinant :: (MonadIO m, Elem a b) => SolverT SparseLU a b m a
-- | The absolute value of the determinant of the matrix of which *this is
-- the QR decomposition.
--
-- A determinant can be very big or small, so for matrices of large
-- enough dimension, there is a risk of overflow/underflow. One way to
-- work around that is to use logAbsDeterminant instead.
absDeterminant :: (MonadIO m, Elem a b) => SolverT SparseLU a b m a
-- | A number representing the sign of the determinant
signDeterminant :: (MonadIO m, Elem a b) => SolverT SparseLU a b m a
-- | The natural log of the absolute value of the determinant of the matrix
-- of which this is the QR decomposition
--
-- This method is useful to work around the risk of overflow/underflow
-- that's inherent to the determinant computation.
logAbsDeterminant :: (MonadIO m, Elem a b) => SolverT SparseLU a b m a
instance GHC.Read.Read Data.Eigen.SparseLA.ComputationInfo
instance GHC.Show.Show Data.Eigen.SparseLA.ComputationInfo
instance GHC.Enum.Enum Data.Eigen.SparseLA.ComputationInfo
instance GHC.Classes.Eq Data.Eigen.SparseLA.ComputationInfo
instance GHC.Read.Read Data.Eigen.SparseLA.SparseQR
instance GHC.Show.Show Data.Eigen.SparseLA.SparseQR
instance GHC.Read.Read Data.Eigen.SparseLA.SparseLU
instance GHC.Show.Show Data.Eigen.SparseLA.SparseLU
instance GHC.Read.Read Data.Eigen.SparseLA.BiCGSTAB
instance GHC.Show.Show Data.Eigen.SparseLA.BiCGSTAB
instance GHC.Read.Read Data.Eigen.SparseLA.ConjugateGradient
instance GHC.Show.Show Data.Eigen.SparseLA.ConjugateGradient
instance GHC.Read.Read Data.Eigen.SparseLA.Preconditioner
instance GHC.Show.Show Data.Eigen.SparseLA.Preconditioner
instance GHC.Read.Read Data.Eigen.SparseLA.OrderingMethod
instance GHC.Show.Show Data.Eigen.SparseLA.OrderingMethod
instance Data.Eigen.SparseLA.Solver Data.Eigen.SparseLA.SparseQR
instance Data.Eigen.SparseLA.DirectSolver Data.Eigen.SparseLA.SparseQR
instance Data.Eigen.Internal.Code Data.Eigen.SparseLA.SparseQR
instance Data.Eigen.SparseLA.Solver Data.Eigen.SparseLA.SparseLU
instance Data.Eigen.SparseLA.DirectSolver Data.Eigen.SparseLA.SparseLU
instance Data.Eigen.Internal.Code Data.Eigen.SparseLA.SparseLU
instance Data.Eigen.SparseLA.Solver Data.Eigen.SparseLA.BiCGSTAB
instance Data.Eigen.SparseLA.IterativeSolver Data.Eigen.SparseLA.BiCGSTAB
instance Data.Eigen.Internal.Code Data.Eigen.SparseLA.BiCGSTAB
instance Data.Eigen.SparseLA.Solver Data.Eigen.SparseLA.ConjugateGradient
instance Data.Eigen.SparseLA.IterativeSolver Data.Eigen.SparseLA.ConjugateGradient
instance Data.Eigen.Internal.Code Data.Eigen.SparseLA.ConjugateGradient