Git Product home page Git Product logo

eigen's Introduction

eigen

Documentation on Hackage https://hackage.haskell.org/package/eigen

Eigen documentation page http://eigen.tuxfamily.org/dox/

This module provides Haskell binding for Eigen. Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Eigen home page is http://eigen.tuxfamily.org/.

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.

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.

eigen's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eigen's Issues

Sparse matrices whose size is not known at compile time

Hi,

I've been looking for a suitable linear algebra package to be used in a finite element solver I'm writing just for fun, and this package looks very nice. The only thing is that I can't figure out how to work with large sparse equation systems emerging from FEM whose size can't be known at compile time. Is it somehow possible?

I'm a mediocre haskeller and haven't used type literals or many of the extensions used in the code. I tried to look around the code. It seems that there are quite many KnownNat constraints in many of the functions although the C-interface layer could also work with dynamically sized matrices.

inlining

almost all functions in eigen are good candidates for inlining. some of the internal functions should probably just be marked INLINEABLE.

Totality

Lots of functions in this module are not total. I plan to use refined to make them total.

Another thing, the Matrix types are totally unsafe. Basically, I think Matrix should look like this:

data Matrix :: Nat -> Nat -> Type -> Type where
Matrix :: !(Vector (C a)) -> a

C is a closed injective type family that maps Haskell types to their C counterparts. In other words,

a ~ Complex ===> C a ~ CComplex, etc.

Build issues

@chessai thank you for taking care of this package.
I noticed that build is broken on ubuntu:xenial:

/tmp/stack1/eigen-3.3.4.1/cbits/eigen-sparse.cpp:24:5: error:
         error: ‘unique_ptr’ is not a member of ‘std’
             std::unique_ptr<M> a(new M(rows, cols));
             ^

as well as cabal file is not compatible with LTS Haskell < 12.x due to cabal version mismatch.

[Ported Issue] Geometry wrappers are not written

Hey Oleg,
I've been following the eigen utorial and it looks like some functions, available in C++, such as
AngleAxis(angle,axis); are not available in haskell-eigen. Are you, perhaps, planning to support more
functions at some point or could you give some directions on how I could achieve that? Or, mayby, I
misunderstand how to use the library and access such functions, in which case - could you provide
some info on that?
Regards,
Vlad

by @madjestic

Sparse matrix eigenvectors / eigenvalues

Is it possible to add functions to return eigenvectors and eigenvalues from sparse eigen matrices? I'm not sure if eigen does it, but there are libraries built on eigen which do this.

[Ported Issue] Sparse Matrix Accession

Is it possible to efficiently get a row, column, or diagonal of a sparse matrix as a sparse vector? Are map
and imap available for sparse matrices and sparse vectors?

For the first question: It looks like eigen itself does not carry those operations for sparse matrices.
Such a change would need to take place in eigen itself.
For the second question: I think so. A function called _map exists but is not exported from
Data.Eigen.SparseMatrix, here:

_map :: I.Elem a b => (a -> a) -> SparseMatrix a b -> SparseMatrix a b
_map f m = fromVector (rows m) (cols m) . VS.map g . toVector $ m where
    g (I.CTriplet r c v) = I.CTriplet r c $ I.cast $ f $ I.cast v

I think an 'imap' could exist. It might look like this:

_imap :: I.Elem a b => (Int -> Int -> a -> a) -> SparseMatrix a b -> SparseMatrix a b
_imap f m = fromVector rs cs . VS.map g . toVector $ m where
  rs = rows m
  cs = cols m  
  g n (I.CTriplet r c v) = I.CTriplet r c $ I.cast $ f r' c' $ I.cast v where
    (c', r') = divMod n rs

osidorkin/haskell-eigen#16

[Ported Issue] Unsupported Modules

http://eigen.tuxfamily.org/dox/unsupported/index.html
Would you be willing to take contributions allowing users to use unsupported code from Eigen?
A lot of the stuff inside of the unsupported modules seems to be well-tested, user-supplied code, as well
as being very useful. For example, the unsupported modules define things such as the Kronecker
Product and FFT.
I would put these in Data.Eigen.Unsupported.X or something. I am willing to start work on such a
contribution(s).

missing functions from refactor

There are some functions missing after the refactor. They were simply forgotten when re-implementing the library. @GregorySchwartz brought some good ones up. If anyone notices any more, please report them here. I will be looking through and re-implementing them, taking note here.

Adding the Sparse Cholesky solvers

I'm new to Eigen and the haskell wrapper--which looks amazing!--so forgive me if this is an already answered and/or obvious question.

I see that the wrapper for Sparse solvers provides the LU and QR but not the simplical Cholesky solvers. Is that a licensing issue (since those are LGPL instead of MPL2), because they depend on external libraries (CHOLMOD ?) or something else?

I'd like to use them. I'm trying to replicate some of the functionality of Rs lme4 package and the simplical cholesky stuff is at the heart of it, at least for problems of any significant size.

I'd be happy to work on a PR--though I have no idea how hard it is!--or a separate library that has eigen as a dependency if that somehow helps with the licensing, dependency issues?

Anyway, any info would be much appreciated! I'm looking forward to using eigen!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.