Here's one that seems faster than the one you posted:
mbsimp=: 3 : 0
ctr=. _1 [ 'mat maxctrs'=. y. NB. maxctrs: outer, inner loop
clrs=. 0$~$mat
while. (0{maxctrs)>ctr=. >:ctr do.
mat=. ((+*:)^:(>1{maxctrs) 0:) mat
clrs=. (clrs+2*clrs>1)+clr0=. +/1 2</ |mat
mat=. mat*clr0<1
end.
mat;<clrs
)
To compare on my machine:
6!:2 '$run ''''' NB. Original
Rendering...
2.985718
Versus:
6!:2 '''mat clrs''=: mbsimp ((_0.75+1.3*i:1j78)j./1.2*i:1j78);32 32'
0.54757015 NB. 32x32 gives comparable number of iterations.
viewmat clrs
viewmat mat
This is based on someone's (Gene McDonnell's?) old sig.
The first argument to mbsimp " (_0.75+1.3*i:1j78)j./1.2*i:1j78 " gives a
complex matrix centered near the center of the set and encompassing
most or all of it.
On 2/6/07, June Kim <[EMAIL PROTECTED]> wrote:
2007/2/7, Miller, Raul D <[EMAIL PROTECTED]>:
> June Kim wrote:
> > What else can I do to speed it up significantly?
>
> I'd probably start with Chris Reiter's implementation
> of Mandelbrot. A quick test shows his non-optimized
> implementation is several times faster than the one
> you posted here.
>
Did you mean this one?
escapetc=: 2 : 0
#@((,[EMAIL PROTECTED]:)^:(<&({:n)@# *. (<&({.n)@|@{:))^:_) f."0
)
zl_clur=: 4 : 0
w=.-~/9 o.y
h=.-~/11 o.y
xs=.({.y)+w*(i.%<:)1+x
ys=.h*(i:%j.)<.0.5+x*h%w
ys +/ xs
)
mandelt=: (3 : 'y&[EMAIL PROTECTED]: escapetc (10 255) 0')"0
zl_cccr=: 4 : 0
w=.--/y
({.y)+w*((i:%j.) +/ (i:%])) <.-:x
)
How could I get the same(or similar) result using these?
> See also:
> http://www.jsoftware.com/jwiki/Addons
> http://www.jsoftware.com/jwiki/Addons/graphics/fvj3
>
> That said, I don't have time to optimize his work
> for this case. (By optimize I mean: make it not
> do unneeded work.)
>
> --
> Raul
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm