Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Ted Dunning
Oops. Right. Not paying full attention this morning. Sorry. On Mon, Nov 2, 2009 at 2:11 PM, Jake Mannix wrote: > Er, there already is, right? -- Ted Dunning, CTO DeepDyve

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
Er, there already is, right? RealVector#isNaN() and RealVector#isInfinite() - they're just not used anywhere except for as verification purposes in the unit tests. No actual internal use as of yet. -jake On Mon, Nov 2, 2009 at 1:58 PM, Ted Dunning wrote: > This makes me think that we need t

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Ted Dunning
This makes me think that we need to have containsNan and containsInfinite methods on vectors and matrices so that it is easy to check. On Mon, Nov 2, 2009 at 1:46 PM, Jake Mannix wrote: > ... Yeah, in my own libraries, I tend to say that either don't force checks > ever and at most throw unchec

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
On Mon, Nov 2, 2009 at 1:29 PM, Luc Maisonobe wrote: > Jake Mannix a écrit : > > On Mon, Nov 2, 2009 at 9:05 AM, Jake Mannix > wrote: > > > >>> Also, why the special case for > ArithmeticExcption here, for the zero norm case? Why not just let > java just > try to divide, and if i

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Luc Maisonobe
Jake Mannix a écrit : > On Mon, Nov 2, 2009 at 9:05 AM, Jake Mannix wrote: > >>> Also, why the special case for ArithmeticExcption here, for the zero norm case? Why not just let java just try to divide, and if it divides by zero, well, it'll throw an ArithmeticException itsel

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
On Mon, Nov 2, 2009 at 9:05 AM, Jake Mannix wrote: > > Also, why the special case for >> > ArithmeticExcption here, for the zero norm case? Why not just let >> > java just >> > try to divide, and if it divides by zero, well, it'll throw an >> > ArithmeticException itself... seems like the whole

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
On Mon, Nov 2, 2009 at 12:43 PM, Luc Maisonobe wrote: > > There are several cases. If you do: > > RealVector v = new ArrayRealVector(...); > > and later use v, a static analysis would be sufficient to know v is > really an ArrayRealVector instance. > Ok, I was familiar with this, yes, and in thi

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Luc Maisonobe
Jake Mannix a écrit : > On Mon, Nov 2, 2009 at 7:41 AM, wrote: > >> This is the reason why the boolean is there. >> > > Yeah, I know, my point is that in the current method implementation, > the boolean is not used properly - it's currently: return new > ArrayRealVector(v) > which forces a copy.

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
On Mon, Nov 2, 2009 at 7:41 AM, wrote: > > This is the reason why the boolean is there. > Yeah, I know, my point is that in the current method implementation, the boolean is not used properly - it's currently: return new ArrayRealVector(v) which forces a copy. return new ArrayRealVector(v, fals

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread luc . maisonobe
- "Jake Mannix" a écrit : > Hey all, > > In digging through ArrayRealVector and OpenMapRealVector, while > trying to > draw up patches for MATH-312 and MATH-314, I found a number of > performance ( > and other) issues: > > 1) in add(double[]), subtract(double[]), and mapXXX methods, the

Re: [math] Performance optimization in the vector classes

2009-11-02 Thread Jake Mannix
Hey all, In digging through ArrayRealVector and OpenMapRealVector, while trying to draw up patches for MATH-312 and MATH-314, I found a number of performance ( and other) issues: 1) in add(double[]), subtract(double[]), and mapXXX methods, the idiom is: double[] v = new double[data.length];