|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.princeton.repeatedgames.rgsolve.utilities.MatrixTextUtilities
public class MatrixTextUtilities
A utility class for translating arrays and BitSets to String, and the reverse.
| Field Summary | |
|---|---|
static java.text.DecimalFormat |
fullPrec
Decimal format for 16 digits of decimal precision |
| Constructor Summary | |
|---|---|
private |
MatrixTextUtilities()
|
| Method Summary | |
|---|---|
static java.lang.String |
bitSetToZeroOne(java.util.BitSet bitset,
int numcols)
Converts the BitSet bitset into a text matrix of
{0,1}, of dimensions (bitset.size() / numcols) x numcols |
static java.lang.String |
booleanToZeroOne(boolean[][] bools)
Converts boolean[][] into a String of a matrix of {0,1} |
static double[][] |
getMatrixFromString(java.lang.String s,
int M,
int N)
Converts the String s to a double[M][N], truncating
and padding as necessary |
static java.lang.String |
getMatrixString(double[][] array,
int numDigits)
Converts the double[][] array into a textual representation,
entries delimited by spaces, rows by new lines, with numDigits
of precision |
static java.lang.String |
getMaxPrecisionMatrixString(double[][] array)
Converts the double[][] array into a textual representation,
entries delimited by spaces, rows by new lines, with full precision. |
static BitSetFixed |
zeroOneToBitSet(java.lang.String s,
int M,
int N)
Take a String s of an M x N matrix of {0,1}
and converts it into a BitSet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.text.DecimalFormat fullPrec
| Constructor Detail |
|---|
private MatrixTextUtilities()
| Method Detail |
|---|
public static double[][] getMatrixFromString(java.lang.String s,
int M,
int N)
s to a double[M][N], truncating
and padding as necessary
s - M - N -
double[][] of the matrix in the String spublic static java.lang.String getMaxPrecisionMatrixString(double[][] array)
double[][] array into a textual representation,
entries delimited by spaces, rows by new lines, with full precision.
array -
double[][] array
public static java.lang.String getMatrixString(double[][] array,
int numDigits)
double[][] array into a textual representation,
entries delimited by spaces, rows by new lines, with numDigits
of precision
array - numDigits -
double[][] array
public static java.lang.String bitSetToZeroOne(java.util.BitSet bitset,
int numcols)
bitset into a text matrix of
{0,1}, of dimensions (bitset.size() / numcols) x numcols
bitset - numcols -
bitsetpublic static java.lang.String booleanToZeroOne(boolean[][] bools)
boolean[][] into a String of a matrix of {0,1}
bools - the boolean[][] to convert
boolean[][] bools
public static BitSetFixed zeroOneToBitSet(java.lang.String s,
int M,
int N)
s of an M x N matrix of {0,1}
and converts it into a BitSet.
s - M - N -
s
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||