/* ## class FPoPack ## ## This class contains the routines for positive definite matrices ## in packed form. ## */ package edu.rice.linpack.Matrix.FMatrix; import edu.rice.linpack.util.*; import edu.rice.linpack.Vector.*; import edu.rice.linpack.LNumber.*; public class FPoPack extends FPacked { public FPoPack() { super(); order = 0; } public FPoPack(int o) { order = o; float r = (float).5*(o*(o+1)); rows = (int) r; cols = 1; Mat = new float[rows][1]; } public FPoPack(float[] f, int o) { rows = f.length; cols = 1; Mat = new float[rows][cols]; for(int i=0;i 0) { int kj = (int)((float).5*(j*(j+1))); int kk = -1; for(int k=0;k this.Mat[kk][0]) { float S = this.Mat[kk][0]/Math.abs(ek-Z[k]); FUtil.scal(order,S,Z,1); ek *= S; } float wk = ek - Z[k]; float wkm = -ek - Z[k]; float S = Math.abs(wk); float SM = Math.abs(wkm); wk = wk/this.Mat[kk][0]; wkm = wkm/this.Mat[kk][0]; int kj = kk + kp; if(kp < order) { for(int j=kp;j=0;k--) { if(Math.abs(Z[k]) > this.Mat[kk][0]) { float S = this.Mat[kk][0]/Math.abs(Z[k]); FUtil.scal(order,S,Z,1); ynorm *= S; } Z[k] = Z[k]/this.Mat[kk][0]; kk = kk - k - 1; this.axpy(k,-Z[k],1,kk+1,0,Z,1,0); } float S = 1/FUtil.asum(order,Z,1); FUtil.scal(order,S,Z,1); ynorm *= S; return ynorm; } private void solveUZ(float[] Z) { int kk = order*(order+1)/2 - 1; for(int k=order-1;k>=0;k--) { if(Math.abs(Z[k]) > this.Mat[kk][0]) { float S = this.Mat[kk][0]/Math.abs(Z[k]); FUtil.scal(order,S,Z,1); } Z[k] = Z[k]/this.Mat[kk][0]; kk = kk - k - 1; this.axpy(k,-Z[k],1,kk+1,0,Z,1,0); } float S = 1/FUtil.asum(order,Z,1); FUtil.scal(order,S,Z,1); } private float solveTransRV(float[] Z) { int kk = -1; float ynorm = 1; for(int k=0;k this.Mat[kk][0]) { float S = this.Mat[kk][0]/Math.abs(Z[k]); FUtil.scal(order,S,Z,1); ynorm *= S; } Z[k] = Z[k]/this.Mat[kk][0]; } float S = 1/FUtil.asum(order,Z,1); FUtil.scal(order,S,Z,1); ynorm *= S; return ynorm; } public void solve(Vector B, int J) throws WrongDataTypeException { this.solve(B); } public void solve(Vector Be) throws WrongDataTypeException { float[] B = Be.getFloatArray(); int kk = -1; for(int k = 0;k kp) { for(int j=kp;j 0) { for(int k=0;k