public class P0I extends IntArrayList implements Serializable
This is a high-speed a small footprint container designed for numerical analysis.
Constructor and Description |
---|
P0I()
Construct an empty container with a title
|
P0I(int[] d)
Construct P0I from array;
|
P0I(String title)
Construct an empty container with a title
|
P0I(String title,
int[] d)
Create P0I from an array.
|
P0I(String title,
P0I p)
Construct a copy from a P0I.
|
P0I(String title,
String sfile)
Construct a P0I 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.
|
P0I |
copy()
Get a copy of the current holder
|
P0I |
copy(String newtitle)
Create an exact copy of the current P0I.
|
double |
correlation(P0I P0I)
Returns the correlation coefficient.
|
double |
covariance(P0I P0I)
Returns the covariance
|
void |
doc()
Show online documentation.
|
void |
fill(double[] values)
Fill a P0I container from an array.
|
void |
fill(int[] values)
Fill a P0I container from an array.
|
void |
fill(int TotNumber,
double min,
double max)
Fill with a sequence of numbers between min and max.
|
int |
find(int d)
Returns the index of first occurrence of the specified element
|
P0I |
func(F1D f1d)
Transform P0I array to array with values given by a function.
|
P0I |
func(String title,
F1D f1d)
Make transformation of P0I using a function.
|
P0I |
get(int d,
String opi)
Get P0I with values below, above or equal a specified value.
|
int[] |
getArray()
Get a double array with P0I values.
|
double[] |
getArrayDouble()
Get a double array with P0I values.
|
int[] |
getArrayInt()
Get an integer array with P0I values.
|
ArrayList<Double> |
getArrayList()
Get data in form of ArrayList
|
H1D |
getH1D(int bins)
Return H1D histogram with P0I content.
|
H1D |
getH1D(int bins,
double min,
double max)
Return H1D histogram with P0I content.
|
DoubleArrayList |
getIntegerArrayList()
Get data in form of DoubleArrayList from cern.colt package
|
int |
getMax()
Returns the minimum value.
|
int |
getMaxIndex()
Returns index corresponding to maximum value.
|
int |
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()
Get string with all 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.
|
P0I |
merge(P0I a)
Merge two P0I 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().
|
P0I |
oper(P0I p,
String what)
Operations on P0I containers: add, subtract, multiply, divide.
|
P0I |
oper(P0I p0i,
String title,
String what)
Operations on P0I containers: add, subtract, multiply, divide.
|
P0I |
operScale(double scale)
Scale P0I with a factor scale.
|
P0I |
operShift(double shift)
Shift all values in the array by a constant.
|
P0I |
operShiftAndScale(double shift,
double scale)
Shift all values by a constant "shift", then scale it.
|
void |
print()
Print a P0I 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.
|
P0I |
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 P0I 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 P0I from a binary file (big endian by default).
|
int |
readGZip(File sfile)
Read PNI from a GZiped file.
|
int |
readGZip(String sfile)
Read P0I from a GZiped file.
|
P0I |
readSerialized(String name)
Read a P0I 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(int value)
Search for the first occurrence of the given argument
|
void |
setArray(int[] array)
Set a double array.
|
void |
setArrayList(ArrayList<Integer> 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 P0I to an external file.
|
String |
toString()
Get a P0I as a string.
|
void |
toTable()
Print the P0I container to a Table in a separate Frame.
|
double |
variance()
Returns the variance.
|
void |
writeBinary(String name)
Write a P0I to a binary file (big endian by default).
|
int |
writeSerialized(String name)
Write a P0I 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, sortFromTo, 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
isEmpty
public P0I(String title)
title
- New titlepublic P0I(int[] d)
d
- arraypublic P0I(String title, int[] d)
title
- titled
- input arraypublic P0I(String title, P0I p)
title
- new titlep
- input data in form of P0Ipublic P0I()
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 P0I 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 AbstractIntList
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 P0I merge(P0I a)
a
- Container to be mergedpublic void fill(double[] values)
values
- array with double valuespublic void fill(int[] values)
values
- array with double valuespublic P0I copy()
copy
in class IntArrayList
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<Integer> array)
array
- ArrayList to be set.public void setArray(int[] array)
array
- array used to fill P0Ipublic P0I copy(String newtitle)
newtitle
- new titlepublic P0I get(int d, String opi)
d
- input valuesopi
- if "=", take equal values; public int find(int d)
d
- input valuepublic int[] getArray()
public int[] getArrayInt()
public int search(int value)
value
- value for searchingpublic int getMax()
public int getMaxIndex()
public int getMinIndex()
public int getMin()
public P0I range(int min, int max)
min
- indexmax
- indexpublic P0I oper(P0I p, String what)
Pp
- Input P0I container for operationwhat
- String representing the operation: "+" add a P0I container to
the original; "-" subtract a P0I from the original; "*"
multiply; "/" divide by P0Ipublic P0I operScale(double scale)
scale
- Scale factorpublic P0I operShift(double shift)
shift
- constants used to addpublic P0I operShiftAndScale(double shift, double scale)
shift
- constants used to add to all valuesscale
- constant used to scale after shifting.public P0I oper(P0I p0i, String title, String what)
p0i
- Input P0I container for operationtitle
- New titlewhat
- String representing the operation: "+" add a P0I container to
the original; "-" subtract a P0I from the original; "*"
multiply; "/" divide by P0Ipublic double mean()
public double kurtosis()
public double median()
public String getStatString()
public DoubleArrayList getIntegerArrayList()
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(P0I P0I)
P0I
- P0I object for covariance calculationspublic double[] getArrayDouble()
public double correlation(P0I P0I)
P0I
- P0I object for correlation calculation.public P0I 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 P0I 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