|
|||||||||
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(java.lang.String title)
Construct an empty container with a title |
|
P0D(java.lang.String title,
java.lang.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 |
P0D |
copy()
Get a copy of the current holder |
P0D |
copy(java.lang.String newtitle)
Create an exact copy of the currentP0D. |
double |
correlation(P0D p0d)
Returns the correlation coefficient. |
double |
covariance(P0D p0d)
Returns the covariance |
void |
fill(double[] values)
Fill a P0D container from an array. |
void |
fill(int[] values)
Fill a P0D container from an array. |
P0D |
fill(int TotNumber,
double min,
double max)
Fill with a sequence of numbers between min and max. |
P0D |
func(Function f)
Transform P0D array to array with values given by a function. |
P0D |
func(java.lang.String definition)
Transform P0D array to array with values given by a function. |
double |
get(int i)
Return a specific value at ith position. |
double[] |
getArray()
Get a double array with P0D values. |
int[] |
getArrayInt()
Get an integer array with P0D values. |
java.util.ArrayList<java.lang.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. |
double |
getSum()
Returns the sum of all values. |
java.lang.String |
getTitle()
Get a new title |
static void |
main(java.lang.String[] args)
Test |
double |
mean()
Returns the mean value. |
P0D |
merge(P0D a)
Merge two P0D containers |
P0D |
oper(P0D p0d,
java.lang.String title,
java.lang.String what)
Operations on P0D containers: add, subtract, multiply, divide. |
void |
print()
Print a P1D container. |
P0D |
randomNormal(int TotNumber,
double mu,
double sigma)
Fill with random numbers with normal random values. |
P0D |
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 |
P0D |
readBinary(java.lang.String name)
Read a P0D from a binary file (big endian by default). |
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(java.util.ArrayList<java.lang.Double> array)
Set the data in form of ArrayList |
void |
setTitle(java.lang.String title)
Set a new title |
int |
size()
Return the P10 data length. |
P0D |
sort()
Sort into ascending order |
double |
stddeviation()
Returns the standard deviation (square root of variance) |
void |
toFile(java.lang.String name)
Write a P0D to an external file. |
java.lang.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(java.lang.String name)
Write a P0D to a binary file (big endian by default). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public P0D(java.lang.String title)
title
- New titlepublic P0D()
public P0D(java.lang.String title, java.lang.String sfile)
title
- Title of the containersfile
- File name with inputMethod Detail |
---|
public void setTitle(java.lang.String title)
title
- New Titlepublic java.lang.String getTitle()
public void toFile(java.lang.String name)
name
- File name with outputpublic void writeBinary(java.lang.String name)
name
- Binary file name for the output.public P0D readBinary(java.lang.String name)
name
- Binary file name for input.public java.lang.String toString()
toString
in class java.lang.Object
public P0D randomNormal(int TotNumber, double mu, double sigma)
TotNumber
- total number of random valuesmu
- parametersigma
- sigma
public P0D 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 value
public P0D randomUniform(int TotNumber, double min, double max)
TotNumber
- of random valuesmin
- min random valuemax
- max random value
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 added
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 java.util.ArrayList<java.lang.Double> getArrayList()
public void setArrayList(java.util.ArrayList<java.lang.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(java.lang.String newtitle)
newtitle
- new titlepublic 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, java.lang.String title, java.lang.String what)
p0d
- Input P1D 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 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(Function f)
f
- input function for transformation.
public P0D func(java.lang.String definition)
Known Bugs 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.
definition
- function definition for transformation
public P0D sort()
public P0D reverse()
public void toTable()
public void toTable(boolean format)
format
- if false, numbers will not be formatted to scientific format
##.#####E00public static void main(java.lang.String[] args)
args
-
|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |