Re: [math] Add module-info.java

2024-03-14 Thread Gili
Hi Gary,

I noticed that you are generating both Automatic-Module and
module-info.java. Isn't this problematic? Shouldn't you drop the automatic
module?

Also, I don't see the root pom adding any "export" statement to the
module-info file. Has anyone tested that thr output actually works as
expected?

Gili

On Thu, Mar 14, 2024, 20:50 Gary Gregory  wrote:

> The commons-parent POM automatically creates module-info.java files. A
> Commons component should not have to do anything beyond using a recent
> version.
>
> Gary
>
> On Thu, Mar 14, 2024, 8:03 PM Gili Tzabari  wrote:
>
> > Hi,
> >
> > I'd like Commons Math to add module-info.java to all the components. I
> > noticed that you are adding a "Automatic-Module" entry in META-INF but
> > this isn't enough for jlink (and related tools) to work properly. We
> > absolutely need to add module-info.java.
> >
> > You just need to add a few lines to pom.xml to turn your releases into
> > multirelease JAR files and you're done. Here is the code I lifted from
> >
> >
> https://medium.com/@ankitagrahari.rkgit/multi-release-functionality-8fc423b6c94e
> > :
> >
> > | java11 compile
> >  11
> >
> ${project.basedir}/src/main/java11
> >
> > true 
> >  |
> >
> > ||
> >
> > |Gili|
> >
>


Re: [math] Add module-info.java

2024-03-14 Thread Gary Gregory
The commons-parent POM automatically creates module-info.java files. A
Commons component should not have to do anything beyond using a recent
version.

Gary

On Thu, Mar 14, 2024, 8:03 PM Gili Tzabari  wrote:

> Hi,
>
> I'd like Commons Math to add module-info.java to all the components. I
> noticed that you are adding a "Automatic-Module" entry in META-INF but
> this isn't enough for jlink (and related tools) to work properly. We
> absolutely need to add module-info.java.
>
> You just need to add a few lines to pom.xml to turn your releases into
> multirelease JAR files and you're done. Here is the code I lifted from
>
> https://medium.com/@ankitagrahari.rkgit/multi-release-functionality-8fc423b6c94e
> :
>
> | java11 compile
>  11
> ${project.basedir}/src/main/java11
>
> true 
>  |
>
> ||
>
> |Gili|
>


Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Alex Herbert
On Fri, 29 Sept 2023 at 18:49, Siddharth Jain  wrote:
>
> thanks. i see this is filed under legacy namespace with the comment
> Implementations
> of common discrete and continuous distributions. [Mostly moved to the
> "Commons Statistics" project (cf. JIRA: MATH-1443).]
> i then checked
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html
> but could not see this class there. should i still use commons-math? and
> the 4.0-beta1 does not seem to be in maven repository. could i get link to
> mvn coordinates if its published on maven?

https://central.sonatype.com/artifact/org.apache.commons/commons-math4-legacy

There are some distribution classes that remain in Commons Math as
they use more math code than just the functions required to implement
standard distributions.

The legacy module contains most of what was in Commons Math 3. This is
code that has not been refactored into modules within the modular
Commons Math 4 layout, or undergone a complete rewrite as a new
project (see Commons RNG, Numbers, Statistics and Geometry).

Alex

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Siddharth Jain
thanks. i see this is filed under legacy namespace with the comment
Implementations
of common discrete and continuous distributions. [Mostly moved to the
"Commons Statistics" project (cf. JIRA: MATH-1443).]
i then checked
https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html
but could not see this class there. should i still use commons-math? and
the 4.0-beta1 does not seem to be in maven repository. could i get link to
mvn coordinates if its published on maven?

On Fri, Sep 29, 2023 at 10:10 AM Alex Herbert 
wrote:

> This may be what you require:
>
>
> https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html
>
> You will have to convert your float values to double and then specify
> the bin size:
>
> float[] x = ...
> int bins = 100;
> ContinuousDistribution d = EmpiricalDistribution.from(bins,
> IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray());
>
> On Fri, 29 Sept 2023 at 17:44, Siddharth Jain  wrote:
> >
> > I have a vector float[] x containing samples of a random variable. I
> would
> > like to initialize a prob. distribution fn. using these samples and then
> be
> > able to call methods like
> >
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html
> >
> > I am looking for an API like:
> >
> > var f = ContinuousDistribution.of(x)
> >
> > is this available in commons-math? thanks.
> >
> > S.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Alex Herbert
This may be what you require:

https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html

You will have to convert your float values to double and then specify
the bin size:

float[] x = ...
int bins = 100;
ContinuousDistribution d = EmpiricalDistribution.from(bins,
IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray());

On Fri, 29 Sept 2023 at 17:44, Siddharth Jain  wrote:
>
> I have a vector float[] x containing samples of a random variable. I would
> like to initialize a prob. distribution fn. using these samples and then be
> able to call methods like
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html
>
> I am looking for an API like:
>
> var f = ContinuousDistribution.of(x)
>
> is this available in commons-math? thanks.
>
> S.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Compute derivatives for bidimensional interpolated function

2022-07-20 Thread Gilles Sadowski
Le mer. 20 juil. 2022 à 21:34, Alessandro Moscatelli
 a écrit :
>
> It seems that the SplineInterpolator per row/columns is exactly what the 
> depracted Cubic Interpolator was doing.
> So, nevermind, I got my answer. It made sense indeed.
>
> Looking further into the code for PR porpuses.

Great, thanks!

Gilles

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Compute derivatives for bidimensional interpolated function

2022-07-20 Thread Gilles Sadowski
Hello.

Le mer. 20 juil. 2022 à 12:29, Alessandro Moscatelli
 a écrit :
>
> Hi everybody !
>
> I have an xyz grid of points.
> I want to interpolate and compute derivations along x, along y, and along xy.
>
> If I understood correctly, I can’t use PiecewiseBicubicSplineInterpolator 
> (this was my first attempt), since it interpolates into 
> PiecewiseBicubicSplineInterpolatingFunction which doesn’t implements 
> MultivariateDifferentiableFunction .
>
> I need a function able to return DerivativeStructure, am I right ?

I think so.

>
> Then I double checked and found a deprecated BicubicSplineInterpolator.
> That interpolator lets me directly compute derivatives I need.

This class does not exist in the development version that will become
the next major version (4.0).

> Am I missing something ?
> How can I do what I need without using deprecated BicubicSplineInterpolator.

As you suggest, it would be great that you explore how to provide
access to the derivatives (which the interpolating functions are able
to compute, since they are polynomials).

A minimal change would perhaps be that "BicubicInterpolatingFunction"
implements a new "BivariateDifferentiableFunction" interface:
---CUT---
public interface BivariateDifferentiableFunction extends
BinaryOperator
{}
---CUT---

Regards,
Gilles

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Reduce density of a point cloud

2021-11-23 Thread Matt Juntunen
Hi Patrik,

It's funny that you mention this because I am currently working on
GEOMETRY-142 [1] in commons-geometry which exactly addresses this
issue. The idea is to have PointMapXD and PointSetXD classes that
store point keys using a precision context, which allows "fuzzy"
comparisons. So, if you create a set with a
Precision.DoubleEquivalence instance with an epsilon of 0.1 and add
all of the points, the "unique" points left in the map will all be at
least a distance of 0.1 away from each other. I'm very early on in the
ticket so I haven't decided what type of algorithm and data structure
to use. If you have any input, it would be most helpful.

Regards,
Matt J

[1] https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-142

On Tue, Nov 23, 2021 at 10:14 AM Patrik Karlström  wrote:
>
> Hi,
> I am working with metric coordinates captured with a 3d scanner.
> The data set tends to be unnecessary large for a simple visualization and a
> bit heavy too.
>
> Does math have something ready made that I can feed my data along with a
> parameter of let's say 0.1 meter rendering a set where no remaining point
> is located closer than 0.1 meter to another?
>
> I have some ideas on how to do this "manually" but I suspect this might be
> an existing feature of commons-math.
>
> Patrik

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2021-06-08 Thread Christoph Läubrich

Hi Gilles and Randy,

that sounds really interesting I'll try this out, both the sigmodial and 
the scaling stuff!


I'm relative new to all this least squares things and I'm not a 
mathematician so I need to learn a lot, so don't hesitate to point out 
things that might seem obvious to the advanced user, that's really 
welcome :-)


Am 08.06.21 um 15:23 schrieb Gilles Sadowski:

Hello.

Le mar. 8 juin 2021 à 08:14, Christoph Läubrich
 a écrit :


Hi Gilles,

I have used the the INFINITY approach for a while now and it works quite
good. I just recently found a problem where I got very bad fits after a
handful of iterations using the LevenbergMarquardtOptimizer.

The problem arises whenever there is a relative small range of valid
values for *one* parameter.

Too keep up with the Gausian example assume that the mean is only valid
in a small window, but norm and sigma are completely free.

My guess is, if in the data there are outlier that indicates a strong
maximum outside this range the optimizer try to go in that 'direction'
because I reject this solution it 'gives up' as it seems evident that
there is no better solution. This then can result in a gausian that is
very thin and a really bad fit (cost e.g about 1E4).

If I help the optimizer (e.g. by adjusting the initial guess of sigma)
it finds a much better solution (cost about 1E-9).

So what I would need to tell the Optimizer (not sure if this is possible
at all!) that not the *whole* solution is bad, but only the choice of
*one* variable so it could use larger increments for the other variables.


If you want to restrict the range of, say, the mean:

public class MyFunc implements ParametricUnivariateFunction {
 private final Sigmoid meanTransform;

 public MyFunc(double minMean, double maxMean) {
 meanTransform = new Sigmoid(minMean, maxMean);
 }

 public double value(double x, double ... param) {
  final double mu = meanTransform.value(param[1]); // param[1]
is the mean.
  final double diff = x - mu;
  final double norm = param[0]; // param[0] is the height.
  final double s = param[2]; // param[2] is the standard deviation.
  final double i2s2 = 1 / (2 * s * s);
  return Gaussian.value(diff, norm, i2s2);
 }
}

// ...
final MyFunc f = new MyFunc(min, max);
final double[] best = fitter.fit(f); // Perform fit.
final double bestMean = new Logit(min, max).value(best[1]);

HTH,
Gilles



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2021-06-08 Thread Randy Motluck
 Hi Gilles,
I may be wrong in understanding your issue,  but in general, I believe you 
should scale your features.
https://towardsdatascience.com/gradient-descent-the-learning-rate-and-the-importance-of-feature-scaling-6c0b416596e1

https://societyofai.medium.com/simplest-way-for-feature-scaling-in-gradient-descent-ae0aaa383039

It becomes important when one feature is of greatly different scale than 
another.  Say for example X is 0-100.0 while Y is 0-10 or something.
Hope this finds you well and best of luck,
Randy Motluck

On Tuesday, June 8, 2021, 08:24:54 AM CDT, Gilles Sadowski 
 wrote:  
 
 Hello.

Le mar. 8 juin 2021 à 08:14, Christoph Läubrich
 a écrit :
>
> Hi Gilles,
>
> I have used the the INFINITY approach for a while now and it works quite
> good. I just recently found a problem where I got very bad fits after a
> handful of iterations using the LevenbergMarquardtOptimizer.
>
> The problem arises whenever there is a relative small range of valid
> values for *one* parameter.
>
> Too keep up with the Gausian example assume that the mean is only valid
> in a small window, but norm and sigma are completely free.
>
> My guess is, if in the data there are outlier that indicates a strong
> maximum outside this range the optimizer try to go in that 'direction'
> because I reject this solution it 'gives up' as it seems evident that
> there is no better solution. This then can result in a gausian that is
> very thin and a really bad fit (cost e.g about 1E4).
>
> If I help the optimizer (e.g. by adjusting the initial guess of sigma)
> it finds a much better solution (cost about 1E-9).
>
> So what I would need to tell the Optimizer (not sure if this is possible
> at all!) that not the *whole* solution is bad, but only the choice of
> *one* variable so it could use larger increments for the other variables.

If you want to restrict the range of, say, the mean:

public class MyFunc implements ParametricUnivariateFunction {
    private final Sigmoid meanTransform;

    public MyFunc(double minMean, double maxMean) {
        meanTransform = new Sigmoid(minMean, maxMean);
    }

    public double value(double x, double ... param) {
        final double mu = meanTransform.value(param[1]); // param[1]
is the mean.
        final double diff = x - mu;
        final double norm = param[0]; // param[0] is the height.
        final double s = param[2]; // param[2] is the standard deviation.
        final double i2s2 = 1 / (2 * s * s);
        return Gaussian.value(diff, norm, i2s2);
    }
}

// ...
final MyFunc f = new MyFunc(min, max);
final double[] best = fitter.fit(f); // Perform fit.
final double bestMean = new Logit(min, max).value(best[1]);

HTH,
Gilles

 [...]

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

  

Re: [math] example for constrain parameters for Least squares

2021-06-08 Thread Gilles Sadowski
Hello.

Le mar. 8 juin 2021 à 08:14, Christoph Läubrich
 a écrit :
>
> Hi Gilles,
>
> I have used the the INFINITY approach for a while now and it works quite
> good. I just recently found a problem where I got very bad fits after a
> handful of iterations using the LevenbergMarquardtOptimizer.
>
> The problem arises whenever there is a relative small range of valid
> values for *one* parameter.
>
> Too keep up with the Gausian example assume that the mean is only valid
> in a small window, but norm and sigma are completely free.
>
> My guess is, if in the data there are outlier that indicates a strong
> maximum outside this range the optimizer try to go in that 'direction'
> because I reject this solution it 'gives up' as it seems evident that
> there is no better solution. This then can result in a gausian that is
> very thin and a really bad fit (cost e.g about 1E4).
>
> If I help the optimizer (e.g. by adjusting the initial guess of sigma)
> it finds a much better solution (cost about 1E-9).
>
> So what I would need to tell the Optimizer (not sure if this is possible
> at all!) that not the *whole* solution is bad, but only the choice of
> *one* variable so it could use larger increments for the other variables.

If you want to restrict the range of, say, the mean:

public class MyFunc implements ParametricUnivariateFunction {
private final Sigmoid meanTransform;

public MyFunc(double minMean, double maxMean) {
meanTransform = new Sigmoid(minMean, maxMean);
}

public double value(double x, double ... param) {
 final double mu = meanTransform.value(param[1]); // param[1]
is the mean.
 final double diff = x - mu;
 final double norm = param[0]; // param[0] is the height.
 final double s = param[2]; // param[2] is the standard deviation.
 final double i2s2 = 1 / (2 * s * s);
 return Gaussian.value(diff, norm, i2s2);
}
}

// ...
final MyFunc f = new MyFunc(min, max);
final double[] best = fitter.fit(f); // Perform fit.
final double bestMean = new Logit(min, max).value(best[1]);

HTH,
Gilles

 [...]

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2021-06-07 Thread Christoph Läubrich

Hi Gilles,

I have used the the INFINITY approach for a while now and it works quite 
good. I just recently found a problem where I got very bad fits after a 
handful of iterations using the LevenbergMarquardtOptimizer.


The problem arises whenever there is a relative small range of valid 
values for *one* parameter.


Too keep up with the Gausian example assume that the mean is only valid 
in a small window, but norm and sigma are completely free.


My guess is, if in the data there are outlier that indicates a strong 
maximum outside this range the optimizer try to go in that 'direction' 
because I reject this solution it 'gives up' as it seems evident that 
there is no better solution. This then can result in a gausian that is 
very thin and a really bad fit (cost e.g about 1E4).


If I help the optimizer (e.g. by adjusting the initial guess of sigma) 
it finds a much better solution (cost about 1E-9).


So what I would need to tell the Optimizer (not sure if this is possible 
at all!) that not the *whole* solution is bad, but only the choice of 
*one* variable so it could use larger increments for the other variables.


Am 11.08.20 um 16:11 schrieb Gilles Sadowski:

Hello.

Le mar. 11 août 2020 à 12:08, Christoph Läubrich
 a écrit :


Thanks for your patience, maybe a better/simpler example would be [1], I
want to find the best fit using LSB


"LSB" ?


under the constraint that the height
of the curve never is above 0.7 (even though without constrains the
optimizer would find a better solution around 8.5).


It occurs to me that this would be more properly defined as a
least-square problem by assigning an error bar (weight) to each
data point.


So my first idea way to copy/extend GausianCurveFitter to accept some
kind of "maxHeight(...)", adjust the function to return INF for
h>maxHeight, I was just unsure that return INF is allowed (per
definition) as it is not mentioned anywhere in the userdocs. And if I
want to limit others (like max position) it would work the same way.


Hopefully "infinity" will not cause an issue; you could try and check.
[Then if it does, just use any suitably large value.]


In my final problem I need to limit the height, width and position of
the bell-curve to fall into certain bounds, but there is no direct
relation (e.g. width must be three times the height).


Then, width is totally correlated (to height) and there are only
2 parameters to fit (height and mean); hence it's probably better
(and more efficient) to use that fact instead of defining the
correlation as a constraint i.e. define (untested):
---CUT---
public class MyFunc implements ParametricUnivariateFunction {
 public double value(double x, double ... param) {
  final double diff = x - param[1]; // param[1] is the mean.
  final double norm = param[0]; // param[0] is the height.
  final double s = 3 * norm; // "constraint".
  final double i2s2 = 1 / (2 * s * s);
  return Gaussian.value(diff, norm, i2s2);
 }

 // And similarly for the "gradient":
 //   
https://gitbox.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java;h=08dcac0d4d37179bc85a7071c84a6cb289c09f02;hb=HEAD#l143
}
---CUT---
to be passed to "SimpleCurveFitter".

Regards,
Gilles





[1]
https://crlbucophysics101.files.wordpress.com/2015/02/gaussian.png?w=538&h=294




Am 11.08.20 um 11:18 schrieb Gilles Sadowski:

Hi.

2020-08-11 8:51 UTC+02:00, Christoph Läubrich :

Hi Gilles,


Just to make clear I don't suspect any error with GausianCurveFitter, I
just don't understand how the advice in the user-doc to restrict
parameter (for general problems) could be applied to a concrete problem
and thus chosen GausianCurvefitter as an example as it uses
LeastSquaresBuilder.

I also noticed that Gaussian Fitter has a restriction on parameters
(norm can't be negative) that is handled in a third way (returning
Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned
in the userdoc at all, so I wonder if this is a general purpose solution
for restricting parameters (seems the simplest approach).


I'd indeed suggest to first try the same trick as in "GaussianCurveFitter"
(i.e. return a "high" value for arguments outside a known range).
That way, you only have to define a suitable "ParametricUnivariateFunction"
and pass it to "SimpleCurveFitter".

One case for the "ParameterValidator" is when some of the model
parameters might be correlated to others.
But using it makes it necessary that you handle yourself all the
arguments to be passed to the "LeastSquaresProblem".


To take the gausian example for my use case, consider an observed signal
similar to [1], given I know (from other source as the plain data) for
example that the result must be found in the range of 2...3 and I wanted
to restrict valid solutions to this area. The same might apply to the
norm: I know it must be between a given range and I want to restrict the
optimi

Re: [math] AffineTransformMatrix2D

2021-03-22 Thread Matt Juntunen
Hello,

> its a bit bad to code against internal representations.

I would not consider the utility method above as a use of an internal 
representation. The toArray() method is a part of the public API and was 
created for use cases such as this.

> What do you think about two methods, transformX and transformY that take a 
> single double and return the transformed value?

That's an interesting idea. Create a new JIRA issue for it and we can go from 
there.

> I also noticed that there is no dedicated "shear" method, if I open a PR 
> could it be in-cooperated?

You bet. That is definitely something lacking in the API. Same as above, create 
a JIRA issue for it and we can talk about it there.

Note that if you plan on submitting PRs, make sure you've gone through the 
documentation in the CONTRIBUTING.md file in the repo. Specifically, you'll 
need a signed Contributor License Agreement on file with the ASF.

Regards,
Matt



From: Christoph Läubrich 
Sent: Monday, March 22, 2021 3:24 AM
To: user@commons.apache.org 
Subject: Re: [math] AffineTransformMatrix2D

Hi Matt,

thanks for the feedback, I have commented on the bug.

Regarding the "direct" method you are most probably right. I have arrays
that are easily can extend 10k or even 100k points that means in extreme
cases 200k Objects created and instantly destroyed as well as the
corresponding method calls. Even if this is not noticeable in some
scenarios it adds an unnecessary penalty.

I have already thought about the util method (and actually using it
currently) but its a bit bad to code against internal representations.
In the end of course I do not need to use the Affine transform at all
and can work on transform-matrix itself but thats not really the goal :-)

What do you think about two methods, transformX and transformY that take
a single double and return the transformed value?

public double transformX(final double x, double y) {
 return LinearCombination.value(m00, x, m01, y) + m02;
}

public double transformY(final double x, double y) {
 return LinearCombination.value(m10, x, m11, y) + m12;
}

I also noticed that there is no dedicated "shear" method, if I open a PR
could it be in-cooperated?


Am 21.03.21 um 19:07 schrieb Matt Juntunen:
> Hello,
>
> It's entirely possible that the OSGi headers are incorrect. I've created a 
> new issue (GEOMETRY-116 [1]) for it. We can continue that part of this 
> discussion there.
>
> The "internal" package in commons-geometry-core is intended to be internal 
> from the standpoint of the library. Classes under this package (and 
> "internal" packages in other modules) are not considered part of the public 
> API and are not guaranteed to be binary compatible with previous releases. 
> From a practical standpoint, however, these packages do need to be exported 
> and available for use by the other modules in the library.
>
> In regard to the new method you mentioned, I am hesitant to add that to the 
> API. The main reason is that there are a large number of possible ways to 
> represent 2D vectors as arrays. For example, the xy components could be in 
> two parallel arrays (as in your example), a single array with interleaved xy 
> components (eg, [x1,y1,x2,y2,...]), a multidimensional array (eg, 
> [[x1,y1],[x2,y2]...]), etc. Adding this method could open up a can of worms 
> as to which formats are accepted by the API. It would keep the API cleaner by 
> leaving this functionality to consuming applications. You could, for example, 
> use AffineTransformMatrix2D as-is for matrix creation and manipulation and 
> create a utility method in your application that performs the required 
> transformations using the target format.
>
> public static void applyTransform(AffineTransformMatrix2D m, double[] x, 
> double[] y) {
>  // input checking, etc
>  double[] mArr = m.toArray();
>  for (int i = 0; i < x.length; ++i {
>  x[i] = LinearCombination.value(mArr[0], x[i], mArr[1], y[i]) + 
> mArr[2];
>  y[i] = LinearCombination.value(mArr[3], x[i], mArr[4], y[i]) + 
> mArr[5];
>  }
> }
>
> I would also be interested in seeing if there is an actual performance 
> improvement when skipping the Vector2D instantiations. In my experience, 
> optimizations such as this sometimes don't really make a difference.
>
> Regards,
> Matt J
>
> [1] https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-116
> 
> From: Christoph Läubrich 
> Sent: Sunday, March 21, 2021 8:40 AM
> To: user@commons.apache.org 
> Subject: Re: [math] 2D Line getOffset and natural orientation
>
> Hi Matt,
>
> just some feedback on the AffineTransformMatrix2D in general I think it
> wo

Re: [math] AffineTransformMatrix2D

2021-03-22 Thread Christoph Läubrich

Hi Matt,

thanks for the feedback, I have commented on the bug.

Regarding the "direct" method you are most probably right. I have arrays 
that are easily can extend 10k or even 100k points that means in extreme 
cases 200k Objects created and instantly destroyed as well as the 
corresponding method calls. Even if this is not noticeable in some 
scenarios it adds an unnecessary penalty.


I have already thought about the util method (and actually using it 
currently) but its a bit bad to code against internal representations. 
In the end of course I do not need to use the Affine transform at all 
and can work on transform-matrix itself but thats not really the goal :-)


