Giter VIP home page Giter VIP logo

clatrix's Introduction

Clatrix matrix

A stupid name for a smart matrix library, because who doesn't love smart matrices? Being implemented as a data type around the native BLAS hooks of jblas gives it speed. Being implemented as a Clojure sequence makes it clever.

Usage

For now, you can read the Marginalia documentation or take a look at a few examples below. (Note: To be updated!)

(in-ns 'clatrix.core)

(matrix (repeat 5 (range 10)))

; A 5x10 matrix
; -------------
; 0.00e+00  1.00e+00  2.00e+00  .  7.00e+00  8.00e+00  9.00e+00
; 0.00e+00  1.00e+00  2.00e+00  .  7.00e+00  8.00e+00  9.00e+00
; 0.00e+00  1.00e+00  2.00e+00  .  7.00e+00  8.00e+00  9.00e+00
; 0.00e+00  1.00e+00  2.00e+00  .  7.00e+00  8.00e+00  9.00e+00
; 0.00e+00  1.00e+00  2.00e+00  .  7.00e+00  8.00e+00  9.00e+00


(from-indices 5 5 *)

; A 5x5 matrix
; ------------
; 0.00e+00  0.00e+00  0.00e+00  0.00e+00  0.00e+00
; 0.00e+00  1.00e+00  2.00e+00  3.00e+00  4.00e+00
; 0.00e+00  2.00e+00  4.00e+00  6.00e+00  8.00e+00
; 0.00e+00  3.00e+00  6.00e+00  9.00e+00  1.20e+01
; 0.00e+00  4.00e+00  8.00e+00  1.20e+01  1.60e+01

(time (solve (rand 1000 1000) (rand 1000)))

; "Elapsed time: 158.216 msecs"
; ....

(time (rank (rand 1000 1000)))

; "Elapsed time: 13469.51 msecs"
; 1000

(let [A (rand 10 14)
      B (* A (t A))     ; B is symmetric
      lu (lu B)
      P (rspectral 10)  ; `respectral` makes positive definite matrices
      G (cholesky P)]   ; so we can get their square root
  (and (= A (c/t (c/t A)))
       (= B (* (:p lu) (:l lu) (:u lu)))
       (= P (* (t G) G))))

; true

Copyright © 2012 Joseph Abrahamson and contributors (see LICENSE.txt)

clatrix's People

Contributors

cbilson avatar ejackson avatar hans avatar mikera avatar quantisan avatar tel avatar

Watchers

 avatar  avatar  avatar

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.