How about this > y=: 1e6 [EMAIL PROTECTED] 1000
s=: y%3 ts '<.s' 0.190772 1.25836e7 ts '<.y%3' 0.209075 2.09721e7 ts 'y<[EMAIL PROTECTED]' 0.209349 2.09722e7 ts 'y<[EMAIL PROTECTED]"0]3' 0.846868 4.19571e6 ts '0.3<[EMAIL PROTECTED]"0 y' 0.84268 4.1959e6 0.846868 4.19571e6 % 0.190772 1.25836e7 4.43916 0.333427 0.846868 4.19571e6 %~ 0.190772 1.25836e7 0.225268 2.99916 I.e. if integerization is done memberwise, the space savings is three times. But at the expense of speed, which should be compensated by special code. --- Roger Hui <[EMAIL PROTECTED]> wrote: > A quick benchmark: > > x=: 1e6 [EMAIL PROTECTED] 0 > y=: 1e6 [EMAIL PROTECTED] 1000 > t=: x*y > > ts=: 6!:2 , 7!:[EMAIL PROTECTED] > ts '<.t' > 0.201745 1.25836e7 > ts '<.x*y' > 0.242125 2.09721e7 > > 0.242125 2.09721e7 % 0.201745 1.25836e7 > 1.20015 1.66662 > > Factor of 1.2 in time and 1.7 in space. Not worth it. > > > > > ----- Original Message ----- > From: Oleg Kobchenko <[EMAIL PROTECTED]> > Date: Monday, February 12, 2007 5:06 pm > Subject: Re: [Jgeneral] large space overhead > > > Ah, this for multiplying fractions. > > (And it's different from integer domain/integer valued > > division <[EMAIL PROTECTED]) > > > > * would be different from <[EMAIL PROTECTED] in such cases: > > > > 255 * 0.1 0.2 0.8 1 > > 25.5 51 204 255 > > 255 <[EMAIL PROTECTED] 0.1 0.2 0.8 1 > > 25 51 204 255 > > > > 0.5 * 10 21 33 > > 5 10.5 16.5 > > 0.5 <[EMAIL PROTECTED] 10 21 33 > > 5 10 16 > > > > The idea of <.@:* is that we should save on the > > allocation of the intermediate floating array, > > and instead store the result in an integer array. > > > > The idea of special <[EMAIL PROTECTED] is to speed up the operation > > in C as compared to evaluating the interpreted > > conjunction in J. I don't know if the speedup > > will be significant. If not then it's not worth it. > > > > The results that don't into integer magnitude domain > > should probably conform with usual J rules. I.e. the > > user is responsible to ensure that the result will > > stay integer. > > > > > > --- Roger Hui <[EMAIL PROTECTED]> wrote: > > > > > How would <[EMAIL PROTECTED] be different from just * ? What > > > would be the result of the following expression on > > > a 32-bit machine? > > > > > > 1e9 <[EMAIL PROTECTED] 2e9 > > > > > > > > > > > > ----- Original Message ----- > > > From: Oleg Kobchenko <[EMAIL PROTECTED]> > > > Date: Monday, February 5, 2007 11:57 am > > > Subject: Re: [Jgeneral] large space overhead > > > > > > > A simple color space transformation could > > > > be done by J expressions. For example, > > > > color/brightness could be as simple as > > > > > > > > Y = C*X + B > > > > > > > > where C is contracts and B is brightness. > > > > > > > > Earlier it was discussed that it would be > > > > good to optimize integral valued division > > > > > > > > <[EMAIL PROTECTED] > > > > > > > > But it also makes sense to optimize integral > > > > valued multiplication > > > > > > > > <[EMAIL PROTECTED] > > > > > > > > or even maybe integral valued polynomial > > > > > > > > <[EMAIL PROTECTED] > > > > > > > > For the above example it would be > > > > > > > > Y = C*X + B > > > > > > > > Y = (B,C) <[EMAIL PROTECTED] X > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ____________________________________________________________________________________ Have a burning question? Go to www.Answers.yahoo.com and get answers from real people who know. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
