public class GivensMatrix extends Object implements Matrix
| Constructor and Description |
|---|
GivensMatrix(GivensMatrix that)
Copy constructor.
|
GivensMatrix(int dim,
int i,
int j,
double c,
double s)
Constructs a Givens matrix in the form
\[
G(i,j,c,s) = \begin{bmatrix}
1 & ...
|
| Modifier and Type | Method and Description |
|---|---|
Matrix |
add(Matrix that)
this + that
|
double |
c()
Gets the value of c.
|
static GivensMatrix |
Ctor2x2(double c,
double s)
Same as
new GivensMatrix(2, 1, 2, c, s). |
static GivensMatrix |
CtorFromRho(int dim,
int i,
int j,
double rho)
Constructs a Givens matrix from ρ.
|
static GivensMatrix |
CtorToRotateColumns(int dim,
int j1,
int j2,
double a,
double b)
Constructs a Givens matrix such that [a b] * G = [* 0].
|
static GivensMatrix |
CtorToRotateRows(int dim,
int i1,
int i2,
double a,
double b)
Constructs a Givens matrix such that G * [a b]t = [* 0]t.
|
static GivensMatrix |
CtorToZeroOutEntry(Matrix A,
int i,
int j)
Constructs a Givens matrix such that G * A has 0 in the [i,j] entry.
|
static GivensMatrix |
CtorToZeroOutEntryByTranspose(Matrix A,
int i,
int j)
Constructs a Givens matrix such that Gt * A has 0 in the [i,j]
entry.
|
GivensMatrix |
deepCopy()
The implementation returns an instance created from
this by the copy
constructor of the class, or just this if the instance itself is
immutable. |
boolean |
equals(Object obj) |
double |
get(int i,
int j)
Get the matrix entry at [i,j].
|
Vector |
getColumn(int j)
Get the specified column in the matrix as a vector.
|
Vector |
getRow(int i)
Get the specified row in the matrix as a vector.
|
int |
hashCode() |
int |
i()
Gets the value of i.
|
int |
j()
Gets the value of j.
|
Matrix |
minus(Matrix that)
this - that
|
Matrix |
multiply(Matrix A)
Left multiplication by G, namely, G * A.
|
Vector |
multiply(Vector v)
Right multiply this matrix, A, by a vector.
|
Matrix |
multiplyInPlace(Matrix A)
Left multiplication by G, namely, G * A.
|
Vector |
multiplyInPlace(Vector v)
Right multiplies this matrix, A, by a vector.
|
int |
nCols()
Gets the number of columns.
|
int |
nRows()
Gets the number of rows.
|
GivensMatrix |
ONE()
Get an identity matrix that has the same dimension as this matrix.
|
Matrix |
opposite()
Get the opposite of this matrix.
|
static Matrix |
product(GivensMatrix[] Gs)
Given an array of Givens matrices {Gi},
computes G, where
G = G1 * G2 * ...
|
static Matrix |
product(List<GivensMatrix> Gs) |
double |
rho()
Gets ρ as discussed in the reference.
|
Matrix |
rightMultiply(Matrix A)
Right multiplication by G, namely, A * G.
|
Matrix |
rightMultiplyInPlace(Matrix A)
Right multiplication by G, namely, A * G.
|
Vector |
rotate(Vector x)
Deprecated.
Not supported yet.
|
double |
s()
Gets the value of s.
|
Matrix |
scaled(double c)
Scale this matrix, A, by a constant.
|
void |
set(int row,
int col,
double value)
Deprecated.
GivensMatrix is immutable
|
GivensMatrix |
t()
Get the transpose of this matrix.
|
String |
toString() |
Matrix |
ZERO()
Deprecated.
no zero matrix for GivensMatrix
|
public GivensMatrix(int dim,
int i,
int j,
double c,
double s)
G[i,i] = c (diagonal entry) G[j,j] = c (diagonal entry) G[i,j] = s G[j,i] = -s
dim - the dimension of Gi - ij - jc - cs - spublic GivensMatrix(GivensMatrix that)
that - a Givens matrixpublic static GivensMatrix CtorFromRho(int dim, int i, int j, double rho)
dim - the dimension of Gi - ij - jrho - ρpublic static GivensMatrix Ctor2x2(double c, double s)
new GivensMatrix(2, 1, 2, c, s).c - cs - spublic static GivensMatrix CtorToRotateRows(int dim, int i1, int i2, double a, double b)
dim - the dimension of Gi1 - i1 as in A[i1,i1] = ci2 - i2 as in A[i1,i2] = sa - a as in [a b]tb - b as in [a b]tpublic static GivensMatrix CtorToZeroOutEntry(Matrix A, int i, int j)
A - a matrixi - i as in A[i,j]j - j as in A[i,j]public static GivensMatrix CtorToRotateColumns(int dim, int j1, int j2, double a, double b)
dim - the dimension of Gj1 - j1 as in A[j1,j1] = cj2 - j2 as in A[j1,j2] = sa - a as in [a b]tb - b as in [a b]tpublic static GivensMatrix CtorToZeroOutEntryByTranspose(Matrix A, int i, int j)
A - a matrixi - i as in A[i,j]j - j as in A[i,j]public int i()
public int j()
public double c()
public double s()
public double rho()
@Deprecated public Vector rotate(Vector x)
x - a vectorpublic double get(int i,
int j)
MatrixAccessget in interface MatrixAccessi - the row indexj - the column indexpublic Vector getRow(int i) throws MatrixAccessException
MatrixgetRow in interface Matrixi - the row indexMatrixAccessException - when i < 1, or when i > the number of rowspublic Vector getColumn(int j) throws MatrixAccessException
MatrixgetColumn in interface Matrixj - the column indexMatrixAccessException - when j < 1, or when j > the number of columnspublic GivensMatrix t()
MatrixRingt in interface MatrixRingpublic Matrix multiply(Matrix A)
multiply in interface MatrixRingmultiply in interface Monoid<Matrix>A - a left multiply matrixpublic Matrix multiplyInPlace(Matrix A)
A - a left multiply matrix; it is changed after the operationpublic Vector multiply(Vector v)
Matrixpublic Vector multiplyInPlace(Vector v)
v - a vector; it is changed after the operationpublic Matrix rightMultiply(Matrix A)
A - a right multiply matrixpublic Matrix rightMultiplyInPlace(Matrix A)
A - a left multiply matrix; it is changed after the operationpublic static Matrix product(GivensMatrix[] Gs)
G = G1 * G2 * ... * Gn
Gs - an array of Givens matricespublic static Matrix product(List<GivensMatrix> Gs)
public GivensMatrix ONE()
MatrixRingONE in interface MatrixRingONE in interface Monoid<Matrix>public GivensMatrix deepCopy()
DeepCopyablethis by the copy
constructor of the class, or just this if the instance itself is
immutable.deepCopy in interface MatrixdeepCopy in interface DeepCopyable@Deprecated public void set(int row, int col, double value)
MatrixAccessset in interface MatrixAccessrow - the row indexcol - the column indexvalue - the value to set A[i,j] to@Deprecated public Matrix ZERO()
MatrixRingZERO in interface MatrixRingZERO in interface AbelianGroup<Matrix>public int nRows()
Tablepublic int nCols()
Tablepublic Matrix add(Matrix that)
MatrixRingadd in interface MatrixRingadd in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix minus(Matrix that)
MatrixRingminus in interface MatrixRingminus in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix scaled(double c)
Matrixpublic Matrix opposite()
MatrixRingopposite in interface MatrixRingopposite in interface AbelianGroup<Matrix>Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.