Newsgroups: comp.lang.apl
Path: watmath!watserv1!torn!utcsri!rpi!news.ans.net!malgudi.oar.net!caen!uunet!decwrl!csus.edu!sfsuvax1.sfsu.edu!vpcsc4
From: vpcsc4@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: while & break statements in J (example using simplex algorithm)
Message-ID: <1992Jul29.010314.29840@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Distribution: NA
Date: Wed, 29 Jul 1992 01:03:14 GMT
Lines: 42

I could use help coding a while statement and installing a break.
(This a bare bones version of the simplex algorithm.)

If 
   t =. 0 0 $''
   t =. t, ' bvc =. </\ (<./, {. y. ) = , {. y.'
   t =. t, ' d   =. , (, _1 {."1 y.) % factors =., bvc #"1 y. '
   t =. t, ' bvr =. </\ (>./ d ) = d '
   t =. t, ' factors =. factors % pivot=.'''' $ bvc# , bvr#"2 y.'
   t =. t, ' factors =. ((<: % ]) pivot ) (bvr# i. $ bvr) } factors'
   t =. t, ' y. =. y. -  |: ($ |: y.)  $ , (, bvr#"2 y. ) *"(0 1) factors'
   interation =. t : ''


I want like a function simplex 
where simplex executes 'y. =. interation y.' so long as
the first ((,$}.a) - 1) elements have a negative number.
The psuedo code would be :

   while ( 0> (( <./ , _1}. {. y. )
   y. =. interation y.

Any suggestions?  <>

Also, how could t be changed to include a conditional break
as shown below:

   t =. 0 0 $''
   t =. t, ' bvc =. </\ (<./, {. y. ) = , {. y.'
   t =. t, ' d   =. , (, _1 {."1 y.) % factors =., bvc #"1 y. '
   t =. t, ' bvr =. </\ (>./ d ) = d '
   t =. t, ' factors =. factors % pivot=.'''' $ bvc# , bvr#"2 y.'

if (*./ 0 > bvc#factors ) then break

   t =. t, ' factors =. ((<: % ]) pivot ) (bvr# i. $ bvr) } factors'
   t =. t, ' y. =. y. -  |: ($ |: y.)  $ , (, bvr#"2 y. ) *"(0 1) factors'
   intrn =. t : ''

Thanks,
Emmett
vpcsc4@sfsuvax1.sfsu.edu
