LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-29-2017, 04:10 AM   #1
januka
LQ Newbie
 
Registered: Sep 2010
Posts: 18

Rep: Reputation: 0
gfortran compiling issue with double complex variable


Hi,
I've been trying to compile a programme and have run into a simple-looking problem. However, I haven't been able to solve it yet. Any ideas are very much appreciated. The programme looks like the following,

Code:
      subroutine rescal(zy,nvar)

      integer nvar,i, nexponent
      double complex zy(nvar)
      double precision maxabs, scalfac

      maxabs = 0.d0
      do i = 1, nvar
        maxabs = max(zabs(zy),maxabs)
      enddo
maxabs((rank 0)) should store the max of zy and maxabs. Simple, right? I try to compile this programme with gfortran and getting the following error. I don't understand as to why the compiler is complaining that maxabs should be rank1 and not rank 0. To my understanding, zabs is the right function to use with a double precision complex number.

gfortran -e -Ofast -ffixed-line-length-none -std=legacy -c -o rescal.o rescal.f
rescal.f:13.8:

maxabs = max(zabs(zy),maxabs)
1
Error: Incompatible ranks 0 and 1 in assignment at (1)
make: *** [rescal.o] Error 1

Last edited by januka; 07-29-2017 at 04:53 AM.
 
Old 07-29-2017, 04:28 PM   #2
januka
LQ Newbie
 
Registered: Sep 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Solved

Code:
      maxabs = 0.d0
      do i = 1, nvar
        maxabs = max(abs(zy(i)),maxabs)
      enddo
 
  


Reply

Tags
compiling, fortran, ranking



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with double complex numbers in C++ AlexBB Programming 10 01-26-2016 10:00 AM
[SOLVED] gfortran linking/compiling with -I and -J flags januka Linux - Newbie 1 09-26-2013 10:56 AM
[SOLVED] bash script problem -- pass complex *one-liner* to a variable RandyTech Linux - Newbie 12 01-27-2013 05:01 PM
gfortran compiling problem, RHEL 4 The_Watcher Linux - Enterprise 1 08-22-2008 11:57 AM
Very complex for newbie, why in some case I can set variable and in other - I can't beep_beep Linux - General 2 09-25-2002 08:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration