All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class linear_algebra.Blas_j

java.lang.Object
   |
   +----linear_algebra.Blas_j

public class Blas_j
extends Object

This class contains Java versions of a number of the LINPACK basic linear algebra subroutines (blas):

  1. daxpy_j
  2. ddot_j
  3. dscal_j
  4. dswap_j
  5. dnrm2_j
  6. dcopy_j
  7. drotg_j
It also contains utility routines that the translator found useful while translating the FORTRAN code to Java code. "col" indicates that the routine operates on two columns of a matrix. "colv" indicates that the routine operates on a column of a matrix and a vector. The "p" at the end of dscalp, dnrm2p, and dcopyp indicates that these routines operate on a portion of a vector:
  1. colaxpy_j
  2. colvaxpy_j
  3. colvraxpy_j
  4. coldot_j
  5. colvdot_j
  6. colscal_j
  7. dscalp_j
  8. colswap_j
  9. colnrm2_j
  10. dnrm2p_j
  11. dcopyp_j
  12. colrot_j
  13. sign_j

IMPORTANT: The "_j" suffixes indicate that these routines use Java style indexing. For example, you will see

   for (i = 0; i < n; i++)
rather than (FORTRAN style)
   for (i = 1; i <= n; i++)
To use the "_j" routines you will have to fill elements 0 through n - 1 of vectors rather than elements 1 through n. Versions of these programs that use FORTRAN style indexing are also available. They end with the suffix "_f77".

This class was translated by a statistician from FORTRAN versions of the LINPACK blas. It is NOT an official translation. When public domain Java numerical analysis routines become available from the people who produce LAPACK, then THE CODE PRODUCED BY THE NUMERICAL ANALYSTS SHOULD BE USED.

Meanwhile, if you have suggestions for improving this code, please contact Steve Verrill at steve@ws10.fpl.fs.fed.us.


Constructor Index

 o Blas_j()

Method Index

 o colaxpy_j(int, double, double[][], int, int, int)

This method multiplies a constant times a portion of a column of a matrix and adds the product to the corresponding portion of another column of the matrix --- a portion of col2 is replaced by the corresponding portion of a*col1 + col2.

 o coldot_j(int, double[][], int, int, int)

This method calculates the dot product of portions of two columns of a matrix.

 o colnrm2_j(int, double[][], int, int)

This method calculates the Euclidean norm of a portion of a column of a matrix.

 o colrot_j(int, double[][], int, int, double, double)

This method "applies a plane rotation." It is a modification of the LINPACK function DROT.

 o colscal_j(int, double, double[][], int, int)

This method scales a portion of a column of a matrix by a constant.

 o colswap_j(int, double[][], int, int)

This method interchanges two columns of a matrix.

 o colvaxpy_j(int, double, double[][], double[], int, int)

This method multiplies a constant times a portion of a column of a matrix x[ ][ ] and adds the product to the corresponding portion of a vector y[ ] --- a portion of y[ ] is replaced by the corresponding portion of ax[ ][j] + y[ ].

 o colvdot_j(int, double[][], double[], int, int)

This method calculates the dot product of a portion of a column of a matrix and the corresponding portion of a vector.

 o colvraxpy_j(int, double, double[], double[][], int, int)

This method multiplies a constant times a portion of a vector y[ ] and adds the product to the corresponding portion of a column of a matrix x[ ][ ] --- a portion of column j of x[ ][ ] is replaced by the corresponding portion of ay[ ] + x[ ][j].

 o daxpy_j(int, double, double[], int, double[], int)

This method multiplies a constant times a vector and adds the product to another vector --- dy[ ] = da*dx[ ] + dy[ ].

 o dcopy_j(int, double[], int, double[], int)

This method copies the vector dx[ ] to the vector dy[ ].

 o dcopyp_j(int, double[], double[], int)

This method copies a portion of vector x[ ] to the corresponding portion of vector y[ ].

 o ddot_j(int, double[], int, double[], int)

This method calculates the dot product of two vectors.

 o dnrm2_j(int, double[], int)

This method calculates the Euclidean norm of the vector stored in dx[ ] with storage increment incx.

 o dnrm2p_j(int, double[], int)

