Leading dimension
来源:互联网 发布:淘宝商品自动下架了 编辑:程序博客网 时间:2024/05/21 14:57
Leading dimension
如果你用LAPACK解过矩阵本征值问题,你一定会接触到这样一个名词,“leading dimension”,比如在函数zheev中。我想绝大部分人在第一次接触这个词的时候都不明白它到底是什么意思。以前我也不明白,今天索性搜了一把,在下面找到了答案。
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?p=661&sid=67c66465dedfcbb6e0612cca7647698f
Suppose that you have a matrix A of size 100x100 which is stored in an array 100x100. In this case LDA is the same as N. Now suppose that you want to work only on the submatrix A(91:100 , 1:100); in this case the number of rows is 10 but LDA=100. Assuming the fortran column-major ordering (which is the case in LAPACK), the LDA is used to define the distance in memory between elements of two consecutive columns which have the same row index. If you call B = A(91:100 , 1:100) then B(1,1) and B(1,2) are 100 memory locations far from each other.
其实之所以设LDA(leading dimension)这个参数主要是考虑到fortran是“列优先”存储数组的原因。这里要解本征值的矩阵是NxN大小的,但是存储这个矩阵的数组A却并不一定非得是NxN大小,可以是M1xM2大小,其中 M1≥N,M2≥N,NxN矩阵要存放在M1xM2数组的左上角,即A(1:N,1:N)部分。这样,当把数组A传给zheev时,zheev通过N来知道要解的矩阵是多大的,通过LDA来知道同一行中相邻两列的元素在内存中相距多远,可见,LDA=M2,其实就是数组A的一列的元素个数,也就是“实际存储时的第一维”的大小。正是由于fortran列优先存储数组,才使得概念上的第一维(行)与实际存储时的第一维(列)不一样。
注1:如果参数A的位置就用数组片段来调用的话则令当别论。例如同样A的大小为M1xM2,那么若调用zheev时,A参数位置处的实参是A(1:N,1:N)的话,则LDA位置处的实参应该是N,而不是M2!
注2:zheev的输出本征矢时,A的每一列代表一个本征矢。
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?p=661&sid=67c66465dedfcbb6e0612cca7647698f
Suppose that you have a matrix A of size 100x100 which is stored in an array 100x100. In this case LDA is the same as N. Now suppose that you want to work only on the submatrix A(91:100 , 1:100); in this case the number of rows is 10 but LDA=100. Assuming the fortran column-major ordering (which is the case in LAPACK), the LDA is used to define the distance in memory between elements of two consecutive columns which have the same row index. If you call B = A(91:100 , 1:100) then B(1,1) and B(1,2) are 100 memory locations far from each other.
其实之所以设LDA(leading dimension)这个参数主要是考虑到fortran是“列优先”存储数组的原因。这里要解本征值的矩阵是NxN大小的,但是存储这个矩阵的数组A却并不一定非得是NxN大小,可以是M1xM2大小,其中 M1≥N,M2≥N,NxN矩阵要存放在M1xM2数组的左上角,即A(1:N,1:N)部分。这样,当把数组A传给zheev时,zheev通过N来知道要解的矩阵是多大的,通过LDA来知道同一行中相邻两列的元素在内存中相距多远,可见,LDA=M2,其实就是数组A的一列的元素个数,也就是“实际存储时的第一维”的大小。正是由于fortran列优先存储数组,才使得概念上的第一维(行)与实际存储时的第一维(列)不一样。
注1:如果参数A的位置就用数组片段来调用的话则令当别论。例如同样A的大小为M1xM2,那么若调用zheev时,A参数位置处的实参是A(1:N,1:N)的话,则LDA位置处的实参应该是N,而不是M2!
注2:zheev的输出本征矢时,A的每一列代表一个本征矢。
转自:http://goodluck1982.blog.sohu.com/94851969.html
0 0
- leading dimension
- Leading dimension
- Leading dimension
- 编程术语及概念(Leading Dimension、哨兵)
- Dimension
- dimension
- Dimension Resources
- Oracle Dimension
- CSS Dimension
- Dimension Role
- Oracle Dimension
- VC Dimension
- Dimension作用?
- dimension适配
- VC Dimension
- css dimension
- Junk Dimension vs Degenerate Dimension
- Fact dimension and degenerate dimension
- Android MotionEvent
- 不能将参数 1 从“const char [12]”转换为“const wchar_t *”
- 输出UUID(python)
- 非阻塞Connect对于select时应注意问题
- Mysql PARTITION 数据表分区技术
- Leading dimension
- 一段高质量的SQL从问问题开始(笔记)
- log4j将记录日志保存到数据库
- 视频监控存储空间大小与传输带宽计算方法
- Android内容提供者(Content provider)
- ViewController加载顺序与self.view
- Android实现更换皮肤功能
- reidis安装,主从复制配置
- 设计模式(十一)代理模式Proxy(结构型)