You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by luc <lu...@spaceroots.org> on 2012/08/14 17:25:20 UTC

[math] problems with tests due to matrix formatting

Hi,

Since a few weeks, I have lots of tests failures due to matrix formats.

I'm not sure exactly when this started, but I think this may be related 
to MATH-831 and the fix introduced as of r1364775 in late July. This 
changed the behaviour of toString in AbstractRealMatrix. The difference 
is that despite the default number of digits is set to one, matrix 
entries that happen to be integer are displayed as "1" or "0" and not as 
"1.0" or "0.0" as expected by the Junit tests.

The tests that fail for me are:

MultivariateSummaryStatisticsTest: testToString,
SparseRealMatrixTest: testToString
SynchronizedMultivariateSummaryStatisticsTest: testToString
Array2DRowRealMatrixTest: testToString
BlockRealMatrixTest: testToString

They fail both when I use eclipse and when I use maven from the command 
line.  Eclipse is configured to use Sun Java 1.5.0_22 JVM. Maven is 
configured with OpenJDK 1.6.0_24. I use a Linux computer running Debian, 
configured with the French locale (but the tests do reset the locale 
themselves).

Here is the output from Maven:

Results :

Failed tests:   
testForgottenSeparator(org.apache.commons.math3.linear.RealMatrixFormatTest): 
expected:<7> but was:<5>
   
testForgottenSuffix(org.apache.commons.math3.linear.RealMatrixFormatTest): 
expected:<9> but was:<5>
   testToString(org.apache.commons.math3.linear.BlockRealMatrixTest): 
expected:<BlockRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}> 
but was:<BlockRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
   
testToString(org.apache.commons.math3.linear.Array2DRowRealMatrixTest): 
expected:<...ay2DRowRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}> 
but 
was:<...ay2DRowRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
   testToString(org.apache.commons.math3.linear.SparseRealMatrixTest): 
expected:<OpenMapRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}> 
but 
was:<OpenMapRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
   
testToString(org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatisticsTest): 
expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
   
testToString(org.apache.commons.math3.stat.descriptive.SynchronizedMultivariateSummaryStatisticsTest): 
expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)

Tests run: 4067, Failures: 7, Errors: 0, Skipped: 40

[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] There are test failures.


Do someone else experience the same problems?

Luc

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] problems with tests due to matrix formatting

Posted by Luc Maisonobe <Lu...@free.fr>.
Le 14/08/2012 21:09, Thomas Neidhart a écrit :
> On 08/14/2012 05:25 PM, luc wrote:
>> Hi,
>>
>> Since a few weeks, I have lots of tests failures due to matrix formats.
>>
>> I'm not sure exactly when this started, but I think this may be related
>> to MATH-831 and the fix introduced as of r1364775 in late July. This
>> changed the behaviour of toString in AbstractRealMatrix. The difference
>> is that despite the default number of digits is set to one, matrix
>> entries that happen to be integer are displayed as "1" or "0" and not as
>> "1.0" or "0.0" as expected by the Junit tests.
>>
>> The tests that fail for me are:
>>
>> MultivariateSummaryStatisticsTest: testToString,
>> SparseRealMatrixTest: testToString
>> SynchronizedMultivariateSummaryStatisticsTest: testToString
>> Array2DRowRealMatrixTest: testToString
>> BlockRealMatrixTest: testToString
>>
>> They fail both when I use eclipse and when I use maven from the command
>> line.  Eclipse is configured to use Sun Java 1.5.0_22 JVM. Maven is
>> configured with OpenJDK 1.6.0_24. I use a Linux computer running Debian,
>> configured with the French locale (but the tests do reset the locale
>> themselves).
>>
>> Here is the output from Maven:
>>
>> Results :
>>
>> Failed tests:  
>> testForgottenSeparator(org.apache.commons.math3.linear.RealMatrixFormatTest):
>> expected:<7> but was:<5>
>>  
>> testForgottenSuffix(org.apache.commons.math3.linear.RealMatrixFormatTest):
>> expected:<9> but was:<5>
>>   testToString(org.apache.commons.math3.linear.BlockRealMatrixTest):
>> expected:<BlockRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
>> but was:<BlockRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>>  
>> testToString(org.apache.commons.math3.linear.Array2DRowRealMatrixTest):
>> expected:<...ay2DRowRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
>> but was:<...ay2DRowRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>>   testToString(org.apache.commons.math3.linear.SparseRealMatrixTest):
>> expected:<OpenMapRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}> but
>> was:<OpenMapRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>>  
>> testToString(org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatisticsTest):
>> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
>>  
>> testToString(org.apache.commons.math3.stat.descriptive.SynchronizedMultivariateSummaryStatisticsTest):
>> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
>>
>> Tests run: 4067, Failures: 7, Errors: 0, Skipped: 40
>>
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] BUILD FAILURE
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] There are test failures.
>>
>>
>> Do someone else experience the same problems?
> 
> Hi Luc,