This method calculates the Euclidean norm of a portion of a vector x[ ].

 o drotg_j(double[])

This method constructs a Givens plane rotation.

 o dscal_j(int, double, double[], int)

This method scales a vector by a constant.

 o dscalp_j(int, double, double[], int)

This method scales a portion of a vector by a constant.

 o dswap_j(int, double[], int, double[], int)

This method interchanges two vectors.

 o matmat_j(double[][], double[][], double[][], int, int, int)

This method multiplies an n x p matrix by a p x r matrix.

 o mattran_j(double[][], double[][], int, int)

This method obtains the transpose of an n x p matrix.

 o matvec_j(double[][], double[], double[], int, int)

This method multiplies an n x p matrix by a p x 1 vector.

 o sign_j(double, double)

This method implements the FORTRAN sign (not sin) function.

Constructors

 o Blas_j
 public Blas_j()

Methods

 o daxpy_j
 public static void daxpy_j(int n,
                            double da,
                            double dx[],
                            int incx,
                            double dy[],
                            int incy)

This method multiplies a constant times a vector and adds the product to another vector --- dy[ ] = da*dx[ ] + dy[ ]. It uses unrolled loops for increments equal to one. It is a translation from FORTRAN to Java of the LINPACK subroutine DAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, June 3, 1997.

Parameters:
n - The order of the vectors dy[ ] and dx[ ]
da - The constant
dx[ ] - This vector will be multiplied by the constant da
incx - The subscript increment for dx[ ]
dy[ ] - This vector will be added to da*dx[ ]
incy - The subscript increment for dy[ ]
 o ddot_j
 public static double ddot_j(int n,
                             double dx[],
                             int incx,
                             double dy[],
                             int incy)

This method calculates the dot product of two vectors. It uses unrolled loops for increments equal to one. It is a translation from FORTRAN to Java of the LINPACK function DDOT. In the LINPACK listing DDOT is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, June 3, 1997.

Parameters:
n - The order of the vectors dx[ ] and dy[ ]
dx[ ] - vector
incx - The subscript increment for dx[ ]
dy[ ] - vector
incy - The subscript increment for dy[ ]
 o dscal_j
 public static void dscal_j(int n,
                            double da,
                            double dx[],
                            int incx)

This method scales a vector by a constant. It uses unrolled loops for an increment equal to one. It is a translation from FORTRAN to Java of the LINPACK subroutine DSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, June 3, 1997.

Parameters:
n - The order of the vector dx[ ]
da - The constant
dx[ ] - This vector will be multiplied by the constant da
incx - The subscript increment for dx[ ]
 o dswap_j
 public static void dswap_j(int n,
                            double dx[],
                            int incx,
                            double dy[],
                            int incy)

This method interchanges two vectors. It uses unrolled loops for increments equal to one. It is a translation from FORTRAN to Java of the LINPACK function DSWAP. In the LINPACK listing DSWAP is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, June 3, 1997.

Parameters:
n - The order of the vectors dx[ ] and dy[ ]
dx[ ] - vector
incx - The subscript increment for dx[ ]
dy[ ] - vector
incy - The subscript increment for dy[ ]
 o dnrm2_j
 public static double dnrm2_j(int n,
                              double x[],
                              int incx)

This method calculates the Euclidean norm of the vector stored in dx[ ] with storage increment incx. It is a translation from FORTRAN to Java of the LINPACK function DNRM2. In the LINPACK listing DNRM2 is attributed to C.L. Lawson with a date of January 8, 1978. The routine below is based on a more recent DNRM2 version that is attributed in LAPACK documentation to Sven Hammarling. Translated by Steve Verrill, June 3, 1997.

Parameters:
n - The order of the vector x[ ]
x[ ] - vector
incx - The subscript increment for x[ ]
 o dcopy_j
 public static void dcopy_j(int n,
                            double dx[],
                            int incx,
                            double dy[],
                            int incy)

This method copies the vector dx[ ] to the vector dy[ ]. It uses unrolled loops for increments equal to one. It is a translation from FORTRAN to Java of the LINPACK subroutine DCOPY. In the LINPACK listing DCOPY is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, March 1, 1997.