What do you think about two methods, transformX and transformY that take 
a single double and return the transformed value?


public double transformX(final double x, double y) {
return LinearCombination.value(m00, x, m01, y) + m02;
}

public double transformY(final double x, double y) {
return LinearCombination.value(m10, x, m11, y) + m12;
}

I also noticed that there is no dedicated "shear" method, if I open a PR 
could it be in-cooperated?



Am 21.03.21 um 19:07 schrieb Matt Juntunen:

Hello,

It's entirely possible that the OSGi headers are incorrect. I've created a new 
issue (GEOMETRY-116 [1]) for it. We can continue that part of this discussion 
there.

The "internal" package in commons-geometry-core is intended to be internal from the 
standpoint of the library. Classes under this package (and "internal" packages in other 
modules) are not considered part of the public API and are not guaranteed to be binary compatible 
with previous releases. From a practical standpoint, however, these packages do need to be exported 
and available for use by the other modules in the library.

In regard to the new method you mentioned, I am hesitant to add that to the 
API. The main reason is that there are a large number of possible ways to 
represent 2D vectors as arrays. For example, the xy components could be in two 
parallel arrays (as in your example), a single array with interleaved xy 
components (eg, [x1,y1,x2,y2,...]), a multidimensional array (eg, 
[[x1,y1],[x2,y2]...]), etc. Adding this method could open up a can of worms as 
to which formats are accepted by the API. It would keep the API cleaner by 
leaving this functionality to consuming applications. You could, for example, 
use AffineTransformMatrix2D as-is for matrix creation and manipulation and 
create a utility method in your application that performs the required 
transformations using the target format.

public static void applyTransform(AffineTransformMatrix2D m, double[] x, 
double[] y) {
 // input checking, etc
 double[] mArr = m.toArray();
 for (int i = 0; i < x.length; ++i {
 x[i] = LinearCombination.value(mArr[0], x[i], mArr[1], y[i]) + mArr[2];
 y[i] = LinearCombination.value(mArr[3], x[i], mArr[4], y[i]) + mArr[5];
 }
}

I would also be interested in seeing if there is an actual performance 
improvement when skipping the Vector2D instantiations. In my experience, 
optimizations such as this sometimes don't really make a difference.

Regards,
Matt J

[1] https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-116

From: Christoph Läubrich 
Sent: Sunday, March 21, 2021 8:40 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Hi Matt,

just some feedback on the AffineTransformMatrix2D in general I think it
would be good to have methods that accept a plain array. for example I
have an array of x and y values and like to transform them.

Currently I need to first construct a Vector of each x/y pair, then
apply the transform (what create another Vector), and copy the data back
to the array.

so a method apply [double[] x, double[] y) that simply performs the
transform in-place would prevent a lot of instantiation overhead.


Am 20.03.21 um 13:25 schrieb Matt Juntunen:

It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen 
:


Re: [math] 2D Line getOffset and natural orientation

2021-03-21 Thread Matt Juntunen
Hello,

It's entirely possible that the OSGi headers are incorrect. I've created a new 
issue (GEOMETRY-116 [1]) for it. We can continue that part of this discussion 
there.

The "internal" package in commons-geometry-core is intended to be internal from 
the standpoint of the library. Classes under this package (and "internal" 
packages in other modules) are not considered part of the public API and are 
not guaranteed to be binary compatible with previous releases. From a practical 
standpoint, however, these packages do need to be exported and available for 
use by the other modules in the library.

In regard to the new method you mentioned, I am hesitant to add that to the 
API. The main reason is that there are a large number of possible ways to 
represent 2D vectors as arrays. For example, the xy components could be in two 
parallel arrays (as in your example), a single array with interleaved xy 
components (eg, [x1,y1,x2,y2,...]), a multidimensional array (eg, 
[[x1,y1],[x2,y2]...]), etc. Adding this method could open up a can of worms as 
to which formats are accepted by the API. It would keep the API cleaner by 
leaving this functionality to consuming applications. You could, for example, 
use AffineTransformMatrix2D as-is for matrix creation and manipulation and 
create a utility method in your application that performs the required 
transformations using the target format.

public static void applyTransform(AffineTransformMatrix2D m, double[] x, 
double[] y) {
// input checking, etc
double[] mArr = m.toArray();
for (int i = 0; i < x.length; ++i {
x[i] = LinearCombination.value(mArr[0], x[i], mArr[1], y[i]) + mArr[2];
y[i] = LinearCombination.value(mArr[3], x[i], mArr[4], y[i]) + mArr[5];
}
}

I would also be interested in seeing if there is an actual performance 
improvement when skipping the Vector2D instantiations. In my experience, 
optimizations such as this sometimes don't really make a difference.

Regards,
Matt J

[1] https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-116

From: Christoph Läubrich 
Sent: Sunday, March 21, 2021 8:40 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Hi Matt,

just some feedback on the AffineTransformMatrix2D in general I think it
would be good to have methods that accept a plain array. for example I
have an array of x and y values and like to transform them.

Currently I need to first construct a Vector of each x/y pair, then
apply the transform (what create another Vector), and copy the data back
to the array.

so a method apply [double[] x, double[] y) that simply performs the
transform in-place would prevent a lot of instantiation overhead.


Am 20.03.21 um 13:25 schrieb Matt Juntunen:
> It's available on maven central [1]. You can find the code on the Apache git 
> repo [2] or on Github [3]. The user guide [4] gives an overview of the 
> library along with code examples so you can get a feel for how it works. 
> Don't hesitate to ask if you have any questions.
>
> -Matt
>
>
> [1] 
> https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
> [2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
> [3] https://github.com/apache/commons-geometry
> [4] https://commons.apache.org/proper/commons-geometry/userguide/index.html
>
>
> 
> From: Patrik Karlström 
> Sent: Saturday, March 20, 2021 4:30 AM
> To: Commons Users List 
> Subject: Re: [math] 2D Line getOffset and natural orientation
>
> Thanks for the clarification, I would be happy to try out beta1 of
> commons-geometry, is there a staging repo for it?
>
> /Patrik
>
> Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen > :
>
>> Hello.
>>
>> I agree that the docs are not really clear on the "natural orientation"
>> part there. Basically, the possible results are as follows:
>>
>>*   positive - The argument lies on the right side of the calling line,
>> with the "right side" defined as the side on the right when looking along
>> the calling line in its defined direction. (This is what I believe is meant
>> by "natural orientation".)
>>*   negative - The argument lies on the left side of the calling line.
>>*   zero - The lines have points in common, meaning they intersect or
>> are coincident.
>>
>> On a side note, if you're writing geometric code, I would suggest trying
>> out the new(-ish) commons-geometry library [1]. It is a rewrite and
>> extension of the commons-math geometry code and, IMHO, the API is more
>> user-friendly. (Disclaimer: I wrote the majority of it so I am completely
>> biased 🙂
>>
>> Regards,

Re: [math] 2D Line getOffset and natural orientation

2021-03-21 Thread Christoph Läubrich

Hi Matt,

just some feedback on the AffineTransformMatrix2D in general I think it 
would be good to have methods that accept a plain array. for example I 
have an array of x and y values and like to transform them.


Currently I need to first construct a Vector of each x/y pair, then 
apply the transform (what create another Vector), and copy the data back 
to the array.


so a method apply [double[] x, double[] y) that simply performs the 
transform in-place would prevent a lot of instantiation overhead.



Am 20.03.21 um 13:25 schrieb Matt Juntunen:

It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen 
:



Hello.

I agree that the docs are not really clear on the "natural orientation"
part there. Basically, the possible results are as follows:

   *   positive - The argument lies on the right side of the calling line,
with the "right side" defined as the side on the right when looking along
the calling line in its defined direction. (This is what I believe is meant
by "natural orientation".)
   *   negative - The argument lies on the left side of the calling line.
   *   zero - The lines have points in common, meaning they intersect or
are coincident.

On a side note, if you're writing geometric code, I would suggest trying
out the new(-ish) commons-geometry library [1]. It is a rewrite and
extension of the commons-math geometry code and, IMHO, the API is more
user-friendly. (Disclaimer: I wrote the majority of it so I am completely
biased 🙂

Regards,
Matt J

[1] https://commons.apache.org/proper/commons-geometry/
[https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



apache/commons-geometry<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



Apache Commons Geometry. Contribute to apache/commons-geometry development
by creating an account on GitHub.
github.com



From: Patrik Karlström 
Sent: Thursday, March 18, 2021 3:42 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :


Sometimes (50/50?) I'm getting an unexpected signum from
org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
line).
The absolute value itself is correct.

 From the javadoc:
"The offset is 0 if both lines are the same, it is positive if the
line is on the right side of the instance and negative if it is on the
left side, according to its natural orientation."

I suspect my problem relates to "according to its natural orientation."
What is a natural orientation and what can I do to adapt to it, when
to reverse my lines? If that's the case.



https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] 2D Line getOffset and natural orientation

2021-03-20 Thread Christoph Läubrich
Taking a deeper look the whole package 
org.apache.commons.geometry.core.internal seems to be required elsewhere 
and should be public+exported. Is there any rationale to make this 
"internal"? Internal packages should really only be used in the module 
itself.


If its proven to be usefull in other modules too it should be proper 
exported. Otherwise the module is not usable in an OSGi framework.


Am 20.03.21 um 13:25 schrieb Matt Juntunen:

It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen 
:



Hello.

I agree that the docs are not really clear on the "natural orientation"
part there. Basically, the possible results are as follows:

   *   positive - The argument lies on the right side of the calling line,
with the "right side" defined as the side on the right when looking along
the calling line in its defined direction. (This is what I believe is meant
by "natural orientation".)
   *   negative - The argument lies on the left side of the calling line.
   *   zero - The lines have points in common, meaning they intersect or
are coincident.

On a side note, if you're writing geometric code, I would suggest trying
out the new(-ish) commons-geometry library [1]. It is a rewrite and
extension of the commons-math geometry code and, IMHO, the API is more
user-friendly. (Disclaimer: I wrote the majority of it so I am completely
biased 🙂

Regards,
Matt J

[1] https://commons.apache.org/proper/commons-geometry/
[https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



apache/commons-geometry<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



Apache Commons Geometry. Contribute to apache/commons-geometry development
by creating an account on GitHub.
github.com



From: Patrik Karlström 
Sent: Thursday, March 18, 2021 3:42 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :


Sometimes (50/50?) I'm getting an unexpected signum from
org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
line).
The absolute value itself is correct.

 From the javadoc:
"The offset is 0 if both lines are the same, it is positive if the
line is on the right side of the instance and negative if it is on the
left side, according to its natural orientation."

I suspect my problem relates to "according to its natural orientation."
What is a natural orientation and what can I do to adapt to it, when
to reverse my lines? If that's the case.



https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] 2D Line getOffset and natural orientation

2021-03-20 Thread Christoph Läubrich

Another thing I noted:

DoubleFunction2N is used but resides in the 
org.apache.commons.geometry.core.internal package and thus is also not 
exported/useable in an OSGi environment this would give CNF exceptions 
if actually run inside one.


Am 20.03.21 um 13:25 schrieb Matt Juntunen:

It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen 
:



Hello.

I agree that the docs are not really clear on the "natural orientation"
part there. Basically, the possible results are as follows:

   *   positive - The argument lies on the right side of the calling line,
with the "right side" defined as the side on the right when looking along
the calling line in its defined direction. (This is what I believe is meant
by "natural orientation".)
   *   negative - The argument lies on the left side of the calling line.
   *   zero - The lines have points in common, meaning they intersect or
are coincident.

On a side note, if you're writing geometric code, I would suggest trying
out the new(-ish) commons-geometry library [1]. It is a rewrite and
extension of the commons-math geometry code and, IMHO, the API is more
user-friendly. (Disclaimer: I wrote the majority of it so I am completely
biased 🙂

Regards,
Matt J

[1] https://commons.apache.org/proper/commons-geometry/
[https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



apache/commons-geometry<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



Apache Commons Geometry. Contribute to apache/commons-geometry development
by creating an account on GitHub.
github.com



From: Patrik Karlström 
Sent: Thursday, March 18, 2021 3:42 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :


Sometimes (50/50?) I'm getting an unexpected signum from
org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
line).
The absolute value itself is correct.

 From the javadoc:
"The offset is 0 if both lines are the same, it is positive if the
line is on the right side of the instance and negative if it is on the
left side, according to its natural orientation."

I suspect my problem relates to "according to its natural orientation."
What is a natural orientation and what can I do to adapt to it, when
to reverse my lines? If that's the case.



https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] 2D Line getOffset and natural orientation

2021-03-20 Thread Christoph Läubrich

Hi Matt,

I try to use the new package in an OSGi application but only the 
org.apache.commons.geometry.euclidean package is exported. Is thsi 
intentional?


I'd like to use AffineTransformMatrix2D from the 
org.apache.commons.geometry.euclidean.twod package for example but don't 
understand how one is created if the package is private...


Am 20.03.21 um 13:25 schrieb Matt Juntunen:

It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen 
:



Hello.

I agree that the docs are not really clear on the "natural orientation"
part there. Basically, the possible results are as follows:

   *   positive - The argument lies on the right side of the calling line,
with the "right side" defined as the side on the right when looking along
the calling line in its defined direction. (This is what I believe is meant
by "natural orientation".)
   *   negative - The argument lies on the left side of the calling line.
   *   zero - The lines have points in common, meaning they intersect or
are coincident.

On a side note, if you're writing geometric code, I would suggest trying
out the new(-ish) commons-geometry library [1]. It is a rewrite and
extension of the commons-math geometry code and, IMHO, the API is more
user-friendly. (Disclaimer: I wrote the majority of it so I am completely
biased 🙂

Regards,
Matt J

[1] https://commons.apache.org/proper/commons-geometry/
[https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



apache/commons-geometry<
https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370



Apache Commons Geometry. Contribute to apache/commons-geometry development
by creating an account on GitHub.
github.com



From: Patrik Karlström 
Sent: Thursday, March 18, 2021 3:42 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :


Sometimes (50/50?) I'm getting an unexpected signum from
org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
line).
The absolute value itself is correct.

 From the javadoc:
"The offset is 0 if both lines are the same, it is positive if the
line is on the right side of the instance and negative if it is on the
left side, according to its natural orientation."

I suspect my problem relates to "according to its natural orientation."
What is a natural orientation and what can I do to adapt to it, when
to reverse my lines? If that's the case.



https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] 2D Line getOffset and natural orientation

2021-03-20 Thread Matt Juntunen
It's available on maven central [1]. You can find the code on the Apache git 
repo [2] or on Github [3]. The user guide [4] gives an overview of the library 
along with code examples so you can get a feel for how it works. Don't hesitate 
to ask if you have any questions.

-Matt


[1] 
https://mvnrepository.com/artifact/org.apache.commons/commons-geometry-euclidean
[2] https://gitbox.apache.org/repos/asf?p=commons-geometry.git
[3] https://github.com/apache/commons-geometry
[4] https://commons.apache.org/proper/commons-geometry/userguide/index.html



From: Patrik Karlström 
Sent: Saturday, March 20, 2021 4:30 AM
To: Commons Users List 
Subject: Re: [math] 2D Line getOffset and natural orientation

Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen :

> Hello.
>
> I agree that the docs are not really clear on the "natural orientation"
> part there. Basically, the possible results are as follows:
>
>   *   positive - The argument lies on the right side of the calling line,
> with the "right side" defined as the side on the right when looking along
> the calling line in its defined direction. (This is what I believe is meant
> by "natural orientation".)
>   *   negative - The argument lies on the left side of the calling line.
>   *   zero - The lines have points in common, meaning they intersect or
> are coincident.
>
> On a side note, if you're writing geometric code, I would suggest trying
> out the new(-ish) commons-geometry library [1]. It is a rewrite and
> extension of the commons-math geometry code and, IMHO, the API is more
> user-friendly. (Disclaimer: I wrote the majority of it so I am completely
> biased 🙂
>
> Regards,
> Matt J
>
> [1] https://commons.apache.org/proper/commons-geometry/
> [https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
> https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370
> >
> apache/commons-geometry<
> https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370
> >
> Apache Commons Geometry. Contribute to apache/commons-geometry development
> by creating an account on GitHub.
> github.com
>
>
> 
> From: Patrik Karlström 
> Sent: Thursday, March 18, 2021 3:42 AM
> To: user@commons.apache.org 
> Subject: Re: [math] 2D Line getOffset and natural orientation
>
> Oh, scratch that!
>
> I had three parallel lines and picked the wrong pair (and the correct
> values came from another calculation).
>
> Still interested in "natural orientation" though.
>
> Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :
> >
> > Sometimes (50/50?) I'm getting an unexpected signum from
> > org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
> > line).
> > The absolute value itself is correct.
> >
> > From the javadoc:
> > "The offset is 0 if both lines are the same, it is positive if the
> > line is on the right side of the instance and negative if it is on the
> > left side, according to its natural orientation."
> >
> > I suspect my problem relates to "according to its natural orientation."
> > What is a natural orientation and what can I do to adapt to it, when
> > to reverse my lines? If that's the case.
> >
> >
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] 2D Line getOffset and natural orientation

2021-03-20 Thread Patrik Karlström
Thanks for the clarification, I would be happy to try out beta1 of
commons-geometry, is there a staging repo for it?

/Patrik

Den fre 19 mars 2021 kl 00:29 skrev Matt Juntunen :

> Hello.
>
> I agree that the docs are not really clear on the "natural orientation"
> part there. Basically, the possible results are as follows:
>
>   *   positive - The argument lies on the right side of the calling line,
> with the "right side" defined as the side on the right when looking along
> the calling line in its defined direction. (This is what I believe is meant
> by "natural orientation".)
>   *   negative - The argument lies on the left side of the calling line.
>   *   zero - The lines have points in common, meaning they intersect or
> are coincident.
>
> On a side note, if you're writing geometric code, I would suggest trying
> out the new(-ish) commons-geometry library [1]. It is a rewrite and
> extension of the commons-math geometry code and, IMHO, the API is more
> user-friendly. (Disclaimer: I wrote the majority of it so I am completely
> biased 🙂
>
> Regards,
> Matt J
>
> [1] https://commons.apache.org/proper/commons-geometry/
> [https://avatars.githubusercontent.com/u/47359?s=400&v=4]<
> https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370
> >
> apache/commons-geometry<
> https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370
> >
> Apache Commons Geometry. Contribute to apache/commons-geometry development
> by creating an account on GitHub.
> github.com
>
>
> 
> From: Patrik Karlström 
> Sent: Thursday, March 18, 2021 3:42 AM
> To: user@commons.apache.org 
> Subject: Re: [math] 2D Line getOffset and natural orientation
>
> Oh, scratch that!
>
> I had three parallel lines and picked the wrong pair (and the correct
> values came from another calculation).
>
> Still interested in "natural orientation" though.
>
> Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :
> >
> > Sometimes (50/50?) I'm getting an unexpected signum from
> > org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
> > line).
> > The absolute value itself is correct.
> >
> > From the javadoc:
> > "The offset is 0 if both lines are the same, it is positive if the
> > line is on the right side of the instance and negative if it is on the
> > left side, according to its natural orientation."
> >
> > I suspect my problem relates to "according to its natural orientation."
> > What is a natural orientation and what can I do to adapt to it, when
> > to reverse my lines? If that's the case.
> >
> >
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] 2D Line getOffset and natural orientation

2021-03-18 Thread Matt Juntunen
Hello.

I agree that the docs are not really clear on the "natural orientation" part 
there. Basically, the possible results are as follows:

  *   positive - The argument lies on the right side of the calling line, with 
the "right side" defined as the side on the right when looking along the 
calling line in its defined direction. (This is what I believe is meant by 
"natural orientation".)
  *   negative - The argument lies on the left side of the calling line.
  *   zero - The lines have points in common, meaning they intersect or are 
coincident.

On a side note, if you're writing geometric code, I would suggest trying out 
the new(-ish) commons-geometry library [1]. It is a rewrite and extension of 
the commons-math geometry code and, IMHO, the API is more user-friendly. 
(Disclaimer: I wrote the majority of it so I am completely biased 🙂

Regards,
Matt J

[1] https://commons.apache.org/proper/commons-geometry/
[https://avatars.githubusercontent.com/u/47359?s=400&v=4]<https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370>
apache/commons-geometry<https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java#L370>
Apache Commons Geometry. Contribute to apache/commons-geometry development by 
creating an account on GitHub.
github.com



From: Patrik Karlström 
Sent: Thursday, March 18, 2021 3:42 AM
To: user@commons.apache.org 
Subject: Re: [math] 2D Line getOffset and natural orientation

Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :
>
> Sometimes (50/50?) I'm getting an unexpected signum from
> org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
> line).
> The absolute value itself is correct.
>
> From the javadoc:
> "The offset is 0 if both lines are the same, it is positive if the
> line is on the right side of the instance and negative if it is on the
> left side, according to its natural orientation."
>
> I suspect my problem relates to "according to its natural orientation."
> What is a natural orientation and what can I do to adapt to it, when
> to reverse my lines? If that's the case.
>
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] 2D Line getOffset and natural orientation

2021-03-18 Thread Patrik Karlström
Oh, scratch that!

I had three parallel lines and picked the wrong pair (and the correct
values came from another calculation).

Still interested in "natural orientation" though.

Den tors 18 mars 2021 kl 07:19 skrev Patrik Karlström :
>
> Sometimes (50/50?) I'm getting an unexpected signum from
> org.apache.commons.math3.geometry.euclidean.twod.Line.getOffset(Line
> line).
> The absolute value itself is correct.
>
> From the javadoc:
> "The offset is 0 if both lines are the same, it is positive if the
> line is on the right side of the instance and negative if it is on the
> left side, according to its natural orientation."
>
> I suspect my problem relates to "according to its natural orientation."
> What is a natural orientation and what can I do to adapt to it, when
> to reverse my lines? If that's the case.
>
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Line.html#getOffset(org.apache.commons.math3.geometry.euclidean.twod.Line)

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] How to Convert 'RealMatrix' Object to Array

2021-02-16 Thread Oscar Bastidas
Awesome!  Thank you so much for this.

Oscar

Oscar Bastidas, Ph.D.
Postdoctoral Research Associate
University of Minnesota

On Tue, Feb 16, 2021, 5:25 AM Alex Herbert  wrote:

> The methods:
>
> double[][] getData();
> double[][] getDataRef();
>
> Provide access to the underlying 2D matrix as a copy or a direct reference.
>
> The method:
>
>double getEntry(int, int);
>
> Provides access to an element of the matrix.
>
> So you can do for example:
>
> Array2DRowRealMatrix m = ...;
>
> int cols = m.getColumnDimension();
> int rows = m.getRowDimension();
> double[][] data = m.getDataRef();
> for (int row = 0; row < rows; row++) {
>   for (int column = 0; column < cols; column++) {
> double d = m.getEntry(row, column);
> double d2 = data[row][column];
> assert d == d2;
>   }
> }
>
> If you need to visit a part of the matrix then you can use the visitor API.
> For example to sum a sub-matrix:
>
> int startRow = 2;
> int endRow = 5;
> int startColumn = 15;
> int endColumn = 20;
> double sum = m.walkInOptimizedOrder(
> new DefaultRealMatrixPreservingVisitor() {
>   double s = 0;
>   @Override
>   public void visit(int row, int column, double value) {
> s += value;
>   }
>   @Override
>   public double end() {
> return s;
>   }
> }, startRow, endRow, startColumn, endColumn);
>
> You can read about the available operations in the API here:
>
>
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/index.html
>
> Regards,
>
> Alex
>
>
>
> On Tue, 16 Feb 2021 at 09:28, Oscar Bastidas 
> wrote:
>
> > Hello,
> >
> > Would someone please tell me how I can go about converting a 'RealMatrix'
> > object to an array?  When I just print out the RealMatrix object I get
> > something that looks like:
> >
> >
> > Array2DRowRealMatrix{{123},{456},{789}}
> >
> >
> > I would like to be able to selectively cycle through each number
> > individually.
> >
> > Thanks.
> >
> > Oscar
> >
> > Oscar Bastidas, Ph.D.
> > Postdoctoral Research Associate
> > University of Minnesota
> >
>


Re: [math] How to Convert 'RealMatrix' Object to Array

2021-02-16 Thread Alex Herbert
The methods:

double[][] getData();
double[][] getDataRef();

Provide access to the underlying 2D matrix as a copy or a direct reference.

The method:

   double getEntry(int, int);

Provides access to an element of the matrix.

So you can do for example:

Array2DRowRealMatrix m = ...;

int cols = m.getColumnDimension();
int rows = m.getRowDimension();
double[][] data = m.getDataRef();
for (int row = 0; row < rows; row++) {
  for (int column = 0; column < cols; column++) {
double d = m.getEntry(row, column);
double d2 = data[row][column];
assert d == d2;
  }
}

If you need to visit a part of the matrix then you can use the visitor API.
For example to sum a sub-matrix:

int startRow = 2;
int endRow = 5;
int startColumn = 15;
int endColumn = 20;
double sum = m.walkInOptimizedOrder(
new DefaultRealMatrixPreservingVisitor() {
  double s = 0;
  @Override
  public void visit(int row, int column, double value) {
s += value;
  }
  @Override
  public double end() {
return s;
  }
}, startRow, endRow, startColumn, endColumn);

You can read about the available operations in the API here:

https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/index.html

Regards,

Alex



On Tue, 16 Feb 2021 at 09:28, Oscar Bastidas 
wrote:

> Hello,
>
> Would someone please tell me how I can go about converting a 'RealMatrix'
> object to an array?  When I just print out the RealMatrix object I get
> something that looks like:
>
>
> Array2DRowRealMatrix{{123},{456},{789}}
>
>
> I would like to be able to selectively cycle through each number
> individually.
>
> Thanks.
>
> Oscar
>
> Oscar Bastidas, Ph.D.
> Postdoctoral Research Associate
> University of Minnesota
>


Re: [math] DerivativeStructure and erf/erfx

2020-10-02 Thread Gilles Sadowski
Hello.

[Cc'ing to the "dev" ML, as this discussion belongs there.]

Le ven. 2 oct. 2020 à 18:17, Christoph Läubrich
 a écrit :
>
> Thanks Gilles, I'm currently trying to dive into all of this a bit

Your help is very welcome.

> and
> just wondering:
>
> Will there still be new releases of commons-math3,

The general issue of what is released is in the hand of
the "community" that is willing to support the development.

My short answer is "no", a.o. things because there hasn't
been any update to the 3.x branch while a lot of work has
gone into the 4.0 ("master") branch over the last 4 years.[1]
A community could be willing to invest in back-porting
work (but it hasn't shown up yet...).
Releasing a version 3.7 would imply that we are ready to fix
bugs filed against it.  [Personally I am not.]

> or is it postponed in
> favor of math4?
>
> I'm asking this because it might be an option to add erf(x) support to
> Derivative structure in math3 first (as it is not ported yet), but of
> course this only makes sense if it will be released some day.

Why not work on the development ("master") branch?
[I recall that there have been other suggestions towards improving
the API of the "autodiff" implementation.]
There are many identified issues still to be fixed in CM, but that
shouldn't prevent us from releasing a "4.0-beta" version.

Best regards,
Gilles

[1] https://issues.apache.org/jira/projects/MATH/versions/12317577

>
> Am 19.08.20 um 23:51 schrieb Gilles Sadowski:
> > Hi.
> >
> > Le mer. 19 août 2020 à 08:38, Christoph Läubrich
> >  a écrit :
> >>
> >> Im mostly using
> >>
> >> - math3.analysis
> >
> > In view of the next major version of CM, it would be nice
> > to refactor codes in that package using the JDK
> > java.util.function
> > package, e.g. replace
> >o.a.c.m.analysis.UnivariateFunction
> > with
> >java.util.function.DoubleUnaryOperator
> > and drop redundant utilities in
> >o.a.c.m.analysis.FuncitonUtils
> >
> >> - math3.fitting
> >> - math3.linear
> >> - math3.fitting.leastsquares
> >
> > IMO, a way to modernize CM is to modularize it.
> > A first step could consist in "fitting" and "linear" becoming
> > (maven) modules.
> >
> > Regards,
> > Gilles
> >
> >> And some of the common util/exception things that drip in when using the
> >> above.
> >>
> >> Am 14.08.20 um 18:42 schrieb Gilles Sadowski:
> >>> Le jeu. 13 août 2020 à 15:46, Christoph Läubrich
> >>>  a écrit :
> 
>  Hi,
> 
>  thnaks for the information, I'm currently using the "old" commons-math3
>  package, would it be possible to use erf with DerivativeStructure there?
> >>>
> >>> Technically, the issue could be that the tools in the "o.a.c.m.special"
> >>> package were not designed as those in the "o.a.c.m.analysis.function"
> >>> package.  And IIUC, "DerivativeStructure" builds on the latter.
> >>> But that doesn't mean it cannot be done (I've not used it personally).
> >>>
> >>> A lot of work has been done on the "master" branch; a 3.7 release
> >>> would mean backporting everything; not a trivial task and (if at all
> >>> possible) it would take more time (by a tall order) than anyone is
> >>> willing to devote to that library.
> >>>
> >>> IMHO, it's about time that we release v4.0 (which has been delayed
> >>> by more than 4 years, according to when the decision has been taken
> >>> to start development on that next major version).
> >>>
> > We are looking for volunteer maintainers for the math tools 
>  available
> 
>  for commons math in general or for "commons-numbers"?
> >>>
> >>> Both and more:
> >>>
> >>> * Commons Geometry (spun off the "o.a.c.m.geometry" package)
> >>> * Commons Statistics (intended to replace the "o.a.c.m.stat" package)
> >>> * Commons RNG (replacement of the "o.a.c.m.random" package, and
> >>> pretty feature-complete as of v1.3).
> >>>
>  I must confess I have only recently noticed that there is development in
>  commons-math-4 and might be out of date with my knowledge a bit as an
>  "old" math3 user :-)
> >>>
> >>> Which classes/packages have you been using?
> >>>
> >>> Gilles
> >>>
> 
>  Am 13.08.20 um 15:12 schrieb Gilles Sadowski:
> > Hi.
> >
> > Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
> >  a écrit :
> >>
> >> I'd like to use the org.apache.commons.math3.special.Erf with a
> >> DerivativeStructure but is seems there is no pre-defined function for
> >> this (like exp()...).
> >>
> >> So the question is, can Erf transformed inside a DerivativeStructure
> >> somehow or does the DerivativeStructure need to support that function
> >> directly?
> >
> > Please note that "Erf" has been moved to the new "Commons Numbers"
> > component[1], along with the other Gamma-related functions.
> > The "DerivativeStructure" is one among several utilities that still 
> > need to
> > be ported (and refactored) there.[2]
> >
> > We are looking for volunteer ma

Re: [math] DerivativeStructure and erf/erfx

2020-10-02 Thread Christoph Läubrich
Thanks Gilles, I'm currently trying to dive into all of this a bit and 
just wondering:


Will there still be new releases of commons-math3, or is it postponed in 
favor of math4?


I'm asking this because it might be an option to add erf(x) support to 
Derivative structure in math3 first (as it is not ported yet), but of 
course this only makes sense if it will be released some day.




Am 19.08.20 um 23:51 schrieb Gilles Sadowski:

Hi.

Le mer. 19 août 2020 à 08:38, Christoph Läubrich
 a écrit :


Im mostly using

- math3.analysis


In view of the next major version of CM, it would be nice
to refactor codes in that package using the JDK
java.util.function
package, e.g. replace
   o.a.c.m.analysis.UnivariateFunction
with
   java.util.function.DoubleUnaryOperator
and drop redundant utilities in
   o.a.c.m.analysis.FuncitonUtils


- math3.fitting
- math3.linear
- math3.fitting.leastsquares


IMO, a way to modernize CM is to modularize it.
A first step could consist in "fitting" and "linear" becoming
(maven) modules.

Regards,
Gilles


And some of the common util/exception things that drip in when using the
above.

Am 14.08.20 um 18:42 schrieb Gilles Sadowski:

Le jeu. 13 août 2020 à 15:46, Christoph Läubrich
 a écrit :


Hi,

thnaks for the information, I'm currently using the "old" commons-math3
package, would it be possible to use erf with DerivativeStructure there?


Technically, the issue could be that the tools in the "o.a.c.m.special"
package were not designed as those in the "o.a.c.m.analysis.function"
package.  And IIUC, "DerivativeStructure" builds on the latter.
But that doesn't mean it cannot be done (I've not used it personally).

A lot of work has been done on the "master" branch; a 3.7 release
would mean backporting everything; not a trivial task and (if at all
possible) it would take more time (by a tall order) than anyone is
willing to devote to that library.

IMHO, it's about time that we release v4.0 (which has been delayed
by more than 4 years, according to when the decision has been taken
to start development on that next major version).


   > We are looking for volunteer maintainers for the math tools available

