Skip to content

Commit

Permalink
test scal completed, 100% test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Guglielmo Gagliardi committed Dec 14, 2023
1 parent 0cd2bd7 commit 51abfa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
33 changes: 4 additions & 29 deletions test/include/dlaf_test/matrix/util_generic_blas_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,13 @@

#include <dlaf_test/util_types.h>


#include <dlaf_test/matrix/util_generic_blas.h>

/// @file

namespace dlaf::matrix::test {

namespace internal {
template <class ElementGetter>
auto opValFunc(ElementGetter&& val, const blas::Op op) {
std::function op_val = val;
switch (op) {
case blas::Op::NoTrans:
break;
case blas::Op::Trans: {
op_val = [&val](auto i) {
i.transpose();
return val(i);
};
break;
}
case blas::Op::ConjTrans: {
op_val = [&val](auto i) {
i.transpose();
return dlaf::conj(val(i));
};
break;
}
}
return op_val;
}
}

template <class ElementIndex, class T>
auto getMatrixScal(const T beta) {
using dlaf::test::TypeUtilities;
Expand All @@ -62,9 +39,7 @@ auto getMatrixScal(const T beta) {
};

auto res_a = [beta, el_a](const ElementIndex& index) {
const double i = index.row();
const double j = index.col();
return beta * el_op_a(index);
return beta * el_a(index);
};

using internal::opValFunc;
Expand Down
5 changes: 3 additions & 2 deletions test/unit/test_blas_tile/test_scal.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <dlaf/blas/enum_output.h>
#include <dlaf/blas/tile.h>
#include <dlaf/matrix/tile.h>
#include <dlaf/blas/tile_extensions.h>

#include <gtest/gtest.h>

Expand Down Expand Up @@ -44,9 +45,9 @@ void testScal(const SizeType m,
auto [el_a, res_a] =
getMatrixScal<TileElementIndex, T>(beta);

auto a = createTile<CT, D>(el_a, size_a, lda);
auto a = createTile<T, D>(el_a, size_a, lda);

invokeBlas<D>(tile::internal::scal, beta, a);
invokeBlas<D>(tile::internal::scal_o, beta, a);

std::stringstream s;
s << "Scal: ";
Expand Down

0 comments on commit 51abfa0

Please sign in to comment.