1//
2// Copyright (c) 2000-2002
3// Joerg Walter, Mathias Koch
4//
5// Distributed under the Boost Software License, Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// The authors gratefully acknowledge the support of
10// GeNeSys mbH & Co. KG in producing this work.
11//
12
13#include "test2.hpp"
14
15template<class V, std::size_t N>
16void test_blas_1<V, N>::test () {
17 {
18 value_type t;
19 real_type n;
20 V v1 (N), v2 (N);
21
22 // _asum
23 initialize_vector (v1);
24 n = ublas::blas_1::asum (v1);
25 std::cout << "asum (v1) = " << n << std::endl;
26
27 // _amax
28 initialize_vector (v1);
29 n = ublas::blas_1::amax (v1);
30 std::cout << "amax (v1) = " << n << std::endl;
31
32 // _nrm2
33 initialize_vector (v1);
34 n = ublas::blas_1::nrm2 (v1);
35 std::cout << "nrm2 (v1) = " << n << std::endl;
36
37 // _dot
38 // _dotu
39 // _dotc
40 initialize_vector (v1);
41 initialize_vector (v2);
42 t = ublas::blas_1::dot (v1, v2);
43 std::cout << "dot (v1, v2) = " << t << std::endl;
44 t = ublas::blas_1::dot (ublas::conj (v1), v2);
45 std::cout << "dot (conj (v1), v2) = " << t << std::endl;
46
47 // _copy
48 initialize_vector (v2);
49 ublas::blas_1::copy (v1, v2);
50 std::cout << "copy (v1, v2) = " << v1 << std::endl;
51
52 // _swap
53 initialize_vector (v1);
54 initialize_vector (v2);
55 ublas::blas_1::swap (v1, v2);
56 std::cout << "swap (v1, v2) = " << v1 << " " << v2 << std::endl;
57
58 // _scal
59 // csscal
60 // zdscal
61 initialize_vector (v1);
62 ublas::blas_1::scal (v1, value_type (1));
63 std::cout << "scal (v1, 1) = " << v1 << std::endl;
64
65 // _axpy
66 initialize_vector (v1);
67 initialize_vector (v2);
68 ublas::blas_1::axpy (v1, value_type (1), v2);
69 std::cout << "axpy (v1, 1, v2) = " << v1 << std::endl;
70
71 // _rot
72 initialize_vector (v1);
73 initialize_vector (v2);
74 ublas::blas_1::rot (value_type (1), v1, value_type (1), v2);
75 std::cout << "rot (1, v1, 1, v2) = " << v1 << " " << v2 << std::endl;
76 }
77}
78
79#ifdef USE_FLOAT
80template struct test_blas_1<ublas::vector<float>, 3>;
81#endif
82
83#ifdef USE_DOUBLE
84template struct test_blas_1<ublas::vector<double>, 3>;
85#endif
86
87#ifdef USE_STD_COMPLEX
88#ifdef USE_FLOAT
89template struct test_blas_1<ublas::vector<std::complex<float> >, 3>;
90#endif
91
92#ifdef USE_DOUBLE
93template struct test_blas_1<ublas::vector<std::complex<double> >, 3>;
94#endif
95#endif
96

source code of boost/libs/numeric/ublas/test/test21.cpp