Opened 12 years ago

Last modified 12 years ago

#4441 new Bugs

SFINAE for operator * breaking auto differentiation code

Reported by: Jesse Perla <jesseperla@…> Owned by: Gunter
Milestone: Boost 1.44.0 Component: uBLAS
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

A while back we had discussed adding overload resolution with SFINAE to the matrix/vector expressions involving scalars in order to implement operator*, etc. The choice was made to use is_convertible between the scalar and matrix type.

But this ended up breaking an auto-differentiation library (CPPAD) I was using. Templated AD libraries will often have their own, arithmetic type which will record operations of the type * a double, etc. for a matrix multiplication by a scalar, etc. But you can't convert between them!

The basic change is to change from using is_convertible to using is_arithmetic. A change to the result type is also needed for autodifferentation to work.

See the attached patch for the change to matrix/vector expression.

Attachments (2)

enable_if_sfinae.patch (3.5 KB ) - added by Jesse Perla <jesseperla@…> 12 years ago.
enable_if_sfinae.2.patch (2.7 KB ) - added by Jesse Perla <jesseperla@…> 12 years ago.

Download all attachments as: .zip

Change History (3)

by Jesse Perla <jesseperla@…>, 12 years ago

Attachment: enable_if_sfinae.patch added

by Jesse Perla <jesseperla@…>, 12 years ago

Attachment: enable_if_sfinae.2.patch added

comment:1 by Jesse Perla <jesseperla@…>, 12 years ago

Actually, let me fix that patch... I used an older version. Use the .2. version.

It is much simpler, just swapping out to is_arithmetic for now. If this doesn't patch properly, my apologies... I am trying to separate out a bunch of changes.

Note: See TracTickets for help on using tickets.