Package elki.visualization.projections
Class SimpleParallel
- java.lang.Object
-
- elki.visualization.projections.SimpleParallel
-
- All Implemented Interfaces:
Projection
,ProjectionParallel
,VisualizationItem
public class SimpleParallel extends java.lang.Object implements ProjectionParallel
Simple parallel projection Scaled space: reordered, scaled and inverted. Lower dimensionality! [0:1] Render space: not used here; no recentering needed.- Since:
- 0.5.0
- Author:
- Robert Rödler, Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
dimOrder
Ordering of dimensions(package private) static byte
FLAG_HIDDEN
Flag for visibility(package private) static byte
FLAG_INVERTED
Flag for inverted dimensions TODO: handle inversions via scales?(package private) byte[]
flags
Flags for the dimensionsprivate Projector
p
Projectorprivate LinearScale[]
scales
Scales(package private) int
visDims
Number of visible dimensions-
Fields inherited from interface elki.visualization.projections.Projection
INVSCALE, SCALE
-
-
Constructor Summary
Constructors Constructor Description SimpleParallel(Projector p, LinearScale[] scales)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
fastProjectDataToRenderSpace(double[] data)
Fast project a vector from data to render spacedouble
fastProjectDataToRenderSpace(double value, int dim)
Project the value of a single axis to its display valuedouble[]
fastProjectDataToRenderSpace(NumberVector data)
Fast project a vector from data to render spacedouble
fastProjectRenderToDataSpace(double v, int projdim)
Project a display value back to the original data spaceint
getAxisForDim(int truedim)
Find the axis assigned to the given dimension.LinearScale
getAxisScale(int axis)
Get scale for the given axisint
getDimForAxis(int pos)
Get the dimension for the given axis numberint
getDimForVisibleAxis(int pos)
Get the dimension for the given visible axisint
getInputDimensionality()
Get the input dimensionality of the projection.java.lang.String
getMenuName()
Name to display in the menu.Projector
getProjector()
Projector used for generating this projection.LinearScale
getScale(int dim)
Get the scale class for a particular dimension.int
getVisibleDimensions()
Get the number of visible dimension.boolean
isAxisInverted(int axis)
Get inversion flag of axis.boolean
isAxisVisible(int dim)
Test whether the current axis is visibleprotected boolean
isDimHidden(int truedim)
boolean
isDimInverted(int truedim)
Get inversion flag of dimension.void
moveAxis(int src, int dest)
shift a dimension to another positionvoid
setAxisInverted(int axis, boolean bool)
Set inversion flag of axis.void
setAxisVisible(int dim, boolean vis)
Set the visibility of the axis.void
setDimInverted(int truedim, boolean bool)
Set inversion flag of a dimension.void
swapAxes(int a, int b)
Exchange axes A and Bvoid
toggleAxisInverted(int axis)
Toggle inverted flag of axis.void
toggleAxisVisible(int dim)
Toggle visibility of the axis.void
toggleDimInverted(int truedim)
Toggle inverted flag of dimension.
-
-
-
Field Detail
-
visDims
int visDims
Number of visible dimensions
-
flags
byte[] flags
Flags for the dimensions
-
dimOrder
int[] dimOrder
Ordering of dimensions
-
scales
private LinearScale[] scales
Scales
-
p
private Projector p
Projector
-
FLAG_HIDDEN
static final byte FLAG_HIDDEN
Flag for visibility- See Also:
- Constant Field Values
-
FLAG_INVERTED
static final byte FLAG_INVERTED
Flag for inverted dimensions TODO: handle inversions via scales?- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SimpleParallel
public SimpleParallel(Projector p, LinearScale[] scales)
Constructor.- Parameters:
p
- Projectorscales
- Scales to use
-
-
Method Detail
-
getScale
public LinearScale getScale(int dim)
Description copied from interface:Projection
Get the scale class for a particular dimension.- Specified by:
getScale
in interfaceProjection
- Parameters:
dim
- Dimension- Returns:
- Scale class
-
isAxisInverted
public boolean isAxisInverted(int axis)
Description copied from interface:ProjectionParallel
Get inversion flag of axis.- Specified by:
isAxisInverted
in interfaceProjectionParallel
- Parameters:
axis
- Axis (reordered) position- Returns:
- Inversion flag
-
setAxisInverted
public void setAxisInverted(int axis, boolean bool)
Description copied from interface:ProjectionParallel
Set inversion flag of axis.- Specified by:
setAxisInverted
in interfaceProjectionParallel
- Parameters:
axis
- Axis (reordered) positionbool
- Value of inversion flag
-
toggleAxisInverted
public void toggleAxisInverted(int axis)
Description copied from interface:ProjectionParallel
Toggle inverted flag of axis.- Specified by:
toggleAxisInverted
in interfaceProjectionParallel
- Parameters:
axis
- Axis (reordered) position
-
isDimInverted
public boolean isDimInverted(int truedim)
Description copied from interface:ProjectionParallel
Get inversion flag of dimension.- Specified by:
isDimInverted
in interfaceProjectionParallel
- Parameters:
truedim
- Dimension in original numbering- Returns:
- Inversion flag
-
setDimInverted
public void setDimInverted(int truedim, boolean bool)
Description copied from interface:ProjectionParallel
Set inversion flag of a dimension.- Specified by:
setDimInverted
in interfaceProjectionParallel
- Parameters:
truedim
- Dimension in original numberingbool
- Value of inversion flag
-
toggleDimInverted
public void toggleDimInverted(int truedim)
Description copied from interface:ProjectionParallel
Toggle inverted flag of dimension.- Specified by:
toggleDimInverted
in interfaceProjectionParallel
- Parameters:
truedim
- Dimension in original numbering
-
getAxisScale
public LinearScale getAxisScale(int axis)
Description copied from interface:ProjectionParallel
Get scale for the given axis- Specified by:
getAxisScale
in interfaceProjectionParallel
- Parameters:
axis
- Axis (reordered) position- Returns:
- Axis scale
-
isDimHidden
protected boolean isDimHidden(int truedim)
-
isAxisVisible
public boolean isAxisVisible(int dim)
Description copied from interface:ProjectionParallel
Test whether the current axis is visible- Specified by:
isAxisVisible
in interfaceProjectionParallel
- Parameters:
dim
- Axis (reordered) position- Returns:
- Visibility of axis
-
setAxisVisible
public void setAxisVisible(int dim, boolean vis)
Description copied from interface:ProjectionParallel
Set the visibility of the axis.- Specified by:
setAxisVisible
in interfaceProjectionParallel
- Parameters:
dim
- Axis numbervis
- Visibility status
-
toggleAxisVisible
public void toggleAxisVisible(int dim)
Description copied from interface:ProjectionParallel
Toggle visibility of the axis.- Specified by:
toggleAxisVisible
in interfaceProjectionParallel
- Parameters:
dim
- Axis number
-
getVisibleDimensions
public int getVisibleDimensions()
Description copied from interface:ProjectionParallel
Get the number of visible dimension.- Specified by:
getVisibleDimensions
in interfaceProjectionParallel
- Returns:
- Number of visible dimensions
-
getDimForAxis
public int getDimForAxis(int pos)
Description copied from interface:ProjectionParallel
Get the dimension for the given axis number- Specified by:
getDimForAxis
in interfaceProjectionParallel
- Parameters:
pos
- Axis number- Returns:
- Dimension
-
getDimForVisibleAxis
public int getDimForVisibleAxis(int pos)
Description copied from interface:ProjectionParallel
Get the dimension for the given visible axis- Specified by:
getDimForVisibleAxis
in interfaceProjectionParallel
- Parameters:
pos
- Axis number (visible axes only)- Returns:
- Dimension
-
swapAxes
public void swapAxes(int a, int b)
Description copied from interface:ProjectionParallel
Exchange axes A and B- Specified by:
swapAxes
in interfaceProjectionParallel
- Parameters:
a
- First axisb
- Second axis
-
moveAxis
public void moveAxis(int src, int dest)
Description copied from interface:ProjectionParallel
shift a dimension to another position- Specified by:
moveAxis
in interfaceProjectionParallel
- Parameters:
src
- axis to shiftdest
- new position
-
fastProjectDataToRenderSpace
public double[] fastProjectDataToRenderSpace(NumberVector data)
Description copied from interface:ProjectionParallel
Fast project a vector from data to render space- Specified by:
fastProjectDataToRenderSpace
in interfaceProjectionParallel
- Parameters:
data
- Input vector- Returns:
- Vector with reordering, inversions and scales applied.
-
fastProjectDataToRenderSpace
public double[] fastProjectDataToRenderSpace(double[] data)
Description copied from interface:ProjectionParallel
Fast project a vector from data to render space- Specified by:
fastProjectDataToRenderSpace
in interfaceProjectionParallel
- Parameters:
data
- Input vector- Returns:
- Vector with reordering, inversions and scales applied.
-
fastProjectRenderToDataSpace
public double fastProjectRenderToDataSpace(double v, int projdim)
Description copied from interface:ProjectionParallel
Project a display value back to the original data space- Specified by:
fastProjectRenderToDataSpace
in interfaceProjectionParallel
- Parameters:
v
- transformed valueprojdim
- Axis to use for scaling and inversion- Returns:
- Original value
-
fastProjectDataToRenderSpace
public double fastProjectDataToRenderSpace(double value, int dim)
Description copied from interface:ProjectionParallel
Project the value of a single axis to its display value- Specified by:
fastProjectDataToRenderSpace
in interfaceProjectionParallel
- Parameters:
value
- Input valuedim
- Axis to use for scaling and inversion- Returns:
- Transformed value
-
getAxisForDim
public int getAxisForDim(int truedim)
Description copied from interface:ProjectionParallel
Find the axis assigned to the given dimension.- Specified by:
getAxisForDim
in interfaceProjectionParallel
- Parameters:
truedim
- Dimension- Returns:
- Axis number
-
getInputDimensionality
public int getInputDimensionality()
Description copied from interface:Projection
Get the input dimensionality of the projection.- Specified by:
getInputDimensionality
in interfaceProjection
- Returns:
- Input dimensionality
-
getMenuName
public java.lang.String getMenuName()
Description copied from interface:VisualizationItem
Name to display in the menu. May benull
or empty string.- Specified by:
getMenuName
in interfaceVisualizationItem
- Returns:
- Menu name.
-
getProjector
public Projector getProjector()
Description copied from interface:Projection
Projector used for generating this projection.- Specified by:
getProjector
in interfaceProjection
- Returns:
- Projector
-
-