for commons math in general or for "commons-numbers"?


Both and more:

* Commons Geometry (spun off the "o.a.c.m.geometry" package)
* Commons Statistics (intended to replace the "o.a.c.m.stat" package)
* Commons RNG (replacement of the "o.a.c.m.random" package, and
pretty feature-complete as of v1.3).


I must confess I have only recently noticed that there is development in
commons-math-4 and might be out of date with my knowledge a bit as an
"old" math3 user :-)


Which classes/packages have you been using?

Gilles



Am 13.08.20 um 15:12 schrieb Gilles Sadowski:

Hi.

Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
 a écrit :


I'd like to use the org.apache.commons.math3.special.Erf with a
DerivativeStructure but is seems there is no pre-defined function for
this (like exp()...).

So the question is, can Erf transformed inside a DerivativeStructure
somehow or does the DerivativeStructure need to support that function
directly?


Please note that "Erf" has been moved to the new "Commons Numbers"
component[1], along with the other Gamma-related functions.
The "DerivativeStructure" is one among several utilities that still need to
be ported (and refactored) there.[2]

We are looking for volunteer maintainers for the math tools available from
the Commons libraries.  The move to more focused, smaller, components
should hopefully simplify development...

Best,
Gilles

[1] 
https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
[2] https://issues.apache.org/jira/browse/NUMBERS-69


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DerivativeStructure and erf/erfx

2020-08-19 Thread Gilles Sadowski
Hi.

Le mer. 19 août 2020 à 08:38, Christoph Läubrich
 a écrit :
>
> Im mostly using
>
> - math3.analysis

In view of the next major version of CM, it would be nice
to refactor codes in that package using the JDK
   java.util.function
package, e.g. replace
  o.a.c.m.analysis.UnivariateFunction
with
  java.util.function.DoubleUnaryOperator
and drop redundant utilities in
  o.a.c.m.analysis.FuncitonUtils

> - math3.fitting
> - math3.linear
> - math3.fitting.leastsquares

IMO, a way to modernize CM is to modularize it.
A first step could consist in "fitting" and "linear" becoming
(maven) modules.

Regards,
Gilles

> And some of the common util/exception things that drip in when using the
> above.
>
> Am 14.08.20 um 18:42 schrieb Gilles Sadowski:
> > Le jeu. 13 août 2020 à 15:46, Christoph Läubrich
> >  a écrit :
> >>
> >> Hi,
> >>
> >> thnaks for the information, I'm currently using the "old" commons-math3
> >> package, would it be possible to use erf with DerivativeStructure there?
> >
> > Technically, the issue could be that the tools in the "o.a.c.m.special"
> > package were not designed as those in the "o.a.c.m.analysis.function"
> > package.  And IIUC, "DerivativeStructure" builds on the latter.
> > But that doesn't mean it cannot be done (I've not used it personally).
> >
> > A lot of work has been done on the "master" branch; a 3.7 release
> > would mean backporting everything; not a trivial task and (if at all
> > possible) it would take more time (by a tall order) than anyone is
> > willing to devote to that library.
> >
> > IMHO, it's about time that we release v4.0 (which has been delayed
> > by more than 4 years, according to when the decision has been taken
> > to start development on that next major version).
> >
> >>   > We are looking for volunteer maintainers for the math tools available
> >>
> >> for commons math in general or for "commons-numbers"?
> >
> > Both and more:
> >
> > * Commons Geometry (spun off the "o.a.c.m.geometry" package)
> > * Commons Statistics (intended to replace the "o.a.c.m.stat" package)
> > * Commons RNG (replacement of the "o.a.c.m.random" package, and
> >pretty feature-complete as of v1.3).
> >
> >> I must confess I have only recently noticed that there is development in
> >> commons-math-4 and might be out of date with my knowledge a bit as an
> >> "old" math3 user :-)
> >
> > Which classes/packages have you been using?
> >
> > Gilles
> >
> >>
> >> Am 13.08.20 um 15:12 schrieb Gilles Sadowski:
> >>> Hi.
> >>>
> >>> Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
> >>>  a écrit :
> 
>  I'd like to use the org.apache.commons.math3.special.Erf with a
>  DerivativeStructure but is seems there is no pre-defined function for
>  this (like exp()...).
> 
>  So the question is, can Erf transformed inside a DerivativeStructure
>  somehow or does the DerivativeStructure need to support that function
>  directly?
> >>>
> >>> Please note that "Erf" has been moved to the new "Commons Numbers"
> >>> component[1], along with the other Gamma-related functions.
> >>> The "DerivativeStructure" is one among several utilities that still need 
> >>> to
> >>> be ported (and refactored) there.[2]
> >>>
> >>> We are looking for volunteer maintainers for the math tools available from
> >>> the Commons libraries.  The move to more focused, smaller, components
> >>> should hopefully simplify development...
> >>>
> >>> Best,
> >>> Gilles
> >>>
> >>> [1] 
> >>> https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
> >>> [2] https://issues.apache.org/jira/browse/NUMBERS-69

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DfpField

2020-08-19 Thread schophil
Hi,

Thank you for the answer.

I can indeed have an instance per thread. I was just wondering if it was
thread safe. Having one instance is easier to manage, especially with DI
frameworks.

As for the use case. I actually need to solve an ODE. I was afraid of using
plain double's since I know precision errors can arise.
The other option in Commons Math is to use a Field integrator; that's why I
went for the DfpField.

Does this make sense?

Anyway, I will remove the single instance; just to be safe.

Regards,

Philippe

On Wed, Aug 19, 2020 at 1:19 PM Gilles Sadowski 
wrote:

> Hi.
>
> 2020-08-19 8:09 UTC+02:00, schophil :
> > Hi,
> >
> > I have a question regarding the use of DfpField.
> >
> > Is an instance of DfpField thread safe?
>
> Personally I don't know. Sorry.
> I've just looked at some of the code, and there is an occurrence
> of the "synchronized" keyword; so it seems that thread-safety
> was at least taken into account.
> Maybe someone else can provide a more accurate answer...
>
> This functionality is implemented by old classes, dating before
> the project had decided to focus on immutable instances in
> order to ensure their thread-safety.
>
> And IIRC, it's the first time, in more than 10 years, that someone
> mentions using "Dfp"...
>
> > Can I use a single instance to
> > perform Dfp calculations in different threads?
>
> Could you provide an example of your use-cases?
> Isn't it possible to make copies, rather than share a single
> instance?
>
> More generally, I'm curious: why would you use it rather
> than JDK's "BigDecimal"?
>
> > I have looked at the code of Dfp and I am a bit worried by the calls to
> > DfpField.setIEEEFlagsBits().
> > Can I just set the flags in advance?
>
> You can, of course; but there are several places where the
> question of thread-safety could be raised...
>
> Also, in the new "Commons Numbers" component[1], there is an
> attempt to implement the concept of "field" in a cleaner (IMHO)
> way than in "Commons Math" (CM).
> Functionality in "Commons Numbers" is probably incomplete.
> Looking for volunteers in order to continue porting more useful
> stuff from CM (refactoring them on the way by making use of
> Java 8 features).
>
> Regards,
> Gilles
>
> [1] http://commons.apache.org/proper/commons-numbers/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] DfpField

2020-08-19 Thread Gilles Sadowski
Hi.

2020-08-19 8:09 UTC+02:00, schophil :
> Hi,
>
> I have a question regarding the use of DfpField.
>
> Is an instance of DfpField thread safe?

Personally I don't know. Sorry.
I've just looked at some of the code, and there is an occurrence
of the "synchronized" keyword; so it seems that thread-safety
was at least taken into account.
Maybe someone else can provide a more accurate answer...

This functionality is implemented by old classes, dating before
the project had decided to focus on immutable instances in
order to ensure their thread-safety.

And IIRC, it's the first time, in more than 10 years, that someone
mentions using "Dfp"...

> Can I use a single instance to
> perform Dfp calculations in different threads?

Could you provide an example of your use-cases?
Isn't it possible to make copies, rather than share a single
instance?

More generally, I'm curious: why would you use it rather
than JDK's "BigDecimal"?

> I have looked at the code of Dfp and I am a bit worried by the calls to
> DfpField.setIEEEFlagsBits().
> Can I just set the flags in advance?

You can, of course; but there are several places where the
question of thread-safety could be raised...

Also, in the new "Commons Numbers" component[1], there is an
attempt to implement the concept of "field" in a cleaner (IMHO)
way than in "Commons Math" (CM).
Functionality in "Commons Numbers" is probably incomplete.
Looking for volunteers in order to continue porting more useful
stuff from CM (refactoring them on the way by making use of
Java 8 features).

Regards,
Gilles

[1] http://commons.apache.org/proper/commons-numbers/

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DerivativeStructure and erf/erfx

2020-08-18 Thread Christoph Läubrich

Im mostly using

- math3.analysis
- math3.fitting
- math3.linear
- math3.fitting.leastsquares

And some of the common util/exception things that drip in when using the 
above.


Am 14.08.20 um 18:42 schrieb Gilles Sadowski:

Le jeu. 13 août 2020 à 15:46, Christoph Läubrich
 a écrit :


Hi,

thnaks for the information, I'm currently using the "old" commons-math3
package, would it be possible to use erf with DerivativeStructure there?


Technically, the issue could be that the tools in the "o.a.c.m.special"
package were not designed as those in the "o.a.c.m.analysis.function"
package.  And IIUC, "DerivativeStructure" builds on the latter.
But that doesn't mean it cannot be done (I've not used it personally).

A lot of work has been done on the "master" branch; a 3.7 release
would mean backporting everything; not a trivial task and (if at all
possible) it would take more time (by a tall order) than anyone is
willing to devote to that library.

IMHO, it's about time that we release v4.0 (which has been delayed
by more than 4 years, according to when the decision has been taken
to start development on that next major version).


  > We are looking for volunteer maintainers for the math tools available

for commons math in general or for "commons-numbers"?


Both and more:

* Commons Geometry (spun off the "o.a.c.m.geometry" package)
* Commons Statistics (intended to replace the "o.a.c.m.stat" package)
* Commons RNG (replacement of the "o.a.c.m.random" package, and
   pretty feature-complete as of v1.3).


I must confess I have only recently noticed that there is development in
commons-math-4 and might be out of date with my knowledge a bit as an
"old" math3 user :-)


Which classes/packages have you been using?

Gilles



Am 13.08.20 um 15:12 schrieb Gilles Sadowski:

Hi.

Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
 a écrit :


I'd like to use the org.apache.commons.math3.special.Erf with a
DerivativeStructure but is seems there is no pre-defined function for
this (like exp()...).

So the question is, can Erf transformed inside a DerivativeStructure
somehow or does the DerivativeStructure need to support that function
directly?


Please note that "Erf" has been moved to the new "Commons Numbers"
component[1], along with the other Gamma-related functions.
The "DerivativeStructure" is one among several utilities that still need to
be ported (and refactored) there.[2]

We are looking for volunteer maintainers for the math tools available from
the Commons libraries.  The move to more focused, smaller, components
should hopefully simplify development...

Best,
Gilles

[1] 
https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
[2] https://issues.apache.org/jira/browse/NUMBERS-69


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DerivativeStructure and erf/erfx

2020-08-14 Thread Gilles Sadowski
Le jeu. 13 août 2020 à 15:46, Christoph Läubrich
 a écrit :
>
> Hi,
>
> thnaks for the information, I'm currently using the "old" commons-math3
> package, would it be possible to use erf with DerivativeStructure there?

Technically, the issue could be that the tools in the "o.a.c.m.special"
package were not designed as those in the "o.a.c.m.analysis.function"
package.  And IIUC, "DerivativeStructure" builds on the latter.
But that doesn't mean it cannot be done (I've not used it personally).

A lot of work has been done on the "master" branch; a 3.7 release
would mean backporting everything; not a trivial task and (if at all
possible) it would take more time (by a tall order) than anyone is
willing to devote to that library.

IMHO, it's about time that we release v4.0 (which has been delayed
by more than 4 years, according to when the decision has been taken
to start development on that next major version).

>  > We are looking for volunteer maintainers for the math tools available
>
> for commons math in general or for "commons-numbers"?

Both and more:

* Commons Geometry (spun off the "o.a.c.m.geometry" package)
* Commons Statistics (intended to replace the "o.a.c.m.stat" package)
* Commons RNG (replacement of the "o.a.c.m.random" package, and
  pretty feature-complete as of v1.3).

> I must confess I have only recently noticed that there is development in
> commons-math-4 and might be out of date with my knowledge a bit as an
> "old" math3 user :-)

Which classes/packages have you been using?

Gilles

>
> Am 13.08.20 um 15:12 schrieb Gilles Sadowski:
> > Hi.
> >
> > Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
> >  a écrit :
> >>
> >> I'd like to use the org.apache.commons.math3.special.Erf with a
> >> DerivativeStructure but is seems there is no pre-defined function for
> >> this (like exp()...).
> >>
> >> So the question is, can Erf transformed inside a DerivativeStructure
> >> somehow or does the DerivativeStructure need to support that function
> >> directly?
> >
> > Please note that "Erf" has been moved to the new "Commons Numbers"
> > component[1], along with the other Gamma-related functions.
> > The "DerivativeStructure" is one among several utilities that still need to
> > be ported (and refactored) there.[2]
> >
> > We are looking for volunteer maintainers for the math tools available from
> > the Commons libraries.  The move to more focused, smaller, components
> > should hopefully simplify development...
> >
> > Best,
> > Gilles
> >
> > [1] 
> > https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
> > [2] https://issues.apache.org/jira/browse/NUMBERS-69

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DerivativeStructure and erf/erfx

2020-08-13 Thread Christoph Läubrich

Hi,

thnaks for the information, I'm currently using the "old" commons-math3 
package, would it be possible to use erf with DerivativeStructure there?


> We are looking for volunteer maintainers for the math tools available

for commons math in general or for "commons-numbers"?

I must confess I have only recently noticed that there is development in 
commons-math-4 and might be out of date with my knowledge a bit as an 
"old" math3 user :-)



Am 13.08.20 um 15:12 schrieb Gilles Sadowski:

Hi.

Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
 a écrit :


I'd like to use the org.apache.commons.math3.special.Erf with a
DerivativeStructure but is seems there is no pre-defined function for
this (like exp()...).

So the question is, can Erf transformed inside a DerivativeStructure
somehow or does the DerivativeStructure need to support that function
directly?


Please note that "Erf" has been moved to the new "Commons Numbers"
component[1], along with the other Gamma-related functions.
The "DerivativeStructure" is one among several utilities that still need to
be ported (and refactored) there.[2]

We are looking for volunteer maintainers for the math tools available from
the Commons libraries.  The move to more focused, smaller, components
should hopefully simplify development...

Best,
Gilles

