The pc matrix contains the main components as its columns. According to the docs:
Rows correspond to observations and columns correspond to variables. The main components are a local n-by-k matrix. Each column corresponds to one main component, and the columns are in descending order of component variance.
So you can look at the ith column by doing
val pc: Matrix = ... val i: Int = ... for(row <- 0 until pc.numRows) { println(pc(row, i)) }
Update
If you have mat = input matrix
0 0 0 2 4 2 4 9 1 3 3 9 3 2 7 9 6 0 7 7
where each row is one example and each column is a variable, then you can calculate the ATP. The two main components with the greatest dispersion: pc =
0.6072 0.2049 0.3466 0.6626 -0.4674 0.7098 0.4343 -0.1024 0.3225 0.0689
Each column represents a projection direction to obtain one dimension of data reducing the dimension. To get now reduced dimension data, you compute mat * pc , which gives you
2.1588 0.0706 -0.2041 9.5523 6.6652 8.9843 12.8425 5.5844
Here's what your data looks like when projected into a vector space of lower size. Here again, each row represents an example and each column is a variable.
If I understand your question correctly, then you are looking for the columns of the pc matrix, which indicate how much each source dimension affects the projected dimensions. Projection is just a scalar product of the source data with the direction of the projection ( pc columns).
source share