## Class Blas_f77

- java.lang.Object
- edu.stanford.rsl.jpop.fortran.Blas_f77

public class Blas_f77extends Object

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

- isamax_f77
- daxpy_f77
- ddot_f77
- dscal_f77
- dswap_f77
- dnrm2_f77
- dcopy_f77
- drotg_f77

- colisamax_f77
- colaxpy_f77
- colvaxpy_f77
- colvraxpy_f77
- coldot_f77
- colvdot_f77
- colscal_f77
- dscalp_f77
- colswap_f77
- colnrm2_f77
- dnrm2p_f77
- dcopyp_f77
- colrot_f77
- sign_f77

**IMPORTANT:**The "_f77" suffixes indicate that these routines useFORTRAN style indexing. For example, you will see for (i = 1; i <= n; i++)rather than for (i = 0; i < n; i++)To use the "_f77" routines you will have to declare your vectorsand matrices to be one element larger (e.g., v[101] rather thanv[100], and a[101][101] rather than a[100][100]), and you will haveto fill elements 1 through n rather than elements 0 through n - 1.Versions of these programs that use C/Java style indexing willsoon be available. They will end with the suffix "_j".This class was translated by a statistician from FORTRAN versions of the LINPACK blas. It is NOT an official translation. It wastesmemory by failing to use the first elements of vectors. When public domain Java numerical analysis routines become available from the people who produce LAPACK, then

**THE CODE PRODUCEDBY THE NUMERICAL ANALYSTS SHOULD BE USED**.Meanwhile, if you have suggestions for improving thiscode, please contact Steve Verrill at steve@ws13.fpl.fs.fed.us.

### Constructor Summary

Constructors Constructor and Description **Blas_f77**()

### Method Summary

Methods Modifier and Type Method and Description `static void`

**colaxpy_f77**(int nrow, double a, double[][] x, int begin, int j1, int j2)This method multiplies a constant times a portion of a columnof a matrix and adds the product to the corresponding portionof another column of the matrix --- a portion of col2 is replaced by the corresponding portion of a*col1 + col2.`static double`

**coldot_f77**(int nrow, double[][] x, int begin, int j1, int j2)This method calculates the dot product of portions of twocolumns of a matrix.`static int`

**colisamax_f77**(int n, double[][] x, int incx, int begin, int j)This method finds the index of the element of a portion of acolumn of a matrix that has the maximum absolute value.`static double`

**colnrm2_f77**(int nrow, double[][] x, int begin, int j)This method calculates the Euclidean norm of a portion of acolumn of a matrix.`static void`

