Git Product home page Git Product logo

hlinear's Introduction

HLinear

HLinear is a Haskell implementation of the PLE decomposition of matrices over division rings. It writes an arbitrary matrix as a product of a permutation matrix, a lower triangular matrix with diagonal entries 1, and an echelon matrix.

Features:

Installation

  1. Install stack.
  2. Install git.
  3. Install flint.
  4. Create a working directory for HLinear and its dependencies:
mkdir hlinear-all; cd hlinear-all
  1. Get natural-test:
git clone https://github.com/martinra/natural-test.git
  1. Get vector-test:
git clone https://github.com/martinra/vector-test.git
  1. Get algebraic-structures:
git clone https://github.com/martinra/algebraic-structures.git
  1. Get hflint:
git clone https://github.com/martinra/hflint.git
  1. Get HLinear:
git clone https://github.com/martinra/hlinear.git
  1. Build HLinear:
cd hlinear
stack build
  1. Test HLinear:
stack test

The log file with the test results can be found at .stack-work/logs/hlinear-0.0.1-test.log

  1. Run a simple benchmark:
stack bench

The log file with the benchmark results can be found at .stack-work/logs/hlinear-0.0.1-bench.log

How to use

This is just a sketchy illustration of how to interact with HLinear from Haskell. For details and code you can immediately start adapting to your needs, see HLinear-example.

(...various imports...)

main :: IO ()
main = do
  let m = M.fromListsUnsafe [[1,2,3],[4,5,6]] :: Matrix FMPQ
      hk = D.unPLEDecomposition $ FU.pleDecompositionFoldUnfold m
      e = Hk.echelonForm hk
      em = EF.toMatrix e
  putStrLn "echelon form:"
  print em

Output:

echelon form:
[ 1/1 2/1 3/1 ]
[ 0/1 1/1 2/1 ]

License

GPLv3, see LICENSE.

hlinear's People

Contributors

aghitza avatar martinra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

andrewdmeier

hlinear's Issues

stack build fails (linker error) on hlinear with lts-5.17 and higher (works with lts-5.16)

Everything is fine with stackage lts-5.16, but we get this error at the end with lts-5.17 and 5.18:

Linking .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/debug-hlinear/debug-hlinear ...
    /opt/ghitza/hlinear-all/hlinear/.stack-work/install/x86_64-linux/lts-5.17/7.10.3/lib/x86_64-linux-ghc-7.10.3/hflint-0.0.1-5w3Xjs5N6UC5sWbFNGNEZl/libHShflint-0.0.1-5w3Xjs5N6UC5sWbFNGNEZl.a(flint_define_wrappers.o): In function `nmod_inv_wrapper':
    (.text+0x12e): undefined reference to `flint_throw' 
    /opt/ghitza/hlinear-all/hlinear/.stack-work/install/x86_64-linux/lts-5.17/7.10.3/lib/x86_64-linux-ghc-7.10.3/hflint-0.0.1-5w3Xjs5N6UC5sWbFNGNEZl/libHShflint-0.0.1-5w3Xjs5N6UC5sWbFNGNEZl.a(flint_define_wrappers.o): In function `nmod_div_wrapper': 
    (.text+0x182): undefined reference to `flint_throw' 
    collect2: error: ld returned 1 exit status

cannot build

Hi,

When I tried stack build, I got the following error message:

[49 of 68] Compiling HLinear.NormalForm.FoldUnfold.ReduceEchelonForm.FractionFree ( src/HLinear/NormalForm/FoldUnfold/ReduceEchelonForm/FractionFree.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/HLinear/NormalForm/FoldUnfold/ReduceEchelonForm/FractionFree.o )

src/HLinear/NormalForm/FoldUnfold/ReduceEchelonForm/FractionFree.hs:50:19: error:
    • No instance for (MonadZip Vector)
        arising from a use of ‘mzipWith’
    • In the expression:
        mzipWith (\ a an -> mulSubMul a den an r2) r3 rn3
      In an equation for ‘r3'’:
          r3' = mzipWith (\ a an -> mulSubMul a den an r2) r3 rn3
      In an equation for ‘normalize’:
          normalize (EchelonFormRow on rn) (EchelonFormRow o r, s)
            = (EchelonFormRow o $ r1 <> zero `V.cons` r3' <> r4', on)
            where
                (r1, r234) = V.splitAt (on - o) r
                r34 = V.tail r234
                (r23, r4) = V.splitAt (s - on) r234
                r2 = V.head r23
                ....

Could you let me know how to fix it? Thanks for any help you can provide!

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.