Re: Matrix Algebra
- Posted by Arthur Adamson <euclid at HORANDATA.NET> Dec 09, 1996
- 1462 views
At 09:08 PM 12/8/96 EST, you wrote: >---------------------- Information from the mail header ----------------------- >Sender: Euphoria Programming for MS-DOS <EUPHORIA at >MIAMIU.ACS.MUOHIO.EDU> >Poster: Robert Craig <72614.1667 at COMPUSERVE.COM> >Subject: Re: Matrix Algebra >------------------------------------------------------------------------------- > >Arthur Adamson writes: >> global type vector(integer len) >> --type vector(x) creates and initializez ax x element vector to 0 >> >> sequence s >> s = {0.0} >> >> for i = 2 to len by 1 do s = s & {0} >> end for >> return s >> end type > >In Euphoria a "type" should return 0 (FALSE) or non-zero (TRUE). >Perhaps you mean "function". > >In this code and some similar code that you posted I would rather >see something like: > > repeat(0, x) -- standard Euphoria library routine, repeats 0 x times > >rather than a "&" or append() loop. repeat() is simpler, executes faster, and >handles the case of length 0 correctly. (Of course by initializing s >to the empty sequence, {}, and running the for-loop from 1 to n, >the loop method above could also handle length-0 correctly). > >You can initialize a "2-dimensional" sequence using: > > z = repeat(repeat(0,x), y) > >and so on for 3-d, 4-d etc. > >Other than that, I think a matrix algebra package could be quite useful. >I don't know of anyone who is working on one. > >Regards, > Rob Craig > Rapid Deployment Software > ------------------------------- Rob, thanks for the help. I will incorporate your suggestions but not real soon since I will be gone for a month or so. Bye Art Arthur P. Adamson, The Engine Man, euclid at mail.horandata.net