public class P0D extends DoubleArrayList implements Serializable
This is a high-speed a small footprint container designed for numerical analysis.
Constructor and Description |
---|
P0D()
Construct an empty container with a title
|
P0D(double[] d)
Construct P0D from array;
|
P0D(String title)
Construct an empty container with a title
|
P0D(String title,
double[] d)
Create P0D from an array.
|
P0D(String title,
P0D p0d)
Construct a copy from a P0D.
|
P0D(String title,
String sfile)
Construct a P0D from a file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsAll(double[] array)
Tests the collection to determine if all of the elements in array are present.
|
P0D |
copy()
Get a copy of the current holder
|
P0D |
copy(String newtitle)
Create an exact copy of the current P0D.
|
double |
correlation(P0D p0d)
Returns the correlation coefficient.
|
double |
covariance(P0D p0d)
Returns the covariance
|
void |
doc()
Show online documentation.
|
void |
fill(double[] values)
Fill a P0D container from an array.
|
void |
fill(int[] values)
Fill a P0D container from an array.
|
void |
fill(int TotNumber,
double min,
double max)
Fill with a sequence of numbers between min and max.
|
int |
find(double d)
Returns the index of first occurrence of the specified element
|
P0D |
func(F1D f1d)
Transform P0D array to array with values given by a function.
|
P0D |
func(String title,
F1D f1d)
Make transformation of P0D using a function.
|
P0D |
get(int d,
String opi)
Get P0D with values below, above or equal a specified value.
|
double[] |
getArray()
Get a double array with P0D values.
|
int[] |
getArrayInt()
Get an integer array with P0D values.
|
ArrayList<Double> |
getArrayList()
Get data in form of ArrayList
|
H1D |
getH1D(int bins)
Return H1D histogram with P0D content.
|
H1D |
getH1D(int bins,
double min,
double max)
Return H1D histogram with P0D content.
|
double |
getMax()
Returns the maximum value.
|
int |
getMaxIndex()
Returns index corresponding to maximum value.
|
double |
getMin()
Returns the minimum value.
|
int |
getMinIndex()
Returns index corresponding to minimum value.
|
Map<String,Double> |
getStat()
Get complete statistics for this container.
|
String |
getStatString()
Returns a string representing statistics.
|
String |
getStringValues()
Return all values as a string.
|
String |
getTitle()
Get a new title
|
int |
hashCode()
Returns the hash code value for this collection.
|
double |
kurtosis()
Returns the kurtosis.
|
int |
lastIndexOf(int offset,
int value)
Searches the list back to front for the last index of value, starting at
offset.
|
double |
mean()
Returns the mean value.
|
double |
median()
Returns the median.
|
P0D |
merge(P0D a)
Merge two P0D containers
|
double |
moment(int k,
double c)
Returns the moment of k-th order with value c, which is Sum( (x[i]-c)k )
/ size().
|
P0D |
oper(P0D p0d,
String what)
Operations on P0D containers: add, subtract, multiply, divide.
|
P0D |
oper(P0D p0d,
String title,
String what)
Operations on P0D containers: add, subtract, multiply, divide.
|
P0D |
operScale(double scale)
Scale P0D with a factor scale.
|
P0D |
operShift(double shift)
Shift all values in the array by a constant.
|
P0D |
operShiftAndScale(double shift,
double scale)
Shift all values by a constant "shift", then scale it.
|
void |
print()
Print a P0D container.
|
void |
random(int TotNumber,
AbstractDistribution dist)
Fill array with random numbers Random generators are taken from
cern.jet.random.*.
|
void |
randomNormal(int TotNumber,
double mu,
double sigma)
Fill with random numbers distributed using the normal (gaussian)
distribution.
|
void |
randomUniform(int TotNumber,
double min,
double max)
Fill with with uniform random numbers between min and max.
|
P0D |
range(int min,
int max)
Get range between min and max
|
int |
read(BufferedReader br)
Read one dimensional data from uncompressed ASCII file.
|
int |
read(File sfile)
Read P0D from a file.
|
int |
read(String sfile)
Read PNI from a file.
|
int |
read(URL url)
Read data from URL.
|
int |
readBinary(String name)
Read a P0D from a binary file (big endian by default).
|
int |
readGZip(File sfile)
Read PNI from a GZiped file.
|
int |
readGZip(String sfile)
Read P0D from a GZiped file.
|
P0D |
readSerialized(String name)
Read a P0D object from a serialized file
|
int |
readZip(String sfile)
Read one dimensional data from ZIP ASCII file.
|
void |
removeAll(int min,
int max)
Remove elements
|
int |
search(double value)
Search for the first occurrence of the given argument
|
void |
setArray(double[] array)
Set a double array.
|
void |
setArray(int[] array)
Set an integer array.
|
void |
setArrayList(ArrayList<Double> array)
Set the data in form of ArrayList
|
void |
setTitle(String title)
Set a new title
|
double |
skew()
Returns the skew, which is moment(3,mean()) / standardDeviation() Run
getStat(0 for evaluation
|
void |
sort(int fromIndex,
int toIndex)
Sort a slice of the list (ascending) using the Sun quicksort
implementation.
|
int[] |
sortIndex()
Return indexes of sorted array in increasing order.
|
double |
standardError()
Returns the sample standard error, which is Math.sqrt(variance() /
size()).
|
double |
stddeviation()
Returns the standard deviation (square root of variance)
|
void |
toFile(String name)
Write a P0D to an external file.
|
String |
toString()
Get a P0D as a string.
|
void |
toTable()
Print the P0D container to a Table in a separate Frame.
|
double |
variance()
Returns the variance.
|
void |
writeBinary(String name)
Write a P0D to a binary file (big endian by default).
|
int |
writeSerialized(String name)
Write a P0D object to a serialized file
|
add, beforeInsert, binarySearchFromTo, clone, elements, elements, ensureCapacity, equals, fillRandom, forEach, get, getQuick, indexOfFromTo, lastIndexOfFromTo, partFromTo, removeAll, replaceFromToWithFrom, retainAll, reverse, set, setQuick, shuffleFromTo, trimToSize
addAllOf, addAllOfFromTo, beforeInsertAllOfFromTo, binarySearch, contains, delete, fillFromToWith, indexOf, lastIndexOf, mergeSortFromTo, mergeSortFromTo, quickSortFromTo, quickSortFromTo, removeFromTo, replaceFromToWithFromTo, replaceFromWith, size, times, toList
addAllOf, beforeInsertAllOf, clear, mergeSort, quickSort, remove, setSize, shuffle, sort, sortFromTo
isEmpty
public P0D(String title)
title
- New titlepublic P0D(double[] d)
d
- arraypublic P0D(String title, double[] d)
title
- titled
- input arraypublic P0D(String title, P0D p0d)
title
- new titlep0d
- input data in form of P0Dpublic P0D()
public void setTitle(String title)
title
- New Titlepublic String getTitle()
public int read(BufferedReader br)
sfile
- File name with inputpublic int read(File sfile)
sfile
- input filepublic int read(URL url)
url
- URL location of input filepublic int readGZip(String sfile)
Use a space to separate values in columns and tab to put new row.
sfile
- File name with input (extension .gz)public int read(String sfile)
The old content will be lost. Use a space to separate values in columns and tab to put new row. Comment lines starting with "#" and "*" are ignored.
sfile
- File name with inputpublic int readGZip(File sfile)
sfile
- File name with input (extension .gz)public int readZip(String sfile)
sfile
- Zipped file name with input (file extension .zip)public void toFile(String name)
name
- File name with outputpublic void writeBinary(String name)
name
- Binary file name for the output.public int writeSerialized(String name)
name
- serialized file name for output.public P0D readSerialized(String name)
name
- serialized file name for input.public int readBinary(String name)
name
- Binary file name for input.public String toString()
toString
in class AbstractDoubleList
public void randomNormal(int TotNumber, double mu, double sigma)
TotNumber
- total number of random valuesmu
- mean valuesigma
- Standard deviation of the random variable.public void fill(int TotNumber, double min, double max)
The step is evaluated as (max-min) / (TotNumber -1). For example, fill(11,0,10) will fill with 11 number: 0,1,2,3,4,5,6,7,8,9,10
TotNumber
- total number of values.min
- min valuemax
- max valuepublic void randomUniform(int TotNumber, double min, double max)
TotNumber
- of random valuesmin
- min random valuemax
- max random valuepublic void random(int TotNumber, AbstractDistribution dist)
TotNumber
- Total number in arraydist
- A custom random distribution from cern.jet.random.*.public H1D getH1D(int bins)
bins
- Number of bins for the histogram.public H1D getH1D(int bins, double min, double max)
min
- Min value of histogrammax
- Max value of histogrambins
- Number of bins for the histogram.public void print()
public P0D merge(P0D a)
a
- Container to be mergedpublic void fill(double[] values)
values
- array with double valuespublic void fill(int[] values)
values
- array with double valuespublic P0D copy()
copy
in class DoubleArrayList
public ArrayList<Double> getArrayList()
public String getStringValues()
public void sort(int fromIndex, int toIndex)
fromIndex
- toIndex
- public int hashCode()
public int lastIndexOf(int offset, int value)
offset
- value
- public boolean containsAll(double[] array)
array
- public void removeAll(int min, int max)
min
- min indexmax
- max indexpublic void setArrayList(ArrayList<Double> array)
array
- ArrayList to be set.public void setArray(double[] array)
array
- array used to fill P0Dpublic void setArray(int[] array)
array
- array used to fill P0Dpublic P0D copy(String newtitle)
newtitle
- new titlepublic P0D get(int d, String opi)
d
- input valuesopi
- if "=", take equal values; public int find(double d)
d
- input valuepublic double[] getArray()
public int[] getArrayInt()
public int search(double value)
value
- value for searchingpublic double getMax()
public int getMaxIndex()
public int getMinIndex()
public double getMin()
public P0D range(int min, int max)
min
- indexmax
- indexpublic P0D oper(P0D p0d, String what)
p0d
- Input P0D container for operationwhat
- String representing the operation: "+" add a P0D container to
the original; "-" subtract a P0D from the original; "*"
multiply; "/" divide by P0Dpublic P0D operScale(double scale)
scale
- Scale factorpublic P0D operShift(double shift)
shift
- constants used to addpublic P0D operShiftAndScale(double shift, double scale)
shift
- constants used to add to all valuesscale
- constant used to scale after shifting.public P0D oper(P0D p0d, String title, String what)
p0d
- Input P0D container for operationtitle
- New titlewhat
- String representing the operation: "+" add a P0D container to
the original; "-" subtract a P0D from the original; "*"
multiply; "/" divide by P0Dpublic double mean()
public double kurtosis()
public double median()
public String getStatString()
public Map<String,Double> getStat()
The key for the output map are: mean, error, rms, variance, stddev . Print the key to find out what is inside.
public double moment(int k, double c)
k
- k-th orderc
- cpublic double standardError()
public double skew()
public double variance()
public double stddeviation()
public double covariance(P0D p0d)
p0d
- P0D object for covariance calculationspublic double correlation(P0D p0d)
p0d
- P0D object for correlation calculation.public P0D func(F1D f1d)
This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.
f1d
- function for transformationpublic P0D func(String title, F1D f1d)
title
- new titlef1d
- function for transformationpublic int[] sortIndex()
public void toTable()
public void doc()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics