| 779 | } |
| 780 | |
| 781 | private void qrUpdateQ(Matrix Q, int k, double[] vk, double TwoOverBeta) |
| 782 | { |
| 783 | //We are computing Q' in what we are treating as the column major order, which represents Q in row major order, which is what we want! |
| 784 | for(int j = 0; j < Q.cols(); j++) |
| 785 | { |
| 786 | double y = 0;//y = vk dot A_j |
| 787 | for (int i = k; i < Q.cols(); i++) |
| 788 | y += vk[i] * Q.get(j, i); |
| 789 | |
| 790 | y *= TwoOverBeta; |
| 791 | for (int i = k; i < Q.rows(); i++) |
| 792 | Q.increment(j, i, -y*vk[i]); |
| 793 | |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | private double initalVKNormCompute(int k, int M, double[] vk, Matrix A) |
| 798 | { |