Commit Graph

4267 Commits

Author SHA1 Message Date
Tim O'Brien 5879d3be89 Altered the build script to use batch test instead of running
a suite.  The advantage of this is that when new tests are added to the
project a TestSuite class does not need to updated.

All classes *Test.java are included, and *AbstractTest.java are excluded.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140837 13f79535-47bb-0310-9956-ffa450edef68
2003-05-18 00:55:18 +00:00
Tim O'Brien d6f7028269 Added a FixedDoubleArray. FixedDoubleArray supports a rolling mechanism
that reuses an array of fixed length.  This classes was added to an efficient
rolling mechanism.

FixedDoubleArray was influenced by discussions on the commons-dev list and
patches submitted by Mark Diggory.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140836 13f79535-47bb-0310-9956-ffa450edef68
2003-05-17 23:24:21 +00:00
Tim O'Brien 71dfdabde1 The Univariate interface now contains getWindow and setWindow in
addition to a constant which signifies an "infinite" window.  Windowing
has been added to all three Univariate implementations:

* UnivariateImpl - If the window is not infinite, we keep track of
0..n elements and discount the contribution of the discarded element when
our "window" is moved.  If the window is infinite no extra storage is used
beyond an empty ContractableDoubleArray.

- In the following two implementations, the window size can be changed at anytime.

* ListStoreUnivariateImpl - If the window is not infinite, this
implementation only takes into account the last n elements of the List.

* StoreUnivariateImpl - Uses an internal ContractableDoubleArray, window size
can be changed at any time.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140835 13f79535-47bb-0310-9956-ffa450edef68
2003-05-16 05:23:29 +00:00
Tim O'Brien 0700b0f482 * DoubleArray is now an interface which is implemented by
ExpandableDoubleArray.  The interface provides a public interface
which does not hint at any of the storage parameters of
Expandable or Contractable.

* DoubleArrayTest now operates on the DoubleArray interface, casting
to Expandable when we need to call the package scopes getInternalLength
method.

* While we should not provide access to the internal storage array, it
should be possible to obtain a double[] of elements stored in this
DoubleArray - double[] getElements() was added to the DoubleArray interface,
it will return the element array.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140834 13f79535-47bb-0310-9956-ffa450edef68
2003-05-16 04:23:06 +00:00
Tim O'Brien 7651a6b14d * ContractableDoubleArray extends ExpandableDoubleArray - I sense the
need for a DoubleArray interface.

* ExpandableDoubleArray and the extension ContractableDoubleArray should
aim towards presenting a public interface that does not expose any
details of the internal.  To this end, one is no longer able to get the
internal storage array via public double[] getValues(), and the startIndex
(which was relative to the internal storage array) is no longer available.

* [Expandable|Contractable]DoubleArray now allow one to discard
elements from the front of the array.  Before this commit, one could
accomplish the same goal by changing the starting index of the element
array within the internal storage array.  This solution allowed one to
discard elements from the front of the array (as well as) reclaiming
elements by decreases the startIndex.

There were two problems with this approach (especially in
ContractableDoubleArray).   The ContractableDoubleArray can be
"compacted" at anytime thereby reseting the startIndex to zero and the
size of the internal store array to number of elements plus one.  Second,
"reclaiming" elements from the internal storage array by finagling
internal "pointers" to the start and end index seems to violate the
principles of encapsulation.  If you "discard" an element from the
front of the array, consider it unavailable.

It should be noted that calling setNumElements allows one to move the end
index of the internal element array at will.  Assume one has a 100 element
array, and one calls setNumElements(10), thereby decreasing the ending index
of the element array by 90.  The 90 "dumped" elements are not currently
reinitializied to the default double primitive value.  This is an open
question.

* Tests for ExpandableDoubleArray and ContractableDoubleArray were
refactored.  both test classes now extend a DoubleArrayAbstractTest
JUnit class which contained shared unit tests for both "implementations".
An approach like this should be adopted to test the Univariate implementations.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140833 13f79535-47bb-0310-9956-ffa450edef68
2003-05-16 03:55:34 +00:00
Tim O'Brien 065a88e241 Patches from Phil S. applied:
* A TestStatistic interface with corresponding implementation and testcase

PR: Bugzilla 19971
Obtained from: Patches attached to issue
Submitted by: Phil S.
Reviewed by: Tim O/


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140832 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 21:58:23 +00:00
Tim O'Brien 5f2a1cbbc5 Made a nubmer of change to the ExpandableDoubleArray.
* This class now supports
the ability to move the starting index of the internal element array.  This
allows one to move the beginning of the element array, and form a sort of
"window", this will come into play when we want to provide moving
averages, or "rolling".

