Adding files for deploying to clojure, and adding clojure example 1 (and sample project file)

This commit is contained in:
joseph.lizier 2014-09-08 07:18:15 +00:00
parent 1bf80f8202
commit f9c03e86c4
5 changed files with 89 additions and 1 deletions

View File

@ -99,6 +99,10 @@
<delete dir="${reports.tests}"/>
<delete dir="${unittestsouttoplevel}"/>
<delete dir="${javadocsdir}"/>
<delete dir="demos/clojure/target"/>
<delete file="demos/clojure/pom.xml"/>
<delete file="demos/clojure/pom.xml.asc"/>
<delete file="demos/clojure/project.clj"/>
<delete file="${jarversiondistnamezip}"/>
<delete file="${distnamezip}"/>
<delete file="${jarplainname}"/>
@ -142,6 +146,13 @@
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy file="demos/clojure/deploy/project-template.clj" toFile="demos/clojure/deploy/project.clj" failonerror="false" overwrite="true">
<!-- The template file only exists in SVN - this won't crash ant
if users try to run it though because failonerror="false" -->
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
</target>
<!-- Developer build - builds everything and makes the jar only distribution file -->
@ -166,7 +177,7 @@
<fileset file="InfoDynamicsToolkit.pdf"/>
<fileset file="${versionfile}"/>
<zipfileset dir="java" includes="**/*.java" prefix="java"/>
<zipfileset dir="demos" includes="**/*.*,**/*" prefix="demos"/>
<zipfileset dir="demos" includes="**/*.*,**/*" excludes="clojure/deploy" prefix="demos"/>
<zipfileset dir="javadocs" includes="**/*.*,**/*" prefix="javadocs"/>
<zipfileset dir="notices" includes="**/*.*,**/*" prefix="notices"/>
</zip>

View File

@ -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"}
)

View File

@ -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.

View File

@ -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 <http://www.gnu.org/licenses/>.
;
;; = 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))

View File

@ -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"] ])