[1] 
https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
[2] https://issues.apache.org/jira/browse/NUMBERS-69

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] DerivativeStructure and erf/erfx

2020-08-13 Thread Gilles Sadowski
Hi.

Le jeu. 13 août 2020 à 12:48, Christoph Läubrich
 a écrit :
>
> I'd like to use the org.apache.commons.math3.special.Erf with a
> DerivativeStructure but is seems there is no pre-defined function for
> this (like exp()...).
>
> So the question is, can Erf transformed inside a DerivativeStructure
> somehow or does the DerivativeStructure need to support that function
> directly?

Please note that "Erf" has been moved to the new "Commons Numbers"
component[1], along with the other Gamma-related functions.
The "DerivativeStructure" is one among several utilities that still need to
be ported (and refactored) there.[2]

We are looking for volunteer maintainers for the math tools available from
the Commons libraries.  The move to more focused, smaller, components
should hopefully simplify development...

Best,
Gilles

[1] 
https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma;h=cb95316a3be45ebfcf938eab63f362f59e590fca;hb=HEAD
[2] https://issues.apache.org/jira/browse/NUMBERS-69

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2020-08-12 Thread Christoph Läubrich

LSB = LeasSquaresBuilder :-)

It seems to work with INF in my testings for one exception: If the 
starting point is in an invalid range, an exception is thrown (unable to 
perform Q.R decomposition) so if using this technique one must take care 
that the initial guess is always inside valid bounds!


Am 11.08.20 um 16:11 schrieb Gilles Sadowski:

Hello.

Le mar. 11 août 2020 à 12:08, Christoph Läubrich
 a écrit :


Thanks for your patience, maybe a better/simpler example would be [1], I
want to find the best fit using LSB


"LSB" ?


under the constraint that the height
of the curve never is above 0.7 (even though without constrains the
optimizer would find a better solution around 8.5).


It occurs to me that this would be more properly defined as a
least-square problem by assigning an error bar (weight) to each
data point.


So my first idea way to copy/extend GausianCurveFitter to accept some
kind of "maxHeight(...)", adjust the function to return INF for
h>maxHeight, I was just unsure that return INF is allowed (per
definition) as it is not mentioned anywhere in the userdocs. And if I
want to limit others (like max position) it would work the same way.


Hopefully "infinity" will not cause an issue; you could try and check.
[Then if it does, just use any suitably large value.]


In my final problem I need to limit the height, width and position of
the bell-curve to fall into certain bounds, but there is no direct
relation (e.g. width must be three times the height).


Then, width is totally correlated (to height) and there are only
2 parameters to fit (height and mean); hence it's probably better
(and more efficient) to use that fact instead of defining the
correlation as a constraint i.e. define (untested):
---CUT---
public class MyFunc implements ParametricUnivariateFunction {
 public double value(double x, double ... param) {
  final double diff = x - param[1]; // param[1] is the mean.
  final double norm = param[0]; // param[0] is the height.
  final double s = 3 * norm; // "constraint".
  final double i2s2 = 1 / (2 * s * s);
  return Gaussian.value(diff, norm, i2s2);
 }

 // And similarly for the "gradient":
 //   
https://gitbox.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java;h=08dcac0d4d37179bc85a7071c84a6cb289c09f02;hb=HEAD#l143
}
---CUT---
to be passed to "SimpleCurveFitter".

Regards,
Gilles





[1]
https://crlbucophysics101.files.wordpress.com/2015/02/gaussian.png?w=538&h=294




Am 11.08.20 um 11:18 schrieb Gilles Sadowski:

Hi.

2020-08-11 8:51 UTC+02:00, Christoph Läubrich :

Hi Gilles,


Just to make clear I don't suspect any error with GausianCurveFitter, I
just don't understand how the advice in the user-doc to restrict
parameter (for general problems) could be applied to a concrete problem
and thus chosen GausianCurvefitter as an example as it uses
LeastSquaresBuilder.

I also noticed that Gaussian Fitter has a restriction on parameters
(norm can't be negative) that is handled in a third way (returning
Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned
in the userdoc at all, so I wonder if this is a general purpose solution
for restricting parameters (seems the simplest approach).


I'd indeed suggest to first try the same trick as in "GaussianCurveFitter"
(i.e. return a "high" value for arguments outside a known range).
That way, you only have to define a suitable "ParametricUnivariateFunction"
and pass it to "SimpleCurveFitter".

One case for the "ParameterValidator" is when some of the model
parameters might be correlated to others.
But using it makes it necessary that you handle yourself all the
arguments to be passed to the "LeastSquaresProblem".


To take the gausian example for my use case, consider an observed signal
similar to [1], given I know (from other source as the plain data) for
example that the result must be found in the range of 2...3 and I wanted
to restrict valid solutions to this area. The same might apply to the
norm: I know it must be between a given range and I want to restrict the
optimizer here even though there might be a solution outside of the
range that (compared of the R^2) fits better, e.g. a gausian fit well
inside the -1..1.

I hope it is a little bit clearer.


I'm not sure.  The picture shows a function that is not a Gaussian.
Do you mean that you want to fit only *part* of the data with a
function that would not fit well *all* the data?

Regards,
Gilles




[1]
https://ascelibrary.org/cms/asset/6ca2b016-1a4f-4eed-80da-71219777cac1/1.jpg

Am 11.08.20 um 00:42 schrieb Gilles Sadowski:

Hello.

Le lun. 10 août 2020 à 17:09, Christoph Läubrich
 a écrit :


The userguide [1] mentions that it is currently not directly possible to
contrain parameters directly but suggest one can use the
ParameterValidator, is there any example code for both mentioned
alternatives?

For example GaussianCurveFitter uses Least

Re: [math] example for constrain parameters for Least squares

2020-08-11 Thread Gilles Sadowski
Hello.

Le mar. 11 août 2020 à 12:08, Christoph Läubrich
 a écrit :
>
> Thanks for your patience, maybe a better/simpler example would be [1], I
> want to find the best fit using LSB

"LSB" ?

> under the constraint that the height
> of the curve never is above 0.7 (even though without constrains the
> optimizer would find a better solution around 8.5).

It occurs to me that this would be more properly defined as a
least-square problem by assigning an error bar (weight) to each
data point.

> So my first idea way to copy/extend GausianCurveFitter to accept some
> kind of "maxHeight(...)", adjust the function to return INF for
> h>maxHeight, I was just unsure that return INF is allowed (per
> definition) as it is not mentioned anywhere in the userdocs. And if I
> want to limit others (like max position) it would work the same way.

Hopefully "infinity" will not cause an issue; you could try and check.
[Then if it does, just use any suitably large value.]

> In my final problem I need to limit the height, width and position of
> the bell-curve to fall into certain bounds, but there is no direct
> relation (e.g. width must be three times the height).

Then, width is totally correlated (to height) and there are only
2 parameters to fit (height and mean); hence it's probably better
(and more efficient) to use that fact instead of defining the
correlation as a constraint i.e. define (untested):
---CUT---
public class MyFunc implements ParametricUnivariateFunction {
public double value(double x, double ... param) {
 final double diff = x - param[1]; // param[1] is the mean.
 final double norm = param[0]; // param[0] is the height.
 final double s = 3 * norm; // "constraint".
 final double i2s2 = 1 / (2 * s * s);
 return Gaussian.value(diff, norm, i2s2);
}

// And similarly for the "gradient":
//   
https://gitbox.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java;h=08dcac0d4d37179bc85a7071c84a6cb289c09f02;hb=HEAD#l143
}
---CUT---
to be passed to "SimpleCurveFitter".

Regards,
Gilles

>
>
>
> [1]
> https://crlbucophysics101.files.wordpress.com/2015/02/gaussian.png?w=538&h=294
>
>
>
>
> Am 11.08.20 um 11:18 schrieb Gilles Sadowski:
> > Hi.
> >
> > 2020-08-11 8:51 UTC+02:00, Christoph Läubrich 
> > :
> >> Hi Gilles,
> >>
> >>
> >> Just to make clear I don't suspect any error with GausianCurveFitter, I
> >> just don't understand how the advice in the user-doc to restrict
> >> parameter (for general problems) could be applied to a concrete problem
> >> and thus chosen GausianCurvefitter as an example as it uses
> >> LeastSquaresBuilder.
> >>
> >> I also noticed that Gaussian Fitter has a restriction on parameters
> >> (norm can't be negative) that is handled in a third way (returning
> >> Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned
> >> in the userdoc at all, so I wonder if this is a general purpose solution
> >> for restricting parameters (seems the simplest approach).
> >
> > I'd indeed suggest to first try the same trick as in "GaussianCurveFitter"
> > (i.e. return a "high" value for arguments outside a known range).
> > That way, you only have to define a suitable "ParametricUnivariateFunction"
> > and pass it to "SimpleCurveFitter".
> >
> > One case for the "ParameterValidator" is when some of the model
> > parameters might be correlated to others.
> > But using it makes it necessary that you handle yourself all the
> > arguments to be passed to the "LeastSquaresProblem".
> >
> >> To take the gausian example for my use case, consider an observed signal
> >> similar to [1], given I know (from other source as the plain data) for
> >> example that the result must be found in the range of 2...3 and I wanted
> >> to restrict valid solutions to this area. The same might apply to the
> >> norm: I know it must be between a given range and I want to restrict the
> >> optimizer here even though there might be a solution outside of the
> >> range that (compared of the R^2) fits better, e.g. a gausian fit well
> >> inside the -1..1.
> >>
> >> I hope it is a little bit clearer.
> >
> > I'm not sure.  The picture shows a function that is not a Gaussian.
> > Do you mean that you want to fit only *part* of the data with a
> > function that would not fit well *all* the data?
> >
> > Regards,
> > Gilles
> >
> >>
> >>
> >> [1]
> >> https://ascelibrary.org/cms/asset/6ca2b016-1a4f-4eed-80da-71219777cac1/1.jpg
> >>
> >> Am 11.08.20 um 00:42 schrieb Gilles Sadowski:
> >>> Hello.
> >>>
> >>> Le lun. 10 août 2020 à 17:09, Christoph Läubrich
> >>>  a écrit :
> 
>  The userguide [1] mentions that it is currently not directly possible to
>  contrain parameters directly but suggest one can use the
>  ParameterValidator, is there any example code for both mentioned
>  alternatives?
> 
>  For example GaussianCurveFitter uses LeastSquaresBuilder and I wan't to
>  

Re: [math] example for constrain parameters for Least squares

2020-08-11 Thread Christoph Läubrich
Thanks for your patience, maybe a better/simpler example would be [1], I 
want to find the best fit using LSB under the constraint that the height 
of the curve never is above 0.7 (even though without constrains the 
optimizer would find a better solution around 8.5).


So my first idea way to copy/extend GausianCurveFitter to accept some 
kind of "maxHeight(...)", adjust the function to return INF for 
h>maxHeight, I was just unsure that return INF is allowed (per 
definition) as it is not mentioned anywhere in the userdocs. And if I 
want to limit others (like max position) it would work the same way.


In my final problem I need to limit the height, width and position of 
the bell-curve to fall into certain bounds, but there is no direct 
relation (e.g. width must be three times the height).




[1] 
https://crlbucophysics101.files.wordpress.com/2015/02/gaussian.png?w=538&h=294





Am 11.08.20 um 11:18 schrieb Gilles Sadowski:

Hi.

2020-08-11 8:51 UTC+02:00, Christoph Läubrich :

Hi Gilles,


Just to make clear I don't suspect any error with GausianCurveFitter, I
just don't understand how the advice in the user-doc to restrict
parameter (for general problems) could be applied to a concrete problem
and thus chosen GausianCurvefitter as an example as it uses
LeastSquaresBuilder.

I also noticed that Gaussian Fitter has a restriction on parameters
(norm can't be negative) that is handled in a third way (returning
Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned
in the userdoc at all, so I wonder if this is a general purpose solution
for restricting parameters (seems the simplest approach).


I'd indeed suggest to first try the same trick as in "GaussianCurveFitter"
(i.e. return a "high" value for arguments outside a known range).
That way, you only have to define a suitable "ParametricUnivariateFunction"
and pass it to "SimpleCurveFitter".

One case for the "ParameterValidator" is when some of the model
parameters might be correlated to others.
But using it makes it necessary that you handle yourself all the
arguments to be passed to the "LeastSquaresProblem".


To take the gausian example for my use case, consider an observed signal
similar to [1], given I know (from other source as the plain data) for
example that the result must be found in the range of 2...3 and I wanted
to restrict valid solutions to this area. The same might apply to the
norm: I know it must be between a given range and I want to restrict the
optimizer here even though there might be a solution outside of the
range that (compared of the R^2) fits better, e.g. a gausian fit well
inside the -1..1.

I hope it is a little bit clearer.


I'm not sure.  The picture shows a function that is not a Gaussian.
Do you mean that you want to fit only *part* of the data with a
function that would not fit well *all* the data?

Regards,
Gilles




[1]
https://ascelibrary.org/cms/asset/6ca2b016-1a4f-4eed-80da-71219777cac1/1.jpg

Am 11.08.20 um 00:42 schrieb Gilles Sadowski:

Hello.

Le lun. 10 août 2020 à 17:09, Christoph Läubrich
 a écrit :


The userguide [1] mentions that it is currently not directly possible to
contrain parameters directly but suggest one can use the
ParameterValidator, is there any example code for both mentioned
alternatives?

For example GaussianCurveFitter uses LeastSquaresBuilder and I wan't to
archive that the mean is within a closed bound e.g from 5 to 6 where my
datapoints ranges from 0..90, how would this be archived?


Could you set up a unit test as a practical example of what
you need to achieve?


I'm especially interested because the FUNCTION inside
GaussianCurveFitter seems to reject invalid values (e.g. negative
valuenorm) by simply return Double.POSITIVE_INFINITY instead of using
either approach described in the user-docs.


What I don't quite get is why you need to force the mean within a
certain range; if the data match a Gaussian with a mean within that
range, I would assume that the fitter will find the correct value...
Sorry if I missed something.  Hopefully the example will clarify.

Best,
Gilles




[1]
https://commons.apache.org/proper/commons-math/userguide/leastsquares.html



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2020-08-11 Thread Gilles Sadowski
Hi.

2020-08-11 8:51 UTC+02:00, Christoph Läubrich :
> Hi Gilles,
>
>
> Just to make clear I don't suspect any error with GausianCurveFitter, I
> just don't understand how the advice in the user-doc to restrict
> parameter (for general problems) could be applied to a concrete problem
> and thus chosen GausianCurvefitter as an example as it uses
> LeastSquaresBuilder.
>
> I also noticed that Gaussian Fitter has a restriction on parameters
> (norm can't be negative) that is handled in a third way (returning
> Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned
> in the userdoc at all, so I wonder if this is a general purpose solution
> for restricting parameters (seems the simplest approach).

I'd indeed suggest to first try the same trick as in "GaussianCurveFitter"
(i.e. return a "high" value for arguments outside a known range).
That way, you only have to define a suitable "ParametricUnivariateFunction"
and pass it to "SimpleCurveFitter".

One case for the "ParameterValidator" is when some of the model
parameters might be correlated to others.
But using it makes it necessary that you handle yourself all the
arguments to be passed to the "LeastSquaresProblem".

> To take the gausian example for my use case, consider an observed signal
> similar to [1], given I know (from other source as the plain data) for
> example that the result must be found in the range of 2...3 and I wanted
> to restrict valid solutions to this area. The same might apply to the
> norm: I know it must be between a given range and I want to restrict the
> optimizer here even though there might be a solution outside of the
> range that (compared of the R^2) fits better, e.g. a gausian fit well
> inside the -1..1.
>
> I hope it is a little bit clearer.

I'm not sure.  The picture shows a function that is not a Gaussian.
Do you mean that you want to fit only *part* of the data with a
function that would not fit well *all* the data?

Regards,
Gilles

>
>
> [1]
> https://ascelibrary.org/cms/asset/6ca2b016-1a4f-4eed-80da-71219777cac1/1.jpg
>
> Am 11.08.20 um 00:42 schrieb Gilles Sadowski:
>> Hello.
>>
>> Le lun. 10 août 2020 à 17:09, Christoph Läubrich
>>  a écrit :
>>>
>>> The userguide [1] mentions that it is currently not directly possible to
>>> contrain parameters directly but suggest one can use the
>>> ParameterValidator, is there any example code for both mentioned
>>> alternatives?
>>>
>>> For example GaussianCurveFitter uses LeastSquaresBuilder and I wan't to
>>> archive that the mean is within a closed bound e.g from 5 to 6 where my
>>> datapoints ranges from 0..90, how would this be archived?
>>
>> Could you set up a unit test as a practical example of what
>> you need to achieve?
>>
>>> I'm especially interested because the FUNCTION inside
>>> GaussianCurveFitter seems to reject invalid values (e.g. negative
>>> valuenorm) by simply return Double.POSITIVE_INFINITY instead of using
>>> either approach described in the user-docs.
>>
>> What I don't quite get is why you need to force the mean within a
>> certain range; if the data match a Gaussian with a mean within that
>> range, I would assume that the fitter will find the correct value...
>> Sorry if I missed something.  Hopefully the example will clarify.
>>
>> Best,
>> Gilles
>>
>>>
>>>
>>> [1]
>>> https://commons.apache.org/proper/commons-math/userguide/leastsquares.html
>>>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2020-08-10 Thread Christoph Läubrich

Hi Gilles,


Just to make clear I don't suspect any error with GausianCurveFitter, I 
just don't understand how the advice in the user-doc to restrict 
parameter (for general problems) could be applied to a concrete problem 
and thus chosen GausianCurvefitter as an example as it uses 
LeastSquaresBuilder.


I also noticed that Gaussian Fitter has a restriction on parameters 
(norm can't be negative) that is handled in a third way (returning 
Double.POSITIVE_INFINITY instead of Parameter Validator) not mentioned 
in the userdoc at all, so I wonder if this is a general purpose solution 
for restricting parameters (seems the simplest approach).


To take the gausian example for my use case, consider an observed signal 
similar to [1], given I know (from other source as the plain data) for 
example that the result must be found in the range of 2...3 and I wanted 
to restrict valid solutions to this area. The same might apply to the 
norm: I know it must be between a given range and I want to restrict the 
optimizer here even though there might be a solution outside of the 
range that (compared of the R^2) fits better, e.g. a gausian fit well 
inside the -1..1.


I hope it is a little bit clearer.


[1] 
https://ascelibrary.org/cms/asset/6ca2b016-1a4f-4eed-80da-71219777cac1/1.jpg


Am 11.08.20 um 00:42 schrieb Gilles Sadowski:

Hello.

Le lun. 10 août 2020 à 17:09, Christoph Läubrich
 a écrit :


The userguide [1] mentions that it is currently not directly possible to
contrain parameters directly but suggest one can use the
ParameterValidator, is there any example code for both mentioned
alternatives?

For example GaussianCurveFitter uses LeastSquaresBuilder and I wan't to
archive that the mean is within a closed bound e.g from 5 to 6 where my
datapoints ranges from 0..90, how would this be archived?


Could you set up a unit test as a practical example of what
you need to achieve?


I'm especially interested because the FUNCTION inside
GaussianCurveFitter seems to reject invalid values (e.g. negative
valuenorm) by simply return Double.POSITIVE_INFINITY instead of using
either approach described in the user-docs.


What I don't quite get is why you need to force the mean within a
certain range; if the data match a Gaussian with a mean within that
range, I would assume that the fitter will find the correct value...
Sorry if I missed something.  Hopefully the example will clarify.

Best,
Gilles




[1]
https://commons.apache.org/proper/commons-math/userguide/leastsquares.html



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] example for constrain parameters for Least squares

2020-08-10 Thread Gilles Sadowski
Hello.

Le lun. 10 août 2020 à 17:09, Christoph Läubrich
 a écrit :
>
> The userguide [1] mentions that it is currently not directly possible to
> contrain parameters directly but suggest one can use the
> ParameterValidator, is there any example code for both mentioned
> alternatives?
>
> For example GaussianCurveFitter uses LeastSquaresBuilder and I wan't to
> archive that the mean is within a closed bound e.g from 5 to 6 where my
> datapoints ranges from 0..90, how would this be archived?

Could you set up a unit test as a practical example of what
you need to achieve?

> I'm especially interested because the FUNCTION inside
> GaussianCurveFitter seems to reject invalid values (e.g. negative
> valuenorm) by simply return Double.POSITIVE_INFINITY instead of using
> either approach described in the user-docs.

What I don't quite get is why you need to force the mean within a
certain range; if the data match a Gaussian with a mean within that
range, I would assume that the fitter will find the correct value...
Sorry if I missed something.  Hopefully the example will clarify.

Best,
Gilles

>
>
> [1]
> https://commons.apache.org/proper/commons-math/userguide/leastsquares.html
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Optimization API Question

2020-07-11 Thread Oscar Bastidas
Hello Gilles,

That is a good question.  I don't know.  I read through the webpage Apache
Commons Math has for the optimization APIs and everything there appeared to
be an optimization (minimization or maximization) not for solving to hit a
custom target "y" value.  I will look at the specific documentation for the
specific class you mention and see if there is some way to do what I am
looking for.  Thanks.

Oscar


On Sat, Jul 11, 2020, 2:00 PM Gilles Sadowski  wrote:

> Hi.
>
> Le sam. 11 juil. 2020 à 03:54, Oscar Bastidas
>  a écrit :
> >
> > Would someone please tell me if the Optimization APIs in Apache Commons
> > Math can be used to solve a multi-variate equation (multiple xs, just one
> > y) for a specific value as Microsoft Excel's Solver can and if so, how
> that
> > would be implemented?  In short, I don't want to solve my multi-variate
> > system for zero, but set it equal to any number of my choosing and have
> the
> > program return the values of the coefficients (Y=Ax1+Bx2+Cx3+...nxi) that
> > satisfy the equation.  Thanks.
>
> Isn't the functionality implemented in the
> org.apache.commons.math4.optim.linear
> package[1] what you are looking for?
>
> Regards,
> Gilles
>
> [1]
> http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/optim/linear/package-frame.html
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] Optimization API Question

2020-07-11 Thread Gilles Sadowski
Hi.

Le sam. 11 juil. 2020 à 03:54, Oscar Bastidas
 a écrit :
>
> Would someone please tell me if the Optimization APIs in Apache Commons
> Math can be used to solve a multi-variate equation (multiple xs, just one
> y) for a specific value as Microsoft Excel's Solver can and if so, how that
> would be implemented?  In short, I don't want to solve my multi-variate
> system for zero, but set it equal to any number of my choosing and have the
> program return the values of the coefficients (Y=Ax1+Bx2+Cx3+...nxi) that
> satisfy the equation.  Thanks.

Isn't the functionality implemented in the
org.apache.commons.math4.optim.linear
package[1] what you are looking for?

Regards,
Gilles

[1] 
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/optim/linear/package-frame.html

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Calculate distance from (3d) Segment to (3d) Segment and Vector3D

2020-05-28 Thread Patrik Karlström
Thanks for the information Gilles,
I'll take a look att Geometry then.

As soon as I posted posted my question though, I got the idea of comparing
the lengths of the segments with the distance from their beginnings to the
line intersection. If longer, then the intersection is valid for the
segments.
It looks like that works for me, but I'll switch over to Geometry.

/Patrik


Den tors 28 maj 2020 kl 13:17 skrev Gilles Sadowski :

> Hello Patrik.
>
> 2020-05-28 9:39 UTC+02:00, Patrik Karlström :
> > Hi,
> > first time user of math here, in more ways than one it feels. :)
> >
> > I need to get the shortest distance between two segments,
> > not knowing the difference, I started off by using 3d Line but until I
> knew
> > why, the result was disturbing. ;)
> >
> > However, the 3d Segment class is missing all sorts of methods compared to
> > the 3d Line class.
> >
> > Does commons math provide a way around this that allows me to get the
> > distances I need in a simple way?
> >
> > Oh, the intersection, if any, is of interest too.
> >
> > /Patrik
> >
>
> In the upcoming version of Commons Math (v4.0), the package
> "geometry" has been removed: Code has been ported to a new
> library:
> https://commons.apache.org/geometry
>
> Please have a look, and if what you need is still missing, don't
> hesitate to repost (using the "[Geometry]" prefix in the subject).
>
> Best regards,
> Gilles
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] Calculate distance from (3d) Segment to (3d) Segment and Vector3D

