Giter Site home page Giter Site logo

aparapi-matrix's Introduction

aparapi-matrix

aparapi-matrix is a core.matrix implementation, and uses aparapi which is API for GPU calculation.

Clojars Project

Installation

  1. download Aparapi from https://code.google.com/p/aparapi/ and extract it.
  2. set :resource-paths, :jvm-opts, :dependencies parameters as below:
(defproject hoge "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :resource-paths ["/Users/bobuhiro11/Aparapi_2012_01_23_MacOSX/aparapi.jar"]
  :jvm-opts ["-Djava.library.path=/Users/bobuhiro11/Aparapi_2012_01_23_MacOSX"]
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [aparapi-matrix "0.1.0-SNAPSHOT"]])

Basic usage

(ns hoge.core
  (:refer-clojure :exclude [* - + == /])
  (:use aparapi-matrix.core)
  (:use clojure.core.matrix)
  (:use clojure.core.matrix.operators)
  (:use clojure.core.matrix.implementations))

;; use aparapi-matrix implementation
(set-current-implementation :aparapi-matrix)
(set-execution-mode :CPU) ; :CPU, :GPU, etc.

;; use matrix library (core.matrix)
(def a (matrix [[2 0] [0 2]]))

(* a [[1 2] [3 4]])

(sqrt a)

(shape (array [[1 2] [3 4] [5 6]])) ; [3 2]

(dimension-count (array [[1 2] [3 4] [5 6]]) 0)

(new-matrix 3 2) ; [[0 0] [0 0] [0 0]]

(set-selection (array [[1 2] [3 4] [5 6]]) :all :all 10)

(* (new-matrix 1000 100) (new-matrix 100 1000))

(print "mode:" last-execution-mode "time:" last-execution-time)

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.