Parameters:
n - The order of dx[ ] and dy[ ]
dx[ ] - vector
incx - The subscript increment for dx[ ]
dy[ ] - vector
incy - The subscript increment for dy[ ]
 o drotg_j
 public static void drotg_j(double rotvec[])

This method constructs a Givens plane rotation. It is a translation from FORTRAN to Java of the LINPACK subroutine DROTG. In the LINPACK listing DROTG is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, March 3, 1997.

Parameters:
rotvec[] - Contains the a,b,c,s values. In Java they cannot be passed as primitive types (e.g., double or int or ...) if we want their return values to be altered.
 o colaxpy_j
 public static void colaxpy_j(int nrow,
                              double a,
                              double x[][],
                              int begin,
                              int j1,
                              int j2)

This method multiplies a constant times a portion of a column of a matrix and adds the product to the corresponding portion of another column of the matrix --- a portion of col2 is replaced by the corresponding portion of a*col1 + col2. It uses unrolled loops. It is a modification of the LINPACK subroutine DAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, February 26, 1997.

Parameters:
nrow - The number of rows involved
a - The constant
x[ ][ ] - The matrix
begin - The starting row
j1 - The id of col1
j2 - The id of col2
 o colvaxpy_j
 public static void colvaxpy_j(int nrow,
                               double a,
                               double x[][],
                               double y[],
                               int begin,
                               int j)

This method multiplies a constant times a portion of a column of a matrix x[ ][ ] and adds the product to the corresponding portion of a vector y[ ] --- a portion of y[ ] is replaced by the corresponding portion of ax[ ][j] + y[ ]. It uses unrolled loops. It is a modification of the LINPACK subroutine DAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, March 1, 1997.

Parameters:
nrow - The number of rows involved
a - The constant
x[ ][ ] - The matrix
y[ ] - The vector
begin - The starting row
j - The id of the column of the x matrix
 o colvraxpy_j
 public static void colvraxpy_j(int nrow,
                                double a,
                                double y[],
                                double x[][],
                                int begin,
                                int j)

This method multiplies a constant times a portion of a vector y[ ] and adds the product to the corresponding portion of a column of a matrix x[ ][ ] --- a portion of column j of x[ ][ ] is replaced by the corresponding portion of ay[ ] + x[ ][j]. It uses unrolled loops. It is a modification of the LINPACK subroutine DAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, March 3, 1997.

Parameters:
nrow - The number of rows involved
a - The constant
y[ ] - The vector
x[ ][ ] - The matrix
begin - The starting row
j - The id of the column of the x matrix
 o coldot_j
 public static double coldot_j(int nrow,
                               double x[][],
                               int begin,
                               int j1,
                               int j2)

This method calculates the dot product of portions of two columns of a matrix. It uses unrolled loops. It is a modification of the LINPACK function DDOT. In the LINPACK listing DDOT is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, February 27, 1997.

Parameters:
nrow - The number of rows involved
x[ ][ ] - The matrix
begin - The starting row
j1 - The id of the first column
j2 - The id of the second column
 o colvdot_j
 public static double colvdot_j(int nrow,
                                double x[][],
                                double y[],
                                int begin,
                                int j)

This method calculates the dot product of a portion of a column of a matrix and the corresponding portion of a vector. It uses unrolled loops. It is a modification of the LINPACK function DDOT. In the LINPACK listing DDOT is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, March 1, 1997.

Parameters:
nrow - The number of rows involved
x[ ][ ] - The matrix
y[ ] - The vector
begin - The starting row
j - The id of the column of the matrix
 o colscal_j
 public static void colscal_j(int nrow,
                              double a,
                              double x[][],
                              int begin,
                              int j)

This method scales a portion of a column of a matrix by a constant. It uses unrolled loops. It is a modification of the LINPACK subroutine DSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, February 27, 1997.

Parameters:
nrow - The number of rows involved
a - The constant
x[ ][ ] - The matrix
begin - The starting row
j - The id of the column
 o dscalp_j
 public static void dscalp_j(int nrow,
                             double a,
                             double x[],
                             int begin)

This method scales a portion of a vector by a constant. It uses unrolled loops. It is a modification of the LINPACK subroutine DSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, March 3, 1997.

