diff --git a/build.xml b/build.xml index 68331db..77bcab0 100755 --- a/build.xml +++ b/build.xml @@ -99,6 +99,10 @@ + + + + @@ -142,6 +146,13 @@ + + + + + + @@ -166,7 +177,7 @@ - + diff --git a/demos/clojure/deploy/project-template.clj b/demos/clojure/deploy/project-template.clj new file mode 100755 index 0000000..6bb1836 --- /dev/null +++ b/demos/clojure/deploy/project-template.clj @@ -0,0 +1,22 @@ +(defproject me.lizier/jidt "@VERSION@" + :description "Java Information Dynamics Toolkit (JIDT)" + :url "https://code.google.com/p/information-dynamics-toolkit/" + :mailing-list {:name "jidt-discuss" + :archive "http://groups.google.com/group/jidt-discuss" + :post "jidt-discuss@googlegroups.com" + :subscribe "jidt-discuss+subscribe@googlegroups.com." + :unsubscribe "jidt-discuss+unsubscribe@googlegroups.com"} + :license + { + :name "GNU GPL v3" + :url "http://www.gnu.org/licenses/gpl.html" + :distribution :repo + } + :dependencies [] + :java-source-paths + ["../../../java/source"] + :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"] + :aot :all + :omit-source true + :signing {:gpg-key "joseph.lizier@gmail.com"} +) diff --git a/demos/clojure/deploy/readme.txt b/demos/clojure/deploy/readme.txt new file mode 100755 index 0000000..2898a78 --- /dev/null +++ b/demos/clojure/deploy/readme.txt @@ -0,0 +1,2 @@ +This folder is used for deploying the infodynamics toolkit jar file to clojars.org, such that clojar users can utilise it. It is not required for users who simply wish to use the toolkit in clojar themselves. + diff --git a/demos/clojure/examples/example1TeBinaryData.clj b/demos/clojure/examples/example1TeBinaryData.clj new file mode 100755 index 0000000..0affcca --- /dev/null +++ b/demos/clojure/examples/example1TeBinaryData.clj @@ -0,0 +1,42 @@ +; +; Java Information Dynamics Toolkit (JIDT) +; Copyright (C) 2012, Joseph T. Lizier +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; + +;; = Example 1 - Transfer entropy on binary data = + +; Simple transfer entropy (TE) calculation on binary data using the discrete TE calculator: + +; Import relevant classes: +(import infodynamics.measures.discrete.TransferEntropyCalculatorDiscrete) + +; Generate some random binary data. +(def sourceArray (int-array (take 100 (repeatedly #(rand-int 2))))) +(def destArray (int-array (cons 0 (butlast sourceArray)))) ; shifts sourceArray by 1 +(def sourceArray2 (int-array (take 100 (repeatedly #(rand-int 2))))) + +; Create a TE calculator and run it: +(def teCalc (TransferEntropyCalculatorDiscrete. 2 1)) +(.initialise teCalc) +(.addObservations teCalc sourceArray destArray) +(println "For copied source, result should be close to 1 bit : " + (.computeAverageLocalOfObservations teCalc)) + +(.initialise teCalc) +(.addObservations teCalc sourceArray2 destArray) +(println "For random source, result should be close to 0 bits : " + (.computeAverageLocalOfObservations teCalc)) + diff --git a/demos/clojure/examples/project.clj b/demos/clojure/examples/project.clj new file mode 100755 index 0000000..f1b6de7 --- /dev/null +++ b/demos/clojure/examples/project.clj @@ -0,0 +1,11 @@ +(defproject me.lizier/jidt-clojure-samples "1.0-SNAPSHOT" + :description "Java Information Dynamics Toolkit (JIDT) clojure samples" + :url "https://code.google.com/p/information-dynamics-toolkit/" + :license + { + :name "GNU GPL v3" + :url "http://www.gnu.org/licenses/gpl.html" + :distribution :repo + } + :dependencies [[org.clojure/clojure "1.6.0"] [me.lizier/jidt "LATEST"] ]) +