Newsgroups: comp.lang.fortran
From: Martin Jørgensen <megaf...@hotmail.com>
Date: Thu, 22 Nov 2007 23:23:45 +0100
Local: Thurs, Nov 22 2007 5:23 pm
Subject: Re: making even and odd index parameter?
Richard Maine wrote: Aha. Thanks. > Martin Jørgensen <megaf...@hotmail.com> wrote: >> integer, parameter, dimension(4) :: odd(1,3,5,7) > This is almost valid, but doesn't mean what you think. The (1,3,5,7) is > integer, parameter, dimension(4) :: odd = [1,3,5,7] > where I'm using the f2003 square bracket array constructor syntax. If Ok. > your compiler doesn't accept that, substitute (/1,3,5,7/), but do note > that you cannot use just (1,3,5,7). >> even_index = [2 4 6 8 10] > That is fine if you declared even_index and odd_index appropriately. You >> somearray(even_index) = somearray(even_index) * 2.0 That's much better, thanks. >> somearray(odd_index) = somearray(odd_index) * 2.0 > This is ok, once you defined even_index and odd_index appropriately. But > somearray(2::2) = somearray(2::2) * 2.0 !-- For the even ones >> Is it possible? I get compiler error when I try it... Well, I see you figured it out anyway. If you want to see the specific > It helps to say what the compiler error is... and what code it goes error messages, which I personally find irrelevant, you could just make a test-file and try what I suggested (which ofcourse wasn't very good suggestions because I didn't knew any better)... Even though I didn't try your suggestions yet, I would like to thank you Thanks. Regards, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||