**colrot_f77**(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 functionDROT.`static void`

**colscal_f77**(int nrow, double a, double[][] x, int begin, int j)This method scales a portion of a column of a matrix by a constant.`static void`

**colswap_f77**(int n, double[][] x, int j1, int j2)This method interchanges two columns of a matrix.`static void`

**colvaxpy_f77**(int nrow, double a, double[][] x, double[] y, int begin, int j)This method multiplies a constant times a portion of a columnof a matrix x[ ][ ] and adds the product to the corresponding portionof a vector y[ ] --- a portion of y[ ] is replaced by the correspondingportion of ax[ ][j] + y[ ].`static double`

**colvdot_f77**(int nrow, double[][] x, double[] y, int begin, int j)This method calculates the dot product of a portion of acolumn of a matrix and the corresponding portion of avector.`static void`

**colvraxpy_f77**(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 portionof a column of a matrix x[ ][ ] --- a portion of column j of x[ ][ ] is replaced by the correspondingportion of ay[ ] + x[ ][j].`static void`

**daxpy_f77**(int n, double da, double[] dx, int incx, double[] dy, int incy)This method multiplies a constant times a vector and adds the productto another vector --- dy[ ] = da*dx[ ] + dy[ ].`static void`

**dcopy_f77**(int n, double[] dx, int incx, double[] dy, int incy)This method copies the vector dx[ ] to the vector dy[ ].`static void`

**dcopyp_f77**(int nrow, double[] x, double[] y, int begin)This method copies a portion of vector x[ ] to the correspondingportion of vector y[ ].`static double`

**ddot_f77**(int n, double[] dx, int incx, double[] dy, int incy)This method calculates the dot product of two vectors.`static double`

**dnrm2_f77**(int n, double[] x, int incx)This method calculates the Euclidean norm of the vectorstored in dx[ ] with storage increment incx.`static double`

**dnrm2p_f77**(int nrow, double[] x, int begin)This method calculates the Euclidean norm of a portionof a vector x[ ].`static void`

**drotg_f77**(double[] rotvec)This method constructs a Givens plane rotation.`static void`

**dscal_f77**(int n, double da, double[] dx, int incx)This method scales a vector by a constant.`static void`

**dscalp_f77**(int nrow, double a, double[] x, int begin)This method scales a portion of a vector by a constant.`static void`

**dswap_f77**(int n, double[] dx, int incx, double[] dy, int incy)This method interchanges two vectors.`static int`

**isamax_f77**(int n, double[] x, int incx)This method finds the index of the element of a vectorthat has the maximum absolute value.`static void`

**matmat_f77**(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.`static void`

**mattran_f77**(double[][] a, double[][] at, int n, int p)This method obtains the transpose of an n x p matrix.`static void`

**matvec_f77**(double[][] a, double[] b, double[] c, int n, int p)This method multiplies an n x p matrix by a p x 1 vector.`static double`

**sign_f77**(double a, double b)This method implements the FORTRAN sign (not sin) function.

### Method Detail

#### isamax_f77

public static int isamax_f77(int n, double[] x, int incx)

This method finds the index of the element of a vectorthat has the maximum absolute value. It is a translation from FORTRAN to Java of the LINPACK function ISAMAX.In the LINPACK listing ISAMAX is attributed to Jack Dongarrawith a date of March 11, 1978.Translated by Steve Verrill, March 10, 1998.

- Parameters:
`n`

- The number of elements to be checked`x[ ]`

- vector`incx`

- The subscript increment for x[ ]

#### colisamax_f77

public static int colisamax_f77(int n, double[][] x, int incx, int begin, int j)

This method finds the index of the element of a portion of acolumn of a matrix that has the maximum absolute value. It is a modification of the LINPACK function ISAMAX.In the LINPACK listing ISAMAX is attributed to Jack Dongarrawith a date of March 11, 1978.Translated by Steve Verrill, March 10, 1998.

- Parameters:
`n`

- The number of elements to be checked`x[ ][ ]`

- The matrix`incx`

- The subscript increment for x[ ][ ]`begin`

- The starting row`j`

- The id of the column

#### daxpy_f77

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

This method multiplies a constant times a vector and adds the productto another vector --- dy[ ] = da*dx[ ] + dy[ ]. It uses unrolled loops for increments equal toone. It is a translation from FORTRAN to Java of the LINPACK subroutineDAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarrawith a date of 3/11/78.Translated by Steve Verrill, February 25, 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[ ]

#### ddot_f77

public static double ddot_f77(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 toone. It is a translation from FORTRAN to Java of the LINPACK functionDDOT. In the LINPACK listing DDOT is attributed to Jack Dongarrawith a date of 3/11/78.Translated by Steve Verrill, February 25, 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[ ]

#### dscal_f77

public static void dscal_f77(int n, double da, double[] dx, int incx)

This method scales a vector by a constant. It uses unrolled loops for an increment equal toone. It is a translation from FORTRAN to Java of the LINPACK subroutineDSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarrawith a date of 3/11/78.Translated by Steve Verrill, February 25, 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[ ]

#### dswap_f77

public static void dswap_f77(int n, double[] dx, int incx, double[] dy, int incy)

This method interchanges two vectors.It uses unrolled loops for increments equal toone. It is a translation from FORTRAN to Java of the LINPACK functionDSWAP. In the LINPACK listing DSWAP is attributed to Jack Dongarrawith a date of 3/11/78.Translated by Steve Verrill, February 25, 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[ ]

#### dnrm2_f77

public static double dnrm2_f77(int n, double[] x, int incx)

This method calculates the Euclidean norm of the vectorstored in dx[ ] with storage increment incx.It is a translation from FORTRAN to Java of the LINPACK functionDNRM2.In the LINPACK listing DNRM2 is attributed to C.L. Lawsonwith a date of January 8, 1978. The routine below is basedon a more recent DNRM2 version that is attributed in LAPACKdocumentation to Sven Hammarling.Translated by Steve Verrill, February 25, 1997.

- Parameters:
`n`

- The order of the vector x[ ]`x[ ]`

- vector`incx`

- The subscript increment for x[ ]

#### dcopy_f77

public static void dcopy_f77(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 toone. It is a translation from FORTRAN to Java of the LINPACK subroutineDCOPY. In the LINPACK listing DCOPY is attributed to Jack Dongarrawith 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[ ]

#### drotg_f77

public static void drotg_f77(double[] rotvec)

This method constructs a Givens plane rotation.It is a translation from FORTRAN to Java of the LINPACK subroutineDROTG. In the LINPACK listing DROTG is attributed to Jack Dongarrawith 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.

#### colaxpy_f77

public static void colaxpy_f77(int nrow, double a, double[][] x, int begin, int j1, int j2)

This method multiplies a constant times a portion of a columnof a matrix and adds the product to the corresponding portionof 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 subroutineDAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarrawith 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

#### colvaxpy_f77

public static void colvaxpy_f77(int nrow, double a, double[][] x, double[] y, int begin, int j)

This method multiplies a constant times a portion of a columnof a matrix x[ ][ ] and adds the product to the corresponding portionof a vector y[ ] --- a portion of y[ ] is replaced by the correspondingportion of ax[ ][j] + y[ ].It uses unrolled loops.It is a modification of the LINPACK subroutineDAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarrawith 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

#### colvraxpy_f77

public static void colvraxpy_f77(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 portionof a column of a matrix x[ ][ ] --- a portion of column j of x[ ][ ] is replaced by the correspondingportion of ay[ ] + x[ ][j].It uses unrolled loops.It is a modification of the LINPACK subroutineDAXPY. In the LINPACK listing DAXPY is attributed to Jack Dongarrawith 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

#### coldot_f77

public static double coldot_f77(int nrow, double[][] x, int begin, int j1, int j2)

This method calculates the dot product of portions of twocolumns of a matrix. It uses unrolled loops.It is a modification of the LINPACK functionDDOT. In the LINPACK listing DDOT is attributed to Jack Dongarrawith 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

#### colvdot_f77

public static double colvdot_f77(int nrow, double[][] x, double[] y, int begin, int j)

This method calculates the dot product of a portion of acolumn of a matrix and the corresponding portion of avector. It uses unrolled loops.It is a modification of the LINPACK functionDDOT. In the LINPACK listing DDOT is attributed to Jack Dongarrawith 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

#### colscal_f77

public static void colscal_f77(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 subroutineDSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarrawith 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

#### dscalp_f77

public static void dscalp_f77(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 subroutineDSCAL. In the LINPACK listing DSCAL is attributed to Jack Dongarrawith 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

#### colswap_f77

public static void colswap_f77(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 functionDSWAP. In the LINPACK listing DSWAP is attributed to Jack Dongarrawith 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

#### colnrm2_f77

public static double colnrm2_f77(int nrow, double[][] x, int begin, int j)

This method calculates the Euclidean norm of a portion of acolumn of a matrix.It is a modification of the LINPACK functiondnrm2.In the LINPACK listing dnrm2 is attributed to C.L. Lawsonwith a date of January 8, 1978. The routine below is basedon a more recent dnrm2 version that is attributed in LAPACKdocumentation 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

#### dnrm2p_f77

public static double dnrm2p_f77(int nrow, double[] x, int begin)

This method calculates the Euclidean norm of a portionof a vector x[ ].It is a modification of the LINPACK functiondnrm2.In the LINPACK listing dnrm2 is attributed to C.L. Lawsonwith a date of January 8, 1978. The routine below is basedon a more recent dnrm2 version that is attributed in LAPACKdocumentation to Sven Hammarling.Translated by Steve Verrill, March 3, 1997.

- Parameters:
`nrow`

- The number of rows involved`x[ ]`

- vector`begin`

- The starting row

#### dcopyp_f77

public static void dcopyp_f77(int nrow, double[] x, double[] y, int begin)

This method copies a portion of vector x[ ] to the correspondingportion of vector y[ ].It uses unrolled loops.It is a modification of the LINPACK subroutinedcopy. In the LINPACK listing dcopy is attributed to Jack Dongarrawith 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

#### colrot_f77

public static void colrot_f77(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 functionDROT. In the LINPACK listing DROT is attributed to Jack Dongarrawith 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"

#### sign_f77

public static double sign_f77(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

#### matmat_f77

public static void matmat_f77(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

#### mattran_f77

public static void mattran_f77(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

#### matvec_f77

public static void matvec_f77(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

**SCaVis 1.8 © jWork.org**