|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfomat.vectorspace.IMatrix
public class IMatrix
IMatrix represents the relations between two IObjectSet:s. The IMatrixCell class represents the elements of this IMatrix. This is implemented considering sparse matrices. The IMatrixCells are stored in a DoubleHashMap and are the non zero matrix elements.
Field Summary | |
---|---|
private DoubleHashMap |
cellMap
|
private IObjectSet |
cols
|
private static float |
maxW
|
private java.util.HashMap<IObject,java.lang.Float> |
objectGlobalWeightMap
|
private IObjectSet |
rows
|
Constructor Summary | |
---|---|
IMatrix(IMatrix m)
Copy constructor. |
|
IMatrix(java.lang.String columnLabel,
java.lang.String rowLabel)
|
Method Summary | |
---|---|
boolean |
addCell(IMatrixCell mc)
Add a IMatrixCell. |
boolean |
addCell(int ri,
int ci,
float weight)
Add the value of a column in a row |
boolean |
addCell(int ri,
int ci,
float localCount,
float weight)
Add the value of a column in a row |
boolean |
addCell(int ri,
int ci,
float localCount,
float localWeight,
float weight)
Add the value of a column in a row |
void |
addColumnIObject(IObject colObj)
Adds a Column IObject to the matrix. |
void |
addDocument(java.lang.String d,
int di)
adds a Document as a Row to the matrix |
void |
addDocument(java.lang.String d,
java.lang.String f,
int di)
adds a Document as a Row to the matrix |
void |
addRowIObject(IObject rowObj)
Adds a Row IObject to the matrix. |
void |
addWord(java.lang.String w,
int ws)
adds a Word as Column to the matrix |
void |
addWord(java.lang.String w,
int ws,
float globalWeight)
adds a Word as a Column IObject to the matrix |
double |
avgColsInRows()
|
double |
avgRowsInCols()
|
boolean |
columnIObjectSet(IObjectSet ios)
|
IObjectGroup |
constructCorrespondingGroup(IObjectGroup group)
Returns the corresponding group, i.e. |
java.util.Vector |
getAllCells()
Returns the DoubleHashMap containing all non zero elements of the IMatrix. |
IMatrixCell |
getCell(IObject row,
IObject col)
Returns the IMatrixCell for the IObject "row" in the "row" IObjectSet and the IObject "col" in the "column" IObjectSet |
DoubleHashMap |
getCellMap()
Returns the DoubleHashMap containing all non zero elements of the IMatrix. |
java.util.Vector |
getCellsWith(IObject co)
Returns a Vector of all the IMatrixCells that contains the given IObject. |
java.util.Vector |
getCellsWithIObjectRestrictedToGroup(IObject io,
IObjectGroup restrictionGroup)
Returns a Vector of the IMatrixCell:s that contains the given IObject AND any of the IObjects in the restrictionGroup. |
java.util.HashSet |
getColumnIMatrixCellsForRowObject(IObject rowObject)
|
IObjectSet |
getColumnIObjectSet()
Returns the "column" IObjectSet. |
IObjectGrouping |
getCurrentColumnGrouping()
Returns the current IObjectGrouping for the columns. |
IObjectGrouping |
getCurrentRowGrouping()
Returns the current IObjectGrouping for the rows. |
java.awt.Dimension |
getCurrentSize()
Returns a Dimension with x-size as the number of "columns" and y-size as the number of "rows" of the IMatrix. |
float |
getGlobalWeight(IObject io)
Returns 0 if the IObject has not been weighted. |
java.util.HashSet<IObject> |
getOtherIObjectsForIObject(IObject io)
Returns all IObject:s the specified IObject share a IMatrixCell with. |
java.util.HashSet |
getRowIMatrixCellsForColumnObject(IObject colObject)
Returns a Vector of the IMatrixCells that contains the given IObject. |
IObjectSet |
getRowIObjectSet()
Returns the "row" IObjectSet. |
java.awt.Dimension |
getSize()
Returns a Dimension with x-size as the number of "columns" and y-size as the number of "rows" of the IMatrix. |
java.util.HashMap<IObject,java.lang.Float> |
getTotalWeight(boolean row,
boolean localWeight)
Returns the total weight for each object along the specified dimension. |
void |
invertMatrix()
|
void |
purgeMatrixToCurrentGroupings()
Removes all IObjects that's not in the current IObjectGroupings from the sets and all their IObjectGroupings. |
void |
removeAllCells()
Revmove all IMatrixCell from the IMatrix. |
void |
removeCell(IMatrixCell mc)
Removes a IMatrixCell from the IMatrix. |
void |
removeCells(IVector<IMatrixCell> ivec)
|
void |
resort()
Resorts the IObjectSet:s "rows" and "cols" according to their current IObjectGroupings. |
boolean |
rowIObjectSet(IObjectSet ios)
|
void |
saveIMatrix(java.io.File file)
|
void |
saveIObjectGroupingFile(IObjectGrouping grouping,
java.io.File file)
|
void |
setColumnIObjectSet(IObjectSet set)
Sets the "column" IObjectSet. |
void |
setGlobalWeight(IObject io,
float globalWeight)
|
void |
setRowIObjectSet(IObjectSet set)
Sets the "row" IObjectSet. |
IMatrix |
subMatrix(IObjectGroup rowGroup,
IObjectGroup colGroup)
Returns a copy of the specified portion of the matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private IObjectSet rows
private IObjectSet cols
private DoubleHashMap cellMap
private static float maxW
private java.util.HashMap<IObject,java.lang.Float> objectGlobalWeightMap
Constructor Detail |
---|
public IMatrix(java.lang.String columnLabel, java.lang.String rowLabel)
public IMatrix(IMatrix m)
Method Detail |
---|
public IMatrix subMatrix(IObjectGroup rowGroup, IObjectGroup colGroup)
public void addWord(java.lang.String w, int ws)
w
- The Word as a stringws
- A unique identifier of the wordpublic void addWord(java.lang.String w, int ws, float globalWeight)
w
- The Word as a stringws
- A unique identifier of the wordglobalWeight
- The global weight of the wordpublic void addColumnIObject(IObject colObj)
public void addDocument(java.lang.String d, int di)
d
- The source of the documentdi
- A unique identifier of the documentpublic void addDocument(java.lang.String d, java.lang.String f, int di)
d
- The source of the documentf
- The location of the documentdi
- A unique identifier of the documentIObject
public void addRowIObject(IObject rowObj)
public boolean addCell(IMatrixCell mc)
mc
- the Matrix cell
public boolean addCell(int ri, int ci, float weight)
ri
- The unique identifier of the rowci
- The unique identifier of the columnweight
- The value of the column in the row
public boolean addCell(int ri, int ci, float localCount, float weight)
ri
- The unique identifier of the rowci
- The unique identifier of the columnweight
- The value of the column in the row
public boolean addCell(int ri, int ci, float localCount, float localWeight, float weight)
ri
- The unique identifier of the rowci
- The unique identifier of the columnweight
- The value of the column in the row
public IObjectGroup constructCorrespondingGroup(IObjectGroup group)
public java.util.Vector getCellsWith(IObject co)
public boolean rowIObjectSet(IObjectSet ios)
public boolean columnIObjectSet(IObjectSet ios)
public java.util.HashMap<IObject,java.lang.Float> getTotalWeight(boolean row, boolean localWeight)
row
- - true: weight for row objects,
false: weight for column objectslocalWeight
- - true: the localWeght,
false: the weightpublic void purgeMatrixToCurrentGroupings()
public void invertMatrix()
public IObjectSet getRowIObjectSet()
public IObjectSet getColumnIObjectSet()
public void setRowIObjectSet(IObjectSet set)
public void setColumnIObjectSet(IObjectSet set)
public IObjectGrouping getCurrentRowGrouping()
public IObjectGrouping getCurrentColumnGrouping()
public DoubleHashMap getCellMap()
public java.util.Vector getAllCells()
public IMatrixCell getCell(IObject row, IObject col)
public void removeCell(IMatrixCell mc)
mc
- An IMatrixCellpublic void removeCells(IVector<IMatrixCell> ivec)
public void removeAllCells()
public java.awt.Dimension getSize()
public java.awt.Dimension getCurrentSize()
public void resort()
public java.util.Vector getCellsWithIObjectRestrictedToGroup(IObject io, IObjectGroup restrictionGroup)
public java.util.HashSet getRowIMatrixCellsForColumnObject(IObject colObject)
public java.util.HashSet getColumnIMatrixCellsForRowObject(IObject rowObject)
public java.util.HashSet<IObject> getOtherIObjectsForIObject(IObject io)
public void saveIMatrix(java.io.File file)
public void saveIObjectGroupingFile(IObjectGrouping grouping, java.io.File file)
public double avgColsInRows()
public double avgRowsInCols()
public void setGlobalWeight(IObject io, float globalWeight)
public float getGlobalWeight(IObject io)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |