Package gov.nih.mipav.model.algorithms
Class StochasticForests
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.StochasticForests
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class StochasticForests extends AlgorithmBase
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description private double
alpha
private java.util.Vector<java.lang.String>
always_split_variable_names
private java.lang.String
case_weights_file
(package private) double
DEFAULT_ALPHA
(package private) StochasticForests.ImportanceMode
DEFAULT_IMPORTANCE_MODE
(package private) int
DEFAULT_MIN_NODE_SIZE_CLASSIFICATION
(package private) int
DEFAULT_MIN_NODE_SIZE_PROBABILITY
(package private) int
DEFAULT_MIN_NODE_SIZE_REGRESSION
(package private) int
DEFAULT_MIN_NODE_SIZE_SURVIVAL
(package private) double
DEFAULT_MINPROP
(package private) int
DEFAULT_NUM_RANDOM_SPLITS
(package private) int
DEFAULT_NUM_THREADS
(package private) int
DEFAULT_NUM_TREE
(package private) StochasticForests.PredictionType
DEFAULT_PREDICTIONTYPE
(package private) StochasticForests.SplitRule
DEFAULT_SPLITRULE
private java.lang.String
dependent_variable_name
private boolean
holdout
private StochasticForests.ImportanceMode
importance_mode
private java.lang.String
input_file
private java.lang.String
load_forest_filename
static double
logprop
(package private) static int[]
mask
private StochasticForests.MemoryMode
memory_mode
private boolean
memory_saving_splitting
private int
min_node_size
private double
minprop
private int
mtry
private int
num_random_splits
private int
num_threads
private int
num_trees
(package private) static int[]
offset
private java.lang.String
output_prefix
private boolean
predict_all
private StochasticForests.PredictionType
prediction_type
private boolean
probability
(package private) double
Q_THRESHOLD
static int
RAND_MAX
private double
sample_fraction
private boolean
sample_with_replacement
private long
seed
private java.lang.String
split_select_weights_file
private StochasticForests.SplitRule
splitrule
(package private) double
STATUS_INTERVAL
private java.lang.String
status_variable_name
private boolean
testMain
private boolean
testUtility
private StochasticForests.TreeType
treetype
private java.util.Vector<java.lang.String>
unordered_variable_names
private boolean
verbose_out
private boolean
write
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description StochasticForests()
StochasticForests(StochasticForests.TreeType treetype, boolean probability, boolean verbose_out, java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, java.lang.String input_file, int mtry, java.lang.String output_prefix, int num_trees, long seed, int num_threads, java.lang.String load_forest_filename, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String split_select_weights_file, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.lang.String case_weights_file, boolean predict_all, double sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits, boolean write)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Vector<java.lang.Double>
adjustPvalues(java.util.Vector<java.lang.Double> unadjusted_pvalues)
private java.lang.String
beautifyTime(int seconds)
private boolean
checkPositiveIntegers(java.util.Vector<java.lang.Double> all_values)
private java.lang.String
checkUnorderedVariables(StochasticForests.Data data, java.util.Vector<java.lang.String> unordered_variable_names)
private double
computeConcordanceIndex(StochasticForests.Data data, java.util.Vector<java.lang.Double> sum_chf, int dependent_varID, int status_varID, java.util.Vector<java.lang.Integer> sample_IDs)
private void
drawWithoutReplacementFisherYates(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
private void
drawWithoutReplacementSimple(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
private void
drawWithoutReplacementSkip(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
private void
drawWithoutReplacementWeighted(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max_index, int num_samples, java.util.Vector<java.lang.Double> weights)
private void
drawWithoutReplacementWeighted(java.util.Vector<java.lang.Integer> result, java.util.Random random, java.util.Vector<java.lang.Integer> indices, int num_samples, java.util.Vector<java.lang.Double> weights)
private double
dstdnorm(double x)
private void
equalSplit(java.util.Vector<java.lang.Integer> result, int start, int end, int num_parts)
private boolean
equalVectorDouble(java.util.Vector<java.lang.Double> v1, java.util.Vector<java.lang.Double> v2, java.lang.String str)
private boolean
equalVectorInteger(java.util.Vector<java.lang.Integer> v1, java.util.Vector<java.lang.Integer> v2, java.lang.String str)
private boolean
equalVectorVectorDouble(java.util.Vector<java.util.Vector<java.lang.Double>> v1, java.util.Vector<java.util.Vector<java.lang.Double>> v2, java.lang.String str)
private boolean
equalVectorVectorInteger(java.util.Vector<java.util.Vector<java.lang.Integer>> v1, java.util.Vector<java.util.Vector<java.lang.Integer>> v2, java.lang.String str)
private double
erf(double x)
private boolean
expectNear(double val1, double val2, double error, java.lang.String str)
(package private) void
loadDoubleVectorFromFile(java.util.Vector<java.lang.Double> result, java.lang.String filename)
private java.util.Vector<java.lang.Double>
logrankScores(java.util.Vector<java.lang.Double> time, java.util.Vector<java.lang.Double> status)
private void
maxstat(java.util.Vector<java.lang.Double> scores, java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Integer> indices, double[] best_maxstat, double[] best_split_value, double minprop, double maxprop)
private double
maxstatPValueLau92(double b, double minprop, double maxprop)
private double
maxstatPValueLau94(double b, double minprop, double maxprop, int N, java.util.Vector<java.lang.Integer> m)
private double
maxstatPValueUnadjusted(double b)
private int
mostFrequentClass(java.util.Vector<java.lang.Integer> class_count, java.util.Random random)
Returns the most frequent class index of a vector with counts for the classes.private int
mostFrequentDClass(java.util.Vector<java.lang.Double> class_count, java.util.Random random)
Returns the most frequent class index of a vector with counts for the classes.private double
mostFrequentValue(java.util.HashMap<java.lang.Double,java.lang.Integer> class_count, java.util.Random random)
private java.util.Vector<java.lang.Integer>
numSamplesLeftOfCutpoint(java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Integer> indices)
private java.util.Vector<java.lang.Integer>
order(java.util.Vector<java.lang.Double> x, boolean decreasing)
private double
pstdnorm(double x)
(package private) java.util.Vector<java.lang.Double>
rank(java.util.Vector<java.lang.Double> values)
Sample ranks starting from 1.private void
readBVector1D(java.util.Vector<java.lang.Boolean> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.private void
readDVector1D(java.util.Vector<java.lang.Double> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.private void
readDVector2D(java.util.Vector<java.util.Vector<java.lang.Double>> result, java.io.BufferedReader br)
Read a 2d vector written by saveVector2D() from filestream.private void
readVector1D(java.util.Vector<java.lang.Integer> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.private void
readVector2D(java.util.Vector<java.util.Vector<java.lang.Integer>> result, java.io.BufferedReader br)
Read a 2d vector written by saveVector2D() from filestream.private int
roundToNextMultiple(int value, int multiple)
void
runAlgorithm()
Actually runs the algorithm.private void
saveBVector1D(java.util.Vector<java.lang.Boolean> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream.private void
saveDVector1D(java.util.Vector<java.lang.Double> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream.private void
saveDVector2D(java.util.Vector<java.util.Vector<java.lang.Double>> vector, java.io.BufferedWriter bw)
Write a 2d vector to filestream.private void
saveVector1D(java.util.Vector<java.lang.Integer> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream.private void
saveVector2D(java.util.Vector<java.util.Vector<java.lang.Integer>> vector, java.io.BufferedWriter bw)
Write a 2d vector to filestream.private void
shuffle(java.util.Vector<java.lang.Integer> v, java.util.Random random)
private void
shuffleAndSplit(java.util.Vector<java.lang.Integer> first_part, java.util.Vector<java.lang.Integer> second_part, int n_all, int n_first, java.util.Random random)
private void
shuffleAndSplitAppend(java.util.Vector<java.lang.Integer> first_part, java.util.Vector<java.lang.Integer> second_part, int n_all, int n_first, java.util.Vector<java.lang.Integer> mapping, java.util.Random random)
private void
splitString(java.util.Vector<java.lang.String> result, java.lang.String input, java.lang.String split_string)
private java.lang.String
uintToString(int number)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
mask
static final int[] mask
-
offset
static final int[] offset
-
DEFAULT_NUM_TREE
final int DEFAULT_NUM_TREE
- See Also:
- Constant Field Values
-
DEFAULT_NUM_THREADS
final int DEFAULT_NUM_THREADS
- See Also:
- Constant Field Values
-
DEFAULT_IMPORTANCE_MODE
final StochasticForests.ImportanceMode DEFAULT_IMPORTANCE_MODE
-
DEFAULT_MIN_NODE_SIZE_CLASSIFICATION
final int DEFAULT_MIN_NODE_SIZE_CLASSIFICATION
- See Also:
- Constant Field Values
-
DEFAULT_MIN_NODE_SIZE_REGRESSION
final int DEFAULT_MIN_NODE_SIZE_REGRESSION
- See Also:
- Constant Field Values
-
DEFAULT_MIN_NODE_SIZE_SURVIVAL
final int DEFAULT_MIN_NODE_SIZE_SURVIVAL
- See Also:
- Constant Field Values
-
DEFAULT_MIN_NODE_SIZE_PROBABILITY
final int DEFAULT_MIN_NODE_SIZE_PROBABILITY
- See Also:
- Constant Field Values
-
DEFAULT_SPLITRULE
final StochasticForests.SplitRule DEFAULT_SPLITRULE
-
DEFAULT_ALPHA
final double DEFAULT_ALPHA
- See Also:
- Constant Field Values
-
DEFAULT_MINPROP
final double DEFAULT_MINPROP
- See Also:
- Constant Field Values
-
DEFAULT_PREDICTIONTYPE
final StochasticForests.PredictionType DEFAULT_PREDICTIONTYPE
-
DEFAULT_NUM_RANDOM_SPLITS
final int DEFAULT_NUM_RANDOM_SPLITS
- See Also:
- Constant Field Values
-
STATUS_INTERVAL
final double STATUS_INTERVAL
- See Also:
- Constant Field Values
-
Q_THRESHOLD
final double Q_THRESHOLD
- See Also:
- Constant Field Values
-
RAND_MAX
public static int RAND_MAX
-
logprop
public static double logprop
-
testUtility
private boolean testUtility
-
testMain
private boolean testMain
-
treetype
private StochasticForests.TreeType treetype
-
probability
private boolean probability
-
verbose_out
private boolean verbose_out
-
dependent_variable_name
private java.lang.String dependent_variable_name
-
memory_mode
private StochasticForests.MemoryMode memory_mode
-
input_file
private java.lang.String input_file
-
mtry
private int mtry
-
output_prefix
private java.lang.String output_prefix
-
num_trees
private int num_trees
-
seed
private long seed
-
num_threads
private int num_threads
-
load_forest_filename
private java.lang.String load_forest_filename
-
importance_mode
private StochasticForests.ImportanceMode importance_mode
-
min_node_size
private int min_node_size
-
split_select_weights_file
private java.lang.String split_select_weights_file
-
always_split_variable_names
private java.util.Vector<java.lang.String> always_split_variable_names
-
status_variable_name
private java.lang.String status_variable_name
-
sample_with_replacement
private boolean sample_with_replacement
-
unordered_variable_names
private java.util.Vector<java.lang.String> unordered_variable_names
-
memory_saving_splitting
private boolean memory_saving_splitting
-
splitrule
private StochasticForests.SplitRule splitrule
-
case_weights_file
private java.lang.String case_weights_file
-
predict_all
private boolean predict_all
-
sample_fraction
private double sample_fraction
-
alpha
private double alpha
-
minprop
private double minprop
-
holdout
private boolean holdout
-
prediction_type
private StochasticForests.PredictionType prediction_type
-
num_random_splits
private int num_random_splits
-
write
private boolean write
-
-
Constructor Detail
-
StochasticForests
public StochasticForests()
-
StochasticForests
public StochasticForests(StochasticForests.TreeType treetype, boolean probability, boolean verbose_out, java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, java.lang.String input_file, int mtry, java.lang.String output_prefix, int num_trees, long seed, int num_threads, java.lang.String load_forest_filename, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String split_select_weights_file, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.lang.String case_weights_file, boolean predict_all, double sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits, boolean write)
-
-
Method Detail
-
order
private java.util.Vector<java.lang.Integer> order(java.util.Vector<java.lang.Double> x, boolean decreasing)
-
rank
java.util.Vector<java.lang.Double> rank(java.util.Vector<java.lang.Double> values)
Sample ranks starting from 1. Ties are given the average rank.- Parameters:
values
- Values to rank- Returns:
- Ranks of input values
-
roundToNextMultiple
private int roundToNextMultiple(int value, int multiple)
-
shuffle
private void shuffle(java.util.Vector<java.lang.Integer> v, java.util.Random random)
-
equalSplit
private void equalSplit(java.util.Vector<java.lang.Integer> result, int start, int end, int num_parts)
-
loadDoubleVectorFromFile
void loadDoubleVectorFromFile(java.util.Vector<java.lang.Double> result, java.lang.String filename)
-
drawWithoutReplacementSkip
private void drawWithoutReplacementSkip(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
-
drawWithoutReplacementSimple
private void drawWithoutReplacementSimple(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
-
drawWithoutReplacementFisherYates
private void drawWithoutReplacementFisherYates(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max, java.util.Vector<java.lang.Integer> skip, int num_samples)
-
drawWithoutReplacementWeighted
private void drawWithoutReplacementWeighted(java.util.Vector<java.lang.Integer> result, java.util.Random random, java.util.Vector<java.lang.Integer> indices, int num_samples, java.util.Vector<java.lang.Double> weights)
-
drawWithoutReplacementWeighted
private void drawWithoutReplacementWeighted(java.util.Vector<java.lang.Integer> result, java.util.Random random, int max_index, int num_samples, java.util.Vector<java.lang.Double> weights)
-
mostFrequentClass
private int mostFrequentClass(java.util.Vector<java.lang.Integer> class_count, java.util.Random random)
Returns the most frequent class index of a vector with counts for the classes. Returns a random class if counts are equal.- Parameters:
class_count
- Vector with class countsrandom_number_generator
- Random number generator- Returns:
- Most frequent class index. Out of range index if all 0.
-
mostFrequentDClass
private int mostFrequentDClass(java.util.Vector<java.lang.Double> class_count, java.util.Random random)
Returns the most frequent class index of a vector with counts for the classes. Returns a random class if counts are equal.- Parameters:
class_count
- Vector with class countsrandom_number_generator
- Random number generator- Returns:
- Most frequent class index. Out of range index if all 0.
-
mostFrequentValue
private double mostFrequentValue(java.util.HashMap<java.lang.Double,java.lang.Integer> class_count, java.util.Random random)
-
computeConcordanceIndex
private double computeConcordanceIndex(StochasticForests.Data data, java.util.Vector<java.lang.Double> sum_chf, int dependent_varID, int status_varID, java.util.Vector<java.lang.Integer> sample_IDs)
-
uintToString
private java.lang.String uintToString(int number)
-
beautifyTime
private java.lang.String beautifyTime(int seconds)
-
splitString
private void splitString(java.util.Vector<java.lang.String> result, java.lang.String input, java.lang.String split_string)
-
shuffleAndSplit
private void shuffleAndSplit(java.util.Vector<java.lang.Integer> first_part, java.util.Vector<java.lang.Integer> second_part, int n_all, int n_first, java.util.Random random)
-
shuffleAndSplitAppend
private void shuffleAndSplitAppend(java.util.Vector<java.lang.Integer> first_part, java.util.Vector<java.lang.Integer> second_part, int n_all, int n_first, java.util.Vector<java.lang.Integer> mapping, java.util.Random random)
-
checkUnorderedVariables
private java.lang.String checkUnorderedVariables(StochasticForests.Data data, java.util.Vector<java.lang.String> unordered_variable_names)
-
checkPositiveIntegers
private boolean checkPositiveIntegers(java.util.Vector<java.lang.Double> all_values)
-
maxstatPValueLau92
private double maxstatPValueLau92(double b, double minprop, double maxprop)
-
maxstatPValueLau94
private double maxstatPValueLau94(double b, double minprop, double maxprop, int N, java.util.Vector<java.lang.Integer> m)
-
maxstatPValueUnadjusted
private double maxstatPValueUnadjusted(double b)
-
dstdnorm
private double dstdnorm(double x)
-
pstdnorm
private double pstdnorm(double x)
-
erf
private double erf(double x)
-
adjustPvalues
private java.util.Vector<java.lang.Double> adjustPvalues(java.util.Vector<java.lang.Double> unadjusted_pvalues)
-
logrankScores
private java.util.Vector<java.lang.Double> logrankScores(java.util.Vector<java.lang.Double> time, java.util.Vector<java.lang.Double> status)
-
maxstat
private void maxstat(java.util.Vector<java.lang.Double> scores, java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Integer> indices, double[] best_maxstat, double[] best_split_value, double minprop, double maxprop)
-
numSamplesLeftOfCutpoint
private java.util.Vector<java.lang.Integer> numSamplesLeftOfCutpoint(java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Integer> indices)
-
saveVector1D
private void saveVector1D(java.util.Vector<java.lang.Integer> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream. First the size is written, then all vector elements.- Parameters:
vector
- Vector of type T to savefile
- ofstream object to write to.
-
saveBVector1D
private void saveBVector1D(java.util.Vector<java.lang.Boolean> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream. First the size is written, then all vector elements.- Parameters:
vector
- Vector of type T to savefile
- ofstream object to write to.
-
readVector1D
private void readVector1D(java.util.Vector<java.lang.Integer> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.- Parameters:
result
- Result vector with elements of type T.file
- ifstream object to read from.
-
readBVector1D
private void readBVector1D(java.util.Vector<java.lang.Boolean> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.- Parameters:
result
- Result vector with elements of type T.file
- ifstream object to read from.
-
saveDVector1D
private void saveDVector1D(java.util.Vector<java.lang.Double> vector, java.io.BufferedWriter bw)
Write a 1d vector to filestream. First the size is written, then all vector elements.- Parameters:
vector
- Vector of type T to savefile
- ofstream object to write to.
-
readDVector1D
private void readDVector1D(java.util.Vector<java.lang.Double> result, java.io.BufferedReader br)
Read a 1d vector written by saveVector1D() from filestream.- Parameters:
result
- Result vector with elements of type T.file
- ifstream object to read from.
-
saveVector2D
private void saveVector2D(java.util.Vector<java.util.Vector<java.lang.Integer>> vector, java.io.BufferedWriter bw)
Write a 2d vector to filestream. First the size of the first dim is written as size_t, then for all inner vectors the size and elements.- Parameters:
vector
- Vector of vectors of type T to write to file.file
- ofstream object to write to.
-
readVector2D
private void readVector2D(java.util.Vector<java.util.Vector<java.lang.Integer>> result, java.io.BufferedReader br)
Read a 2d vector written by saveVector2D() from filestream.- Parameters:
result
- Result vector of vectors with elements of type T.file
- ifstream object to read from.
-
saveDVector2D
private void saveDVector2D(java.util.Vector<java.util.Vector<java.lang.Double>> vector, java.io.BufferedWriter bw)
Write a 2d vector to filestream. First the size of the first dim is written as size_t, then for all inner vectors the size and elements.- Parameters:
vector
- Vector of vectors of type T to write to file.file
- ofstream object to write to.
-
readDVector2D
private void readDVector2D(java.util.Vector<java.util.Vector<java.lang.Double>> result, java.io.BufferedReader br)
Read a 2d vector written by saveVector2D() from filestream.- Parameters:
result
- Result vector of vectors with elements of type T.file
- ifstream object to read from.
-
equalVectorInteger
private boolean equalVectorInteger(java.util.Vector<java.lang.Integer> v1, java.util.Vector<java.lang.Integer> v2, java.lang.String str)
-
equalVectorVectorInteger
private boolean equalVectorVectorInteger(java.util.Vector<java.util.Vector<java.lang.Integer>> v1, java.util.Vector<java.util.Vector<java.lang.Integer>> v2, java.lang.String str)
-
equalVectorDouble
private boolean equalVectorDouble(java.util.Vector<java.lang.Double> v1, java.util.Vector<java.lang.Double> v2, java.lang.String str)
-
equalVectorVectorDouble
private boolean equalVectorVectorDouble(java.util.Vector<java.util.Vector<java.lang.Double>> v1, java.util.Vector<java.util.Vector<java.lang.Double>> v2, java.lang.String str)
-
expectNear
private boolean expectNear(double val1, double val2, double error, java.lang.String str)
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
-