Skip to content

[eigen] Operand order with bitwise operations in C++ #353

@GondotCl

Description

@GondotCl

When using IntervalVectors and standard types, for example doubles :

IntervalVector x(2);
double y = 0.3;

Binary operators & and | won't work with the mixed-type product as left-hand operand :

IntervalVector z_bad  = (x * y) | x;  // breaks
IntervalVector z_good = x | (x * y); // works

Compilation will output the following :

/codac/build_install/include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h:573:3: 
error: static assertion failed: BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES
  573 |   EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::RequireInitialization,
      |   ^~~~~~~~~~~~~~~~~~~

Note : This can be resolved by casting the mixed prodcut to IntervalVector, but this issue can be tricky to detect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions