edu.stanford.math.plex
public class Plex extends java.lang.Object
Plex class provides some utility functions that don't
have a clearly defined home, and some entry points into plex library
code that are especially useful when in matlab. It is (apparently)
impossible in matlab to execute code like new PlexClass(),
so we provide static methods for creating Plex objects in matlab. The
naming convention for these methods is that the constructor for
instances of PlexClass will be named
PlexClass(), and its argument spectrum will be whatever the
usual form (or forms) of the associated constuctor are.| Modifier and Type | Class and Description |
|---|---|
static class |
Plex.BettiNumbers
An array of Betti numbers (int[]) boxed up for convenience.
|
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.Random |
rand |
protected static boolean |
useMessageWindow |
| Constructor and Description |
|---|
Plex() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
d_okay(double[][] d) |
static DistanceData |
DistanceData(double[][] d)
Create a DistanceData instance.
|
static boolean |
equalPersistenceIntervals(PersistenceInterval.Float[] arg1,
PersistenceInterval.Float[] arg2,
double delta)
Are two PersistenceInterval.Float[] arguments sufficiently equal?
|
static EuclideanArrayData |
EuclideanArrayData(double[][] data)
Create a EuclideanArrayData instance from a double[][].
|
static EuclideanArrayData |
EuclideanArrayData(double[] data,
int dimension)
Create a EuclideanArrayData instance from a data array.
|
static EuclideanArrayData |
EuclideanArrayData(int num_pts,
int dimension)
Create a random EuclideanArrayData instance.
|
static EuclideanArrayData |
EuclideanArrayData(java.lang.String filename)
Create a EuclideanArrayData instance from a text file containing a
distance matrix.
|
static ExplicitStream |
ExplicitStream()
Make an empty ExplicitStream.
|
protected static PersistenceInterval.Float[] |
filter_pintervals(PersistenceInterval.Float[] vec,
double delta) |
static Plex.BettiNumbers |
FilterInfinite(PersistenceBasisInterval[] coll)
Summarize the semi-infinite PersistenceBasisIntervals.
|
static Plex.BettiNumbers |
FilterInfinite(PersistenceInterval[] coll)
Summarize the semi-infinite PersistenceIntervals.
|
protected static int |
firstSmallerPtIndex(int arg,
int lo,
int[] pts) |
static int |
intersection_count(int[] v1,
int[] v2) |
protected static boolean |
is_permutation(int[] perm) |
static LazyWitnessStream |
LazyWitnessStream(double delta,
int max_d,
double R,
int nu,
int[] landmarks,
PointData data)
Make a stream of the simplices in a lazy Witness complex for data.
|
static void |
main(java.lang.String[] args)
Entry point to Plex from the java interpreter.
|
static ExplicitStream |
makeExplicit(SimplexStream str)
Convert a SimplexStream into an explicit one.
|
static PlexMessageWindow |
messageWindow(java.lang.String title)
Make a Plex message window.
|
protected static double |
normalizeUpperBound(double arg) |
static Persistence |
Persistence()
Create a Persistence instance.
|
static PersistenceBasis |
PersistenceBasis()
Create a PersistenceBasis instance.
|
static void |
plot(PersistenceBasisInterval[] arg,
java.lang.String label,
double upperBound)
Plot an array of Plex barcodes computed with bases.
|
static void |
plot(PersistenceInterval[] arg,
java.lang.String label,
double upperBound)
Plot an array of Plex barcodes (that is, a PersistenceInterval[]).
|
protected static double[][][] |
printable_intervals(PersistenceInterval[] arg) |
protected static boolean |
ptArrayIsSubset(int[] ipts,
int[] jpts) |
static void |
random_index_subset(int N,
int[] subset,
int subset_size)
Take subset_size distinct entries from the integers 0 through N-1,
and put them in the initial segment of subset[].
|
static void |
random_permutation(int[] perm)
Make a random permutation of the integers 0 through perm.length-1
and put them in perm.
|
static void |
random_subset(int[] set,
int[] subset)
Take subset.length distinct entries from set[], and put them in
subset[].
|
static void |
random_subset(int[] set,
int set_size,
int[] subset,
int subset_size)
Take subset_size distinct entries from initial segment of length
set_size in set[] and put them in the initial segment of subset[].
|
static void |
random_subset(int N,
int[] subset)
Take subset.length distinct entries from the integers 1 through N,
and put them in subset[].
|
static void |
random_subset(int N,
int[] subset,
int subset_size)
Take subset_size distinct entries from the integers 1 through N,
and put them in the initial segment of subset[].
|
static double[][] |
readMatrix(java.io.Reader input)
Read a double[][] from a stream.
|
static double[][] |
readMatrix(java.lang.String inputFilename)
Read a double[][] from a file.
|
static RipsStream |
RipsStream(double delta,
int max_d,
double max_distance,
PointData data)
Make a stream of the simplices in a Rips complex for given data set.
|
static void |
scatter(PersistenceBasisInterval[] arg,
java.lang.String label,
double upperBound)
Make a scatterplot of a PersistenceBasisInterval[].
|
static void |
scatter(PersistenceInterval[] arg,
java.lang.String label,
double upperBound)
Make a scatterplot of a PersistenceInterval[].
|
static SimplexStream.Stack |
SimplexStack(int max_findex,
int max_dimension)
Create an empty SimplexStream.Stack.
|
static SimplexTable |
SimplexTable(int limit)
Make a new SimplexTable.
|
static int |
sorted_intersection_count(int[] v1,
int[] v2)
Compute the overlap size for two sorted arrays using the zipper algorithm.
|
static Torus |
Torus(int n,
int d)
Create a Torus with a given granulatity.
|
static java.lang.String |
toString(byte[] x)
Take an array of byte and make a string.
|
static java.lang.String |
toString(byte[] x,
int max_entries)
Take an array of byte and make a string.
|
static java.lang.String |
toString(double[] x)
Take an array of double and make a string.
|
static java.lang.String |
toString(double[][] x)
Take an double[][] and make a string.
|
static java.lang.String |
toString(double[][] x,
int max_entries)
Take an array of double[] and make a string.
|
static java.lang.String |
toString(double[] x,
int max_entries)
Take an array of double and make a string.
|
static java.lang.String |
toString(int[] x)
Take an array of int and make a string.
|
static java.lang.String |
toString(int[][] x)
Take an int[][] and make a string.
|
static java.lang.String |
toString(int[][] x,
int max_entries)
Take an array of int[] and make a string.
|
static java.lang.String |
toString(int[] x,
int max_entries)
Take an array of int and make a string.
|
static java.lang.String |
toString(long[] x)
Take an array of long and make a string.
|
static java.lang.String |
toString(long[] x,
int max_entries)
Take an array of long and make a string.
|
static boolean |
useMessageWindow()
Should we use a PlexMessageWindow for messages?
|
static void |
useMessageWindow(boolean flag)
Use a PlexMessageWindow for messages?
|
static WitnessStream |
WitnessStream(double delta,
int max_d,
double R,
int[] landmarks,
PointData data)
Make a stream of the simplices in a Witness complex for data.
|
protected static java.util.Random rand
protected static boolean useMessageWindow
public static int intersection_count(int[] v1,
int[] v2)
public static int sorted_intersection_count(int[] v1,
int[] v2)
v1 - First sorted array.v2 - Second sorted array.public static void random_subset(int[] set,
int set_size,
int[] subset,
int subset_size)
set - an int[] from which to select.set_size - an int specifying how many entries to use.subset - an int[] in which to deposit the selections.subset_size - an int specifying how many entries to select.public static void random_subset(int[] set,
int[] subset)
set - an int[] from which to select.subset - an int[] in which to deposit the selections.public static void random_subset(int N,
int[] subset,
int subset_size)
N - an int specifying the range from which to choose the subset.subset - an int[] in which to deposit the selections.subset_size - an int specifying how many entries to use.public static void random_subset(int N,
int[] subset)
N - an int specifying the range from which to choose the subset.subset - an int[] in which to deposit the selections.protected static boolean is_permutation(int[] perm)
public static void random_permutation(int[] perm)
perm - an int[] to hold a random permutation.public static java.lang.String toString(int[] x,
int max_entries)
x - an int[] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(int[] x)
x - an int[] we want to examine.public static java.lang.String toString(byte[] x,
int max_entries)
x - an byte[] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(byte[] x)
x - an byte[] we want to examine.public static java.lang.String toString(int[][] x,
int max_entries)
x - an int[][] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(int[][] x)
x - an int[][] we want to examine.public static java.lang.String toString(double[] x,
int max_entries)
x - a double[] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(double[] x)
x - a double[] we want to examine.public static java.lang.String toString(double[][] x,
int max_entries)
x - an double[][] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(double[][] x)
x - an double[][] we want to examine.public static java.lang.String toString(long[] x,
int max_entries)
x - a long[] we want to examine.max_entries - The maximum number of entries we wish to examine.public static java.lang.String toString(long[] x)
x - a long[] we want to examine.public static void random_index_subset(int N,
int[] subset,
int subset_size)
N - an int specifying the range from which to choose the subset.subset - an int[] in which to deposit the selections.subset_size - an int specifying how many entries to use.protected static int firstSmallerPtIndex(int arg,
int lo,
int[] pts)
protected static boolean ptArrayIsSubset(int[] ipts,
int[] jpts)
public static Plex.BettiNumbers FilterInfinite(PersistenceInterval[] coll)
coll - A collection of PersistenceIntervals.public static Plex.BettiNumbers FilterInfinite(PersistenceBasisInterval[] coll)
coll - A collection of PersistenceBasisIntervals.public static SimplexStream.Stack SimplexStack(int max_findex, int max_dimension)
The object returned from this method can be used to create a new
SimplexStream from the contents of another one, or using an
Interator
max_findex - Largest filtration index used by entries in this stream.max_dimension - Maximum dimension of Simplex instances stored in this stream.public static Persistence Persistence()
Used to calculate persistent homology; e.g., p.computeIntervals(stream).
public static PersistenceBasis PersistenceBasis()
Used to calculate persistent homology returning bases for the resulting intervals; e.g., p.computeIntervals(stream).
public static EuclideanArrayData EuclideanArrayData(int num_pts, int dimension)
num_pts - How many points.dimension - Dimension of the space.public static EuclideanArrayData EuclideanArrayData(double[] data, int dimension)
data - The data.dimension - The dimension of the data.public static EuclideanArrayData EuclideanArrayData(double[][] data)
data - The data.public static EuclideanArrayData EuclideanArrayData(java.lang.String filename)
filename - The name of the datafile.public static double[][] readMatrix(java.io.Reader input)
input - A Reader instance.public static double[][] readMatrix(java.lang.String inputFilename)
inputFilename - An input file.protected static boolean d_okay(double[][] d)
public static DistanceData DistanceData(double[][] d)
d - The distance matrixpublic static Torus Torus(int n, int d)
n - Split the Torus into n^^d squares, return the corners.public static RipsStream RipsStream(double delta, int max_d, double max_distance, PointData data)
delta - Granularity to apply to the underlying metric.max_distance - Maximum edge length we will consider.max_d - Maximum dimension of Simplex instances we construct.data - Metric data to use in constructing stream.public static ExplicitStream ExplicitStream()
public static ExplicitStream makeExplicit(SimplexStream str)
str - A SimplexStream instance.public static SimplexTable SimplexTable(int limit)
limit - An upper bound on the number of simplices that
will be interned in the table.SimplexTable.SimplexTable(int)public static WitnessStream WitnessStream(double delta, int max_d, double R, int[] landmarks, PointData data)
delta - Granularity to apply to the underlying metric.max_d - Maximum dimension of Simplex instances we construct.R - Maximum R we will use.landmarks - Indices of points to use as landmarks. The
simplices constructed will use the landmark
indices, rather than the indices into data.data - Metric data to use in constructing stream.public static LazyWitnessStream LazyWitnessStream(double delta, int max_d, double R, int nu, int[] landmarks, PointData data)
delta - Granularity to apply to the underlying metric.max_d - Maximum dimension of Simplex instances we construct.R - Maximum R we will use.nu - See Topological estimation using witness complexes, above.landmarks - Indices of points to use as landmarks. The
simplices constructed will use the landmark
indices, rather than the indices into data.data - Metric data to use in constructing stream.protected static PersistenceInterval.Float[] filter_pintervals(PersistenceInterval.Float[] vec, double delta)
public static boolean equalPersistenceIntervals(PersistenceInterval.Float[] arg1, PersistenceInterval.Float[] arg2, double delta)
arg1 - PersistenceInterval.Float[].arg2 - PersistenceInterval.Float[].delta - doubleprotected static double normalizeUpperBound(double arg)
protected static double[][][] printable_intervals(PersistenceInterval[] arg)
public static void plot(PersistenceInterval[] arg, java.lang.String label, double upperBound)
arg - PersistenceInterval[].label - A String to use as the label.upperBound - A limit on the plot width. This limit is not strict.
The actual plotted range will be at least this size,
and no larger than 10% greater.public static void plot(PersistenceBasisInterval[] arg, java.lang.String label, double upperBound)
arg - PersistenceBasisInterval[].label - A string to use as a label.upperBound - A limit on the plot width. This limit is not strict.
The actual plotted range will be at least this size, and
no larger than 10% greater.public static void scatter(PersistenceInterval[] arg, java.lang.String label, double upperBound)
arg - PersistenceInterval[].label - A String to use as the label.upperBound - A limit on the plot width. This limit is not strict.
The actual plotted range will be at least this size,
and no larger than 10% greater.public static void scatter(PersistenceBasisInterval[] arg, java.lang.String label, double upperBound)
arg - PersistenceBasisInterval[].label - A String to use as the label.upperBound - A limit on the plot width. This limit is not strict.
The actual plotted range will be at least this size,
and no larger than 10% greater.public static void useMessageWindow(boolean flag)
flag - Set useMessageWindow.public static boolean useMessageWindow()
public static PlexMessageWindow messageWindow(java.lang.String title)
title - Window title.public static void main(java.lang.String[] args)
This stub will, when time permits, be turned into something that allows users to make some non-trivial use of Plex from the java launcher.
args - Strings that will need to be parsed.