fortran使用MKL函数库计算两个实数向量的内积

这篇博文简要介绍使用MKL函数库计算两个向量的内积
代码如下:
program MKL_dot
        use blas95
        implicit none
        integer, parameter :: n = 10
        real*8             :: x(n), y(n), res
        
        call random_seed()
        call random_number(x)
        write(*,*) 'the vector x is...'
        write(*,*) x

        call random_number(y)
        write(*,*) 'the vector y is...'
        write(*,*) y        

        res = dot(x, y)
        write(*,*) 'the dot of vector x and y is...'
        write(*,*) res
end program MKL_dot

结果如下:
 the vector x is...
  0.679810766961385       0.940445379325120       0.118188116255211
  0.816592771285391       0.838392989366967       0.849352073015143
  0.266004683268441       0.847329051710184       0.322610789640767
  0.493228510452631
 the vector y is...
  0.376989557893998       0.270279820064913       9.455209506532534E-003
  0.102345081371875       0.396037357702467       0.419892290928794
  0.960550118073242       0.357395240281985       0.350215226303922
  0.206699864272721
 the dot of vector x and y is...
   2.05710372421063

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值