24小时热门版块排行榜    

CyRhmU.jpeg
查看: 467  |  回复: 2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

lijunjiexm

铁虫 (小有名气)

[求助] double precision versions of dot product?

function dot (x,y,n)
cc-begin
c
c-----------------------------------------------------------------------
c
c     dot (x,y,n)
c
c
c     purpose
c     -------
c
c     dot calculates the dot product of the two n-vectors
c     x and y.
c
cc-doc
c     input arguments
c     ---------------
c
c     x       = vector of length n.
c     y       = vector of length n.
c     n       = dimension of x and y.
c
c     output arguments
c     ----------------
c
c     dot     = value of the function, i.e. dot product of x and y.
c
c     notes
c     -----
c
c     1. dot contains a test for n = 0.
c
c-----------------------------------------------------------------------
cc-end
c
      implicit real*8 (a-h,o-z)
      dimension x(*),y(*)
c
      dot = 0.
      if (n .le. 0) return
c      do 100 i = 1,n
c         dot = dot + x(i)*y(i)
c  100 continue
      dot = ddot(n,x,1,y,1)
      end
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

【答案】应助回帖


lijunjiexm(金币+10): 谢谢,呵呵,好多都不懂,要多加强! 2011-07-20 13:02:44
jjdg(金币+1): 感谢你的积极参与 2011-07-20 14:47:02
这个函数不需要自己写啊,blas 或 lapack 包中就有啊,如果不想用这两个包,自己去 netlib 下搜一下 ddot 也应该有啊……

implicit real*8 (a-h,o-z) 表示凡是以 a-h 以及 o-z 字母开头的变量都是 real*8 类型,即双精度类型的……
3楼2011-07-20 11:50:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 3 个回答

lijunjiexm

铁虫 (小有名气)


dubo(金币+1): 欢迎常来程序语言版讨论 2011-07-31 13:27:46
两个问题,implicit real*8 (a-h,o-z) 什么意思?另一个是如何把dot函数改写成双精度版本的ddot函数?请指教,谢谢
2楼2011-07-20 09:41:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见