public class SimilarityMatrix extends ReadWriteableMatrix implements ReadWriteable
Modifier | Constructor and Description |
---|---|
protected |
SimilarityMatrix()
Construct an empty similarity matrix.
|
|
SimilarityMatrix(int size)
Construct a similarity matrix with the given size
and allocate the index accordingly.
|
|
SimilarityMatrix(String[] index)
Construct a similarity matrix with the given index
and set the matrix size based on the index length.
|
|
SimilarityMatrix(String[] index,
double[][] data)
Construct a similarity matrix based on the given index
and matrix data.
|
|
SimilarityMatrix(String[] index,
Jama.Matrix data)
Construct a similarity matrix based on the given index
and matrix.
|
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii input.
|
byte[] |
binaryHeader()
Header for binary input.
|
SimilarityMatrix |
clone() |
SimilarityMatrix |
copy() |
String[] |
getIndex()
Get the index
|
String |
getIndexValue(int i)
Get a value from the index
|
int |
indexOf(String value)
Get the offset in the index for a given value
|
SimilarityMatrix |
process(SimilarityMatrixProcessor proc)
Process a copy of this similarity matrix with the
given processor and return the copy.
|
SimilarityMatrix |
processInplace(SimilarityMatrixProcessor proc)
Process this matrix with the given processor.
|
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
setIndexValue(int i,
String value)
Set the value of the index at a given offset
|
String |
toString() |
org.jgrapht.UndirectedGraph<String,org.jgrapht.graph.DefaultEdge> |
toUndirectedUnweightedGraph(double threshold)
Convert the similarity matrix to an unweighted, undirected
graph representation.
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
setData
arrayLeftDivide, arrayLeftDivideEquals, arrayRightDivide, arrayRightDivideEquals, arrayTimes, arrayTimesEquals, chol, cond, constructWithCopy, det, eig, get, getArray, getArrayCopy, getColumnDimension, getColumnPackedCopy, getMatrix, getMatrix, getMatrix, getMatrix, getRowDimension, getRowPackedCopy, identity, inverse, lu, minus, minusEquals, norm1, norm2, normF, normInf, plus, plusEquals, print, print, print, print, qr, random, rank, read, set, setMatrix, setMatrix, setMatrix, setMatrix, solve, solveTranspose, svd, times, times, timesEquals, trace, transpose, uminus
protected SimilarityMatrix()
public SimilarityMatrix(int size)
size
- the size of the matrixpublic SimilarityMatrix(String[] index)
index
- the index.public SimilarityMatrix(String[] index, Jama.Matrix data)
index
- the indexdata
- the matrixpublic SimilarityMatrix(String[] index, double[][] data)
index
- the indexdata
- the matrix datapublic int indexOf(String value)
value
- the valuepublic void setIndexValue(int i, String value)
i
- the offsetvalue
- the valuepublic String getIndexValue(int i)
i
- the offset into the indexpublic void readASCII(Scanner in) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
readASCII
in class ReadWriteableMatrix
in
- source to read from.IOException
- an error reading inputpublic String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
asciiHeader
in class ReadWriteableMatrix
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
readBinary
in class ReadWriteableMatrix
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
binaryHeader
in class ReadWriteableMatrix
public void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
writeASCII
in class ReadWriteableMatrix
out
- sink to write toIOException
- an error writing to outpublic void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
writeBinary
in class ReadWriteableMatrix
out
- sink to write toIOException
- an error writing to outpublic org.jgrapht.UndirectedGraph<String,org.jgrapht.graph.DefaultEdge> toUndirectedUnweightedGraph(double threshold)
threshold
- the thresholdpublic SimilarityMatrix copy()
copy
in class Jama.Matrix
public SimilarityMatrix clone()
clone
in class Jama.Matrix
public SimilarityMatrix process(SimilarityMatrixProcessor proc)
proc
- the processorpublic SimilarityMatrix processInplace(SimilarityMatrixProcessor proc)
proc
- the processor