2020-05-28 Thread Gilles Sadowski
Hello Patrik.

2020-05-28 9:39 UTC+02:00, Patrik Karlström :
> Hi,
> first time user of math here, in more ways than one it feels. :)
>
> I need to get the shortest distance between two segments,
> not knowing the difference, I started off by using 3d Line but until I knew
> why, the result was disturbing. ;)
>
> However, the 3d Segment class is missing all sorts of methods compared to
> the 3d Line class.
>
> Does commons math provide a way around this that allows me to get the
> distances I need in a simple way?
>
> Oh, the intersection, if any, is of interest too.
>
> /Patrik
>

In the upcoming version of Commons Math (v4.0), the package
"geometry" has been removed: Code has been ported to a new
library:
https://commons.apache.org/geometry

Please have a look, and if what you need is still missing, don't
hesitate to repost (using the "[Geometry]" prefix in the subject).

Best regards,
Gilles

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Question about GaussianCurveFitter.ParameterGuesser

2020-05-25 Thread Gilles Sadowski
Hello.

Le lun. 25 mai 2020 à 07:27, Christoph Läubrich
 a écrit :
>
> I'm currently looking into some curve-fitting and have examined the
>
> basicGuess(WeightedObservedPoint[])
>
> in GaussianCurveFitter.ParameterGuesser, and there is one thing I don't
> really understand.
>
> in Line 301 [1] the "halfY" is computed by n (what is the maximal y
> value of the observation) + half the sum of n+m (where m is the x value
> of the maximum) applying this to some of my datapoints that fit
> relatively good as a Gaussian later, it seems that this condition never
> works, and the default in the catch clause is used instead.
>
> I also wonder why x is taken into account for computing the half-y value..

Good question indeed.  I don't see why the estimation of the
half-width would change depending on the position of the curve
along the x-axis.
Also it seems that the current code could be made more robust by
shifting the abscissa of the maximum height to 0 before performing
the rest of the computation.

Could you please file a report on the bug-tracking system?[1]

Thanks,
Gilles

[1] https://issues.apache.org/jira/projects/MATH

> [...]

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] ode event handler

2020-01-15 Thread Bo Johnson

Hi Gilles,

Thanks for your reply. I'm rather new to Java and how user guides and 
docs are organized (they all seem to follow a general format I'm getting 
used to). I found in the docs a specific example of how to treat a 
bouncing ball and it was the solution to my question.


Best,

On 1/15/20 8:35 AM, Gilles Sadowski wrote:

Hi.

I do not personally use this part of the library.
Thus, only suggesting the obvious: Did you read the user guide, and
the examples that are part of the test suite (in order to be sure that
everything is coded correctly)?
If so, the next step would be to try and devise a minimal (simplified)
example, in the form of a Junit tests to be added to the test suite.

Best regards,
Gilles

Le sam. 11 janv. 2020 à 22:15, Bo Johnson  a écrit :

Hi there,

I'm new to Java and working on a project to integrate some ODEs. I'm
having issues knowing how to work with the event handler. My ODE class
looks like:

public class DipoleODEimplements FirstOrderDifferentialEquations {

  public int getDimension() {
  return 6; }

  public void computeDerivatives(double t, double[] y, double[] yDot) {
  double r = y[0]; double r2 = r * r; double r3 = r2 * r; double r4 = 
r3 * r; double theta = y[1]; double phi = y[2]; double sin_phi = Math.sin(phi); 
double cos_phi = Math.cos(phi); double pr = y[3]; double ptheta = y[4]; double 
ptheta2 = ptheta * ptheta; double pphi = y[5]; double cos2 = Math.cos(phi -2 * 
theta); double sin2 = Math.sin(phi -2 * theta); yDot[0] = pr; yDot[1] = ptheta 
/ r2; yDot[2] =10 * pphi; yDot[3] = ptheta2 / r3 - (cos_phi +3 * cos2) / (4 * 
r4); yDot[4] = sin2 / (2 * r3); yDot[5] = -(sin_phi +3 * sin2) / (12 * r3); }

}

When the y[0] value gets below 1.0, I'd like to change the y[3] value
and the continue the integration. Basically I'm looking for a ball to
bounce off another one. The integration gets stuck though and I can't
seem to get things bouncing. Here's my event handler, too:

EventHandler handler =new EventHandler() {
  @Override public void init(double t0, double[] y0, double t) {

  }

  @Override public double g(double t, double[] y) {
  return y[0] -1.0; }

  @Override public ActioneventOccurred(double t, double[] y, boolean 
increasing) {
  return Action.RESET_STATE; }

  @Override public void resetState(double t, double[] y) {
  y[3] *= -1.0; }
};

And adding it to the integrator:

dp853.addEventHandler(handler, 50.0, 1e-6, 100);

Thanks for the help,

--
Bo Johnson
(801) 503-2043


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


--
Bo Johnson
(801) 503-2043


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] ode event handler

2020-01-15 Thread Gilles Sadowski
Hi.

I do not personally use this part of the library.
Thus, only suggesting the obvious: Did you read the user guide, and
the examples that are part of the test suite (in order to be sure that
everything is coded correctly)?
If so, the next step would be to try and devise a minimal (simplified)
example, in the form of a Junit tests to be added to the test suite.

Best regards,
Gilles

Le sam. 11 janv. 2020 à 22:15, Bo Johnson  a écrit :
>
> Hi there,
>
> I'm new to Java and working on a project to integrate some ODEs. I'm
> having issues knowing how to work with the event handler. My ODE class
> looks like:
>
> public class DipoleODEimplements FirstOrderDifferentialEquations {
>
>  public int getDimension() {
>  return 6; }
>
>  public void computeDerivatives(double t, double[] y, double[] yDot) {
>  double r = y[0]; double r2 = r * r; double r3 = r2 * r; double r4 = 
> r3 * r; double theta = y[1]; double phi = y[2]; double sin_phi = 
> Math.sin(phi); double cos_phi = Math.cos(phi); double pr = y[3]; double 
> ptheta = y[4]; double ptheta2 = ptheta * ptheta; double pphi = y[5]; double 
> cos2 = Math.cos(phi -2 * theta); double sin2 = Math.sin(phi -2 * theta); 
> yDot[0] = pr; yDot[1] = ptheta / r2; yDot[2] =10 * pphi; yDot[3] = ptheta2 / 
> r3 - (cos_phi +3 * cos2) / (4 * r4); yDot[4] = sin2 / (2 * r3); yDot[5] = 
> -(sin_phi +3 * sin2) / (12 * r3); }
>
> }
>
> When the y[0] value gets below 1.0, I'd like to change the y[3] value
> and the continue the integration. Basically I'm looking for a ball to
> bounce off another one. The integration gets stuck though and I can't
> seem to get things bouncing. Here's my event handler, too:
>
> EventHandler handler =new EventHandler() {
>  @Override public void init(double t0, double[] y0, double t) {
>
>  }
>
>  @Override public double g(double t, double[] y) {
>  return y[0] -1.0; }
>
>  @Override public ActioneventOccurred(double t, double[] y, boolean 
> increasing) {
>  return Action.RESET_STATE; }
>
>  @Override public void resetState(double t, double[] y) {
>  y[3] *= -1.0; }
> };
>
> And adding it to the integrator:
>
> dp853.addEventHandler(handler, 50.0, 1e-6, 100);
>
> Thanks for the help,
>
> --
> Bo Johnson
> (801) 503-2043
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Question about constructing a PolyhedronsSet using B-rep (commons-math3 v3.6.1)

2019-09-23 Thread Gilles Sadowski
Hello.

Short answer: The "geometry" package of "Commons Math" will
be deprecated, as we currently work on a new component:
https://gitbox.apache.org/repos/asf?p=commons-geometry.git

There is no official release yet, but you should definitely test it.

Best regards,
Gilles

P.S. We seek help in order to release this component ASAP... ;-)

2019-09-23 9:12 UTC+02:00, Steven Fontaine :
> Hi, I have a (hopefully) simple question regarding constructing a
> PolyhedronsSet using the constructor PolyhedronsSet(List
> vertices, List facets, double tolerance). Currently I have the
> following code to construct a simple tetrahedron:
>
> List verts = Arrays.asList(new Vector3D(0, 0, 0), new Vector3D(0,
> 1, 1), new Vector3D(1, 1, 0), new Vector3D(1, 0, 1));
> List facets = Arrays.asList(new int[] {0, 3, 1}, new int[] {3, 2,
> 1}, new int[] {2, 1, 0}, new int[] {3, 2, 0});
> PolyhedronsSet set = new PolyhedronsSet(verts, facets, 1e-10);
>
> To the best of my knowledge, according to the documentation for this
> constructor, the previous code should be right. However, it obviously
> isn't. I'm getting the following error:
>
> org.apache.commons.math3.exception.MathIllegalArgumentException: facets
> orientation mismatch around edge joining points (0, 0, 0) and (1, 0, 1)
>
> at
> org.apache.commons.math3.geometry.euclidean.threed.PolyhedronsSet.successors(PolyhedronsSet.java:403)
> at
> org.apache.commons.math3.geometry.euclidean.threed.PolyhedronsSet.buildBoundary(PolyhedronsSet.java:274)
> at
> org.apache.commons.math3.geometry.euclidean.threed.PolyhedronsSet.(PolyhedronsSet.java:131)
> at ...
>
>
> So, my question is, what am I doing wrong? If it's something more complex
> than can easily be explained via email, feel free to link me to some
> articles which might help. (Preferably articles which someone with very
> limited experience with BSP trees and such could understand.)
>
> Thanks for your time. -Steven
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [MATH]Performance issue with SVD calculation for large matrices

2019-09-05 Thread Gilles Sadowski
Hi.

2019-09-05 12:04 UTC+02:00, Sudheer Kumar Gattu :
> Hi All,
>
>
> We use SingularValueDecomposition(RealMatrix realMatrix) , getSolver() in
> our project.
>
> For large matrices of size 925*161 , when these API's are used iteratively.
> It is taking so much time, Refer attached snapshot.

Attachment was probably stripped.
Anyways, I guess that it's the same as on the JIRA page.[1]
If so, it's not very telling.

>
> I have tried this with 3.3 and 3.6.1, both versions perform similarly.

Good to know.
Did you also check the development version?

>
> Is there any way to improve the performance of these API's.
>

Hard to say without a minimal working example.
Best would be to set up unit tests that replicate your usage of the
class, and provide answers to the following questions:
 * What kind of performance do you expect?  Did you compare
with other libraries?
 * Did you investigate how the performance varies with matrix size?
 * Do you observe the same slow-down with other decomposition
classes?
 * Is the behaviour similar with square matrices?
 * Which matrix implementation do you use?

Regards,
Gilles

[1] https://issues.apache.org/jira/browse/MATH-1497

> Regards
> Sudheer Gattu
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Apache Commons Math Median performance

2019-05-29 Thread Marco Neumann
Hi Gilles,

On Wed, May 29, 2019 at 11:18 PM Gilles Sadowski 
wrote:

> Hello.
>
> Le mer. 29 mai 2019 à 12:24, Marco Neumann  a
> écrit :
> >
> > I am evaluating the use of Apache Math Commons Median for the querying of
> > large data sets in another Apache project called Apache Jena.
> >
> > In my preliminary performance tests I was surprised to find that a simple
> > implementation of a median function with Arrays.sort() and a programmatic
> > selection of the median value yields much faster results
> > than Median().evaluate() or DescriptiveStatistics.getPercentile(50).
>
> :-(
>

no worries, I still consider Apache Commons Math still a very valuable
effort.


>
> > Since we only use this function for  Arrays of confirmed numbers
>
> What is a "confirmed number"?
>

should probably read more like programmatically confirmed "numbers" rather
than "confirmed number". I am not dealing with NaN and infinite values in
the sort at the moment.


> > is there a
> > particular benefit in using Apache Commons Math for this task or are we
> > better advised to use our own implementation here?
>
> There is ongoing work to refactor the "o.a.c.m.stat.descriptive" package
> of "Commons Math".  The new code will be in "Commons Statistics".[1]
> Your observation is an interesting data point for this task; could you
> please
> file a report in JIRA[2] and/or mention on the "dev" ML?
>

I can certainly file a report and will do so tomorrow. I am looking forward
to the results of the work on the new stats package!

Best,
Marco

Thanks,
> Gilles
>
> [1] http://commons.apache.org/proper/commons-statistics/
> [2]
> https://issues.apache.org/jira/projects/STATISTICS/issues/STATISTICS-15?filter=allopenissues
>
> >
> > Thank You
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>

-- 


---
Marco Neumann
KONA


Re: [math] Apache Commons Math Median performance

2019-05-29 Thread Marco Neumann
Thank you for the feedback and confirmation Eric. I am looking forward to
the new statistics libraries. I am glad that the work continuous on
these libraries and that they will be available to the community to improve
and enhance our projects.



On Wed, May 29, 2019 at 10:56 PM Eric Barnhill 
wrote:

> Hi Marco,
>
> Thanks a lot for this feedback. I am one of the contribs building out the
> new commons-numbers release which will replace much of commons-math
> including the statistics libraries.
>
> I took a look at the commons-math code for Median. Based on my reading of
> it I am not surprised by what you report. Median just invokes Percentile.
> Percentile does seem to have some overhead, for example lots of range and
> null checking. As as one off Median is probably not as efficient as a
> simple sort. However it can store data and recalculate percentiles, and
> there it might be efficient to use, as well as having flexibility in how it
> is implemented.
>
> I quite agree that most users simply want to call median() on their array
> and expect at least as efficient an algorithm as they could hand code
> themselves. For medians as we all learned in CS 101 class, for a guaranteed
> result one cannot improve on O(n log n) time, just sorting like you
> mentioned, however a method can deliver O(log n) time on average, but with
> a potential worst case of O(n^2), and the user could be given this choice
> of implementation.
>
> The fact that the commons-math contributors did not seem aware of this
> finding shows some of the occasional weaknesses I am finding as we design a
> new, fleeter library in commons-numbers. We are redesigning the statistics
> libraries over this summer with support from Google Summer of Code, so I
> will see what I can do. Without feedback like yours we would not find these
> points of improvement, so thanks.
>
> On Wed, May 29, 2019 at 3:24 AM Marco Neumann 
> wrote:
>
> > I am evaluating the use of Apache Math Commons Median for the querying of
> > large data sets in another Apache project called Apache Jena.
> >
> > In my preliminary performance tests I was surprised to find that a simple
> > implementation of a median function with Arrays.sort() and a programmatic
> > selection of the median value yields much faster results
> > than Median().evaluate() or DescriptiveStatistics.getPercentile(50).
> >
> > Since we only use this function for  Arrays of confirmed numbers is
> there a
> > particular benefit in using Apache Commons Math for this task or are we
> > better advised to use our own implementation here?
> >
> > Thank You
> >
>


-- 


---
Marco Neumann
KONA


Re: [math] Apache Commons Math Median performance

2019-05-29 Thread Gilles Sadowski
Hello.

Le mer. 29 mai 2019 à 12:24, Marco Neumann  a écrit :
>
> I am evaluating the use of Apache Math Commons Median for the querying of
> large data sets in another Apache project called Apache Jena.
>
> In my preliminary performance tests I was surprised to find that a simple
> implementation of a median function with Arrays.sort() and a programmatic
> selection of the median value yields much faster results
> than Median().evaluate() or DescriptiveStatistics.getPercentile(50).

:-(

> Since we only use this function for  Arrays of confirmed numbers

What is a "confirmed number"?

> is there a
> particular benefit in using Apache Commons Math for this task or are we
> better advised to use our own implementation here?

There is ongoing work to refactor the "o.a.c.m.stat.descriptive" package
of "Commons Math".  The new code will be in "Commons Statistics".[1]
Your observation is an interesting data point for this task; could you please
file a report in JIRA[2] and/or mention on the "dev" ML?

Thanks,
Gilles

[1] http://commons.apache.org/proper/commons-statistics/
[2] 
https://issues.apache.org/jira/projects/STATISTICS/issues/STATISTICS-15?filter=allopenissues

>
> Thank You

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Apache Commons Math Median performance

2019-05-29 Thread Eric Barnhill
Hi Marco,

Thanks a lot for this feedback. I am one of the contribs building out the
new commons-numbers release which will replace much of commons-math
including the statistics libraries.

I took a look at the commons-math code for Median. Based on my reading of
it I am not surprised by what you report. Median just invokes Percentile.
Percentile does seem to have some overhead, for example lots of range and
null checking. As as one off Median is probably not as efficient as a
simple sort. However it can store data and recalculate percentiles, and
there it might be efficient to use, as well as having flexibility in how it
is implemented.

I quite agree that most users simply want to call median() on their array
and expect at least as efficient an algorithm as they could hand code
themselves. For medians as we all learned in CS 101 class, for a guaranteed
result one cannot improve on O(n log n) time, just sorting like you
mentioned, however a method can deliver O(log n) time on average, but with
a potential worst case of O(n^2), and the user could be given this choice
of implementation.

The fact that the commons-math contributors did not seem aware of this
finding shows some of the occasional weaknesses I am finding as we design a
new, fleeter library in commons-numbers. We are redesigning the statistics
libraries over this summer with support from Google Summer of Code, so I
will see what I can do. Without feedback like yours we would not find these
points of improvement, so thanks.

On Wed, May 29, 2019 at 3:24 AM Marco Neumann 
wrote:

> I am evaluating the use of Apache Math Commons Median for the querying of
> large data sets in another Apache project called Apache Jena.
>
> In my preliminary performance tests I was surprised to find that a simple
> implementation of a median function with Arrays.sort() and a programmatic
> selection of the median value yields much faster results
> than Median().evaluate() or DescriptiveStatistics.getPercentile(50).
>
> Since we only use this function for  Arrays of confirmed numbers is there a
> particular benefit in using Apache Commons Math for this task or are we
> better advised to use our own implementation here?
>
> Thank You
>


Re: [math] Vector math question

2019-05-28 Thread Gilles Sadowski
Hi.

Le mar. 28 mai 2019 à 10:31, LE TELLIER Romain 211391
 a écrit :
>
> Hello,
>
> Yes, Apache Commons Maths has what you need. Start by having a look at the 
> org.apache.commons.math3.geometry.euclidean.threed package and the Vector3D 
> class
> https://commons.apache.org/proper/commons-math/userguide/geometry.html

This Javadoc page may be more to the point:

https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.html

> By the way, I have understand that this geometry package will be supplanted 
> by the apache commons geometry 
> (https://commons.apache.org/proper/commons-geometry/)

Indeed.  The new class, equivalent to the above is:

https://gitbox.apache.org/repos/asf?p=commons-geometry.git;a=blob;f=commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java

>  but there is no release yet.

True but the refactoring work is ongoing (see posts on the "dev" ML),
and reviewers are most welcome.

> Does anybody knows what is the associated schedule?

ASAP. ;-)
[The more people express an interest, the greater the motivation...]

And we are looking for actual use-cases (for integration testing and
in order to populate a "Get Started" userguide).

Also, the new "Commons Geometry" component will depend on the
new "Commons Numbers" component (that is as yet unreleased too).
Reviewers/contributors for this "core" dependency are also most
wanted in order to iron out the pending issues:

https://issues.apache.org/jira/projects/NUMBERS/issues/NUMBERS-74?filter=allopenissues

Please chime in on the "dev" ML if you'd like to help.

Thanks,
Gilles

>
> Best regards,
> Romain
>
> -Message d'origine-
> De : Oscar Bastidas [mailto:obast...@umn.edu]
> Envoyé : mardi 28 mai 2019 09:38
> À : user@commons.apache.org
> Objet : [math] Vector math question
>
> Hello,
>
> I have some calculations that specifically involve:
>
> 1) calculating vectors from 3-dimensional x, y, z points in Euclidean space
>
> 2) performing dot products with the aforementioned vectors
>
> 3) finding vector length
>
> Would someone please tell me if Apache Commons Math has tools to calculate 
> these quantities, and if so, what is the complete import statements to summon 
> these classes and their methods?  Thanks.
>
> Oscar
>
> Oscar Bastidas, Ph.D.
> Postdoctoral Research Associate
> University of Minnesota

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Vector math question

2019-05-28 Thread sebb
On Tue, 28 May 2019 at 09:31, LE TELLIER Romain 211391
 wrote:
>
> Hello,
>
> Yes, Apache Commons Maths has what you need. Start by having a look at the 
> org.apache.commons.math3.geometry.euclidean.threed package and the Vector3D 
> class
> https://commons.apache.org/proper/commons-math/userguide/geometry.html
>
> By the way, I have understand that this geometry package will be supplanted 
> by the apache commons geometry 
> (https://commons.apache.org/proper/commons-geometry/)  but there is no 
> release yet.
> Does anybody knows what is the associated schedule?

Please start a new thread for a new question.

> Best regards,
> Romain
>
> -Message d'origine-
> De : Oscar Bastidas [mailto:obast...@umn.edu]
> Envoyé : mardi 28 mai 2019 09:38
> À : user@commons.apache.org
> Objet : [math] Vector math question
>
> Hello,
>
> I have some calculations that specifically involve:
>
> 1) calculating vectors from 3-dimensional x, y, z points in Euclidean space
>
> 2) performing dot products with the aforementioned vectors
>
> 3) finding vector length
>
> Would someone please tell me if Apache Commons Math has tools to calculate 
> these quantities, and if so, what is the complete import statements to summon 
> these classes and their methods?  Thanks.
>
> Oscar
>
> Oscar Bastidas, Ph.D.
> Postdoctoral Research Associate
> University of Minnesota

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: [math] Vector math question

2019-05-28 Thread LE TELLIER Romain 211391
Hello,

Yes, Apache Commons Maths has what you need. Start by having a look at the 
org.apache.commons.math3.geometry.euclidean.threed package and the Vector3D 
class
https://commons.apache.org/proper/commons-math/userguide/geometry.html 

By the way, I have understand that this geometry package will be supplanted by 
the apache commons geometry 
(https://commons.apache.org/proper/commons-geometry/)  but there is no release 
yet.
Does anybody knows what is the associated schedule?

Best regards,
Romain

-Message d'origine-
De : Oscar Bastidas [mailto:obast...@umn.edu] 
Envoyé : mardi 28 mai 2019 09:38
À : user@commons.apache.org
Objet : [math] Vector math question

Hello,

I have some calculations that specifically involve:

1) calculating vectors from 3-dimensional x, y, z points in Euclidean space

2) performing dot products with the aforementioned vectors

3) finding vector length

Would someone please tell me if Apache Commons Math has tools to calculate 
these quantities, and if so, what is the complete import statements to summon 
these classes and their methods?  Thanks.

Oscar

Oscar Bastidas, Ph.D.
Postdoctoral Research Associate
University of Minnesota


Re: [math] - Math on Android?

2019-05-21 Thread Gilles Sadowski
Hello.

Le mar. 21 mai 2019 à 12:42, Oscar Bastidas  a écrit :
>
> Hello,
>
> Can someone please tell me if the Math library will work on Android Java,
> or is this just restricted to "regular" Java?  Thanks.

"Commons Math" has been partly superseded by new components:
 * "Commons RNG"
 * "Commons Numbers"
 * "Commons Geometry"
 * "Commons Statistics"

What functionality are you looking for?

