dgesvd函数

    用到svd分解,老师用的是 svdcmp(float **a, int m, int n, float w[], float **v) 函数。这函数的解释是Given a matrix a[1..m][1..n], this routine computes its singular value decomposition, A = U.W.VT.  The matrix U replaces a on output.  The diagonal matrix of singular values W is output as a vector w[1..n].  The matrix V (not the transpose VT) is output as v[1..n][1..n]。

    具体算法:http://www.tina-vision.net/tina4/doxygen/html/dc/df5/svd_8c.html

    但是关于这个函数,还有些疑问(我没看这函数的源码,也没用过,所以不确定,若有人知道,请告诉我,THX~)

    1、返回值W的储存形式,是有W(i+1)>W(i),还是奇异值按照任意形式储存

    2、关于a,w,v的储存形式,我看到老师算2*2的矩阵svd时,用的是3*3的a来储存,矩阵存在a的右下角2*2里面,w,v也是一样的,要多加一维。

    

     因为想直接用MKL,所以查了一下,发现可以直接用

dgesvd( char *jobu, char *jobvt, MKL_INT *m, MKL_INT *n, double *a, MKL_INT *lda, double *s, double *u, MKL_INT *ldu, double *vt, MKL_INT *ldvt, double *work, MKL_INT *lwork, MKL_INT *info );


这个函数,这里要特别注意储存方式(column major)!!

具体参数含义,请参看http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/index.htm

PS:

1、work is a workspace array, its dimensionmax(1,lwork).

2、lwork Constraints:  ( lwork:The dimension of the arraywork.)

lwork 1

lwork max(3*min(m, n)+max(m, n), 5*min(m,n)) (for real flavors);

lwork 2*min(m, n)+max(m, n) (for complex flavors).

For good performance, lwork must generally be larger.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of thework array, returns this value as the first entry of thework array, and no error message related tolwork is issued byxerbla.SeeApplication Notes for details.

 3、s(i) >= s(i+1)

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值