mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
templateBLAS_test.cpp
Go to the documentation of this file.
1/** \file templateBLAS_test.cpp
2 * \brief Tests the typed BLAS wrappers.
3 */
4
5#include "../../catch2/catch.hpp"
6
8
9/// Verify typed scal wrappers for supported real and complex precisions.
10/**
11 * \ingroup templateBLAS_unit_tests
12 */
13TEST_CASE( "testing scal", "[templateBLAS]" )
14{
15 GIVEN( "a precision" )
16 {
17
18 WHEN( "precision is float" )
19 {
20 int N = 2;
21 float alpha = 2.;
22 float x[] = { 1., 2. };
23 int incX = 1;
24 mx::math::scal( N, alpha, x, incX );
25 REQUIRE_THAT( x[0], Catch::Matchers::WithinAbs( 2.0, 1e-6 ) );
26 REQUIRE_THAT( x[1], Catch::Matchers::WithinAbs( 4.0, 1e-6 ) );
27 }
28
29 WHEN( "precision is double" )
30 {
31 int N = 2;
32 double alpha = 2.;
33 double x[] = { 1., 2. };
34 int incX = 1;
35 mx::math::scal( N, alpha, x, incX );
36 REQUIRE_THAT( x[0], Catch::Matchers::WithinAbs( 2.0, 1e-12 ) );
37 REQUIRE_THAT( x[1], Catch::Matchers::WithinAbs( 4.0, 1e-12 ) );
38 }
39 }
40}
TEST_CASE("testing scal", "[templateBLAS]")
Verify typed scal wrappers for supported real and complex precisions.
void scal(const int N, const dataT &alpha, dataT *X, const int incX)
Template wrapper for cblas xSCAL.
Declares and defines templatized wrappers for the BLAS.