Hi Mike,
thanks for your reply...I've actually been keeping a very close eye on
core.matrix since day 1 and I have to admit I am very very tempted to
start contributing...My research is on Text-mining which as you probably
know is machine-learning on text (mainly sequence-labelling, HMM based
). The problem is (as it always tends to be) time...I'm in my 2nd year
of my Ph.D. and my research just transformed from an idea to something
concrete roughly 3 months ago so things are truly hectic at the moment!
I'm preparing papers, doing lots of coding/experiments etc etc...So for
the moment I physically cannot be of much use I'm afraid...
anyway, that is probably too much detail! What I meant to say is that
for now I'm not looking for something performant...I guess you could say
I was messing about with ways of generating code that constructs
matrices based on 'for'. I cracked it after a couple of hours so I'm
happy...Of course it goes without saying that I'm not going to use my
macro for performance critical code...just fun and games :)
In any case thank you for your reply and a bigger thank you for starting
core.matrix...this is good stuff and the first chance I get I'll jump in!
Jim
On 06/02/13 12:25, Mikera wrote:
Hmmm... sounds like you might want to take a look at the latest
development version core.matrix:
https://github.com/clojure-numerics/core.matrix
You can construct nested vectors of arbitrary shape, e.g.
(new-array 2 3 4 5)
This creates a new 4-dimensional 2x3x4x5 matrix. core.matrix supports
all different kinds of matrix types (e.g. native JBLAS matrices) but
if you want to work with nested Clojure vectors you can just do:
(set-current-implementation [])
On Tuesday, 5 February 2013 23:03:17 UTC+8, Jim foo.bar wrote:
Hi all,
I 'm a bit confused with this - I'm trying to think but I can't!!!
Probably cos I've not had any food yet!
Up till now I thought I could construct matrices with 'for'...So
(for [i
(range 3)] i) gives us a 1d structure (a list)...
(for [i (range 3) j (range 4)] [i j]) gives us a 2d structure
(list of
vectors)
On that basis I wrote the following little macro thinking I'd be
bale to
create matrices with arbitrary dimensions:
(defn matrix [& dim-lengths]
(let [bindings (vec (mapcat #(vector (gensym) `(range ~%))
dim-lengths))
symbols (mapv first (partition 2 bindings))
counts (count symbols)]
`(for ~bindings (if (< counts 1) ~symbols (first ~symbols)))))
Now, even though this expands to the 'for' I want I'm starting to
think
this is not the right approach for matrices...all I get is 2d
structures
regardless of how many dimensions I pass in...
any ideas anyone?
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.