potential bug outer product

Issue #150 resolved
Harry Hill created an issue

I'm struggling to get the outer product to work, I've tried various versions on my code and based on the docs, https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector%20Multiplication I expected the following to compile,

#include <blaze/Math.h>

int main() {
    blaze::StaticVector<int,3UL, blaze::rowVector> v1{  2, 5, -1 };
    blaze::StaticVector<int,3UL, blaze::rowVector> v2{ -1, 3, -2 };

   //blaze::StaticMatrix<int, 3UL, 3UL> result = trans( v1 ) * v2;
  blaze::StaticMatrix<int, 3UL, 3UL> result = outer( v1, v2);
 }

however, I'm getting g++-6 -std=c++14

error: conversion from blaze::MultTrait_<int, int> {aka int} to non-scalar type blaze::StaticMatrix<int, 3ul, 3ul> requested
 blaze::StaticMatrix<int, 3UL, 3UL> result = outer( v1, v2);
                                             ~~~~~^~~~~~~~~
In file included from /usr/local/include/blaze/math/SparseVector.h:63:0,
                 from /usr/local/include/blaze/math/CompressedVector.h:47,
                 from /usr/local/include/blaze/math/CompressedMatrix.h:46,
                 from /usr/local/include/blaze/Math.h:47,
                 from blaze_outer_bug.cpp:1:
/usr/local/include/blaze/math/Vector.h: In instantiation of blaze::MultTrait_<typename MT::ElementType, typename MT::ElementType> blaze::outer(const blaze::Vector<T1, true>&, const blaze::Vector<T2, true>&) [with T1 = blaze::StaticVector<int, 3ul, true>; T2 = blaze::StaticVector<int, 3ul, true>; blaze::MultTrait_<typename MT::ElementType, typename MT::ElementType> = int]:
blaze_outer_bug.cpp:9:58:   required from here
/usr/local/include/blaze/math/Vector.h:297:30: error: cannot convert ReturnType {aka const blaze::DVecDVecOuterExpr<blaze::DVecTransExpr<blaze::StaticVector<int, 3ul, true>, false>, blaze::StaticVector<int, 3ul, true> >} to blaze::MultTrait_<int, int> {aka const int} in return
    return trans(~lhs) * (~rhs);

am I doing something wrong?

Comments (2)

  1. Klaus Iglberger

    Hi!

    Thanks for raising this issue. This bug has already been resolved via commit 3f8fdd4 on November, 6th, 2017. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.3.

    In case you cannot use the current HEAD of the repository, please use the first form of your minimum example:

    blaze::StaticMatrix<int, 3UL, 3UL> result = trans( v1 ) * v2;
    

    This code will work as the problem is restricted to the outer() function. We are sorry for the inconvenience,

    Best regards,

    Klaus!

  2. Log in to comment