다음: , 상위 문서: Diagonal and Permutation Matrices   [차례][찾아보기]


21.1 Creating and Manipulating Diagonal/Permutation Matrices

A diagonal matrix is defined as a matrix that has zero entries outside the main diagonal; that is, D(i,j) == 0 if i != j. Most often, square diagonal matrices are considered; however, the definition can equally be applied to non-square matrices, in which case we usually speak of a rectangular diagonal matrix.

A permutation matrix is defined as a square matrix that has a single element equal to unity in each row and each column; all other elements are zero. That is, there exists a permutation (vector) p such that P(i,j) == 1 if j == p(i) and P(i,j) == 0 otherwise.

Octave provides special treatment of real and complex rectangular diagonal matrices, as well as permutation matrices. They are stored as special objects, using efficient storage and algorithms, facilitating writing both readable and efficient matrix algebra expressions in the Octave language. The special treatment may be disabled by using the functions disable_diagonal_matrix and disable_permutation_matrix.

= disable_diagonal_matrix ()
옛_값 = disable_diagonal_matrix (새_값)
disable_diagonal_matrix (새_값, "local")

Query or set the internal variable that controls whether diagonal matrices are stored in a special space-efficient format.

The default value is true. If this option is disabled Octave will store diagonal matrices as full matrices.

함수 안에서 "local" 선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.

같이 보기: disable_range, disable_permutation_matrix.

= disable_permutation_matrix ()
옛_값 = disable_permutation_matrix (새_값)
disable_permutation_matrix (새_값, "local")

Query or set the internal variable that controls whether permutation matrices are stored in a special space-efficient format.

The default value is true. If this option is disabled Octave will store permutation matrices as full matrices.

함수 안에서 "local" 선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.

같이 보기: disable_range, disable_diagonal_matrix.

The space savings are significant as demonstrated by the following code.

x = diag (rand (10, 1));
xf = full (x);
sizeof (x)
⇒ 80
sizeof (xf)
⇒ 800

다음: , 상위 문서: Diagonal and Permutation Matrices   [차례][찾아보기]