We are certainly interested to know whether there is anything that
prevents using those components for developing applications on
some OS.

Regards,
Gilles

>
> Oscar
>
> Oscar Bastidas, Ph.D.
> Postdoctoral Research Associate
> University of Minnesota

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] - Math on Android?

2019-05-21 Thread Axel
 Hi

Search for example for tag commons-math

   - https://github.com/mkulesh/microMathematics
   - https://github.com/topics/commons-math

Similar like the commons-math library the Hipparchus fork
https://github.com/Hipparchus-Math/hipparchus is also usable under Android.

See the symbolic math projects which focus on Android  and use Hipparchus:

   - For Android Java 7:
   https://github.com/tranleduy2000/symja_android_library
   - forked from Java 8 Symja project:
   https://github.com/axkr/symja_android_library


On Tue, May 21, 2019 at 12:42 PM Oscar Bastidas  wrote:

> Hello,
>
> Can someone please tell me if the Math library will work on Android Java,
> or is this just restricted to "regular" Java?  Thanks.
>
> Oscar
>
> Oscar Bastidas, Ph.D.
> Postdoctoral Research Associate
> University of Minnesota
>


-- 
Axel Kramer


Re: [math] univariate nonlinear optimisation : how to start?

2019-04-08 Thread Matthew Rowles
I managed to solve it to the extent that it works well enough for me.

I pinched some code and changed it a little for my purposes:
https://stackoverflow.com/questions/32494230/newton-raphson-method-using-the-math-commons-library



public static void main(String args[])
{

//setup all variables
final double R   =(new Double(args[0])).doubleValue(); //=250.0;
final double om1 =(new Double(args[1])).doubleValue(); //=  5.0;
final double om2 =(new Double(args[2])).doubleValue(); //= 15.0;
final double th21=(new Double(args[3])).doubleValue(); //= 29.07965;
final double th22=(new Double(args[4])).doubleValue(); //= 29.69008;
final double D_obs = th21 - th22;

BisectionSolver solver = new BisectionSolver();

UnivariateFunction f = new UnivariateFunction()
{
public double value(double s) {
return ((delta(R,om1,th21,s)-delta(R,om2,th22,s)) - (D_obs));
}
};

System.out.printf("The speciment offset is %.3f mm.\n", solver.solve(1000,
f, -3, 3));
}

On Thu, 4 Apr 2019 at 23:15, Matthew Rowles  wrote:

> I'm having difficulty even beginning to solve this problem. All examples
> that I have found are either too simple or way too complex to digest.
>
> I want to to find the value S given a series of inputs. The function is
> univariate but non-linear. S will always be between -3 .. 3.
>
> I would like to use the Apache Commons library, as I have had prior
> experience in other sections of the code.
>
> For each time I want to solve my problem, I know the following information:
>
> double R =250.0;
> double om1   =  5.0;
> double om2   = 15.0;
> double th21  = 29.07965;
> double th22  = 29.69008;
> double D_obs = th21 - th22;
>
> The actual values will change between solutions, but they are fixed for
> any one particular solution.
>
> The value I want to find is:
>
> double S   = 0.0;
>
> such that
>
> double d1 = delta(R,om1,th21,S);
> double d2 = delta(R,om2,th22,S);
> double D_calc = d1 - d2;
>
> have values to make
>
> double minme = Math.abs(D_obs - D_calc);
>
> a minimum. (ideally zero, but a minimum).
>
> The function delta is defined as
>
> public static double delta(double R, double om, double th2, double s)
> {
> if(Math.abs(s) <= 0.0001) //is the displacement == 0?
> {
> return 0.0;
> }
> else
> {
> return 
> Math.toDegrees((-1*Cos(th2)*s-R*Sin(om)+Sqrt(-1*Math.pow(Cos(th2),2)*Math.pow(s,2)+2*Cos(th2)*Sin(om)*R*s-Math.pow(Cos(om),2)*Math.pow(R,2)+Math.pow(R,2)+2*Math.pow(s,2)))/(Sin(th2)*s));
> }
> }
>
> where, for example, Cosis defined elsewhere as
> Math.cos(Math.toRadians(val))
>
> Where/what can I read/do to get a start on this problem?
>
>
> Thanks
>
>
> Matthew
>


Re: [math] univariate nonlinear optimisation : how to start?

2019-04-06 Thread Gilles Sadowski
Hello.

Le jeu. 4 avr. 2019 à 17:23, Matthew Rowles  a écrit :
>
> I'm having difficulty even beginning to solve this problem. All examples
> that I have found are either too simple or way too complex to digest.

What did you try?
Did you at the Javadocs for the "optim" and "fitting" package?
The unit tests could also help.

>
> I want to to find the value S given a series of inputs. The function is
> univariate but non-linear. S will always be between -3 .. 3.
>
> I would like to use the Apache Commons library, as I have had prior
> experience in other sections of the code.
>
> For each time I want to solve my problem, I know the following information:
>
> double R =250.0;
> double om1   =  5.0;
> double om2   = 15.0;
> double th21  = 29.07965;
> double th22  = 29.69008;
> double D_obs = th21 - th22;
>
> The actual values will change between solutions, but they are fixed for any
> one particular solution.
>
> The value I want to find is:
>
> double S   = 0.0;

So, you have it. ;-)

>
> such that
>
> double d1 = delta(R,om1,th21,S);
> double d2 = delta(R,om2,th22,S);
> double D_calc = d1 - d2;
>
> have values to make
>
> double minme = Math.abs(D_obs - D_calc);
>
> a minimum. (ideally zero, but a minimum).

So, a least-squares problem (with 1 observation?).

> The function delta is defined as
>
> public static double delta(double R, double om, double th2, double s)
> {
> if(Math.abs(s) <= 0.0001) //is the displacement == 0?
> {
> return 0.0;
> }
> else
> {
> return 
> Math.toDegrees((-1*Cos(th2)*s-R*Sin(om)+Sqrt(-1*Math.pow(Cos(th2),2)*Math.pow(s,2)+2*Cos(th2)*Sin(om)*R*s-Math.pow(Cos(om),2)*Math.pow(R,2)+Math.pow(R,2)+2*Math.pow(s,2)))/(Sin(th2)*s));
> }
> }

You could improve readability and performance by
* not calling "pow" to get the square,
* not compute the same value multiple times,
* perform the computation with radians throughout (i.e. only convert
  the inputs and outputs from and to degrees)

HTH,
Gilles

>
> where, for example, Cosis defined elsewhere as Math.cos(Math.toRadians(val))
>
> Where/what can I read/do to get a start on this problem?
>
>
> Thanks
>
>
> Matthew

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-26 Thread Sven Rathgeber

> Please have a look at the fix (in "master" now).

> Thanks a lot for the report,

> Gilles


Hi Gilles and Matt,

the fix works !!! Thanks a lot.

Cheers.

Sven


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-25 Thread Gilles Sadowski
Hi Sven.

Le jeu. 24 janv. 2019 à 09:21, Sven Rathgeber  a écrit :
>
> > Matt Juntunen leads the development of "Commons Geometry".
> > Hopefully, he'll have a look at your example.

Please have a look at the fix (in "master" now).

Thanks a lot for the report,
Gilles

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] java.lang.OutOfMemoryError: Java heap space: DescriptiveStatistics.addValue() ...

2019-01-24 Thread Albretch Mueller
On 1/24/19, Gilles Sadowski  wrote:
> This caveat is mentioned in the documentation:
>
> http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.html
>
>>  Is there a way around that problem?
>
> Yes; also mentioned in the above link.

 
http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/stat/descriptive/SummaryStatistics.html

 Actually (from a Mathematical point of view), why can't you get the
Skewness and Kurtosis of the data if very similar, incrementally
producing formulas based on the distribution moments could be used?

 You can always write a wrapper object in the way I described above,
but I think my point is still valid.

 lbrtchx

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] java.lang.OutOfMemoryError: Java heap space: DescriptiveStatistics.addValue() ...

2019-01-24 Thread Gilles Sadowski
Hello.

Le jeu. 24 janv. 2019 à 08:23, Albretch Mueller  a écrit :
>
>  I am "consistently" getting java.lang.OutOfMemoryError while trying
> to use DescriptiveStatistics.
>
>  The files I am using are relatively large and I need to analyze the
> byte distributions in them. I am taking care of clearing the cash each
> time I run a new sample . . .
>
>  I can't quite get why this is happening, when all you need are at the
> most 6 double variables which values you would incrementally update
> based on well-known formulas.
>
>  Why would such OutOfMemoryError happen?

This caveat is mentioned in the documentation:

http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.html

>  Is there a way around that problem?

Yes; also mentioned in the above link.

HTH,
Gilles

>
>  lbrtchx
> ~
> java.lang.OutOfMemoryError: Java heap space:
> DescriptiveStatistics.addValue() ...
>
> $ export JVM_ARGS="-Xms2048m -Xmx2048m"
>
> $ time(java -classpath "${CLASSPATH}" -Dfile.encoding=utf8 "${_KD}") >
> "${_LOG}" 2>&1
>
> $ tail -n 11 "${_LOG}"
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
>  at 
> org.apache.commons.math3.util.ResizableDoubleArray.expand(ResizableDoubleArray.java:697)
>  at 
> org.apache.commons.math3.util.ResizableDoubleArray.addElement(ResizableDoubleArray.java:442)
>  at 
> org.apache.commons.math3.stat.descriptive.DescriptiveStatistics.addValue(DescriptiveStatistics.java:171)
>  at KByteInfo10DiffStats.setFfst(KByteInfo10DiffStats.java:80)
>  at IOBytAr08.readBytes(IOBytAr08Test.java:310)
>  at IOBytAr08Test.main(IOBytAr08Test.java:545)
>
> real4m44.987s
> user1m20.380s
> sys 3m28.568s
> $
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] java.lang.OutOfMemoryError: Java heap space: DescriptiveStatistics.addValue() ...

2019-01-24 Thread Albretch Mueller
On 1/24/19, Albretch Mueller  wrote:
>  I am "consistently" getting java.lang.OutOfMemoryError while trying
> to use DescriptiveStatistics.

 Actually, this is what I needed:

import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation;
import org.apache.commons.math3.stat.descriptive.moment.Skewness;
import org.apache.commons.math3.stat.descriptive.moment.Kurtosis;
~
 in case someone runs into the same problem.

 lbrtchx

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-24 Thread Sven Rathgeber
> Matt Juntunen leads the development of "Commons Geometry".
> Hopefully, he'll have a look at your example.
> Best would be to file a report on the bug-tracking system[1] and
> attach a patch (or a git pull request) to it.

> Thanks,
> Gilles

> [1] https://issues.apache.org/jira/projects/GEOMETRY

Done.

Issue: https://issues.apache.org/jira/browse/GEOMETRY-38
Pull request: https://github.com/apache/commons-geometry/pull/19

Cheers,
Sven

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-23 Thread Gilles Sadowski
Hi.

Le mer. 23 janv. 2019 à 13:16, Sven Rathgeber  a écrit :
>
> > Codes in package "o.a.c.m.geometry" of Commons Math are being superseded
> > by a new component.[1]
> > It is currently in development and we hope to release a beta version soon; 
> > you
> > are most welcome to help with testing.[2]
>
> > Please try the new project's code, and let us know how it goes.
>
> Thanks for the quick reply.
>
> I checked out the new geometry repo and added my test to
>
> org/apache/commons/geometry/euclidean/threed/PolyhedronsSetTest.java
>
> -> same result. The SubHyperplane is null.
>
> hmm, I'm not sure, if I use the library correctly or if this is a corner case 
> ?

Matt Juntunen leads the development of "Commons Geometry".
Hopefully, he'll have a look at your example.
Best would be to file a report on the bug-tracking system[1] and
attach a patch (or a git pull request) to it.

Thanks,
Gilles

[1] https://issues.apache.org/jira/projects/GEOMETRY

>
> Regards. Sven

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Aw: Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-23 Thread Sven Rathgeber
> Codes in package "o.a.c.m.geometry" of Commons Math are being superseded
> by a new component.[1]
> It is currently in development and we hope to release a beta version soon; you
> are most welcome to help with testing.[2]

> Please try the new project's code, and let us know how it goes.

Thanks for the quick reply.

I checked out the new geometry repo and added my test to

org/apache/commons/geometry/euclidean/threed/PolyhedronsSetTest.java

-> same result. The SubHyperplane is null.

hmm, I'm not sure, if I use the library correctly or if this is a corner case ?

Regards. Sven

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-22 Thread Gilles Sadowski
Hello.

Le mar. 22 janv. 2019 à 11:06, Sven Rathgeber  a écrit :
>
> Hi,
>
> I'm working with PolyhedronsSets. To get a basic understanding
> I set up a cube and tried to intersect it diagonally. (apache.commons.math 
> 3.6.1)

Codes in package "o.a.c.m.geometry" of Commons Math are being superseded
by a new component.[1]
It is currently in development and we hope to release a beta version soon; you
are most welcome to help with testing.[2]

> When debugging the following test, it looks to me, that Vector(0,0,0) is
> ignored, since it is on the border.
>
> Hmm, any ideas.

Please try the new project's code, and let us know how it goes.

Best regards,
Gilles

[1] https://commons.apache.org/geometry
[2] Source repository is here:
https://gitbox.apache.org/repos/asf?p=commons-geometry.git

> [...]

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Struggling with least squares

2018-12-28 Thread David Tinker
I figured it out. The issue was with my derivative calculation. I was using
(a - b) / DELTA * 2. Changing this to (b - a) / DELTA * 2 fixes this
problem.

a = morton3pTime(cp - DELTA, wPrime, pmax, p);
b = morton3pTime(cp + DELTA, wPrime, pmax, p);
jacobian.setEntry(i, 0, (b - a) / (DELTA * 2));

Thanks

On Fri, Dec 28, 2018 at 8:33 PM Gilles  wrote:

> Hello.
>
> On Thu, 27 Dec 2018 07:32:30 -0600 (CST), David Tinker wrote:
> > Hi Guys. I am struggling to use the least squares optimizer to fit a
> > 2
> > variable non-linear function to a curve of observed data points. I am
> > pretty
> > sure I am doing something stupid because I don't know the maths. My
> > MultivariateJacobianFunction moves away from my starting values on
> > the first
> > iteration but then converges back to the starting values. My
> > variables are
> > CP and W' and this is what happens:
> >
> > cp 250.0 W' 24000.0 (starting values)
> > cp 197.17292724155843 W' 5627.212534968825
> > cp 233.7927945744999 W' 18662.916420529345
> > cp 245.72618039512386 W' 22592.92114117481
> > cp 248.91747806252718 W' 23643.613738664597
> > cp 249.9974080222 W' 23999.146684
> > ...
> > cp 249.9993520052 W' 23999.7866709
> > optimum {250; 24,000}
> >
> > Any ideas?
>
> What happens when different starting points?
>
> Gilles
>
> > Here is the code:
> >
> > public class LeastSquaresExample {
> >
> > private static final double DELTA = 0.01; // for calculating
> > derivatives
> >
> > public static void main(String[] args) {
> > Vector2D[] observedPoints = new Vector2D[3];
> > observedPoints[0] = new Vector2D(388, 250); // maps power in
> > watts
> > to time in seconds
> > observedPoints[1] = new Vector2D(368, 450);
> > observedPoints[2] = new Vector2D(321, 780);
> >
> > int pmax = 961;
> >
> > MultivariateJacobianFunction fn = point -> {
> > double cp = point.getEntry(0);
> > double wPrime = point.getEntry(1);
> > System.out.println("cp " + cp + " W' " + wPrime);
> >
> > RealVector value = new
> > ArrayRealVector(observedPoints.length);
> > RealMatrix jacobian = new
> > Array2DRowRealMatrix(observedPoints.length, 2);
> > for (int i = 0; i < observedPoints.length; i++) {
> > double p = observedPoints[i].getX();
> > value.setEntry(i, morton3pTime(cp, wPrime, pmax, p));
> >
> > // each row in the jacobian is a measurement and cols
> > are
> > partial derivatives wrt cp(0) and wPrime(1)
> > double a, b;
> > a = morton3pTime(cp - DELTA, wPrime, pmax, p);
> > b = morton3pTime(cp + DELTA, wPrime, pmax, p);
> > jacobian.setEntry(i, 0, (a - b) / (DELTA * 2));
> >
> > a = morton3pTime(cp, wPrime - DELTA, pmax, p);
> > b = morton3pTime(cp, wPrime + DELTA, pmax, p);
> > jacobian.setEntry(i, 1, (a - b) / (DELTA * 2));
> > }
> > return new Pair<>(value, jacobian);
> > };
> >
> > double[] target = new double[observedPoints.length];
> > for (int i = 0; i < observedPoints.length; i++) target[i] =
> > observedPoints[i].getY();
> >
> > LeastSquaresProblem problem = new LeastSquaresBuilder()
> > .start(new double[]{250.0, 24000.0})
> > .model(fn)
> > .target(target)
> > .maxEvaluations(1000)
> > .maxIterations(1000)
> > .build();
> > LeastSquaresOptimizer.Optimum optimum = new
> > LevenbergMarquardtOptimizer().optimize(problem);
> > RealVector pt = optimum.getPoint();
> > System.out.println("optimum " + pt);
> > }
> >
> > private static double morton3pTime(double cp, double wPrime,
> > double
> > pmax, double p) {
> > return wPrime / (p - cp) + wPrime / (cp - pmax);
> > }
> > }
> >
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] Struggling with least squares

2018-12-28 Thread David Tinker
The same. Example:

cp 300.0 W' 12000.0
cp 333.74051281161115 W' -12839.244450996564
cp 298.7156407940922 W' 7487.731100602964
cp 298.9550329672171 W' 11242.142876024549
cp 299.7463658640514 W' 11824.469512284873
cp 299.9341647360811 W' 11954.82219199176
...
cp 299.9974568135 W' 11999.999825967237
cp 299.9993642035 W' 11999.56491805
optimum {300; 12,000}


On Fri, Dec 28, 2018 at 8:33 PM Gilles  wrote:

> Hello.
>
> On Thu, 27 Dec 2018 07:32:30 -0600 (CST), David Tinker wrote:
> > Hi Guys. I am struggling to use the least squares optimizer to fit a
> > 2
> > variable non-linear function to a curve of observed data points. I am
> > pretty
> > sure I am doing something stupid because I don't know the maths. My
> > MultivariateJacobianFunction moves away from my starting values on
> > the first
> > iteration but then converges back to the starting values. My
> > variables are
> > CP and W' and this is what happens:
> >
> > cp 250.0 W' 24000.0 (starting values)
> > cp 197.17292724155843 W' 5627.212534968825
> > cp 233.7927945744999 W' 18662.916420529345
> > cp 245.72618039512386 W' 22592.92114117481
> > cp 248.91747806252718 W' 23643.613738664597
> > cp 249.9974080222 W' 23999.146684
> > ...
> > cp 249.9993520052 W' 23999.7866709
> > optimum {250; 24,000}
> >
> > Any ideas?
>
> What happens when different starting points?
>
> Gilles
>
> > Here is the code:
> >
> > public class LeastSquaresExample {
> >
> > private static final double DELTA = 0.01; // for calculating
> > derivatives
> >
> > public static void main(String[] args) {
> > Vector2D[] observedPoints = new Vector2D[3];
> > observedPoints[0] = new Vector2D(388, 250); // maps power in
> > watts
> > to time in seconds
> > observedPoints[1] = new Vector2D(368, 450);
> > observedPoints[2] = new Vector2D(321, 780);
> >
> > int pmax = 961;
> >
> > MultivariateJacobianFunction fn = point -> {
> > double cp = point.getEntry(0);
> > double wPrime = point.getEntry(1);
> > System.out.println("cp " + cp + " W' " + wPrime);
> >
> > RealVector value = new
> > ArrayRealVector(observedPoints.length);
> > RealMatrix jacobian = new
> > Array2DRowRealMatrix(observedPoints.length, 2);
> > for (int i = 0; i < observedPoints.length; i++) {
> > double p = observedPoints[i].getX();
> > value.setEntry(i, morton3pTime(cp, wPrime, pmax, p));
> >
> > // each row in the jacobian is a measurement and cols
> > are
> > partial derivatives wrt cp(0) and wPrime(1)
> > double a, b;
> > a = morton3pTime(cp - DELTA, wPrime, pmax, p);
> > b = morton3pTime(cp + DELTA, wPrime, pmax, p);
> > jacobian.setEntry(i, 0, (a - b) / (DELTA * 2));
> >
> > a = morton3pTime(cp, wPrime - DELTA, pmax, p);
> > b = morton3pTime(cp, wPrime + DELTA, pmax, p);
> > jacobian.setEntry(i, 1, (a - b) / (DELTA * 2));
> > }
> > return new Pair<>(value, jacobian);
> > };
> >
> > double[] target = new double[observedPoints.length];
> > for (int i = 0; i < observedPoints.length; i++) target[i] =
> > observedPoints[i].getY();
> >
> > LeastSquaresProblem problem = new LeastSquaresBuilder()
> > .start(new double[]{250.0, 24000.0})
> > .model(fn)
> > .target(target)
> > .maxEvaluations(1000)
> > .maxIterations(1000)
> > .build();
> > LeastSquaresOptimizer.Optimum optimum = new
> > LevenbergMarquardtOptimizer().optimize(problem);
> > RealVector pt = optimum.getPoint();
> > System.out.println("optimum " + pt);
> > }
> >
> > private static double morton3pTime(double cp, double wPrime,
> > double
> > pmax, double p) {
> > return wPrime / (p - cp) + wPrime / (cp - pmax);
> > }
> > }
> >
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math] Struggling with least squares

2018-12-28 Thread Gilles

Hello.

On Thu, 27 Dec 2018 07:32:30 -0600 (CST), David Tinker wrote:
Hi Guys. I am struggling to use the least squares optimizer to fit a 
2
variable non-linear function to a curve of observed data points. I am 
pretty

sure I am doing something stupid because I don't know the maths. My
MultivariateJacobianFunction moves away from my starting values on 
the first
iteration but then converges back to the starting values. My 
variables are

CP and W' and this is what happens:

cp 250.0 W' 24000.0 (starting values)
cp 197.17292724155843 W' 5627.212534968825
cp 233.7927945744999 W' 18662.916420529345
cp 245.72618039512386 W' 22592.92114117481
cp 248.91747806252718 W' 23643.613738664597
cp 249.9974080222 W' 23999.146684
...
cp 249.9993520052 W' 23999.7866709
optimum {250; 24,000}

Any ideas?


What happens when different starting points?

Gilles


Here is the code:

public class LeastSquaresExample {

private static final double DELTA = 0.01; // for calculating
derivatives

public static void main(String[] args) {
Vector2D[] observedPoints = new Vector2D[3];
observedPoints[0] = new Vector2D(388, 250); // maps power in 
watts

to time in seconds
observedPoints[1] = new Vector2D(368, 450);
observedPoints[2] = new Vector2D(321, 780);

int pmax = 961;

MultivariateJacobianFunction fn = point -> {
double cp = point.getEntry(0);
double wPrime = point.getEntry(1);
System.out.println("cp " + cp + " W' " + wPrime);

RealVector value = new 
ArrayRealVector(observedPoints.length);

RealMatrix jacobian = new
Array2DRowRealMatrix(observedPoints.length, 2);
for (int i = 0; i < observedPoints.length; i++) {
double p = observedPoints[i].getX();
value.setEntry(i, morton3pTime(cp, wPrime, pmax, p));

// each row in the jacobian is a measurement and cols 
are

partial derivatives wrt cp(0) and wPrime(1)
double a, b;
a = morton3pTime(cp - DELTA, wPrime, pmax, p);
b = morton3pTime(cp + DELTA, wPrime, pmax, p);
jacobian.setEntry(i, 0, (a - b) / (DELTA * 2));

a = morton3pTime(cp, wPrime - DELTA, pmax, p);
b = morton3pTime(cp, wPrime + DELTA, pmax, p);
jacobian.setEntry(i, 1, (a - b) / (DELTA * 2));
}
return new Pair<>(value, jacobian);
};

double[] target = new double[observedPoints.length];
for (int i = 0; i < observedPoints.length; i++) target[i] =
observedPoints[i].getY();

LeastSquaresProblem problem = new LeastSquaresBuilder()
.start(new double[]{250.0, 24000.0})
.model(fn)
.target(target)
.maxEvaluations(1000)
.maxIterations(1000)
.build();
LeastSquaresOptimizer.Optimum optimum = new
LevenbergMarquardtOptimizer().optimize(problem);
RealVector pt = optimum.getPoint();
System.out.println("optimum " + pt);
}

private static double morton3pTime(double cp, double wPrime, 
double

pmax, double p) {
return wPrime / (p - cp) + wPrime / (cp - pmax);
}
}




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math | Statistics] looking for an equivalent of both the R class "lm" and intrcept

