/* ## class DPoPack ## ## This class contains the routines for positive definite matrices ## in packed form. ## */ package edu.rice.linpack.Matrix.DMatrix; import edu.rice.linpack.util.*; import edu.rice.linpack.Vector.*; import edu.rice.linpack.LNumber.*; public class DPoPack extends DPacked { public DPoPack() { super(); order = 0; } public DPoPack(int o) { order = o; double r = .5*(o*(o+1)); rows = (int) r; cols = 1; Mat = new double[rows][1]; } public DPoPack(double[] f, int o) { rows = f.length; cols = 1; Mat = new double[rows][cols]; for(int i=0;i 0) { int kj = (int)(.5*(j*(j+1))); int kk = -1; for(int k=0;k this.Mat[kk][0]) { double S = this.Mat[kk][0]/Math.abs(ek-Z[k]); DUtil.scal(order,S,Z,1); ek *= S; } double wk = ek - Z[k]; double wkm = -ek - Z[k]; double S = Math.abs(wk); double 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]) { double S = this.Mat[kk][0]/Math.abs(Z[k]); DUtil.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); } double S = 1/DUtil.asum(order,Z,1); DUtil.scal(order,S,Z,1); ynorm *= S; return ynorm; } private void solveUZ(double[] 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]) { double S = this.Mat[kk][0]/Math.abs(Z[k]); DUtil.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); } double S = 1/DUtil.asum(order,Z,1); DUtil.scal(order,S,Z,1); } private double solveTransRV(double[] Z) { int kk = -1; double ynorm = 1; for(int k=0;k this.Mat[kk][0]) { double S = this.Mat[kk][0]/Math.abs(Z[k]); DUtil.scal(order,S,Z,1); ynorm *= S; } Z[k] = Z[k]/this.Mat[kk][0]; } double S = 1/DUtil.asum(order,Z,1); DUtil.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 { double[] B = Be.getDoubleArray(); int kk = -1; for(int k = 0;k kp) { for(int j=kp;j 0) { for(int k=0;k