1

I am trying to achieve multiplication in array for doing PCA in java

I calculated mean and substrtacted it from each x values.Next I need to find covarience

So inorder to find that I need to multiply all the combinations in a given array

 [a,b,c] --> (aa)(ab)(ac)(bb)(bc)(cc)

How to construct a matrix of all possible products?

Whether taking subset and multiplying solves the problem?

4

1 回答 1

1

您正在计算矩阵乘积。说A = [a, b, c](水平向量),你得到一个明显对称的矩阵:

M = t A 。一个

矩阵的上半部分由所有可能的产品组成。

aa ab ac
ba bb bc
ca cb cc

计算时,您可以使用 symetry :

for(int i=0; i<len; i++) {
    for (int j=0; j<=i; j++) { // do not go up to len but stop at i ...
        // computations ...
    }
}
于 2014-07-15T08:55:55.780 回答