带BLAS功能的打包存储

Packed storage with BLAS function

我想用 A 下三角矩阵和向量 x 计算 A*x。例如:

     1  0  0
A =  2  4  0
     3  5  6

打包存储

 A = (/ 1, 2, 3, 4, 5, 6/) 

 X = (/1, 1, 1/)

现在我想用BLAS函数做A*x,我要把A变回3x3矩阵吗?如果没有,你能给我一些提示吗? (我知道在fortran数组的记忆中,A是连续存储的)

通过检查解决:http://www.icl.utk.edu/~mgates3/docs/lapack.html

program main

  implicit none
  integer :: n
  real*8, allocatable, dimension(:) :: x
  real*8, allocatable, dimension(:) :: A

  n = 3
  allocate(A(n*(n+1)/2))
  allocate(x(n))
  A = 1.0d0
  x = 1.0d0

  ! x will be updated as A*x
  call dtpmv('L', 'N', 'N', n, A, x, 1)

  deallocate(A)
  deallocate(x)

end program main