Mantid
Loading...
Searching...
No Matches
EigenVectorView.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2022 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8#include "MantidCurveFitting/DllConfig.h"
9
10#include <Eigen/Core>
11
12namespace Mantid::CurveFitting {
13typedef Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic> dynamic_stride;
14typedef Eigen::Map<Eigen::VectorXd, 0, dynamic_stride> vec_map_type;
15typedef Eigen::Map<const Eigen::VectorXd, 0, dynamic_stride> vec_const_map_type;
16
17class MANTID_CURVEFITTING_DLL EigenVector_View {
18public:
19 // EigenVector_View Constructors
20 // default constructor
22
24 EigenVector_View(vec_map_type &vector, const int nElements = -1, const size_t startElement = 0);
25
26 // constructor: vector->vector view
27 EigenVector_View(Eigen::VectorXd &vector, const int nElements = -1, const size_t startElement = 0);
28
29 // constructor: array->vector view
30 EigenVector_View(double *base, const size_t nElements, const size_t startElement = 0);
31
33 EigenVector_View(const vec_map_type &vector, const size_t nElements = -1, const size_t startElement = 0);
34
35 // CONST constructor: vector->vector view
36 EigenVector_View(const Eigen::VectorXd &vector, const size_t nElements, const size_t startElement = 0);
37
38 // CONST constructor: array->vector view
39 EigenVector_View(const double *base, const size_t nElements, const size_t startElement = 0);
40
41 // copy constructor
43
44 // CONST copy constructor
46
47 vec_map_type &vector_mutator();
48 inline const vec_map_type vector_inspector() const { return m_view; }
49 inline vec_map_type vector_copy() const { return m_view; }
50 inline size_t size() const { return m_view.size(); }
51
53 EigenVector_View &operator=(EigenVector_View &&V);
54
55protected:
57 bool m_isConst = false;
58};
59} // namespace Mantid::CurveFitting
const vec_map_type vector_inspector() const
Eigen::Map< Eigen::VectorXd, 0, dynamic_stride > vec_map_type
Eigen::Map< const Eigen::VectorXd, 0, dynamic_stride > vec_const_map_type
Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > dynamic_stride