Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7033325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:03:08+00:00 2026-05-28T01:03:08+00:00

How should I call a Fortran function? I am trying to call DLANSY but

  • 0

How should I call a Fortran function?

I am trying to call DLANSY but it erroneously returns 0. See the code and the program output below.

      SUBROUTINE COND(TYP,N,A,LDA,IPIV,WORK,LWORK,IWORK,INFO,RCOND)

      INTEGER TYP, N, LDA, IPIV(*), IWORK(*), INFO, LWORK
      DOUBLE PRECISION A(LDA,*), ANORM, RCOND, WORK(*)
      CHARACTER*1 UPLO
      EXTERNAL DLANSY, DSYTRF, DSYCON

      IF (TYP .EQ. 0) THEN 
        UPLO = 'L'
      ELSE
        UPLO = 'U'
      ENDIF

      DO I = 1, N
        DO J = 1,N 
          WRITE(*,*) I,J,A(I,J)
        END DO
      END DO

      WRITE(*,*) 'TYPE ',UPLO
      WRITE(*,*) 'N    ',N
      WRITE(*,*) 'LDA  ',LDA

      ANORM = DLANSY('1', UPLO, N, A, LDA, WORK)
C      ANORM = 10;

      WRITE(*,*) 'ANORM  ',ANORM

      END

And what it prints:

           1           1   1.0000000000000000     
           1           2   2.0000000000000000     
           1           3   3.0000000000000000     
           1           4   4.0000000000000000     
           2           1   1.0000000000000000     
           2           2   2.0000000000000000     
           2           3   3.0000000000000000     
           2           4   4.0000000000000000     
           3           1   1.0000000000000000     
           3           2   2.0000000000000000     
           3           3   3.0000000000000000     
           3           4   4.0000000000000000     
           4           1   1.0000000000000000     
           4           2   2.0000000000000000     
           4           3   3.0000000000000000     
           4           4   4.0000000000000000     
 TYPE L
 N               4
 LDA             4
 ANORM     0.0000000000000000   

In the input arrays are of proper size.

What is going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:03:09+00:00Added an answer on May 28, 2026 at 1:03 am

    You need to tell the compiler that DLANSY returns a double precision value, rather than real, which is what you get currently via the implicit typing rules. E.g. with a line like

    double precision, external :: dlansy
    

    Or, if for some strange reason one is limited to some ancient compiler that does not support F90:

    DOUBLE PRECISION DLANSY
    EXTERNAL DLANSY
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The general advice is that you should not call GC.Collect from your code, but
I'm writing code that will call a C function from Fortran using Fortran's C
I am trying to call out to a legacy dll compiled from FORTRAN code.
Many GDI+ classes implement IDisposable, but I'm not sure when I should call Dispose.
I have two WIN32 DLL projects in the solution, main.dll should call a function
http://code.google.com/appengine/docs/python/tools/uploadingdata.html is not clearly understand. Where i should call the bulkloader.py or appcfg.py? Should
Two points -- first, the example is in Fortran, but I think it should
I have a C# program which should call Matlab for running a m-file and
The reference says this: You should call this function from the main thread of
I have a function like: uiModal.simpleModal('<p>This is some content</p>'); Which should call a modal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.