Results 1 to 6 of 6

Thread: LSLCB and ERSET functions

  1. #1

    LSLCB and ERSET functions

    Hi,

    Does someone knows how to set up a ERSET with LSLCB function?

    Have a look on my program, I tried but didn't work.

    Of course, I put wrong values by propose on dimension.

    program Test_lib

    INCLUDE 'link_fnl_shared_imsl.h'

    USE LSLCB_int
    implicit none

    double complex, dimension(37,1864) :: akg
    double complex, dimension(1864) :: fge
    double complex, dimension(1864) :: xsoluc

    integer i, j, nlca, nuca, lda, n, ipath

    DATA akg/(0.0,0.0), (-2.0,-3.0), (6.0,1.0), (4.0,0.0), (-0.5,3.0),&
    (1.0,1.0), (-2.0,2.0), (3.0,-3.0), (0.0,2.0), (-4.0,-1.0),&
    (1.0,-1.0), (0.0,0.0)/
    DATA fge/(-10.0,-5.0), (9.5,5.5), (12.0,-12.0), (0.0,8.0)/

    CALL ERSET (0, 1, −1)

    CALL dLSLCB (akg, NLCA, NUCA, fge, xsoluc)

    print *,'Libs_Works'
    pause

    end program Test_lib

  2. #2
    Senior Member mecej4's Avatar
    Join Date
    Dec 2009
    Posts
    139
    The bugs have nothing to do with ERSET. ERSET is for use with IMSL routines that have been called correctly, but the values of the input arguments are such that something goes wrong while executing the algorithm in IMSL.

    The external routine dLSLCB is a Fortran 77 style routine, and is not covered by the LSLCB_int module (that module would have helped if you had called D_LSLCB instead of DLSLCB). Instead, you should have added USE numerical_libraries to your caller, and the compiler would have then spotted that you call dLSLCB with the wrong number of arguments (and other errors, if any). Such errors are most likely to cause access violations at run time, if not caught at compile or link time.

    The argument list of DLSLCB is (N, A, LDA, NLCA, NUCA, B, IPATH, X), i.e., 8 arguments. Your call contains 6 arguments, and for even those the type are not correct.

    When you call an F77 entry into IMSL, you are responsible for passing correct arguments: types, dimensions, proper sequence, and correct values for arguments.
    Last edited by mecej4; 08-07-2020 at 08:59 AM.

  3. #3
    Hi,

    Thank you for your advices. I've fixed the code but I'm still have a problem.

    Before, matrixs described aren't the ones I'm using, the ones are on outside files (attached). If you run the code, I have the output message.Error_VS_LSLCB.JPGProgram_LSLCB_error.zip

    program Test_lib

    INCLUDE 'link_fnl_shared_imsl.h'

    use numerical_libraries
    use LSLCB_int
    use error_option_packet

    implicit none

    double complex, dimension(37,1864) :: akg
    double complex, dimension(1864) :: fge
    double complex, dimension(1864) :: xsoluc

    integer i, j, nlca, nuca

    open(47, file = 'akg.k', status = 'old')
    do i=1,37
    do j=1, 1864
    read(47,*) akg(i,j)
    end do
    end do
    close(47)

    open(48, file = 'fge.k', status = 'old')
    do j=1, 1864
    read(48,*) fge(j)
    end do
    close(48)

    nlca=18
    nuca=18

    CALL D_LSLCB (akg, NLCA, NUCA, fge, xsoluc)

    print *,'Libs_Works'
    pause

    end program Test_lib


    So, library doesn't give me a hint what could be the issue. Dimensions and declarations are right, parameters of functions also seem good. Code 0 (0x0) doesn't tell me anything. I was tring to use also ERSET to invoke some detailed error message, but it doesn't work either.

    Do you have another clue how can I solve this? My main difficulty is to descover what is going wrong and why VS is exiting without further explanation.

    I'll appreciate

    Danilo

  4. #4
    Senior Member mecej4's Avatar
    Join Date
    Dec 2009
    Posts
    139
    Depending on which compiler/OS/target architecture and default options you are using to compile and link, you may need to set the EXE stack size higher than the default value. The MS linker has a /stack option, and you may choose, say, /stack:10000000 . Alternatively, you could add the SAVE attribute to the large array, AKG, since that attribute will cause AKG to be assigned in a different segment than the stack.

    After that is taken care of, you will find that there is a problem with the input data, because the program runs and gives the following error message:

    *** FATAL ERROR 1 from DLSLCB. The input matrix is singular. Some of
    *** the diagonal elements of the upper triangular matrix U of the
    *** LU factorization are close to zero.
    Last edited by mecej4; 08-11-2020 at 03:45 AM.

  5. #5
    Hi,

    Thank you for your assessment! I'll check the matrix data.

    Danilo

  6. #6
    Senior Member mecej4's Avatar
    Join Date
    Dec 2009
    Posts
    139
    Danilo,

    I ran your data through the Lapack routine GBSV as an independent check, using the driver code below. The solution vector contains only 6 non-zero elements, and even these six have zero real parts.

    Code:
    program Test_lib
    
    use lapack95
    
    implicit none
    
    integer, parameter :: KL = 18, KU = 18, NEQ = 1864
    
    double complex, save, dimension(2*KL+KU+1,NEQ) :: akg
    double complex, dimension(NEQ,1) :: fge
    
    integer i, j, nlca, nuca
    
    open(47, file = 'akg.k', status = 'old')
    do i=1,KL+KU+1
       read(47,*) akg(i,1:NEQ)
    end do
    close(47)
    
    open(48, file = 'fge.k', status = 'old')
    read(48,*) (fge(j,1), j=1,NEQ)
    close(48)
    
    CALL gbsv (akg, fge)
    
    do i=1, NEQ
       if(fge(i,1) /= (0.0,0.0))print 10, i,fge(i,1)
    end do
    10 format(1x,i4,2x,'(',ES12.4,',',ES12.4,' )')
    end program Test_lib
    The output:

    Code:
        1  (  0.0000E+00,  7.0958E-03 )
        2  (  0.0000E+00,  1.2164E-02 )
        3  (  0.0000E+00,  9.1232E-03 )
        4  (  0.0000E+00,  6.0821E-03 )
        5  (  0.0000E+00,  3.0411E-03 )
        6  (  0.0000E+00,  5.0684E-04 )

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •