/*## ## class DMatrix ## ## This class extends Matrix to represent a Matrix of single precision ## floating point numbers. It contains all the BLAS (basic linear ## algebra subroutines) and other low-level functions common to all ## matrices. ## DMatrix's contain no factoring or solving capabilities. ## ##*/ package edu.rice.linpack.Matrix.DMatrix; import edu.rice.linpack.Matrix.Matrix; import edu.rice.linpack.util.*; import edu.rice.linpack.Vector.*; public abstract class DMatrix extends Matrix { protected double[][] Mat; void cons() { pivot = new int[cols]; } void cons(int i, int j) { Mat = new double[i][j]; rows = i; cols = j; pivot = new int[cols]; } void cons(DMatrix M) { rows = M.rows; cols = M.cols; Mat = new double[rows][cols]; for(int i=0;i 0 && Da != 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0;i 0 && Da != 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0;i 0 && Da != 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0;i 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0;i 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0;i 0){ int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0; i 0){ int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; for(int i=0; i 0 && Da != 1) { int ix = 0; for (int i=0;i 0) { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; double N; for(int i=0;i 0) { int ix = incx; Dmax = Math.abs(Mat[r][c]); for(int i=1;i Dmax) { max = ix; Dmax = Math.abs(Mat[ix+r][c]); } ix += incx; } } return max; } /*## ## rotg - construct a Givens plane rotation ## Tg contains the computed sin and cos values ##*/ public void rotg(int r, int c, Trig Tger) { DTrig Tg = (DTrig) Tger; double Roe = Tg.getB(); double Da = this.Mat[r][c]; double R; if(Math.abs(Da) > Math.abs(Tg.getB())) Roe = Da; double Scale = Math.abs(Da) + Math.abs(Tg.getB()); if(Scale == 0) { Tg.setCos(1); Tg.setSin(0); R = 0; } else { R = Scale*Math.sqrt(Math.pow(Da/Scale,2) + Math.pow(Tg.getB()/Scale,2)); if(Roe < 0) R = -R; Tg.setCos(Da/R); Tg.setSin(Tg.getB()/R); } double Z = 1; if(Math.abs(Da) > Math.abs(Tg.getB())) Z = Tg.getSin(); else if(Tg.getCos() != 0) Z = 1/Tg.getCos(); this.Mat[r][c] = R; Tg.setB(Z); } /*## ## rot applies a plane rotation from the parameters figured from Givens ##*/ public void rot(int n, int incx, int rx, int cx, Matrix B, int incy, int ry, int cy, Trig Tger) { DTrig Tg = (DTrig) Tger; double[][] Mat2 = ((DMatrix) B).Mat; if(n <= 0) return; else { int ix = 0; int iy = 0; if(incx < 0) ix = (-n+1)*incx; if(incy < 0) iy = (-n+1)*incy; double temp; for(int i=0;i