Re: benchmarks on a poor-man's matrix concept

2010-03-09 Thread Jonathan Shore
On Mar 9, 2010, at 1:28 AM, Per Vognsen wrote: > Which is preferable depends on the nature of the changes that your > matrices will undergo. For dense linear algebra, it's common for most > of a matrix to change with every operation. Hence you won't reap any > benefits from the persistence of Clo

Re: benchmarks on a poor-man's matrix concept

2010-03-09 Thread Per Vognsen
By the way, I also noticed your logic is wrong. It should be (+ (* i ncol) j) rather than (* i j). -Per On Tue, Mar 9, 2010 at 2:57 AM, Jonathan Shore wrote: > Hi, > I'm still trying to work out the best way to deal with operations on > heterogenous data in clojure.   I have a complex applicatio

Re: benchmarks on a poor-man's matrix concept

2010-03-09 Thread jshore
It looks like the new (deftype ..) may be what I am looking for in terms of binding heterogenous state efficiently. The matrix function was just a test case for how to bind state efficiently. Thanks for all of the responses. On Mar 8, 2:57 pm, Jonathan Shore wrote: > Hi, > > I'm still trying

Re: benchmarks on a poor-man's matrix concept

2010-03-09 Thread Jonathan Shore
On Mar 9, 2010, at 2:41 AM, Per Vognsen wrote: > By the way, I also noticed your logic is wrong. It should be (+ (* i > ncol) j) rather than (* i j). > > -Per Thanks -- I was just trying to explore how to deal with heterogeneous data. No plans to build my own matrix lib. Thanks for spotti

Re: benchmarks on a poor-man's matrix concept

2010-03-09 Thread Per Vognsen
Which is preferable depends on the nature of the changes that your matrices will undergo. For dense linear algebra, it's common for most of a matrix to change with every operation. Hence you won't reap any benefits from the persistence of Clojure's maps. The problem with your first implementation

Re: benchmarks on a poor-man's matrix concept

2010-03-08 Thread Timothy Pratley
On 9 March 2010 06:57, Jonathan Shore wrote: > the second because maps clearly are not "near the metal" maps are actually very very efficiently implemented. Small maps are especially efficient as they are implemented as array maps. user=> (type {:a 1, :b 2}) clojure.lang.PersistentArrayMap At te

benchmarks on a poor-man's matrix concept

2010-03-08 Thread Jonathan Shore
Hi, I'm still trying to work out the best way to deal with operations on heterogenous data in clojure. I have a complex application which has such requirements. I wrote a simple toy matrix as a means to explore closure versus map based implementations. Note that in this case the "data str