TR-mbed 1.0
Loading...
Searching...
No Matches
MovableScalar.h
Go to the documentation of this file.
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2020 Sebastien Boisvert <seb@boisvert.info>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_MISC_MOVABLE_SCALAR_H
11#define EIGEN_MISC_MOVABLE_SCALAR_H
12
13#include <vector>
14
15namespace Eigen
16{
17template <typename Scalar, typename Base = std::vector<Scalar>>
18struct MovableScalar : public Base
19{
20 MovableScalar() = default;
21 ~MovableScalar() = default;
22 MovableScalar(const MovableScalar&) = default;
23 MovableScalar(MovableScalar&& other) = default;
26 MovableScalar(Scalar scalar) : Base(100, scalar) {}
27
28 operator Scalar() const { return this->size() > 0 ? this->back() : Scalar(); }
29};
30
31template<> struct NumTraits<MovableScalar<float>> : GenericNumTraits<float> {};
32}
33
34#endif
35
Scalar Scalar int size
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition NumTraits.h:153
Definition MovableScalar.h:19
MovableScalar(MovableScalar &&other)=default
MovableScalar(Scalar scalar)
Definition MovableScalar.h:26
~MovableScalar()=default
MovableScalar(const MovableScalar &)=default
MovableScalar & operator=(const MovableScalar &)=default
MovableScalar & operator=(MovableScalar &&other)=default
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233