2017-01-15 3 views

답변

1

예, 대한 Ref 클래스가 :

MatrixXd G(100,100); // global matrix 

// reference to sub-blocks: 
Ref<MatrixXd> A = G.topLeftCorner(50,50); 
Ref<MatrixXd> B = G.topRightCorner(50,50); 
Ref<MatrixXd> C = G.bottomLeftCorner(50,50); 
Ref<MatrixXd> D = G.bottomRightCorner(50,50); 

// Accessing/modifiying the submatrices: 
A.setOnes(); 
B.setRandom(); 
C.setIdentity(); 
D = A+B+C; 

입니다 constG 경우, 하위 행렬에 Ref<const MatrixXd>을 할 수는 (이들은 물론 읽기 전용).