For Programmers: Free Programming Magazines  


Home > Archive > Scheme > December 2004 > compute intensive scheme









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author compute intensive scheme
Brandon J. Van Every

2004-11-18, 8:58 pm

I have frequently seen references to Scheme's usage as an embedded scripting
language. Although there are plenty of tasks that do require this sort of
thing, it is of little personal interest to me. I'm mainly interested in
compute intensive uses of a language, such as heavy lifting for 3D graphics
or AI. Can anyone point me at open source examples of compute intensive
uses of Scheme? Something that really breaks a computer.

As far as implementations, I've been interested in Bigloo Scheme for
performance reasons. However, the archive of software pointed at by Bigloo
is very small. Then there's Stalin, which doesn't appear to even have a
webpage, just a FTP site.

--
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA

"The pioneer is the one with the arrows in his back."
- anonymous entrepreneur


Brandon J. Van Every

2004-11-21, 3:58 am

Brandon J. Van Every wrote:
> Can anyone point me at open
> source examples of compute intensive uses of Scheme? Something that
> really breaks a computer.


So I suppose there isn't anything then.

--
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA

Brandon's Law (after Godwin's Law):
"As a Usenet discussion grows longer, the probability of
a person being called a troll approaches one RAPIDLY."

Hans Oesterholt-Dijkema

2004-11-21, 3:58 pm

On Sat, 20 Nov 2004 22:31:28 -0800, Brandon J. Van Every wrote:

I suppose This isn't what you are looking for,
but it *does* take a heavy burden on your computer in terms
of CPU usage and memory usage. E.g. using bigloo with
BIGLOOHEAP=200.

(module test
(main main))

(define (f1 n)
(do
((i 0 (+ i 1))
(c 0))
((>= i n) c)
(set! c (+ c 1))))

(define ff2
(lambda args
(+ (car args) (cadr args))))

(define (f2 n)
(do
((i 0 (+ i 1))
(c 0))
((>= i n) c)
(set! c (ff2 c 1))))

(define (ff3 . args)
(+ (car args) (cadr args)))

(define (f3 n)
(do
((i 0 (+ i 1))
(c 0))
((>= i n) c)
(set! c (ff3 c 1))))

(define (ff4 . args)
(apply + args))

(define (f4 n)
(do
((i 0 (+ i 1))
(c 0))
((>= i n) c)
(set! c (ff4 c 1))))

(define (f5 n)
(do
((i 0 (+ i 1))
(c 0))
((>= i n) c)
(set! c (apply + (list c 1)))))

