xtensor-blas
xtensor-blas copied to clipboard
View dot multiplication causing runtime error
The following example causing runtime error:
#ifndef __TESTCPP__
#define __TESTCPP__
#include <iostream>
#include <xtensor/xarray.hpp>
#include <xtensor/xfixed.hpp>
#include <xtensor/xio.hpp>
#include <xtensor/xtensor.hpp>
#include <xtensor/xview.hpp>
#include <xtensor/xindex_view.hpp>
#include "xtensor-blas/xlinalg.hpp"
int main()
{
xt::xtensor_fixed<double, xt::xshape<4, 4> > c = xt::linspace<double>(1.0, 16, 16);
std::cout << c << std::endl
<< std::endl;
xt::filter(c, c > 5) = 0;
std::cout << c << std::endl
<< std::endl;
auto v1 = xt::view(c, xt::range(0, 2), xt::range(0, 2));
std::cout << v1 << std::endl
<< std::endl;
v1 = xt::linalg::dot(v1, v1);
std::cout << c << std::endl;
}
#endif
Result:
{{ 1., 2., 3., 4.},
{ 5., 6., 7., 8.},
{ 9., 10., 11., 12.},
{ 13., 14., 15., 16.}}
{{ 1., 2., 3., 4.},
{ 5., 0., 0., 0.},
{ 0., 0., 0., 0.},
{ 0., 0., 0., 0.}}
{{ 1., 2.},
{ 5., 0.}}
terminate called after throwing an instance of 'std::runtime_error'
what(): No valid layout chosen.
Aborted (core dumped)
g++ --std=c++20 -DXTENSOR_USE_FLENS_BLAS -I./xtensor/include -I./xtl/include -I./xtensor-blas/include test.cpp -o test
xtensor version
commit d09e8076fe918562efca0f9ecee2748ce0de1692 (HEAD -> master, origin/master, origin/HEAD)
Merge: 5b6f0996 318239f5
Author: Johan Mabille <[email protected]>
Date: Wed Mar 31 14:27:15 2021 +0200
Merge pull request #2344 from t-bltg/ravel
FIX for xtensor-stack/xtl/issues/245
xtensor-blas version
commit 303bb5bd4e10f888fb4ecf2b2b671fa2b02ea89d (HEAD -> master, tag: 0.19.1, origin/master, origin/HEAD)
Author: Johan Mabille <[email protected]>
Date: Tue Mar 23 21:23:14 2021 +0100
Release 0.19.1