Hi Thomas,

> 
> the problem is that
> 
>  * not all tests override the locale with US
>  * in some locales (like yours) the decimal point is a ',' instead of a
>    '.'
> 
> The RealMatrixFormat tests have to be improved to include always the
> currently configured decimal separator for the expected result (as in
> the RealVectorFormatTest class).
> 
> For the RealMatrix.toString, I kept the ',' as element separator for
> backwards compatibility, but this will fail for certain locales, so I
> guess it would be better to also set the used locale to US instead of
> the local configured one to prevent such situations.

Yes, your are right.

> 
> The same may also happen if some tests depend on the output of
> RealVectorFormat (e.g. in ArrayRealVector), so maybe we should do the
> same there?

For now, these are the only tests that fail for me. So we can simply
wait until it becomes really necessary to get a look at this. This is a
minor problem and fairly easy to reproduce (just launch the test with a
French locale).

thanks for your analysis,
Luc

> 
> Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] problems with tests due to matrix formatting

Posted by Thomas Neidhart <th...@gmail.com>.
On 08/14/2012 05:25 PM, luc wrote:
> Hi,
> 
> Since a few weeks, I have lots of tests failures due to matrix formats.
> 
> I'm not sure exactly when this started, but I think this may be related
> to MATH-831 and the fix introduced as of r1364775 in late July. This
> changed the behaviour of toString in AbstractRealMatrix. The difference
> is that despite the default number of digits is set to one, matrix
> entries that happen to be integer are displayed as "1" or "0" and not as
> "1.0" or "0.0" as expected by the Junit tests.
> 
> The tests that fail for me are:
> 
> MultivariateSummaryStatisticsTest: testToString,
> SparseRealMatrixTest: testToString
> SynchronizedMultivariateSummaryStatisticsTest: testToString
> Array2DRowRealMatrixTest: testToString
> BlockRealMatrixTest: testToString
> 
> They fail both when I use eclipse and when I use maven from the command
> line.  Eclipse is configured to use Sun Java 1.5.0_22 JVM. Maven is
> configured with OpenJDK 1.6.0_24. I use a Linux computer running Debian,
> configured with the French locale (but the tests do reset the locale
> themselves).
> 
> Here is the output from Maven:
> 
> Results :
> 
> Failed tests:  
> testForgottenSeparator(org.apache.commons.math3.linear.RealMatrixFormatTest):
> expected:<7> but was:<5>
>  
> testForgottenSuffix(org.apache.commons.math3.linear.RealMatrixFormatTest):
> expected:<9> but was:<5>
>   testToString(org.apache.commons.math3.linear.BlockRealMatrixTest):
> expected:<BlockRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
> but was:<BlockRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>  
> testToString(org.apache.commons.math3.linear.Array2DRowRealMatrixTest):
> expected:<...ay2DRowRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
> but was:<...ay2DRowRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>   testToString(org.apache.commons.math3.linear.SparseRealMatrixTest):
> expected:<OpenMapRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}> but
> was:<OpenMapRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>  
> testToString(org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatisticsTest):
> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
>  
> testToString(org.apache.commons.math3.stat.descriptive.SynchronizedMultivariateSummaryStatisticsTest):
> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
> 
> Tests run: 4067, Failures: 7, Errors: 0, Skipped: 40
> 
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] There are test failures.
> 
> 
> Do someone else experience the same problems?

