Skip to content

Commit

Permalink
Merge pull request #207 from DerThorsten/fix_flens
Browse files Browse the repository at this point in the history
fixing wrong signature in flens
  • Loading branch information
JohanMabille committed Oct 14, 2021
2 parents 11fdbce + 66d5ebf commit 56c5bb7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/xflens/cxxlapack/interface/gesdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ template <typename IndexType>
IndexType n,
std::complex<float > *A,
IndexType ldA,
double *s,
float *s,
std::complex<float > *U,
IndexType ldU,
std::complex<float > *Vt,
Expand Down
2 changes: 1 addition & 1 deletion include/xflens/cxxlapack/interface/gesdd.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ gesdd(char jobZ,
IndexType n,
std::complex<float> *A,
IndexType ldA,
double *s,
float *s,
std::complex<float> *U,
IndexType ldU,
std::complex<float> *Vt,
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ set(XTENSOR_BLAS_TESTS
test_dot.cpp
test_dot_extended.cpp
test_qr.cpp
test_complex_float_norm.cpp
)

add_executable(test_xtensor_blas ${XTENSOR_BLAS_TESTS} ${XTENSOR_BLAS_HEADERS} ${XTENSOR_HEADERS})
Expand Down
32 changes: 32 additions & 0 deletions test/test_complex_float_norm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/***************************************************************************
* Copyright (c) Wolf Vollprecht, Johan Mabille and Sylvain Corlay *
* Copyright (c) QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

// this test is for https://github.com/xtensor-stack/xtensor-blas/issues/206

#include "gtest/gtest.h"
#include "xtensor/xarray.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/xbuilder.hpp"
#include "xtensor/xrandom.hpp"

#include "xtensor-blas/xblas.hpp"
#include "xtensor-blas/xlinalg.hpp"

namespace xt
{

TEST(xblas, norm_complex_float) {
xt::xarray<std::complex<float>> a = {std::complex<float>(1.0f, 2.0f), std::complex<float>(3.0f, 4.0f)};
auto res = linalg::norm(a);

EXPECT_NEAR(res.real(), 5.4772f, 1e-3f);
EXPECT_NEAR(res.imag(), 0.0f, 1e-3f);
}

}

0 comments on commit 56c5bb7

Please sign in to comment.