Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect result from sample programs #191

Open
michael-pruglo opened this issue Apr 2, 2021 · 1 comment
Open

Incorrect result from sample programs #191

michael-pruglo opened this issue Apr 2, 2021 · 1 comment

Comments

@michael-pruglo
Copy link

I'm trying to use xtensor-blas for the first time. I've had lots of difficulties linking to it, but finally, I've done that and tried to run the sample programs from https://xtensor-blas.readthedocs.io/en/latest/usage.html . However, as the output, I get 0 for the first and 0, -inf for the second.

I'm using Windows 10 x64, Clion
Installed cmake 3.19.7, xtensor 0.23.4, xtensor-blas 0.19.0, openblas 0.3.13, lapack 3.6.1 using anaconda
Compile using Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe

cmake_minimum_required(VERSION 3.19)
project(tstxtensor6)

set(CMAKE_CXX_STANDARD 20)

find_package(xtensor)
find_package(xtensor-blas)
add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} xtensor xtensor-blas)
#include <xtensor-blas/xlinalg.hpp>

int main()
{
    {
        xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
        auto d = xt::linalg::det(a);
        std::cout << d << std::endl;  // 6.661338e-16
    }
    {
        xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
        auto d = xt::linalg::slogdet(a);
        std::cout << std::get<0>(d) << ", " << std::get<1>(d) << std::endl;  // 1, -34.9450...
    }
}
@tdegeus
Copy link
Member

tdegeus commented Apr 3, 2021

Looking better at this, it seems that the examples are terrible!! So it's not you! The determinant of the first example is zero, which make the second example completely undefined. So they should be replaced with something descent. In the mean-time you could try something other the is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants