package Jampack;
/**
Pivot applys a sequence of pivot operations to the
rows of a matrix. The pivot sequence is contained
in an integer array pvt[], which determines a permution
as follows:
* for (k=0; k<pvt.length; k++)
* swap k and pvt[k];
Both k and pvt[k] represent zero-based references
to the rows of the matrix.
Pivot also has a method to apply the inverse permutation.
Comments: Column pivoting will be added later.
@version Pre-alpha
@author G. W. Stewart
*/
public class Pivot{
/**
Pivots the rows of a Zmat (altered) as specified by a pivot array.
@param A The Zmat (altered)
@param pvt The pivot array
@return The Zmat A with its rows permuted
@exception JampackException
Thrown for inconsistent dimensions.
*/
public static Zmat row(Zmat A, int pvt[])
throws JampackException{
int np = pvt.length;
if (np > A.nrow)
throw new JampackException
("Inconsistent array dimensions");
A.dirty = true;
for (int k=0; k A.nrow)
throw new JampackException
("Inconsistent array dimensions");
A.dirty = true;
for (int k=np-1; k>=0; k--)
for (int j=0; j
Ads help maintain this website.