File tree Expand file tree Collapse file tree 7 files changed +110
-0
lines changed Expand file tree Collapse file tree 7 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 5252[submodule "ext/segger/rtt "]
5353 path = ext/segger/rtt
5454 url = https://github.com/modm-ext/segger-rtt.git
55+ [submodule "ext/libeigen/eigen "]
56+ path = ext/libeigen/eigen
57+ url = https://github.com/modm-ext/eigen-partial.git
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025, Henrik Hose
3+ * Copyright (c) 2025, Niklas Hauser
4+ *
5+ * This file is part of the modm project.
6+ *
7+ * This Source Code Form is subject to the terms of the Mozilla Public
8+ * License, v. 2.0. If a copy of the MPL was not distributed with this
9+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10+ */
11+ // ----------------------------------------------------------------------------
12+
13+ #pragma once
14+
15+ #if __has_include(<eigen_conf_local.h>)
16+ # include <eigen_conf_local.h>
17+ #endif
18+
19+ #define EIGEN_DONT_VECTORIZE
20+ #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
21+
22+ %% if eigen_no_malloc
23+ #define EIGEN_NO_MALLOC
24+ %% endif
25+
26+ #include <modm/architecture/interface/assert.h>
27+
28+ #define eigen_assert(cond) \
29+ modm_assert(cond, "eigen", __FILE__ ":" MODM_STRINGIFY(__LINE__) " -> \"" #cond "\"")
30+
31+ #include "Version_orig"
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+ #
4+ # Copyright (c) 2025, Henrik Hose
5+ # Copyright (c) 2025, Niklas Hauser
6+ #
7+ # This file is part of the modm project.
8+ #
9+ # This Source Code Form is subject to the terms of the Mozilla Public
10+ # License, v. 2.0. If a copy of the MPL was not distributed with this
11+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12+ # -----------------------------------------------------------------------------
13+
14+ def init (module ):
15+ module .name = ":eigen"
16+ module .description = """
17+ # Eigen Linear Algebra Library
18+
19+
20+ """
21+
22+
23+ def prepare (module , options ):
24+ module .depends (":architecture:assert" )
25+ return True
26+
27+
28+ def build (env ):
29+ env .outbasepath = "modm/ext/eigen"
30+ env .collect (":build:path.include" , "modm/ext/eigen" )
31+
32+ env .substitutions = {"eigen_no_malloc" : not env .has_module (":platform:heap" )}
33+ env .copy ("eigen/Eigen" , "Eigen" , ignore = env .ignore_files ("Version" ))
34+ env .copy ("eigen/Eigen/Version" , "Eigen/Version_orig" )
35+ env .template ("Version.in" , "Eigen/Version" )
36+
37+ if env .has_module (":io" ):
38+ env .outbasepath = "modm/src/modm/io"
39+ env .copy ("iostream_eigen.hpp" )
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025, Henrik Hose
3+ * Copyright (c) 2025, Niklas Hauser
4+ *
5+ * This file is part of the modm project.
6+ *
7+ * This Source Code Form is subject to the terms of the Mozilla Public
8+ * License, v. 2.0. If a copy of the MPL was not distributed with this
9+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10+ */
11+ // ----------------------------------------------------------------------------
12+
13+ #pragma once
14+ #include < Eigen/Dense>
15+
16+ namespace modm
17+ {
18+
19+ template <typename Derived>
20+ modm::IOStream& operator <<(modm::IOStream& s, const Eigen::MatrixBase<Derived>& m)
21+ {
22+ for (Eigen::Index r = 0 ; r < m.rows (); ++r) {
23+ for (Eigen::Index c = 0 ; c < m.cols (); ++c) {
24+ s << m (r, c);
25+ if (c + 1 < m.cols ()) s << " , " ;
26+ }
27+ if (r + 1 < m.rows ()) s << " \n " ;
28+ }
29+ return s;
30+ }
31+
32+ } // namespace modm
Original file line number Diff line number Diff line change @@ -372,5 +372,8 @@ white(IOStream& ios);
372372} // namespace modm
373373
374374#include "iostream_chrono.hpp"
375+ %% if with_eigen
376+ #include "iostream_eigen.hpp"
377+ %% endif
375378
376379#endif // MODM_IOSTREAM_HPP
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def build(env):
4949 "with_fiber" : env .has_module (":processing:fiber" ),
5050 "family" : target .family ,
5151 "core" : core ,
52+ "with_eigen" : env .has_module (":eigen" ),
5253 }
5354 env .outbasepath = "modm/src/modm/io"
5455 env .copy ("iodevice.hpp" )
You can’t perform that action at this time.
0 commit comments