Understanding Lapack_row_major and Lapack_col_major with lda

I have three questions regarding lapack_row_major and lapack_col_major:

1) As far as I understand, if A = [1,2,3,4,5,6] with dimensions 2 * 3, then lapack_row_major leads to [[1,2,3], [4,5, 6]], and lapack_col_major - [[1,3,5], [2,4,6]]?

2) Does any of the row_major or col_major that I select when I want to pass A to the function matter?

3) how are lapack_row_major and lda (leading array dimension) related? Is it true that if I want to pass the m * n-matrix A in the format lapack_row_major to the function, then its lda will be n? and if I pass A as lapack_col_major, then its lda will be m?

thanks

+4
source share
2 answers

, LAPACK LAPACKE. :

LAPACK_ {ROW, COL} _MAJOR: http://www.netlib.org/lapack/lapacke.html#_array_arguments

LD: http://www.netlib.org/lapack/lug/node116.html

, :

  • , ().

LAPACK_{ROW,COL}_MAJOR LAPACKE ( C LAPACK), , , ( C), , major ( ) ( ). , ( 2D-) → " " col → " ".

: C Fortran col-major. , , , . .

, LAPACK_{ROW,COL}_MAJOR , LAPACK/E ( , int N LAPACK LAPACKE).

, A [1,2,3,4,5,6] ( , )

// interpreted as row-major, 2 rows, (note: LDA=3)
A = [[1,2,3],  // a 2x3 matrix
     [4,5,6]]

// interpreted as row-major, 3 rows (note: LDA=2)
A = [[1,2],    // a 3x2 matrix
     [3,4],
     [5,6]]

// interpreted as col-major, 2 col (note: LDA=3)
A = [[1, 4]    // a (different) 3x2 matrix
     [2, 5]
     [3, 6]]

, C, , , . " " LAPACK/E, LAPACK_COL_MAJOR, ( int N int LDA).

  1. . . .

  2. A r c cols, LDA = c. , c. .

. c? int N. , : " , nCols, - "?

: , c, . , LDA = 2 * c, " " LAPACK, , " LDA, ", .

- ? - "" () . LAPACK: (LD LDA).

, , , : " , i i+1. LDA (.. LDA != c) .

col-major, LDA r, ( - ). : " , col i col i+1.

+5

MrDrFenner:

3 lda 1: http://www.netlib.org/utk/forums/netlib/messages/272.html

2 , . eiganvalues.

0

Source: https://habr.com/ru/post/1623591/


All Articles