Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Newbie Question...
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave Seaman  
View profile  
 More options Sep 10 2003, 10:10 am
Newsgroups: comp.lang.fortran
From: Dave Seaman <dsea...@no.such.host>
Date: Wed, 10 Sep 2003 14:01:10 +0000 (UTC)
Local: Wed, Sep 10 2003 10:01 am
Subject: Re: Newbie Question...
On 10 Sep 2003 04:22:55 -0700, Andrea wrote:

> Hello Fortran Gurus,
>     I'm not an expert with fortran, but I would like to ask 2
> questions:
> 1) Is there a fortran function/subroutine that returns the indices of
> a vector (matrix) X that are non-zero? (for whom that know matlab,
> like the "find" function).

In what form do you need the indices?  Will a logical array help?  There are
lots of ways to use such arrays in vector operations.

    program bittest

      implicit none

      integer, parameter :: n = 5
      real               :: a(n) = (/ 1.0, 0.0, 2.0, 0.0, 0.0 /)
      logical            :: flag(n)

      flag = a /= 0.0   ! the "/=" operator is sometimes spelled ".ne."

      print *, flag

    end program bittest

This program prints

 T F T F F

--
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/index.cfm?action=book&bookid=228>


 
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.