|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjhplot.P0D
public class P0D
A container to hold data points in one dimension. All numbers are expected to be in double precision. It extends ArrayList and adds many new features for data manipulation. The class does not have graphical option (use H1D to show the data or methods of this class which transform P0D to a H1D histogram).
Constructor Summary | |
---|---|
P0D()
Construct an empty container with a title |
|
P0D(double[] d)
Construct P0D from array; |
|
P0D(cern.colt.list.DoubleArrayList d)
Construct P0D from DoubleArrayList from cern.colt.list.DoubleArrayList; |
|
P0D(int[] d)
Construct P0D from an integer array. |
|
P0D(String title)
Construct an empty container with a title |
|
P0D(String title,
boolean shallow,
P0D p0d)
Construct a copy from a P0D. |
|
P0D(String title,
double[] d)
Create P0D from an array. |
|
P0D(String title,
int[] d)
Construct P0D from integers. |
|
P0D(String title,
String sfile)
Construct a P0D from a file. |
Method Summary | |
---|---|
void |
add(double value)
Adds (appends) the specified element to the end of this list. |
void |
add(int value)
Adds (appends) the specified element to the end of this list. |
void |
clear()
Clear the container |
boolean |
contains(double d)
Returns true if value exists |
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. |
double |
get(int i)
Return a specific value at ith position. |
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 |
cern.colt.list.DoubleArrayList |
getDoubleArrayList()
Get data in form of DoubleArrayList from cern.colt package |
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. |
double |
getSum()
Returns the sum of all values. |
String |
getTitle()
Get a new title |
double |
kurtosis()
Returns the kurtosis. |
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,
cern.jet.random.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 |
remove(int i)
Remove a value at the specified position. |
P0D |
reverse()
Reverse the order of elements |
int |
search(double value)
Search for the first occurrence of the given argument |
void |
set(int i,
double value)
Sets a value at the specified position. |
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 |
int |
size()
Return the P10 data length. |
double |
skew()
Returns the skew, which is moment(3,mean()) / standardDeviation() Run getStat(0 for evaluation |
P0D |
sort()
Sort into ascending order |
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. |
void |
toTable(boolean format)
Print the P0D array 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 |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public P0D(String title)
title
- New titlepublic P0D(cern.colt.list.DoubleArrayList d)
d
- DoubleArrayList frompublic P0D(double[] d)
d
- arraypublic P0D(String title, double[] d)
title
- titled
- input arraypublic P0D(int[] d)
d
- integer arraypublic P0D(String title, int[] d)
title
- title;d
- input arraypublic P0D(String title, boolean shallow, P0D p0d)
title
- new titleshallow
- if true, a shallow copy of a collection.p0d
- input data in form of P0Dpublic P0D()
public P0D(String title, String sfile)
title
- Title of the containersfile
- File name with input. Can be either file location or URL. Must start as http or ftpMethod Detail |
---|
public void setTitle(String title)
title
- New Titlepublic String getTitle()
public int read(BufferedReader br)
sfile
- File name with input
public int read(File sfile)
sfile
- input file
public 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 input
public 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 Object
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, cern.jet.random.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 merged
public void add(double value)
value
- value to be added.public void add(int value)
value
- value to be added.public void fill(double[] values)
values
- array with double valuespublic void fill(int[] values)
values
- array with double valuespublic void set(int i, double value)
i
- positionvalue
- value to be insertedpublic void remove(int i)
i
- position of a value to be removedpublic int size()
public P0D copy()
public ArrayList<Double> getArrayList()
public String getStringValues()
public cern.colt.list.DoubleArrayList getDoubleArrayList()
public 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 boolean contains(double d)
d
- double valuepublic int find(double d)
d
- input valuepublic double[] getArray()
public int[] getArrayInt()
public double get(int i)
i
- index of the array
public int search(double value)
value
- value for searching
public double getMax()
public int getMaxIndex()
public int getMinIndex()
public double getMin()
public double getSum()
public P0D range(int min, int max)
min
- indexmax
- index
public 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 P0D
public P0D operScale(double scale)
scale
- Scale factor
public P0D operShift(double shift)
shift
- constants used to add
public 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 P0D
public 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
- c
public double standardError()
public double skew()
public double variance()
public double stddeviation()
public double covariance(P0D p0d)
p0d
- P0D object for covariance calculations
public double correlation(P0D p0d)
p0d
- P0D object for correlation calculation.
public void clear()
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 transformation
public P0D func(String title, F1D f1d)
title
- new titlef1d
- function for transformation
public P0D sort()
public int[] sortIndex()
public P0D reverse()
public void toTable()
public void toTable(boolean format)
format
- if false, numbers will not be formatted to scientific format
##.#####E00public void doc()
|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |