fortran使用MKL函数库中的swap交换两个向量的值
作者:互联网
下面代码使用MKL函数库中的swap交换两个向量的值
program MKL_dotc
use blas95
implicit none
integer, parameter :: n = 5
real(kind=8) :: x(n), y(n)
call random_seed()
call random_number(x)
call random_number(y)
print*, 'before...'
print*, 'x is...'
print*, x
print*, 'y is...'
print*, y
call swap(x, y)
print*, 'after...'
print*, 'x is...'
print*, x
print*, 'y is...'
print*, y
end program MKL_dotc
执行结果如下:
before...
x is...
0.293077156837823 0.778565734242128 0.916142777945908
0.969873565919347 0.876402969702263
y is...
0.351081195679447 0.389913050989903 0.557465489667172
0.600472359936753 0.169660161445436
after...
x is...
0.351081195679447 0.389913050989903 0.557465489667172
0.600472359936753 0.169660161445436
y is...
0.293077156837823 0.778565734242128 0.916142777945908
0.969873565919347 0.876402969702263
标签:...,random,函数库,MKL,fortran,call,swap,print 来源: https://blog.csdn.net/chd_lkl/article/details/96621763