* Added an addElementRolling(double v) - this will increment the startIndex
and add the element to the end of the internal element array

* brought the Clover test cases up to 100% for this class

Added a class ContractableDoubleArray:

* This is an extension of ExpandableDoubleArray - it addes a configuration
parameter contractionCriteria.  Essential if the contractionCriteria is
2.0f we commit to never having the internal storage array provide more
than 2.0 times the storage capacity needed.  Once the internal
storage array exceed this measurement, the internal storage array is
pruned to the size of the internal element array.

Also, my IDE scolded me for some ununsed imports in ListUnivariateImpl, they
have been removed.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140831 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 15:38:48 +00:00
Tim O'Brien 5ae92f12c7 Another change to the stored Univariates. The calculations are now abstracted
into an AbstractStoreUnivariate class which take responsibility for
all statistical calculations.  AbstractStoreUnivariate is implemented by
two classes:

* StoreUnivariateImpl - This class uses a ExpandableDoubleArray for
internal storage.  This class is a more efficient class in terms
of storage and cycles for users who are interested in gathering statistics
not available in the UnivariateImpl implementation.

* ListUnivariateImpl - This class is for a situation where a user might
wish to maintain a List of numeric objects outside of a StoreUnivariate
instance.  We still need to add serious error checking in the absence of
1.5's generics, but this implementation will work with any list that
contains Number objects - (BigDecimal, BigInteger, Byte, Double, Float,
Integer, Long, Short).  This implementation ultimately transforms all
numeric objects into double primitives via Number.doubleValue().

Becuase AbstractStoreUnivariate does not hold on to any state, a user
can add values through the Univariate.addValue() function OR one can
directly manipulate the contents of the List directly.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140830 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 06:33:19 +00:00
Tim O'Brien 52590a7d00 Submitted by: Phil S.
Reviewed by: Tim O.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140829 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 05:47:51 +00:00
Tim O'Brien 97568dc06f The following changes were made to the Univariate implementation. The public
interface of Univariate was extracted in an interface of the same name.
Univariate, an interface, is now implemented by UnivariateImpl which contains
all code originally present in the original Univariate implementation.

* StoredUnivariate is an interface which extends Univariate and adds
measures not available in the superinterface such as mode, kurtosis, and skew

* StoredUnivariateImpl provides an implementation which uses the
ExpandableDoubleArray for internal storage.  Calculations are performed
on demand *each* time a particular measure is required no state is
maintained by this implementation.

* Univariate provided methods addValue(int), addValue(float), addValue(long).
There functions were removed as no cast is required - all of these
assignments are widening conversions - no cast required

* Removed the name property from Univariate - property not relevant to
univariate statistics


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140828 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 05:39:01 +00:00
Tim O'Brien f039b677b8 Added an expandable double array, this class simply contains a double[] and takes care of automatic expansion of an internal array when necessary. Class added with accompanying unit test
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140827 13f79535-47bb-0310-9956-ffa450edef68
2003-05-15 05:19:57 +00:00
Tim O'Brien ccf6befd5f 1. Make RealMatrixImpl implement Serializable
2. Make all currently unimplemented methods throw UnsupportedOperationException
3. Add solve() method to RealMatrix interface, representing vector
   solution to AX = B, where B is the parameter and A is *this.

Phil

Obtained from: Phil S.
Submitted by: Phil S.
Reviewed by: Tim O.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140826 13f79535-47bb-0310-9956-ffa450edef68
2003-05-13 19:08:14 +00:00
Tim O'Brien 9b7cfb86b2 Added myself to STATUS and PROPOSAL
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140825 13f79535-47bb-0310-9956-ffa450edef68
2003-05-12 20:32:26 +00:00
Tim O'Brien 352f134f0e A maven project.xml was added for conv
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140824 13f79535-47bb-0310-9956-ffa450edef68
2003-05-12 19:28:54 +00:00
Robert Burrell Donkin e4694325bc Starting source code - basic matrix operations and univarient stats plus test code. Submitted by Phil Steitz.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140823 13f79535-47bb-0310-9956-ffa450edef68
2003-05-12 19:04:38 +00:00
Robert Burrell Donkin 925847780e added new commons math component
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140822 13f79535-47bb-0310-9956-ffa450edef68
2003-05-12 15:07:54 +00:00
No Author 4a8cbc2867 New repository initialized by cvs2svn.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140821 13f79535-47bb-0310-9956-ffa450edef68
2003-05-12 15:07:54 +00:00