Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×

Comment 4 lines of python and faster (Score 1) 311

fixed logic bug. now 4 lines.

This essentially proves that badly written python is almost as unitelligible as badly written perl.  Interestingly badly written python is easier to debug than badly written perl.  But then again perl-golf is played for characters not lines!  for example, bzip2 is done in 55 perl characters.

def recurse((position, visited),xdim= int(__import__("sys").argv[1]),ydim=
int(__import__("sys").argv[2])):

        map(recurse,sorted([(t,visited+[t]) for t in (lambda t: [ (t[0]+2, t[1]+1), (t[0]+2, t[1]-1), (t[0]-2, t[1]+1), (t[0]-2, t[1]-1), (t[0]-1, t[1]+2), (t[0]-1, t[1]-2),(t[0]+1, t[1]+2),(t[0]+1, t[1]-2)])(position) if 0<=t[0]<xdim and 0<=t[1]<ydim and t not in visited],lambda x,y:cmp(len( [1  for t in [  (-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)]  if (x[0][0]+t[0],x[0][1]+t[1])  in visited ] ),len( [1  for t in [  (-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)]  if (y[0][0]+t[0],y[0][1]+t[1])  in visited ] ))))

        if len(visited) == xdim*ydim: print "success: %s"%str(visited).strip("[]"),__import__("sys").exit()

for ii,jj in [ (i,j) for i in xrange((int(__import__("sys").argv[1])+1)/2) for j in xrange( (int(__import__("sys").argv[2])+1)/2) ]:  recurse(((ii,jj),[(ii,jj)]))

Space

Submission + - Meteorite Causes Illness in Peru (physorg.com)

eldavojohn writes: "A meteorite struck in Peru on Saturday leaving cinders, rock & water boiling out of the ground. Villagers nearby reported headaches & vomiting and attributed it to the event. From the article, "Seven policemen who went to check on the reports also became ill and had to be given oxygen before being hospitalized, Lopez said. Rescue teams and experts were dispatched to the scene, where the meteorite left a 100-foot-wide (30-meter-wide) and 20-foot-deep (six-meter-deep) crater, said local official Marco Limache." It's not yet clear whether this is from the meteorite, gas trapped underground that was released or a chemical reaction between the two."
Programming

Submission + - What is the best java sceintific numerics package?

goombah99 writes: What's the best high performance numerics and scientific environment library in Java? I've been using Python lately because the numerical lib numpy has some very coherent and easy to use matrix syntax, is quite fast, and there are scientific analysis (scipy) and interactive ploting (pylab) packages built on the same data types as Numpy. However, I'm still not always satisfied with the speed since too often the python glue between the calls to numpy becomes the limiting step. I'm evaluating the possibility of shifting to Groovy+Java. That way I get the dynamic script language rapid development advantage (Groovy) and a seemless ability to hand code some java at any glue language bottlenecks. This is a lot more seamless than say Swig or pyfort.

The problem I'm having is I don't know what's the state of the art in Java Numerical libs, science packages and plotting libs. When I google I get a bewildering list of numerical packages, most of which turn out to have ceased development. With others it's not clear which scientific analysis packages share what underlying numerical libs (and thus would be interoperable). Thus I'm asking slashdot for advice.

I don't require the numerics package be native java (I'm willing to compile the libs for the native processor and use optimized array storage formats if there's more than a factor of 3 in performance boost and it's handled transparently in java). The arrays access should have an easy syntax that permits slicing and functions distributed over array elements in a manner reminiscent of matlab or numpy. I should be able to generate automatically sized and labeled 2 and 3-d plots of data easily without converting data types. And there should be a standard scientific library that includes things like fft, and non-linear solvers. Finally, I need either a non-commercial solution or one whose runtimes I can distribute freely, and it needs to be able to compile on linux and hopefully a mac too. I'd be willing to substitute R or Gnuplot graphics if I can easily call them from inside java without too much data format conversion. Any solution needs to be Groovy compatible or it defeats the purpose. Advice?
Patents

Submission + - Patent Peer Review is now operational (peertopatent.org)

Carl Oppedahl writes: "USPTO's pilot program for peer review of pending patent applications is now operational (the early stages of which were discussed in Slashdot here, here, here, and here), and you can see how it actually works. Not every pending US patent application is eligible — only applications on particular subjects that were published within particular date ranges qualify for inclusion.

As you can see some patent applications have had quite few comments posted.

My patent law firm has thus far volunteered two of our clients' patent applications for review in this program. One of them has received one comment so far (it has 77 days left for comments), and the other one has not received any comments so far (it has 43 days left).

I like the user interface for the system:
  • it reminds readers that they must actually read and comment upon the claims
  • it shows how much time is left for comments on each patent application
  • it lets you subscribe to see activity for a particular patent application


I surely hope that this pilot program will succeed."

Programming

Submission + - Scientific and Numerical Java recommendations?

goombah99 writes: What's the best high performance numerics and scientific environment library in Java? I've been using Python lately because the numerical lib numpy has some very coherent and easy to use matrix syntax, is quite fast, and there are scientific analysis (scipy) and interactive ploting (pylab) packages built on the same data types as Numpy. However, I'm still not always satisfied with the speed since too often the python glue between the calls to numpy becomes the limiting step. I'm evaluating the possibility of shifting to Groovy+Java. That way I get the script language rapid development advantage (groovy) and a seemless ability to hand code some java at the glue language bottlenecks.

The problem I'm having is I don't know what's the state of the art in Java Numerical libs, science packages and plotting libs. When I google I get a bewildering list of numerical packages, most of which turn out to have ceased development. With others it's not clear which scientific analysis packages share what underlying numerical libs (and thus would be interoperable). Thus I'm asking slashdot for advice.

I don't require the numerics package be native java (I'm willing to compiled the libs for the native processor and use optimized array storage formats if there's more than a factor of 3 in performance boost and it's handled transparently in java). The arrays access should have an easy syntax that permits slicing and functions distributed over array elements in a manner reminiscent of matlab or numpy. I should be able to generate automatically sized and labeled 2 and 3-d plots of data easily without converting data types. And there should be a standard scientific library that includes things like fft, and non-linear solvers. Finally, I need either a non-commercial solution or one whose runtimes I can distribute freely, and it needs to be able to compile on linux and hopefully a mac too. I'd be willing to substitute R or Gnuplot graphics if I can easily call them from inside java without too much data format conversion.

Slashdot Top Deals

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...