2018-11-07 Thread Jonathan MERCIER

Thanks  Eric and Gilles for your help

Best regards

--

Jonathan MERCIER
Centre National de Recherche en Génomique Humaine (CNRGH)

Researcher computational biology

PhD, Jonathan MERCIER

Bioinformatics (LBI)

2, rue Gaston Crémieux

91057 Evry Cedex

Tel :(33) 1 60 87 83 44

Email :jonathan.merc...@cng.fr 



Re: [Math | Statistics] looking for an equivalent of both the R class "lm" and intrcept

2018-10-30 Thread Eric Barnhill
On Tue, Oct 30, 2018 at 4:22 AM Jonathan MERCIER  wrote:

> *R examples:*
>
> Y ~ A  |  Y = βo + β1A | Straight-line with an implicit
> y-intercept
> Y ~ -1 + A |  Y = β1A  | Straight-line with no y-intercept;
> that is, a fit forced through (0,0)
>

SimpleRegression should take care of these first cases.
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/stat/regression/SimpleRegression.html

Construct the SimpleRegression() object, then pass data using the
addObservations() method. You can either call regress() and inspect the
RegressionResults object returned, or after calling results, use the
SimpleRegression methods getSlope() and getIntercept() . The results
returned by RegressionResults are more exhaustive. The boolean
includeIntercept should toggle whether the model fits an intercept.


Y ~ A + I(A^2) | Y = βo+ β1A + β2A2| Polynomial model; note that the
> identity function I( ) allows terms in the model to include normal
> mathematical symbols.
>

I don't think we have such a compact syntax for this. I think you'll have
to do it the old-fashioned way and create the appropriate model matrix,
then solve using the OLS regression package
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.html
which uses a QR factorization.

Add data with the newSampleData() method, then get your regression
coefficients by calling calculateBeta() .



>
> Thanks for your help
> --
> [image: Jonathan MERCIER]
> [image: Centre National de Recherche en Génomique Humaine (CNRGH)]
>
> Researcher computational biology
>
> PhD, Jonathan MERCIER
>
> Bioinformatics (LBI)
>
> 2, rue Gaston Crémieux
>
> 91057 Evry Cedex
>
> Tel :(33) 1 60 87 83 44
>
> Email :jonathan.merc...@cng.fr
>


Re: [Math | Statistics] looking for an equivalent of both the R class "lm" and intrcept

2018-10-30 Thread Gilles

Hello.

On Tue, 30 Oct 2018 12:22:46 +0100, Jonathan MERCIER wrote:

Dear,

Firstly thanks for your amazing libraries.

Currently I am working to port some R code to Java, and I encounter
some difficulties.


What is the equivalent of:

- the R class "lm" ?

*description*:

https://www.rdocumentation.org/packages/stats/versions/3.5.1/topics/lm

- of intercept: Z ~ y-1 or z ~ 1

*R examples:*
Y ~ A          |  Y = βo + β1A     | Straight-line with an implicit
y-intercept
Y ~ -1 + A    | Y = β1A| Straight-line with no y-intercept; that is,
a fit forced through (0,0)
Y ~ A + I(A^2)| Y = βo+ β1A + β2A2| Polynomial model; note that the
identity function I( ) allows terms in the model to include normal
mathematical symbols.


I can guess that some of the equivalent functionality is provided
by the "o.a.c.math4.stat.regression" package:
  
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/stat/regression/package-summary.html



Regards,
Gilles



Thanks for your help
--

Jonathan MERCIER
Centre National de Recherche en Génomique Humaine (CNRGH)

Researcher computational biology

PhD, Jonathan MERCIER

Bioinformatics (LBI)

2, rue Gaston Crémieux

91057 Evry Cedex

Tel :(33) 1 60 87 83 44

Email :jonathan.merc...@cng.fr 



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] How to use LevenbergMarquardtOptimizer for finding the optimal dampening factor for exponential smoothing

2018-05-17 Thread Gilles

Hello.

On Thu, 17 May 2018 09:14:13 +0530, Manish Java wrote:

Dear Josef

My sincere thanks for your reply and your insights into using the
Levenberg-Marquardt algorithm. I already have a method in place for 
finding
the optimal "alpha" using a linear optimization algorithm. I was 
therefore
looking add a non-linear optimization strategy for users who would 
want to

use it.


For univariate optimization, there is
  
http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/optim/univariate/BrentOptimizer.html


I will use the linear optimization algorithm I have for the time 
being and

see if I can incorporate some other type of non-linear optimization
algorithm, such as some form of gradient descent.


If it is a least-squares problem, it should be possible to
use either "LevenbergMarquardtOptimizer" or "GaussNewtonOptimizer":
  
http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/fitting/leastsquares/package-frame.html


The unit tests in the code repository should put you on track.

There is also the userguide:
  
http://commons.apache.org/proper/commons-math/userguide/leastsquares.html


[While working your way to implementing the code for getting the 
solution,

you could even contribute another example to that page.]

If you can't make it work, don't hesitate to ask more.

HTH,
Gilles

Once again, many thanks for your kind reply and insights into the 
approach

I shared.


Kind regards
~ Manish

On Wed, May 16, 2018 at 9:54 PM,  wrote:


Dear Manish,

There are a few issues with your approach:

first: as far as I understand, the LevenbergMarquardtOptimizer is 
designed
to optimize more than one parameter. In the present case alpha is 
the sole
parameter to be optimized. There is no Jacobian for the 
one-dimensional

case.

In the web-side that you mentioned, they recommend to use a proper
starting value for the smoothed sequence as additional unknown 
parameter.
In your case it would be something around 9. With a second parameter 
to be

optimized, you could formally use the LevenbergMarquardtOptimizer.

second: you alpha-value should be restrained to stay in the range of
0You can achieve this by using a fit parameter x, and in the routine 
that
calculates the predicted sequence  you have to first convert x to 
alpha

using for example the formula alpha= exp(x)/(1+exp(x)).

third: your calculation for the weights does not reflect the
weight-formula they recommend on the web-side.

fourth: The jacobian is the derivative of predicted sequence values
against the parameters,i.e against alpha and the startvalue 
mentioned
above. However, in your case the 'weights', which correspond to the 
inverse
of the variance or standard deviation of the observations (aka 
measurement
error) also depend on alpha, and hence you do not have a 
straightforward

least squares problem, were the weights (or measurement errors or
observational errors) are assumed to be constant.

For your case, I would use a standard optimizer like 'Powell' or 
'BobyQA'
and in the 'value'-function I would calculate the 'Residual sum of 
squares'

based on observations, sequence- and weight formulas.

Good luck,  Josef


Zitat von Manish Java :

I am trying to write a Java program for generating a forecast using

exponential smoothing as described here:
https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm. 
As
described at the linked document, exponential smoothing uses a 
dampening
factor "alpha". The document further goes on to say that an optimal 
value
for "alpha" can be found using the "Marquardt procedure", which I 
take as
referring to the Levenberg-Marquardt algorithm. From the linked 
document,
it seems that the problem of finding the optimal "alpha" is treated 
as a
least-squares problem and fed into the optimizer, with an initial 
guess

for
"alpha".

After extensive web search I could not find any ready example of 
using the
Levenberg-Marquardt algorithm to find "alpha" for this kind of a 
problem,
with any programming language. So, I dug into the Javadocs and test 
cases
for the class *LevenbergMarquardtOptimizer* to see if I could come 
up with
a solution of my own. My program is given an array of values, say 
*[9, 8,
9, 12, 10, 12, 11, 7, 13, 9, 11, 10]*, and an initial guess for 
"alpha",
say *0.2*. I have been able to determine that this information 
needs to be

converted into a *LeastSquaresProblem*, for which I have done the
following
so far:


   1. Set the input array as the *target*;
   2. Set the starting point *start *as the initial value of alpha 
(*{ 0.2

   }*);
   3. Set *weight* to *[1, 1 - alpha, (1 - alpha)^2, ...]*; and
   4. Set the optimization function of the model to return smooth 
values

   for each of the input values.

I am now unsure how the Jacobian should be calculated. I would like 
to

know
if I have approached the problem correctly so far, and how to 
calculate

the
Jacobian. I have not been able to find any ma

Re: [math] How to use LevenbergMarquardtOptimizer for finding the optimal dampening factor for exponential smoothing

2018-05-16 Thread Manish Java
Dear Josef

My sincere thanks for your reply and your insights into using the
Levenberg-Marquardt algorithm. I already have a method in place for finding
the optimal "alpha" using a linear optimization algorithm. I was therefore
looking add a non-linear optimization strategy for users who would want to
use it.

I will use the linear optimization algorithm I have for the time being and
see if I can incorporate some other type of non-linear optimization
algorithm, such as some form of gradient descent.

Once again, many thanks for your kind reply and insights into the approach
I shared.


Kind regards
~ Manish

On Wed, May 16, 2018 at 9:54 PM,  wrote:

> Dear Manish,
>
> There are a few issues with your approach:
>
> first: as far as I understand, the LevenbergMarquardtOptimizer is designed
> to optimize more than one parameter. In the present case alpha is the sole
> parameter to be optimized. There is no Jacobian for the one-dimensional
> case.
>
> In the web-side that you mentioned, they recommend to use a proper
> starting value for the smoothed sequence as additional unknown parameter.
> In your case it would be something around 9. With a second parameter to be
> optimized, you could formally use the LevenbergMarquardtOptimizer.
>
> second: you alpha-value should be restrained to stay in the range of
> 0 You can achieve this by using a fit parameter x, and in the routine that
> calculates the predicted sequence  you have to first convert x to alpha
> using for example the formula alpha= exp(x)/(1+exp(x)).
>
> third: your calculation for the weights does not reflect the
> weight-formula they recommend on the web-side.
>
> fourth: The jacobian is the derivative of predicted sequence values
> against the parameters,i.e against alpha and the startvalue mentioned
> above. However, in your case the 'weights', which correspond to the inverse
> of the variance or standard deviation of the observations (aka measurement
> error) also depend on alpha, and hence you do not have a straightforward
> least squares problem, were the weights (or measurement errors or
> observational errors) are assumed to be constant.
>
> For your case, I would use a standard optimizer like 'Powell' or 'BobyQA'
> and in the 'value'-function I would calculate the 'Residual sum of squares'
> based on observations, sequence- and weight formulas.
>
> Good luck,  Josef
>
>
> Zitat von Manish Java :
>
> I am trying to write a Java program for generating a forecast using
>> exponential smoothing as described here:
>> https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm. As
>> described at the linked document, exponential smoothing uses a dampening
>> factor "alpha". The document further goes on to say that an optimal value
>> for "alpha" can be found using the "Marquardt procedure", which I take as
>> referring to the Levenberg-Marquardt algorithm. From the linked document,
>> it seems that the problem of finding the optimal "alpha" is treated as a
>> least-squares problem and fed into the optimizer, with an initial guess
>> for
>> "alpha".
>>
>> After extensive web search I could not find any ready example of using the
>> Levenberg-Marquardt algorithm to find "alpha" for this kind of a problem,
>> with any programming language. So, I dug into the Javadocs and test cases
>> for the class *LevenbergMarquardtOptimizer* to see if I could come up with
>> a solution of my own. My program is given an array of values, say *[9, 8,
>> 9, 12, 10, 12, 11, 7, 13, 9, 11, 10]*, and an initial guess for "alpha",
>> say *0.2*. I have been able to determine that this information needs to be
>> converted into a *LeastSquaresProblem*, for which I have done the
>> following
>> so far:
>>
>>
>>1. Set the input array as the *target*;
>>2. Set the starting point *start *as the initial value of alpha (*{ 0.2
>>}*);
>>3. Set *weight* to *[1, 1 - alpha, (1 - alpha)^2, ...]*; and
>>4. Set the optimization function of the model to return smooth values
>>for each of the input values.
>>
>> I am now unsure how the Jacobian should be calculated. I would like to
>> know
>> if I have approached the problem correctly so far, and how to calculate
>> the
>> Jacobian. I have not been able to find any material on the web or printed
>> form that describes the procedure for finding the Jacobian for a problem
>> like this.
>>
>> Any help or pointers will be greatly appreciated.
>>
>>
>
>
>


Re: [math] How to use LevenbergMarquardtOptimizer for finding the optimal dampening factor for exponential smoothing

2018-05-16 Thread josef . vogt
Sorry, i got confused with the term 'weight', which in the present  
case is not related to measurement errors. Please ignore my fourth  
point. Nevertheless I would use one of standard optimizers.


Regards, Josef


Zitat von josef.v...@uni-ulm.de:


Dear Manish,

There are a few issues with your approach:

first: as far as I understand, the LevenbergMarquardtOptimizer is
designed to optimize more than one parameter. In the present case alpha
is the sole parameter to be optimized. There is no Jacobian for the
one-dimensional case.

In the web-side that you mentioned, they recommend to use a proper
starting value for the smoothed sequence as additional unknown
parameter. In your case it would be something around 9. With a second
parameter to be optimized, you could formally use the
LevenbergMarquardtOptimizer.

second: you alpha-value should be restrained to stay in the range of
0:


I am trying to write a Java program for generating a forecast using
exponential smoothing as described here:
https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm. As
described at the linked document, exponential smoothing uses a dampening
factor "alpha". The document further goes on to say that an optimal value
for "alpha" can be found using the "Marquardt procedure", which I take as
referring to the Levenberg-Marquardt algorithm. From the linked document,
it seems that the problem of finding the optimal "alpha" is treated as a
least-squares problem and fed into the optimizer, with an initial guess for
"alpha".

After extensive web search I could not find any ready example of using the
Levenberg-Marquardt algorithm to find "alpha" for this kind of a problem,
with any programming language. So, I dug into the Javadocs and test cases
for the class *LevenbergMarquardtOptimizer* to see if I could come up with
a solution of my own. My program is given an array of values, say *[9, 8,
9, 12, 10, 12, 11, 7, 13, 9, 11, 10]*, and an initial guess for "alpha",
say *0.2*. I have been able to determine that this information needs to be
converted into a *LeastSquaresProblem*, for which I have done the following
so far:


  1. Set the input array as the *target*;
  2. Set the starting point *start *as the initial value of alpha (*{ 0.2
  }*);
  3. Set *weight* to *[1, 1 - alpha, (1 - alpha)^2, ...]*; and
  4. Set the optimization function of the model to return smooth values
  for each of the input values.

I am now unsure how the Jacobian should be calculated. I would like to know
if I have approached the problem correctly so far, and how to calculate the
Jacobian. I have not been able to find any material on the web or printed
form that describes the procedure for finding the Jacobian for a problem
like this.

Any help or pointers will be greatly appreciated.






-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] How to use LevenbergMarquardtOptimizer for finding the optimal dampening factor for exponential smoothing

2018-05-16 Thread josef . vogt

Dear Manish,

There are a few issues with your approach:

first: as far as I understand, the LevenbergMarquardtOptimizer is  
designed to optimize more than one parameter. In the present case  
alpha is the sole parameter to be optimized. There is no Jacobian for  
the one-dimensional case.


In the web-side that you mentioned, they recommend to use a proper  
starting value for the smoothed sequence as additional unknown  
parameter. In your case it would be something around 9. With a second  
parameter to be optimized, you could formally use the  
LevenbergMarquardtOptimizer.


second: you alpha-value should be restrained to stay in the range of  
0You can achieve this by using a fit parameter x, and in the routine  
that calculates the predicted sequence  you have to first convert x to  
alpha using for example the formula alpha= exp(x)/(1+exp(x)).


third: your calculation for the weights does not reflect the  
weight-formula they recommend on the web-side.


fourth: The jacobian is the derivative of predicted sequence values  
against the parameters,i.e against alpha and the startvalue mentioned  
above. However, in your case the 'weights', which correspond to the  
inverse of the variance or standard deviation of the observations (aka  
measurement error) also depend on alpha, and hence you do not have a  
straightforward least squares problem, were the weights (or  
measurement errors or observational errors) are assumed to be constant.


For your case, I would use a standard optimizer like 'Powell' or  
'BobyQA' and in the 'value'-function I would calculate the 'Residual  
sum of squares' based on observations, sequence- and weight formulas.


Good luck,  Josef


Zitat von Manish Java :


I am trying to write a Java program for generating a forecast using
exponential smoothing as described here:
https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm. As
described at the linked document, exponential smoothing uses a dampening
factor "alpha". The document further goes on to say that an optimal value
for "alpha" can be found using the "Marquardt procedure", which I take as
referring to the Levenberg-Marquardt algorithm. From the linked document,
it seems that the problem of finding the optimal "alpha" is treated as a
least-squares problem and fed into the optimizer, with an initial guess for
"alpha".

After extensive web search I could not find any ready example of using the
Levenberg-Marquardt algorithm to find "alpha" for this kind of a problem,
with any programming language. So, I dug into the Javadocs and test cases
for the class *LevenbergMarquardtOptimizer* to see if I could come up with
a solution of my own. My program is given an array of values, say *[9, 8,
9, 12, 10, 12, 11, 7, 13, 9, 11, 10]*, and an initial guess for "alpha",
say *0.2*. I have been able to determine that this information needs to be
converted into a *LeastSquaresProblem*, for which I have done the following
so far:


   1. Set the input array as the *target*;
   2. Set the starting point *start *as the initial value of alpha (*{ 0.2
   }*);
   3. Set *weight* to *[1, 1 - alpha, (1 - alpha)^2, ...]*; and
   4. Set the optimization function of the model to return smooth values
   for each of the input values.

I am now unsure how the Jacobian should be calculated. I would like to know
if I have approached the problem correctly so far, and how to calculate the
Jacobian. I have not been able to find any material on the web or printed
form that describes the procedure for finding the Jacobian for a problem
like this.

Any help or pointers will be greatly appreciated.






-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] Calculate R-Square for PolynomialCurveFitter

2018-03-18 Thread Debraj Manna
Thanks Giles for the pointers.

On Sun, Mar 18, 2018 at 10:29 PM, Gilles 
wrote:

> On Sun, 18 Mar 2018 20:52:27 +0530, Debraj Manna wrote:
>
>> Cross-posting from stackoverflow
>>
>> > square-for-polynomialcurvefitter-in-apache-commons-math3>
>> .
>>
>> OLSMultipleLinearRegression, SimpleRegression provide a method that
>> returns calculateRSquared(),
>> getRSquare(). But I am not able to find any such method for
>> PolynomialCurveFitter ?
>>
>> Right now I am doing it myself like below :-
>>
>> Is there any such method in common-math which does this?
>>
>
> "PolynomialCurveFitter" is one of the syntactic sugar/wrapper
> around the least-squares optimizers.
> No state is maintained in the (immutable) instance.
>
> private PolynomialFunction getPolynomialFitter(List>
>> pointlist) {
>> final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2);
>> final WeightedObservedPoints obs = new WeightedObservedPoints();
>> for (List point : pointlist) {
>> obs.add(point.get(0), point.get(1));
>> }
>>
>> double[] fit = fitter.fit(obs.toList());
>> System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1],
>> fit[2]);
>> final PolynomialFunction fitted = new PolynomialFunction(fit);
>> return fitted;
>> }
>>
>
> This is indeed one the intended use-cases.
>
> private double getRSquare(PolynomialFunction fitter,
>> List> pointList) {
>> final double[] coefficients = fitter.getCoefficients();
>> double[] predictedValues = new double[pointList.size()];
>> double residualSumOfSquares = 0;
>> final DescriptiveStatistics descriptiveStatistics = new
>> DescriptiveStatistics();
>> for (int i=0; i< pointList.size(); i++) {
>> predictedValues[i] = predict(coefficients,
>> pointList.get(i).get(0));
>> double actualVal = pointList.get(i).get(1);
>> double t = Math.pow((predictedValues[i] - actualVal), 2);
>> residualSumOfSquares  += t;
>> descriptiveStatistics.addValue(actualVal);
>> }
>> final double avgActualValues = descriptiveStatistics.getMean();
>> double totalSumOfSquares = 0;
>> for (int i=0; i> totalSumOfSquares += Math.pow( (predictedValues[i] -
>> avgActualValues),2);
>> }
>> return 1.0 - (residualSumOfSquares/totalSumOfSquares);
>> }
>>
>
> The "predict" method is not shown here, but note that the argument
> which you called "fitter" in the above, is actually a polynomial
> function:
>   http://commons.apache.org/proper/commons-math/apidocs/org/
> apache/commons/math4/analysis/polynomials/PolynomialFunction.html
>
> Hence:
>   predictedValues[i] = fitter.value(pointList.get(i).get(0));
>
> But otherwise, yes, the caller is responsible for choosing his
> assessement of the quality of the model.
>
> You could directly use the least-squares suite of classes; then
> the "Evaluation" object would allow to retrieve various measures
> of the fit:
>   http://commons.apache.org/proper/commons-math/apidocs/org/
> apache/commons/math4/fitting/leastsquares/LeastSquaresProbl
> em.Evaluation.html
>
> However, they might still not be what you are looking for...
>
> HTH,
> Gilles
>
> final PolynomialFunction polynomial = getPolynomialFitter(trainData);
>> System.out.printf("\nPolynimailCurveFitter R-Square %f",
>> getRSquare(polynomial, trainData));
>>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [Math] Calculate R-Square for PolynomialCurveFitter

2018-03-18 Thread Gilles

On Sun, 18 Mar 2018 20:52:27 +0530, Debraj Manna wrote:

Cross-posting from stackoverflow


.

OLSMultipleLinearRegression, SimpleRegression provide a method that
returns calculateRSquared(),
getRSquare(). But I am not able to find any such method for
PolynomialCurveFitter ?

Right now I am doing it myself like below :-

Is there any such method in common-math which does this?


"PolynomialCurveFitter" is one of the syntactic sugar/wrapper
around the least-squares optimizers.
No state is maintained in the (immutable) instance.


private PolynomialFunction getPolynomialFitter(List>
pointlist) {
final PolynomialCurveFitter fitter = 
PolynomialCurveFitter.create(2);

final WeightedObservedPoints obs = new WeightedObservedPoints();
for (List point : pointlist) {
obs.add(point.get(0), point.get(1));
}

double[] fit = fitter.fit(obs.toList());
System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1], 
fit[2]);

final PolynomialFunction fitted = new PolynomialFunction(fit);
return fitted;
}


This is indeed one the intended use-cases.


