Using the C++ Math Library    

Selecting a Matrix

Use a matrix index to select a matrix. A matrix index works just like a vector index, except the result is a matrix rather than a vector. For example, let B be the index matrix:

Then, A(B) is:

Note that the example matrix A was chosen so that A(X) = X for all types of one-dimensional indexing. This is not generally the case. For example, if A were changed to A = magic(3),

then A(B) would equal


 Selecting a Vector Selecting the Entire Matrix As a Column Vector