Modify

Ticket #7296 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

Bug-fix and improvements to test utility functions

Reported by: Marco Guazzone <marco.guazzone@…> Owned by: guwi17
Milestone: Boost 1.52.0 Component: uBLAS
Version: Boost Release Branch Severity: Problem
Keywords: Cc:

Description

Three years ago I introduced in libs/numeric/ublas/test/utils a small set of utility functions for testing purpose.

Now, I corrected some bugs and added new and hopefully useful functions.

Furthermore, I fixed the license part.

I attach a patch file along with the whole include file.

I tested it against the following tests:

begin_end
num_columns
num_rows
size
test_complex_norms

and all works.

I had to skip the following tests since they fail (not for the new version of utils.hpp):

test_assignment
test_coordinate_matrix_sort
test_inplace_solve

Could you add it?

Attachments

utils.patch Download (10.1 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Patch file for utils.hpp
utils.hpp Download (8.6 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The new (i.e., already patched) utils.hpp
utils-new.patch Download (12.5 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
New patch file for utils.hpp
utils.2.hpp Download (11.0 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The new (i.e., already patched by utils-new.patch) utils.hpp
utils-201208280915.patch Download (12.5 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Patch file for utils.hpp to be applied against the version you currently find in boost trunk
utils_UBLA_UBLAS-201208280915.patch Download (1.2 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Patch file for utils.hpp to be applied against the version of utils.hpp patched with utils-new.patch (i.e., the one named utils.2.hpp)
utils.3.hpp Download (11.0 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The new (i.e., already patched by utils-201208280915.patch) utils.hpp file.
utils-fix_complex-201208281922.patch Download (7.9 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Patch file for utils.hpp to make it works with complex numbers. To be applied to the version of utils.hpp in the current boost trunk.
utils.4.hpp Download (14.3 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The new utils.hpp file that you should obtain after applying the utils-fix_complex-201208281922.patch patch.
test_ticket7296.cpp Download (8.1 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Test case for utils.hpp. It also shows that now utils.hpp works with complex value types.
utils-201208301042.patch Download (19.0 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
Patch file for utils.hpp to be applied against utils.4.hpp
utils.5.hpp Download (17.7 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The new patched utils.hpp (i.e., the one resulting after applying patch utils-201208301042.patch)
test_ticket7296.2.cpp Download (10.9 KB) - added by Marco Guazzone <marco.guazzone@…> 3 years ago.
The updated test_ticket7296.cpp for the new version of utils.hpp named utils.5.hpp

Change History

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched) utils.hpp

comment:1 Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The previously attached patch contained simpler macros but some output messages was less informative (for the user). Now, with the new attached patch utils-new.patch, those output messages are again informative.

Sorry for the inconvenience.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

New patch file for utils.hpp

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched by utils-new.patch) utils.hpp

comment:2 Changed 3 years ago by guwi17

(In [80267]) boost/numeric/ublas/triangular.hpp - applied patch, see #4024 libs/numeric/ublas/test/test_inplace_solve.cpp - fixed includes

libs/numeric/ublas/test/utils.hpp - applied patch (after s/BOOST_UBLA_TEST/BOOST_UBLAS_TEST/g), see #7296

comment:3 Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The previous patch file utils-new.patch contained bad macro names: BOOST_UBLA_TEST_CHECK_EQ and BOOST_UBLA_TEST_CHECK_EQUAL. Specifically, UBLA_ should be UBLAS_. The new attached patch fix this.

I attach two patches:

  • utils-201208280915.patch is the patch file to be used if applied against the original (unpatched) utils.hpp (i.e., the one you find in the actual boost trunk).
  • utils-201208280915.patch is the patch file to be used if applied against the patched utils.hpp (i.e., the ones named utils.2.hpp in the above attachments).

As before, I also attach the new (patched) version of utils.hpp.

Again, sorry for this inconvenience, and thanks to guwi17 for pointing it out.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against the version you currently find in boost trunk

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against the version of utils.hpp patched with utils-new.patch (i.e., the one named utils.2.hpp)

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched by utils-201208280915.patch) utils.hpp file.

comment:4 Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

In the last my comment, read the second utils-201208280915.patch as utils_UBLA_UBLAS-201208280915.patch.

comment:5 Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

To date, some macros in utils.hpp fail when the value type has a complex type.

I've tried to fix it and to test the fix I have created a test-suite for the macros contained in utils.hpp.

I'm going to upload the patch file together with the test suite.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to make it works with complex numbers. To be applied to the version of utils.hpp in the current boost trunk.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The new utils.hpp file that you should obtain after applying the utils-fix_complex-201208281922.patch patch.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Test case for utils.hpp. It also shows that now utils.hpp works with complex value types.

comment:6 Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

I've tried to make some macro more robust to complex expressions by using (when needed) macro expansion inside parenthesis. Furthermore,

  • I fixed a bug: I forgot to add an increment of the variable used to count test failures
  • I added two more macros for performing relative closeness comparison in case of vectors and matrices
  • I replaced the use of unsigned long with std::size_t (I think it's better)
  • I enhanced the doc

As usual, I add the new patch file (wrt utils.4.hpp) together with the whole new utils.hpp file and the updated test-case.

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against utils.4.hpp

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The new patched utils.hpp (i.e., the one resulting after applying patch utils-201208301042.patch)

Changed 3 years ago by Marco Guazzone <marco.guazzone@…>

The updated test_ticket7296.cpp for the new version of utils.hpp named utils.5.hpp

comment:7 Changed 3 years ago by guwi17

(In [80483]) boost/numeric/ublas/traits.hpp, libs/numeric/ublas/test/test_assignment.cpp, libs/numeric/ublas/test/begin_end.cpp: see #7296, fix test issues with unsigned integer types

comment:8 Changed 3 years ago by guwi17

(In [80485])

  • libs/numeric/ublas/test/utils.hpp : see #7296, improved macros
  • libs/numeric/ublas/test/Jamfile.v2 : add new test for utils.hpp

comment:9 Changed 3 years ago by guwi17

(In [80507])

  • libs/numeric/ublas/tests/utils.hpp: see #7296 - replace func by FUNCTION if compiled with MSVC

comment:10 Changed 3 years ago by guwi17

  • Status changed from new to assigned
  • Milestone changed from To Be Determined to Boost 1.52.0

comment:11 Changed 3 years ago by guwi17

(In [80563])

  • libs/numeric/ublas/test/test_ticket7296.cpp: see #7296 - add missing test

comment:12 Changed 3 years ago by guwi17

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:13 Changed 3 years ago by guwi17

  • Status changed from closed to reopened
  • Version changed from Boost 1.52.0 to Boost Release Branch
  • Resolution fixed deleted

comment:14 Changed 3 years ago by guwi17

(In [80624])

  • libs/numeric/ublas/test/utils.hpp: switch to boost::math::isnan, see #7296

comment:15 Changed 3 years ago by guwi17

(In [80644])

  • libs/numeric/ublas/test/test_triangular.cpp: switch to boost::timer and enable all tests, see #7296
  • libs/numeric/ublas/test/Jamfile.v2: add required lib boost_timer

comment:16 Changed 3 years ago by guwi17

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [80645]) merged [80483],[80487],[80586],[80591],[80592],[80599],[80600],[80624],[80625],[80643],[80644] into release:

  • fix #7296 (hopefully ;-)
  • see #7363 (must wait for a full test cycle before closing this task)
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.