Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cs.dal.ca!silvert From: silvert@cs.dal.ca (Bill Silvert) Newsgroups: comp.lang.fortran Subject: Re: beyond the debate.....HELP!!! (and my opinions...) Summary: rows or columns? Message-ID: <1990Dec3.154406.23176@cs.dal.ca> Date: 3 Dec 90 15:44:06 GMT References: <48577@eerie.acsu.Buffalo.EDU> Sender: silvert@cs.dal.ca.UUCP (Bill Silvert) Reply-To: bill%biomel@cs.dal.ca Organization: Habitat Ecology Div., Bedford Inst. of Oceanography Lines: 42 In article <48577@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes: > >I am in a little bind. I am trying to do the following >and don't know if it is possible, please tell me ASAP; > >I have a main program and a subroutine (well much more >than that, but this is a simplification). The main >program runs some calc's and creates a matrix of numbers >(say MxN). The subroutine needs one row at a time in >array format (say Mx1). The subroutine cannot be >restructured because of its impact on tons of other code. > >can I send one column of a matrix into an array with a >CALL statement, without passing the variables into a >dummy array first (which is what I'll do as a last resort), You refer to rows at one point and columns at another. It makes a big difference. Treating MxN as Mx1 is tricky, but 1xN is easy because of the way that Fortran stores arrays. To handle the mth column: real array(M, N) ... call proc(array(m, 1), N) ... subroutine proc(array, N) real array(1, N) ... should handle it, since the calling procedure passes the address of the first element of the column and the subroutine processes N values starting at the address passed. If you need to process rows, then you may be able to do the following: pass the address of array(1, n) to the subroutine, and have the subroutine process every Mth value in an array of length M*(N-1)+1. -- William Silvert, Habitat Ecology Division, Bedford Inst. of Oceanography P. O. Box 1006, Dartmouth, Nova Scotia, CANADA B2Y 4A2. Tel. (902)426-1577 UUCP=..!{uunet|watmath}!dalcs!biomel!bill BITNET=bill%biomel%dalcs@dalac InterNet=bill%biomel@cs.dal.ca Brought to you by Super Global Mega Corp .com