Fortran Coder

标题: 菜鸟求助:IVF中实矩阵求逆用哪个函数啊? [打印本页]

作者: sailor8    时间: 2016-12-31 10:58
标题: 菜鸟求助:IVF中实矩阵求逆用哪个函数啊?
原先CVF还了解一点,现在用IVF有点迷糊了。求逆矩阵不是.i.了吗?
[Fortran] 纯文本查看 复制代码
program main
    use imsl_libraries
    implicit none
    integer,parameter::n=3
    real::a(n,n)=(/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0/)
    real::b(n,n)=(/5.0,6.0,4.0,8.0,9.0,7.0,2.0,3.0,1.0/)
    real::c(n,n)
    c=.i.a
    write(*,*)c
    end program
求指点
多谢多谢!

作者: vvt    时间: 2016-12-31 11:21
cvf 中自动安装了 4.0 版本的 IMSL
现在您用 IVF,默认是不带有 IMSL 的,并且 4.0 的无法使用。

你需要:
1.安装高版本的IMSL
2.配置并使用

详解本论坛视频教程:http://v.fcode.cn/video-use_library.html
作者: sailor8    时间: 2016-12-31 13:53
vvt 发表于 2016-12-31 11:21
cvf 中自动安装了 4.0 版本的 IMSL
现在您用 IVF,默认是不带有 IMSL 的,并且 4.0 的无法使用。

多谢多谢,先学习一下,有问题再向您请教。
新手的福音啊
作者: weixing1531    时间: 2016-12-31 21:37
矩阵求逆Excel
作者: weixing1531    时间: 2016-12-31 21:38
矩阵求逆Excel有现成的函数
作者: sailor8    时间: 2017-1-1 10:13
经过提升,程序能运行了,不过只要是加上USE operation_x就报错误
        1        Compilation Aborted (code 1)        
不知道是哪里出了问题?
在工具-选项-IVF-compiles里面的includes和lib已经把相关的
    C:\Program Files (x86)\VNI\imsl\fnl600\Intel64\include\dll
    C:\Program Files (x86)\VNI\imsl\fnl600\Intel64\include\static
和C:\Program Files (x86)\VNI\imsl\fnl600\Intel64\lib
都加上了。
纠结啊,求指教,多谢多谢。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Fortran] 纯文本查看 复制代码
program main
    include 'link_fnl_shared.h'
    include 'link_fnl_static.h'
use operation_x !//这句
implicit none
    integer,parameter::m=3,n=3
    integer::mi,ni,iaq,jaq
    real,parameter::hoa=7.0,h=0.1
    real::a(m,n)
    real::t(m,n)
    real::e(m,n)
    !
    open(24,file='test12311339.txt')
    do mi=1,m
       do ni=1,n
        t(mi,ni)=hoa*ni+hoa*mi
        a(mi,ni)=hoa*(ni-1)+hoa*mi
        end do
    end do
    e=a.x.t
    write(24,*)e
    end program

作者: sailor8    时间: 2017-1-1 10:20
weixing1531 发表于 2016-12-31 21:38
矩阵求逆Excel有现成的函数

嗯嗯 是的,不过求逆这个运算是一个大程序里面的一部分,单独拿出来计算可能会不方便了。
谢谢你
作者: vvt    时间: 2017-1-1 10:44
IMSL 的 bug
作者: sailor8    时间: 2017-1-2 08:09
vvt 发表于 2017-1-1 10:44
IMSL 的 bug


有什么解决的建议吗?
多谢多谢了
作者: vvt    时间: 2017-1-2 08:12
1. 用 matmul 代替 .x. 进行矩阵相乘。
2. 用 IMSL 5.0 代替 6.0和7.0(因为它们有bug)
3. 用 MKL 、Lapack 等代替 IMSL 进行求逆。

选其一

作者: sailor8    时间: 2017-1-2 09:42
vvt 发表于 2017-1-2 08:12
1. 用 matmul 代替 .x. 进行矩阵相乘。
2. 用 IMSL 5.0 代替 6.0和7.0(因为它们有bug)
3. 用 MKL 、Lapac ...

好,我尝试一下imsl5.0。
谢谢了~
作者: kerb    时间: 2017-1-6 12:33
本帖最后由 kerb 于 2017-1-6 12:46 编辑

subroutine dgesv        (        integer         N,
integer         NRHS,
double precision, dimension( lda, * )         A,
integer         LDA,
integer, dimension( * )         IPIV,
double precision, dimension( ldb, * )         B,
integer         LDB,
integer         INFO
)               
DGESV computes the solution to system of linear equations A * X = B for GE matrices

Download DGESV + dependencies [TGZ] [ZIP] [TXT]

Purpose:
DGESV computes the solution to a real system of linear equations
    A * X = B,
where A is an N-by-N matrix and X and B are N-by-NRHS matrices.

The LU decomposition with partial pivoting and row interchanges is
used to factor A as
    A = P * L * U,
where P is a permutation matrix, L is unit lower triangular, and U is
upper triangular.  The factored form of A is then used to solve the
system of equations A * X = B.
Parameters
[in]        N       
          N is INTEGER
          The number of linear equations, i.e., the order of the
          matrix A.  N >= 0.
[in]        NRHS       
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrix B.  NRHS >= 0.
[in,out]        A       
          A is DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the N-by-N coefficient matrix A.
          On exit, the factors L and U from the factorization
          A = P*L*U; the unit diagonal elements of L are not stored.
[in]        LDA       
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]        IPIV       
          IPIV is INTEGER array, dimension (N)
          The pivot indices that define the permutation matrix P;
          row i of the matrix was interchanged with row IPIV(i).
[in,out]        B       
          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
          On entry, the N-by-NRHS matrix of right hand side matrix B.
          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
[in]        LDB       
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]        INFO       
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
                has been completed, but the factor U is exactly
                singular, so the solution could not be computed.





欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2