(define (f7 n)
(do
((i 0 (+ i 1))
(c 0)
(f +))
((>= i n) c)
(set! c (f c 1)))

(define (main argv)
(set! argv (cdr argv))
(cond
((string=? (car argv) "1")
(print "f1:" (f1 (string->number (cadr argv)))))
((string=? (car argv) "2")
(print "f2:" (f2 (string->number (cadr argv)))))
((string=? (car argv) "3")
(print "f3:" (f3 (string->number (cadr argv)))))
((string=? (car argv) "4")
(print "f4:" (f4 (string->number (cadr argv)))))
((string=? (car argv) "5")
(print "f5:" (f5 (string->number (cadr argv)))))
((string=? (car argv) "7")
(print "f7:" (f7 (string->number (cadr argv))))))
0)

Taylor Campbell

2004-11-21, 3:58 pm

The impression I get is that Jeff Siskind wrote Stalin specifically so
he would be enabled to write high-performance light-pattern-processing
(sorry, I'm totally clueless about the right terms in that field)
applications his research is mainly on in Scheme, so you could probably
find some, ah, fairly high-performance Scheme applications in his
software lists.
Brandon J. Van Every

2004-11-21, 3:58 pm

Taylor Campbell wrote:
> The impression I get is that Jeff Siskind wrote Stalin specifically so
> he would be enabled to write high-performance light-pattern-processing
> (sorry, I'm totally clueless about the right terms in that field)
> applications his research is mainly on in Scheme, so you could
> probably find some, ah, fairly high-performance Scheme applications
> in his software lists.


Thanks for the pointer. I'll take a dig at it and see how far I get.

--
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA

Taking risk where others will not.



Aubrey Jaffer

2004-12-02, 3:57 am

"Brandon J. Van Every" <try_vanevery_at_mycompanyname@yahoo.com> writes:

> I have frequently seen references to Scheme's usage as an embedded
> scripting language. Although there are plenty of tasks that do
> require this sort of thing, it is of little personal interest to me.
> I'm mainly interested in compute intensive uses of a language, such as
> heavy lifting for 3D graphics or AI. Can anyone point me at open
> source examples of compute intensive uses of Scheme? Something that
> really breaks a computer.


Download a computer algebra system like
http://swiss.csail.mit.edu/~jaffer/JACAL

Now try to find the intersection of two arbitrary ellipses. The
calculation is double-exponential in the number of variables. Here is a
pared-down version of the problem (axis-aligned ellipses) which takes a
few seconds:

eliminate([(x*s2-a2)^2+(y-c2)^2=r2^2, (x*s1)^2+(y-c1)^2=r1^2], y);

Adding one more variable takes 3 minutes:

eliminate([(x*s2-a2)^2+(y-c2)^2=r2^2, (x*s1-a1)^2+(y-c1)^2=r1^2], y);

Adding another tries my patience:

eliminate([(x*s2-a2)^2+(y-c2)^2=r2^2, (x*s1-a1)^2+(y*t1-c1)^2=r1^2], y);

This is an uncontrived problem domain where a factor of 10 in speed
makes little difference; it wouldn't handle the complexity of even one
additional variable!

-=-=-=-=-

Here is how to set up the general intersection of two ellipses; each
ellipse being those points whose sum of the distances to the two centers
is a constant (d1, d3). Please post if you find a solution.

bash-2.05b$ jacal
scm -ip1 -l /usr/local/lib/jacal/go
..............
JACAL version 1b4, Copyright 1989-2002 Aubrey Jaffer
JACAL comes with ABSOLUTELY NO WARRANTY; for details type `(terms)'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `(terms)' for details.
;;; Type (math) to begin.
type qed; to return to scheme, type help; for help.
e0 : l1^2 = (x-a1)^2+(y-c1)^2;

2 2 2 2 2
e0: 0 = a1 + c1 - l1 - 2 a1 x + x - 2 c1 y + y

e1 : l2^2 = (x-a2)^2+(y-c2)^2;

2 2 2 2 2
e1: 0 = a2 + c2 - l2 - 2 a2 x + x - 2 c2 y + y

e2 : eliminate([e0, e1, l1+l2=d1], [l1, l2]);

4 2 2 4 2 2 2 4 2
e2: 0 = - a1 + 2 a1 a2 - a2 + (- 2 a1 + 2 a2 ) c1 - c1 + (2 a1 -

2 2 2 4 2 2 2 2 2 4
2 a2 + 2 c1 ) c2 - c2 + (2 a1 + 2 a2 + 2 c1 + 2 c2 ) d1 - d1 +

3 2 2 3 2
(4 a1 - 4 a1 a2 - 4 a1 a2 + 4 a2 + (4 a1 - 4 a2) c1 + (- 4 a1 +

2 2 2 2
4 a2) c2 + (- 4 a1 - 4 a2) d1 ) x + (- 4 a1 + 8 a1 a2 - 4 a2 +

2 2 2 2 3 2 2 2
4 d1 ) x + ((4 a1 - 4 a2 ) c1 + 4 c1 + (- 4 a1 + 4 a2 - 4 c1 ) c2 -

2 3 2
4 c1 c2 + 4 c2 + (- 4 c1 - 4 c2) d1 + ((- 8 a1 + 8 a2) c1 + (8 a1 -

2 2 2 2
8 a2) c2) x) y + (- 4 c1 + 8 c1 c2 - 4 c2 + 4 d1 ) y

e3 : l3^2 = (x-a3)^2+(y-c3)^2;

2 2 2 2 2
e3: 0 = a3 + c3 - l3 - 2 a3 x + x - 2 c3 y + y

e4 : l4^2 = (x-a4)^2+(y-c4)^2;

2 2 2 2 2
e4: 0 = a4 + c4 - l4 - 2 a4 x + x - 2 c4 y + y

e5 : eliminate([e3, e4, l3+l4=d3], [l3, l4]);

4 2 2 4 2 2 2 4 2
e5: 0 = - a3 + 2 a3 a4 - a4 + (- 2 a3 + 2 a4 ) c3 - c3 + (2 a3 -

2 2 2 4 2 2 2 2 2 4
2 a4 + 2 c3 ) c4 - c4 + (2 a3 + 2 a4 + 2 c3 + 2 c4 ) d3 - d3 +

3 2 2 3 2
(4 a3 - 4 a3 a4 - 4 a3 a4 + 4 a4 + (4 a3 - 4 a4) c3 + (- 4 a3 +

2 2 2 2
4 a4) c4 + (- 4 a3 - 4 a4) d3 ) x + (- 4 a3 + 8 a3 a4 - 4 a4 +

2 2 2 2 3 2 2 2
4 d3 ) x + ((4 a3 - 4 a4 ) c3 + 4 c3 + (- 4 a3 + 4 a4 - 4 c3 ) c4 -

2 3 2
4 c3 c4 + 4 c4 + (- 4 c3 - 4 c4) d3 + ((- 8 a3 + 8 a4) c3 + (8 a3 -

2 2 2 2
8 a4) c4) x) y + (- 4 c3 + 8 c3 c4 - 4 c4 + 4 d3 ) y

e6 : eliminate([e2, e5], y);
parker

2004-12-03, 7:09 am

http://www.ardice.com/Games/Video_G...ows/3D_Graphics
Brandon J. Van Every

2004-12-03, 4:00 pm

parker wrote:
>

http://www.ardice.com/Games/Video_G...ows/3D_Graphics

What were you suggesting? This web page says a few things related to games
and 3D, but nothing related to Scheme.

--
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA

Taking risk where others will not.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com