Hi,
i use Pharo-1.1-11411 and got a few questions. i looked at the comments of Matrix: it talks about Array2D but this object does not exist? it says "Element-wise matrix arithmetic works", but this is not true: while + - * functions in this way: aNumber + aMatrix, "/" does not always function: aSmallInteger / aMatrix produces an error, because aMatrix is tested with isZero. a simple fix would be to change the first program line in SmallInteger>>/ from: aNumber isZero ifTrue: [^(ZeroDivide dividend: self) signal]. to: (aNumber isNumber and: [aNumber isZero]) ifTrue: [^(ZeroDivide dividend: self) signal]. further aMatrix + aNumber and similar arithmetic dont work. but with the above fix it would work nicely with simple implementations like this: Collection>>/ / aNumber ^aNumber adaptToCollection: self andSend: #/ and so forth. while testing these things with Fractions, i noticed this: printing {3/4} produces this output:{(3/4)}. printing {{0.75}} produces this output:#(#(0.75)). printing {{3/4}} produces this output:{((Array new: 1) at: 1 put: (3/4); yourself)}. i wonder what the last output wants to tell me? does it want to tell me, that the last thing uses up a lot more memory than the first two, and accessing it takes more time, so that i should use the second thing instead, or is it (more or less) just print output related? werner |
long time ago I guess there was a class Array2D which could work as a matrix.
Now I do not remember if it was replaced or rewritten. Stef On Feb 2, 2011, at 9:26 PM, Werner Kassens wrote: > Hi, > i use Pharo-1.1-11411 and got a few questions. > i looked at the comments of Matrix: > > it talks about Array2D but this object does not exist? > > it says "Element-wise matrix arithmetic works", but this is not true: > while + - * functions in this way: aNumber + aMatrix, "/" does not always function: > aSmallInteger / aMatrix produces an error, because aMatrix is tested with isZero. > a simple fix would be to change the first program line in SmallInteger>>/ from: > aNumber isZero ifTrue: [^(ZeroDivide dividend: self) signal]. to: > (aNumber isNumber and: [aNumber isZero]) ifTrue: [^(ZeroDivide dividend: self) signal]. > further aMatrix + aNumber and similar arithmetic dont work. but with the above fix it would work nicely with simple implementations like this: > Collection>>/ > / aNumber > ^aNumber adaptToCollection: self andSend: #/ > and so forth. > > while testing these things with Fractions, i noticed this: > printing {3/4} produces this output:{(3/4)}. > printing {{0.75}} produces this output:#(#(0.75)). > printing {{3/4}} produces this output:{((Array new: 1) at: 1 put: (3/4); yourself)}. > i wonder what the last output wants to tell me? does it want to tell me, that the last thing uses up a lot more memory than the first two, and accessing it takes more time, so that i should use the second thing instead, or is it (more or less) just print output related? > werner > |
In reply to this post by wernerk
Hi Wener,
Have you tried the DhbMatrix at http://www.squeaksource.com/DHBNumerical.html ? Cheers, Hernán 2011/2/2 Werner Kassens <[hidden email]>: > Hi, > i use Pharo-1.1-11411 and got a few questions. > i looked at the comments of Matrix: > > it talks about Array2D but this object does not exist? > > it says "Element-wise matrix arithmetic works", but this is not true: > while + - * functions in this way: aNumber + aMatrix, "/" does not always > function: > aSmallInteger / aMatrix produces an error, because aMatrix is tested with > isZero. > a simple fix would be to change the first program line in SmallInteger>>/ > from: > aNumber isZero ifTrue: [^(ZeroDivide dividend: self) signal]. to: > (aNumber isNumber and: [aNumber isZero]) ifTrue: [^(ZeroDivide dividend: > self) signal]. > further aMatrix + aNumber and similar arithmetic dont work. but with the > above fix it would work nicely with simple implementations like this: > Collection>>/ > / aNumber > ^aNumber adaptToCollection: self andSend: #/ > and so forth. > > while testing these things with Fractions, i noticed this: > printing {3/4} produces this output:{(3/4)}. > printing {{0.75}} produces this output:#(#(0.75)). > printing {{3/4}} produces this output:{((Array new: 1) at: 1 put: (3/4); > yourself)}. > i wonder what the last output wants to tell me? does it want to tell me, > that the last thing uses up a lot more memory than the first two, and > accessing it takes more time, so that i should use the second thing instead, > or is it (more or less) just print output related? > werner > > |
Hi Hernán
i wasn't aware of this, it is interesting indeed. thanks werner > Have you tried the DhbMatrix at http://www.squeaksource.com/DHBNumerical.html ? |
In reply to this post by hernanmd
Hi Hernán,
i had a superficial look at DHBNumerical and it does indeed what i wanted to do, thanks again. i ran DHB-Numerical-Tests and it showed 5 errors.i added this method: DhbNevilleInterpolator>>initialize super initialize. leftErrors :=#(). rightErrors :=#() and the tests showed only 1 error. i havent looked, what the code does, it was only an instinctive fix, hence use with caution. the last error is not fixable in this instinctive way, one would have to understand how DhbClusterFinder actually finds clusters, and i have not yet looked at the doku and dont have the time at the moment. werner |
Thanks Werner, I will check later with the VW image too but I've
integrated your fix. I've splitted the tests to their own package. The repository is world writable so feel free to add future improvements. Hernán 2011/2/3 Werner Kassens <[hidden email]>: > Hi Hernán, > i had a superficial look at DHBNumerical and it does indeed what i wanted to > do, thanks again. > i ran DHB-Numerical-Tests and it showed 5 errors.i added this method: > DhbNevilleInterpolator>>initialize > super initialize. > leftErrors :=#(). > rightErrors :=#() > and the tests showed only 1 error. i havent looked, what the code does, it > was only an instinctive fix, hence use with caution. the last error is not > fixable in this instinctive way, one would have to understand how > DhbClusterFinder actually finds clusters, and i have not yet looked at the > doku and dont have the time at the moment. > werner > > |
Could you add that didier agreed to release his code under MIT
Tx Stef On Feb 3, 2011, at 4:43 PM, Hernán Morales Durand wrote: > Thanks Werner, I will check later with the VW image too but I've > integrated your fix. I've splitted the tests to their own package. The > repository is world writable so feel free to add future improvements. > > Hernán > > 2011/2/3 Werner Kassens <[hidden email]>: >> Hi Hernán, >> i had a superficial look at DHBNumerical and it does indeed what i wanted to >> do, thanks again. >> i ran DHB-Numerical-Tests and it showed 5 errors.i added this method: >> DhbNevilleInterpolator>>initialize >> super initialize. >> leftErrors :=#(). >> rightErrors :=#() >> and the tests showed only 1 error. i havent looked, what the code does, it >> was only an instinctive fix, hence use with caution. the last error is not >> fixable in this instinctive way, one would have to understand how >> DhbClusterFinder actually finds clusters, and i have not yet looked at the >> doku and dont have the time at the moment. >> werner >> >> > |
It seems only Paul DeBruicker can do that, he's the project admin.
Paul? 2011/2/3 Stéphane Ducasse <[hidden email]>: > Could you add that didier agreed to release his code under MIT > Tx > > Stef > > On Feb 3, 2011, at 4:43 PM, Hernán Morales Durand wrote: > >> Thanks Werner, I will check later with the VW image too but I've >> integrated your fix. I've splitted the tests to their own package. The >> repository is world writable so feel free to add future improvements. >> >> Hernán >> >> 2011/2/3 Werner Kassens <[hidden email]>: >>> Hi Hernán, >>> i had a superficial look at DHBNumerical and it does indeed what i wanted to >>> do, thanks again. >>> i ran DHB-Numerical-Tests and it showed 5 errors.i added this method: >>> DhbNevilleInterpolator>>initialize >>> super initialize. >>> leftErrors :=#(). >>> rightErrors :=#() >>> and the tests showed only 1 error. i havent looked, what the code does, it >>> was only an instinctive fix, hence use with caution. the last error is not >>> fixable in this instinctive way, one would have to understand how >>> DhbClusterFinder actually finds clusters, and i have not yet looked at the >>> doku and dont have the time at the moment. >>> werner >>> >>> |
In reply to this post by hernanmd
Hi Hernán,
a fix for the last error in DHBNumerical would be to change DhbEuclideanCluster>>centerOn to: centerOn: aVector "(c) Copyrights Didier BESSET, 2000, all rights reserved. Initial code: 2/16/00 " center := aVector. accumulator := DhbVectorAccumulator new: (aVector ifNil:[0] ifNotNil: [aVector size]). i am glad that i am able to download a package and im certain i would mess up everything if i would try to upload something, hence i would appreciate it, if you would do that if you deem it appropriate. werner |
In reply to this post by hernanmd
On 02/03/2011 02:25 PM, Hernán Morales Durand wrote:
> It seems only Paul DeBruicker can do that, he's the project admin. > Paul? > OK. I did that. Is it important to link to Didier's email in the project? I also added Hernán as an admin. Let me know if there's anything else. Paul > 2011/2/3 Stéphane Ducasse<[hidden email]>: >> Could you add that didier agreed to release his code under MIT >> Tx >> >> Stef >> >> On Feb 3, 2011, at 4:43 PM, Hernán Morales Durand wrote: >> >>> Thanks Werner, I will check later with the VW image too but I've >>> integrated your fix. I've splitted the tests to their own package. The >>> repository is world writable so feel free to add future improvements. >>> >>> Hernán >>> >>> 2011/2/3 Werner Kassens<[hidden email]>: >>>> Hi Hernán, >>>> i had a superficial look at DHBNumerical and it does indeed what i wanted to >>>> do, thanks again. >>>> i ran DHB-Numerical-Tests and it showed 5 errors.i added this method: >>>> DhbNevilleInterpolator>>initialize >>>> super initialize. >>>> leftErrors :=#(). >>>> rightErrors :=#() >>>> and the tests showed only 1 error. i havent looked, what the code does, it >>>> was only an instinctive fix, hence use with caution. the last error is not >>>> fixable in this instinctive way, one would have to understand how >>>> DhbClusterFinder actually finds clusters, and i have not yet looked at the >>>> doku and dont have the time at the moment. >>>> werner >>>> >>>> |
Free forum by Nabble | Edit this page |