Scalar Multiplication fails for column selection created via callable

Issue #249 resolved
Tim Zimmermann created an issue

Hi Klaus,

first of all, thank you for the quick bug fix of #247. I just pulled the changes and it works like a charm. However, I encountered a new potential bug. Consider the following snippet

#include "blaze/math/Rows.h"
#include <iostream>
#include "blaze/math/Columns.h"
#include "blaze/math/DynamicMatrix.h"

int main() {
    using namespace blaze;
    const int N = 4;
    DynamicMatrix<double, blaze::columnMajor> M(N, N, 1);

    auto odd_rows = rows(M, [](size_t k) { return 2 * k + 1; }, N / 2);
    // This works as expected (compiles and yields the correct result)
    odd_rows *= -1;

    auto odd_cols_exp = columns(M, {1, 3});
    // scalar multiplication with column selection from init list works as well
    odd_cols_exp *= -1;

    auto odd_cols_lambda =
        columns(M, [](size_t k) { return 2 * k + 1; }, N / 2);
    //  scalar multiplication with column selection created via callable won't compile
    odd_cols_lambda *= -1;

    std::cout << M << std::endl;
    return 0;
}

Judging from the compiler output, it seems like it is searching for a function template that accepts three template parameters but only manages to find one that supports one parameter. So I guess there are also some overloads missing as was the case in #247.

Thanks for the support, Tim

Comments (6)

  1. Klaus Iglberger

    Hi Tim!

    Thanks again for creating this issue. Again you are correct, this is an error on our side and again we apologize for the the inconvenience. We will add the missing functionality as quickly as possible.

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit 438ed1c adds a missing overload of the columns() function, which resolves the compilation error. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.6.

  3. Log in to comment