public class TestSVD
extends java.lang.Object
SVD wrapper test
Copyright (C) 2008 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifier and Type | Field and Description |
---|---|
(package private) static double |
CHECK_EPS |
(package private) static double |
S_EPS |
Constructor and Description |
---|
TestSVD() |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
checkSVD(int m,
int n,
double[] a,
double[] s,
double[] u,
double[] vt)
Check that a is
VonaMath.relativeEquals(double, double,
double) u*s*vt up to CHECK_EPS . |
protected static void |
clampColRank(double[] a,
int m,
int n,
int cr,
double s)
Clamp the column rank of a to at most cr.
|
protected static void |
clampRank(double[] a,
int m,
int n,
int cr,
double s)
Clamp the rank of a to at most cr.
|
protected static void |
clampRowRank(double[] a,
int m,
int n,
int cr,
double s)
Clamp the row rank of a to at most cr.
|
protected static double[] |
consRandom(int m,
int n)
cons a random-valued mxn matrix
|
static void |
main(java.lang.String[] arg)
entry point
|
protected static void |
makeDependentCol(double[] a,
int m,
int n,
int dc,
int[] oc,
int ocStart,
double slop)
Rewrite column dc of a as a random linear combination of
columns oc[ocStart to oc.length].
|
protected static void |
makeDependentRow(double[] a,
int m,
int n,
int dr,
int[] or,
int orStart,
double slop)
Rewrite row dr of a as a random linear combination of
rows or[orStart to or.length].
|
protected static void |
shuffle(int[] a)
randomly shuffle a
|
protected static void |
swap(int[] a,
int i,
int j)
swap elements i and j
|
static final double S_EPS
static final double CHECK_EPS
public static void main(java.lang.String[] arg)
protected static double[] consRandom(int m, int n)
protected static void clampRank(double[] a, int m, int n, int cr, double s)
Clamp the rank of a to at most cr.
protected static void clampRowRank(double[] a, int m, int n, int cr, double s)
Clamp the row rank of a to at most cr.
protected static void clampColRank(double[] a, int m, int n, int cr, double s)
Clamp the column rank of a to at most cr.
protected static void shuffle(int[] a)
protected static void swap(int[] a, int i, int j)
protected static void makeDependentRow(double[] a, int m, int n, int dr, int[] or, int orStart, double slop)
Rewrite row dr of a as a random linear combination of rows or[orStart to or.length].
protected static void makeDependentCol(double[] a, int m, int n, int dc, int[] oc, int ocStart, double slop)
Rewrite column dc of a as a random linear combination of columns oc[ocStart to oc.length].
protected static boolean checkSVD(int m, int n, double[] a, double[] s, double[] u, double[] vt)
Check that a is VonaMath.relativeEquals(double, double,
double)
u*s*vt up to CHECK_EPS
.