Hi Luc,

the problem is that

 * not all tests override the locale with US
 * in some locales (like yours) the decimal point is a ',' instead of a
   '.'

The RealMatrixFormat tests have to be improved to include always the
currently configured decimal separator for the expected result (as in
the RealVectorFormatTest class).

For the RealMatrix.toString, I kept the ',' as element separator for
backwards compatibility, but this will fail for certain locales, so I
guess it would be better to also set the used locale to US instead of
the local configured one to prevent such situations.

The same may also happen if some tests depend on the output of
RealVectorFormat (e.g. in ArrayRealVector), so maybe we should do the
same there?

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] problems with tests due to matrix formatting

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
On Tue, Aug 14, 2012 at 05:25:20PM +0200, luc wrote:
> Hi,
> 
> Since a few weeks, I have lots of tests failures due to matrix formats.
> 
> I'm not sure exactly when this started, but I think this may be
> related to MATH-831 and the fix introduced as of r1364775 in late
> July. This changed the behaviour of toString in AbstractRealMatrix.
> The difference is that despite the default number of digits is set
> to one, matrix entries that happen to be integer are displayed as
> "1" or "0" and not as "1.0" or "0.0" as expected by the Junit tests.
> 
> The tests that fail for me are:
> 
> MultivariateSummaryStatisticsTest: testToString,
> SparseRealMatrixTest: testToString
> SynchronizedMultivariateSummaryStatisticsTest: testToString
> Array2DRowRealMatrixTest: testToString
> BlockRealMatrixTest: testToString
> 
> They fail both when I use eclipse and when I use maven from the
> command line.  Eclipse is configured to use Sun Java 1.5.0_22 JVM.
> Maven is configured with OpenJDK 1.6.0_24. I use a Linux computer
> running Debian, configured with the French locale (but the tests do
> reset the locale themselves).
> 
> Here is the output from Maven:
> 
> Results :
> 
> Failed tests:   testForgottenSeparator(org.apache.commons.math3.linear.RealMatrixFormatTest):
> expected:<7> but was:<5>
>    testForgottenSuffix(org.apache.commons.math3.linear.RealMatrixFormatTest):
> expected:<9> but was:<5>
>   testToString(org.apache.commons.math3.linear.BlockRealMatrixTest): expected:<BlockRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
> but
> was:<BlockRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>    testToString(org.apache.commons.math3.linear.Array2DRowRealMatrixTest): expected:<...ay2DRowRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
> but was:<...ay2DRowRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>   testToString(org.apache.commons.math3.linear.SparseRealMatrixTest): expected:<OpenMapRealMatrix{{1[.0,2.0,3.0},{2.0,5.0,3.0},{1.0,0.0,8.]0}}>
> but
> was:<OpenMapRealMatrix{{1[,0,2,0,3,0},{2,0,5,0,3,0},{1,0,0,0,8,]0}}>
>    testToString(org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatisticsTest):
> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
>    testToString(org.apache.commons.math3.stat.descriptive.SynchronizedMultivariateSummaryStatisticsTest):
> expected:<...ay2DRowRealMatrix{{1[.0,-1.0},{-1.0,1.]0}}(..)
> 
> Tests run: 4067, Failures: 7, Errors: 0, Skipped: 40
> 
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] There are test failures.
> 
> 
> Do someone else experience the same problems?

The build went fine here:
$ mvn --version
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_24
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.2.0-2-amd64" arch: "amd64" Family: "unix"

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Best regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org