Parameters:
nrow - The number of rows involved
a - The constant
x[ ] - The vector
begin - The starting row
 o colswap_j
 public static void colswap_j(int n,
                              double x[][],
                              int j1,
                              int j2)

This method interchanges two columns of a matrix. It uses unrolled loops. It is a modification of the LINPACK function DSWAP. In the LINPACK listing DSWAP is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, February 26, 1997.

Parameters:
n - The number of rows of the matrix
x[ ][ ] - The matrix
j1 - The id of the first column
j2 - The id of the second column
 o colnrm2_j
 public static double colnrm2_j(int nrow,
                                double x[][],
                                int begin,
                                int j)

This method calculates the Euclidean norm of a portion of a column of a matrix. It is a modification of the LINPACK function dnrm2. In the LINPACK listing dnrm2 is attributed to C.L. Lawson with a date of January 8, 1978. The routine below is based on a more recent dnrm2 version that is attributed in LAPACK documentation to Sven Hammarling. Translated and modified by Steve Verrill, February 26, 1997.

Parameters:
nrow - The number of rows involved
x[ ][ ] - The matrix
begin - The starting row
j - The id of the column
 o dnrm2p_j
 public static double dnrm2p_j(int nrow,
                               double x[],
                               int begin)

This method calculates the Euclidean norm of a portion of a vector x[ ]. It is a modification of the LINPACK function dnrm2. In the LINPACK listing dnrm2 is attributed to C.L. Lawson with a date of January 8, 1978. The routine below is based on a more recent dnrm2 version that is attributed in LAPACK documentation to Sven Hammarling. Translated by Steve Verrill, March 3, 1997.

Parameters:
nrow - The number of rows involved
x[ ] - vector
begin - The starting row
 o dcopyp_j
 public static void dcopyp_j(int nrow,
                             double x[],
                             double y[],
                             int begin)

This method copies a portion of vector x[ ] to the corresponding portion of vector y[ ]. It uses unrolled loops. It is a modification of the LINPACK subroutine dcopy. In the LINPACK listing dcopy is attributed to Jack Dongarra with a date of 3/11/78. Translated by Steve Verrill, March 1, 1997.

Parameters:
nrow - The number of rows involved
x[ ] - vector
y[ ] - vector
begin - The starting row
 o colrot_j
 public static void colrot_j(int n,
                             double x[][],
                             int j1,
                             int j2,
                             double c,
                             double s)

This method "applies a plane rotation." It is a modification of the LINPACK function DROT. In the LINPACK listing DROT is attributed to Jack Dongarra with a date of 3/11/78. Translated and modified by Steve Verrill, March 4, 1997.

Parameters:
n - The order of x[ ][ ]
x[ ][ ] - The matrix
j1 - The id of the first column
j2 - The id of the second column
c - "cos"
s - "sin"
 o sign_j
 public static double sign_j(double a,
                             double b)

This method implements the FORTRAN sign (not sin) function. See the code for details. Created by Steve Verrill, March 1997.

Parameters:
a - a
b - b
 o matmat_j
 public static void matmat_j(double a[][],
                             double b[][],
                             double c[][],
                             int n,
                             int p,
                             int r)

This method multiplies an n x p matrix by a p x r matrix. Created by Steve Verrill, March 1997.

Parameters:
a[ ][ ] - The left matrix
b[ ][ ] - The right matrix
c[ ][ ] - The product
n - n
p - p
r - r
 o mattran_j
 public static void mattran_j(double a[][],
                              double at[][],
                              int n,
                              int p)

This method obtains the transpose of an n x p matrix. Created by Steve Verrill, March 1997.

Parameters:
a[ ][ ] - matrix
at[ ][ ] - transpose of the matrix
n - n
p - p
 o matvec_j
 public static void matvec_j(double a[][],
                             double b[],
                             double c[],
                             int n,
                             int p)

This method multiplies an n x p matrix by a p x 1 vector. Created by Steve Verrill, March 1997.

Parameters:
a[ ][ ] - The matrix
b[ ] - The vector
c[ ] - The product
n - n
p - p

All Packages  Class Hierarchy  This Package  Previous  Next  Index