private double getRSquare(PolynomialFunction fitter,
List> pointList) {
final double[] coefficients = fitter.getCoefficients();
double[] predictedValues = new double[pointList.size()];
double residualSumOfSquares = 0;
final DescriptiveStatistics descriptiveStatistics = new
DescriptiveStatistics();
for (int i=0; i< pointList.size(); i++) {
predictedValues[i] = predict(coefficients, 
pointList.get(i).get(0));

double actualVal = pointList.get(i).get(1);
double t = Math.pow((predictedValues[i] - actualVal), 2);
residualSumOfSquares  += t;
descriptiveStatistics.addValue(actualVal);
}
final double avgActualValues = descriptiveStatistics.getMean();
double totalSumOfSquares = 0;
for (int i=0; i

The "predict" method is not shown here, but note that the argument
which you called "fitter" in the above, is actually a polynomial
function:
  
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.html


Hence:
  predictedValues[i] = fitter.value(pointList.get(i).get(0));

But otherwise, yes, the caller is responsible for choosing his
assessement of the quality of the model.

You could directly use the least-squares suite of classes; then
the "Evaluation" object would allow to retrieve various measures
of the fit:
  
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.Evaluation.html


However, they might still not be what you are looking for...

HTH,
Gilles


final PolynomialFunction polynomial = getPolynomialFitter(trainData);
System.out.printf("\nPolynimailCurveFitter R-Square %f",
getRSquare(polynomial, trainData));



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] How to do Polynomial Regression ?

2018-03-13 Thread Debraj Manna
Thanks Phil

On Tue, Mar 13, 2018 at 4:03 AM, Phil Steitz  wrote:

> On 3/12/18 10:15 AM, Debraj Manna wrote:
> > Crossposting from stackoverflow
> >  regression-with-apache-maths-3-6-1>
> > as I did not get any reply there
> >
> > Can someone let me know how I can do Polynomial Regression with Apache
> Maths
> > 
> 3.6.1
> > ?
> >
> > Below are the data points I used for my testing
> >
> > 60735214881.391304  152025480.0060697824142.469570
> > 152025840.0060651182200.208694
> > 152026200.0060684367132.939130
> > 152026560.0060676588613.008700
> > 152026920.0060641816564.869570
> > 152027280.0060604714824.233510
> > 152027640.0060580042814.330440
> > 152028000.0060536134542.469570
> > 152028360.0060566323732.034780
> > 152028720.0060578775249.252174
> > 152029080.0060547382844.104350
> > 152029440.0060536776546.802160
> > 152029800.0060474342718.330440
> > 152030160.0060452725477.286960
> > 152030520.0060486821569.669560
> > 152030880.0060247997139.995674
> > 152031240.0060248432181.426090
> > 152031600.0060217476247.373920
> > 152031960.0060170744493.634780  152032320.00
> >
> > My code looks like below
> >
> > private void polynomialFitter(List> pointlist) {
> > final PolynomialCurveFitter fitter =
> PolynomialCurveFitter.create(2);
> > final WeightedObservedPoints obs = new WeightedObservedPoints();
> > for (List point : pointlist) {
> > obs.add(point.get(1), point.get(0));
> > }
> > double[] fit = fitter.fit(obs.toList());
> > System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1],
> fit[2]);
> > }
> >
> > The coefficients are reported as
> >
> > Coefficient 12.910025, 0.00, 0.00
> >
> > But these does not seem to be quite correct. If I use the same dataset
> > in Online
> > Polynimal Regression 
> and
> > in archanoid online regression  - both
> > reports same value as 654623237474.68250993904929103762,
> > 28.75921919628759991574, -0.023885199278
> >
> > Can someone let me know what is going wrong? I have seen this question
> >  regression-with-apache-maths-java>
> >  but that is not helping me?
>
> Polynomial regression is not the same as curve fitting.  To do
> polynomial regression in Commons Math, use the
> OLSMultipleLinearRegression class, using, X, X^2 etc as the
> independent variables (as your second reference above shows).
>
> Phil
>
>
>
>
> >
> > Thanks,
> >
>
>


Re: [Math] How to do Polynomial Regression ?

2018-03-12 Thread Phil Steitz
On 3/12/18 10:15 AM, Debraj Manna wrote:
> Crossposting from stackoverflow
> 
> as I did not get any reply there
>
> Can someone let me know how I can do Polynomial Regression with Apache Maths
>  3.6.1
> ?
>
> Below are the data points I used for my testing
>
> 60735214881.391304  152025480.0060697824142.469570
> 152025840.0060651182200.208694
> 152026200.0060684367132.939130
> 152026560.0060676588613.008700
> 152026920.0060641816564.869570
> 152027280.0060604714824.233510
> 152027640.0060580042814.330440
> 152028000.0060536134542.469570
> 152028360.0060566323732.034780
> 152028720.0060578775249.252174
> 152029080.0060547382844.104350
> 152029440.0060536776546.802160
> 152029800.0060474342718.330440
> 152030160.0060452725477.286960
> 152030520.0060486821569.669560
> 152030880.0060247997139.995674
> 152031240.0060248432181.426090
> 152031600.0060217476247.373920
> 152031960.0060170744493.634780  152032320.00
>
> My code looks like below
>
> private void polynomialFitter(List> pointlist) {
> final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2);
> final WeightedObservedPoints obs = new WeightedObservedPoints();
> for (List point : pointlist) {
> obs.add(point.get(1), point.get(0));
> }
> double[] fit = fitter.fit(obs.toList());
> System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1], fit[2]);
> }
>
> The coefficients are reported as
>
> Coefficient 12.910025, 0.00, 0.00
>
> But these does not seem to be quite correct. If I use the same dataset
> in Online
> Polynimal Regression  and
> in archanoid online regression  - both
> reports same value as 654623237474.68250993904929103762,
> 28.75921919628759991574, -0.023885199278
>
> Can someone let me know what is going wrong? I have seen this question
> 
>  but that is not helping me?

Polynomial regression is not the same as curve fitting.  To do
polynomial regression in Commons Math, use the
OLSMultipleLinearRegression class, using, X, X^2 etc as the
independent variables (as your second reference above shows).

Phil




>
> Thanks,
>


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] nextDouble

2018-03-09 Thread Gilles

On Fri, 9 Mar 2018 16:53:21 -0500, David Cogen wrote:

On 03/09/2018 04:35 PM, Matt Bru wrote:
I have a question about 
org.apache.commons.math3.random.BitsStreamGenerator.




nextDouble() documents:

“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”



Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?


The question is practically moot. If the generator is truly random,
then the chance of getting 0 or 1 are essentially zero even if 
running

at 1MHz for the lifetime of the universe!

Still, it would be nice if that was stated definitively.


I'd say "exclusive" but without any warranty. ;-)
The doc of "Commons RNG" has pointers to the references.
Review and patch welcome!

Regards,
Gilles


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] nextDouble

2018-03-09 Thread Gilles

On Fri, 9 Mar 2018 16:35:57 -0500, Matt Bru wrote:
I have a question about 
org.apache.commons.math3.random.BitsStreamGenerator.


Please note that the package "org.apache.commons.math3.random"
is deprecated (see [1]).

Regards,
Gilles

[1] http://commons.apache.org/rng



nextDouble() documents:

“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”



Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] nextDouble

2018-03-09 Thread David Cogen

On 03/09/2018 04:35 PM, Matt Bru wrote:

I have a question about org.apache.commons.math3.random.BitsStreamGenerator.



nextDouble() documents:

“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”



Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?

The question is practically moot. If the generator is truly random, then the 
chance of getting 0 or 1 are essentially zero even if running at 1MHz for the 
lifetime of the universe!


Still, it would be nice if that was stated definitively.



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] OLSMultipleLinearRegression

2017-12-31 Thread Gilles

On Sun, 31 Dec 2017 17:35:26 -0600, Andy Arledge wrote:

i had the row index 1st initially and got an error message that said:

org.apache.commons.math3.exception.DimensionMismatchException: 17 != 
293


so i tried reversing the row/columns, no luck got the message below.


Did you have a look at the unit tests[1]?
Hopefully, it should show how to set up your code.

Best,
Gilles

[1] 
https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java;hb=HEAD






On 12/31/2017 4:56 PM, Gilles wrote:

On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:

Hi,

I get an

"org.apache.commons.math3.exception.MathIllegalArgumentException: 
not

enough data (17 rows) for this many predictors (293 predictors)"

with the following code : https://pastebin.com/aZ4DXQB3

My class extends OLSMultipleLinearRegression. I have 293 rows of 
data

with 17 columns.

Is there something I'm missing here? I'm basing my work on the 
example @




http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression


Thanks for any guidance.


In Java, the "row" index is the first dimension.
Try
---CUT---
 double[][] data = new double[myList.size()][17];
 // etc.
---CUT---

HTH,
Gilles



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] OLSMultipleLinearRegression

2017-12-31 Thread Andy Arledge

i had the row index 1st initially and got an error message that said:

org.apache.commons.math3.exception.DimensionMismatchException: 17 != 293

so i tried reversing the row/columns, no luck got the message below.



On 12/31/2017 4:56 PM, Gilles wrote:

On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:

Hi,

I get an

"org.apache.commons.math3.exception.MathIllegalArgumentException: not
enough data (17 rows) for this many predictors (293 predictors)"

with the following code : https://pastebin.com/aZ4DXQB3

My class extends OLSMultipleLinearRegression. I have 293 rows of data
with 17 columns.

Is there something I'm missing here? I'm basing my work on the example @


http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression 



Thanks for any guidance.


In Java, the "row" index is the first dimension.
Try
---CUT---
 double[][] data = new double[myList.size()][17];
 // etc.
---CUT---

HTH,
Gilles


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



--
Thanks
Andy

Andy Arledge
Appraiser Genie, LLC
325-455-7890
www.appraisergenie.com


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] OLSMultipleLinearRegression

2017-12-31 Thread Gilles

On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:

Hi,

I get an

"org.apache.commons.math3.exception.MathIllegalArgumentException: not
enough data (17 rows) for this many predictors (293 predictors)"

with the following code : https://pastebin.com/aZ4DXQB3

My class extends OLSMultipleLinearRegression. I have 293 rows of data
with 17 columns.

Is there something I'm missing here? I'm basing my work on the 
example @



http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression

Thanks for any guidance.


In Java, the "row" index is the first dimension.
Try
---CUT---
 double[][] data = new double[myList.size()][17];
 // etc.
---CUT---

HTH,
Gilles


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Levenerg-Marquardt evaluations vs. iterations

2017-10-20 Thread Gilles

Hi.

On Wed, 18 Oct 2017 15:00:20 -0600, Kearns, Aaron wrote:

Hi,

I have been using the LM solver in a least-squares curve fitting 
function.
I have been using some debugging statements every time the function 
(&
Jacobian) is evaluated. I would like some clarification on what the 
number
of evalutations vs. iterations is. My understanding is that the 
number of
evaluations is the number of times the MultivariateJacobianFunction 
used in

the least-squares problem definition is run,


Indeed.


whereas the number of
iterations is the number of times a change in the input variables 
leads to

an improvement in the cost function / residual.


The number of iterations is incremented by one for each pass
through the algorithm's in main loop:
  
http://commons.apache.org/proper/commons-math/apidocs/src-html/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.html#line.337



Is this a correct
interpretation?


Probably (bugs notwithstanding).


Would we be able to get the number of iterations based on
just looking at the change in the cost function per evaluation of the 
MJF
at different points and subtracting the times that a change in 
variables

produced a worse cost?


Calling "getIterations()" would be more straightforward:
  
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.Optimum.html



HTH,
Gilles



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Using optimization package for non linear equations

2017-09-28 Thread Gilles

Hi Vladimir.

On Thu, 28 Sep 2017 09:37:15 -0400, Vladimir Blagojevic wrote:

I've read optimization guide (http://commons.apache.org/pro
per/commons-math/userguide/optimization.html) yet I'm still unsure 
about how

to apply optimization examples in my case.


The unit tests provide working examples of how to use the
library, e.g.:
  
https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java

should help you get started.

HTH,
Gilles


I have a set of nonlinear equations in the form:

e^(qt)S - e^(rt)K1 = b1
e^(qt)S - e^(rt)K2 = b2
...
e^(qt)S - e^(rt)Kn = bn

r and q are unknown variables (parameters?), while S, t, K1...Kn are 
known
scalars. b1...bn is a set of known scalar observations that could 
contain

errors.

Since r,q are two unknown variables I could simply solve the set of 
two
equations b1,b2 and find the desired q and r. However, those two 
particular
observations b1 and b2 could contain the most error in observation 
set data

thus propagating the error to r and q.

How could I use optimization package to find optimal r and q for the 
entire

set of observations that would minimize the sum of the difference?

Regards,
Vladimir



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] PolyhedronsSet query

2017-08-09 Thread Guang Chao
On Thu, Aug 10, 2017 at 3:56 AM, Zach  wrote:

> Hi, I am making a PolyhedronsSet object by list of vertices and faces.
> Once I have created that object, I would like to get that same information
> back out or get a list of vertices. I am trying to use the union command to
> union two PolyhedronsSets and then get the lines or vertices of the unioned
> PolyhedronsSet. I've tried using the visit class to traverse the tree and
> see if the data is stored in the nodes but I can't figure out how to get
> data out of the nodes either.
>
> Thank you,
>
> Zach


Would you kindly share some code you are working on?

-- 
Guang 


Re: [math]

2017-05-17 Thread michael.brzustow...@gmail.com
Perhaps use the DescriptiveStatistics class with an appropriate window size?
http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/index.html
You will have to retrieve the sum after the insertion of each new data
point.

On Wed, May 17, 2017 at 4:22 AM, Gilles 
wrote:

> Hi.
>
> On Wed, 17 May 2017 09:54:23 +, tobias.w...@t-systems.com wrote:
>
>> Hi guys,
>>
>> is there any methods in apache common math library that I can use to
>> implement Exponential Moving Average and other financial statistics
>> functions like MACD,SMA,RSI?
>>
>>
>> https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
>>
>> https://en.wikipedia.org/wiki/MACD
>>
>> https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average
>>
>> https://en.wikipedia.org/wiki/Relative_strength_index
>>
>
> I don't think so; but you should have a look at the contents of the
> "stat" package too see how easy/difficult this extension would be
> within the current design. [Some of it needs change but we lack human
> resources.  Help welcome...]
>
>
> Best regards,
> Gilles
>
>
>> regards,
>> Tobi
>>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [math]

2017-05-17 Thread Gilles

Hi.

On Wed, 17 May 2017 09:54:23 +, tobias.w...@t-systems.com wrote:

Hi guys,

is there any methods in apache common math library that I can use to
implement Exponential Moving Average and other financial statistics
functions like MACD,SMA,RSI?


https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average

https://en.wikipedia.org/wiki/MACD

https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average

https://en.wikipedia.org/wiki/Relative_strength_index


I don't think so; but you should have a look at the contents of the
"stat" package too see how easy/difficult this extension would be
within the current design. [Some of it needs change but we lack human
resources.  Help welcome...]


Best regards,
Gilles



regards,
Tobi



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] Frequency class included in 3.6, but not 3.6.1?

2017-04-27 Thread Gilles

Hello.

On Wed, 26 Apr 2017 16:17:54 -0400, Matthew Mah wrote:

I am trying to use the Apache commons math Frequency class within an
Eclipse project using maven.

According to the documentation, the Frequency class should be present
in the latest release 3.6.1:

http://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/index.html

When I include the latest release using Maven:

org.apache.commons
commons-math3
3.6.1


the import statement
import org.apache.commons.math3.stat.Frequency;
complains that:
The import org.apache.commons.math3.stat.Frequency cannot be resolved


I've just tested a simple application (importing and using the class)
and it produced the expected outcome.

Perhaps this link
  
http://stackoverflow.com/questions/4322893/eclipse-error-the-import-xxx-cannot-be-resolved

can help you.


This problem resolves for me if I use a slightly older version (3.6)

org.apache.commons
commons-math3
3.6


Is the Frequency class intentionally excluded from the 3.6.1 release?


Certainly not; it exists within the JAR.


Or is there a problem with the 3.6.1 release?


Not that we know of (apart from the bug reports listed on the
bug-tracking system).


Regards,
Gilles


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] collinearity test: QR Decomposition rank incorrect (SVD ok)

2017-02-24 Thread Gilles

FTR:
  https://issues.apache.org/jira/browse/MATH-1403

Gilles

On Thu, 23 Feb 2017 10:52:55 +, Hugo Ferreira wrote:

Hello,

I am aware that such a question have been asked before but I cannot
seem to solve this issue for a very simple example. The closest
example I have is:

https://issues.apache.org/jira/browse/MATH-1100

from which I could not get an answer.

I am trying to copy an algorithm from R's Caret package that
identifies collinear columns of a matrix [1]. I am assuming a "long"
matrix and and am using the trivial example from the reference above.
However I cannot get this to work because the QR's rank result is
incorrect.

I have the following example:

import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.RRQRDecomposition;
import org.apache.commons.math3.linear.Array2DRowRealMatrix;
import org.apache.commons.math3.linear.SingularValueDecomposition ;

public class QRIssue {

  public static void main(String[] args) {

double[][] am = new double[5][];
double[] c1 = new double[] {1.0, 1.0, 1.0, 1.0, 1.0, 1.0} ;
double[] c2 = new double[] {1.0, 1.0, 1.0, 0.0, 0.0, 0.0} ;
double[] c3 = new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0} ;
double[] c4 = new double[] {1.0, 0.0, 0.0, 1.0, 0.0, 0.0 } ;
double[] c6 = new double[] {0.0, 0.0, 1.0, 0.0, 0.0, 1.0 } ;

am[0] = c1 ;
am[1] = c2 ;
am[2] = c3 ;
am[3] = c4 ;
am[4] = c6 ;

Double threshold = 1e-1;

Array2DRowRealMatrix m = new Array2DRowRealMatrix( am, false )  ;
// use array, don't copy
RRQRDecomposition qr = new RRQRDecomposition( m,  threshold) ;
RealMatrix r = qr.getR() ;
int numColumns = r.getColumnDimension() ;
int rank = qr.getRank( threshold ) ;
System.out.println("QR rank: " + rank) ;
System.out.println("QR is singular: " +
!qr.getSolver().isNonSingular()) ;
System.out.println("QR is singular: " + (numColumns == rank) ) ;

SingularValueDecomposition sv2 = new
org.apache.commons.math3.linear.SingularValueDecomposition(m);
System.out.println("SVD rank: " + sv2.getRank()) ;
}
}


For SVD I get a rank of 4 which is correct (columns 0,1,2 are
collinear : c0 = c1 + c2). But for QR I get 5. I have tried several
thresholds with no success. For several subsets of the columns above
(example only 0,1,2 I get the correct answer). What am I doing wrong?

TIA,
Hugo F.


1. https://topepo.github.io/caret/pre-processing.html#lindep






-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] Re: LU decomposition very SLOW (commons.math3.linear)

2016-10-29 Thread Gilles

Hi.

This conversation should preferably be continued on the
"dev" ML.
[CC'ing there.]

Best regards,
Gilles

On Sat, 29 Oct 2016 13:43:43 +0200, Eric Barnhill wrote:

Hi Wilbur,

That is strange that such a basic technique appears to be at odds 
with best
practices, especially when said best practice is out of numerical 
recipes,

which has such broad authority.

I think you would be welcome to push the change if you were 
interested to

and your contribution would be welcome.

Thank you also for citing the smile library. That appears to be an
extraordinarily rich Java library. It is a good example of why 
projects
need active, interested, expert maintainers; if code is not 
maintained by
such a person it is generally quickly surpassed by other code 
elsewhere.


Best,
Eric
Well, I tried the same with "Array2DRowRealMatrix" but it made no 
difference

at all.

Meanwhile I cloned the CM snapshot and checked the source code. The 
authors
of the "LUDecomposition" class state that their code "is based on the 
class
with similar name from the JAMA library" but this seems not the case! 
The
Jama implementation is quite different -- actually the same as the 
alternate
(Num. Recipes) implementation I had supplied earlier (and also runs 
at the

expected speed)!

So, whatever the reason was to abandon the JAMA version, the current 
Commons
Math implementation is certainly much inferior in terms of 
performance.

Which is astonishing given the popularity of this method.

Will ask the "dev" mailing list, as suggested ...

Thanks,
Wilhelm





--
View this message in context: http://apache-commons.680414.
n4.nabble.com/math-LU-decomposition-very-SLOW-commons-math3-linear-
tp4692255p4692283.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] Re: LU decomposition very SLOW (commons.math3.linear)

2016-10-29 Thread Eric Barnhill
Hi Wilbur,

That is strange that such a basic technique appears to be at odds with best
practices, especially when said best practice is out of numerical recipes,
which has such broad authority.

I think you would be welcome to push the change if you were interested to
and your contribution would be welcome.

Thank you also for citing the smile library. That appears to be an
extraordinarily rich Java library. It is a good example of why projects
need active, interested, expert maintainers; if code is not maintained by
such a person it is generally quickly surpassed by other code elsewhere.

Best,
Eric
Well, I tried the same with "Array2DRowRealMatrix" but it made no difference
at all.

Meanwhile I cloned the CM snapshot and checked the source code. The authors
of the "LUDecomposition" class state that their code "is based on the class
with similar name from the JAMA library" but this seems not the case! The
Jama implementation is quite different -- actually the same as the alternate
(Num. Recipes) implementation I had supplied earlier (and also runs at the
expected speed)!

So, whatever the reason was to abandon the JAMA version, the current Commons
Math implementation is certainly much inferior in terms of performance.
Which is astonishing given the popularity of this method.

Will ask the "dev" mailing list, as suggested ...

Thanks,
Wilhelm





--
View this message in context: http://apache-commons.680414.
n4.nabble.com/math-LU-decomposition-very-SLOW-commons-math3-linear-
tp4692255p4692283.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


Re: [Math] Re: LU decomposition very SLOW (commons.math3.linear)

2016-10-28 Thread wilbur
Well, I tried the same with "Array2DRowRealMatrix" but it made no difference
at all.

Meanwhile I cloned the CM snapshot and checked the source code. The authors
of the "LUDecomposition" class state that their code "is based on the class
with similar name from the JAMA library" but this seems not the case! The
Jama implementation is quite different -- actually the same as the alternate
(Num. Recipes) implementation I had supplied earlier (and also runs at the
expected speed)!

So, whatever the reason was to abandon the JAMA version, the current Commons
Math implementation is certainly much inferior in terms of performance.
Which is astonishing given the popularity of this method.

Will ask the "dev" mailing list, as suggested ...

Thanks,
Wilhelm





--
View this message in context: 
http://apache-commons.680414.n4.nabble.com/math-LU-decomposition-very-SLOW-commons-math3-linear-tp4692255p4692283.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Math] Re: LU decomposition very SLOW (commons.math3.linear)

2016-10-28 Thread Gilles

Hi.

On Thu, 27 Oct 2016 05:41:08 -0700 (PDT), wilbur wrote:

Hello Gilles,

thanks for your interest! I am attaching a minimal example that 
demonstrates

this behavior.
The matrix -- which I create with MatrixUtils.createRealMatrix() -- 
is dense

(of type BlockRealMatrix).


Could you please try with "Array2DRowRealMatrix" too?

The results listed at the bottom of the main class suggest, that 
execution

times for the standard LUDecomposition get out of proportion for N
somewhere between 750 and 1000.

I am also including the ‘MyLUDecomposition’ implementation provided 
by Smile
as a separate class. It is fast but I can’t say if it is numerically 
as good

as the Commons Math version.


Do you propose it as an alternative implementation to be included
in Commons Math?
[If so, this should be discussed on the "dev" mailing list.]


Hope this is conclusive.


I don't know.
First thing is to ensure the performance/accuracy trade-off, as you
suggested.


I am new to this group, not sure if the attachment
gets delivered.


No, but the link below is fine.


Appreciate any hints.


You seem to be on your way to figure out what is going on.[1] ;-)

Thanks,
Gilles

[1] For the investigation, I suggest to use a CM snapshot:
   
https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-math4/4.0-SNAPSHOT/

or work from the current development repository:
   https://git1-us-west.apache.org/repos/asf?p=commons-math.git



--Wilhelm
lu_decomp_test.zip





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



  1   2   3   4   5   6   7   8   9   >