ZonoOpt 2.5.0
Loading...
Searching...
No Matches
ZonoJson.hpp
Go to the documentation of this file.
1#pragma once
2
14#include <memory>
15#include <string>
16#include <vector>
17
18#include "Eigen/Dense"
19#include "Eigen/Sparse"
20#include "nlohmann/json.hpp"
21
22#include "HybZono.hpp"
23
24namespace ZonoOpt
25{
34 void to_json(const HybZono& Z, const std::string& filename);
35
45 std::unique_ptr<HybZono> from_json(const std::string& filename);
46
47namespace detail
48{
49 void sparse_to_json(const Eigen::SparseMatrix<zono_float>& mat, nlohmann::json& j);
50 Eigen::SparseMatrix<zono_float> json_to_sparse(const nlohmann::json& j);
51 Eigen::Vector<zono_float, -1> std_2_eigen(const std::vector<zono_float>& vec);
52 std::vector<zono_float> eigen_2_std(const Eigen::Vector<zono_float, -1>& vec);
53}
54
55}
Hybrid zonotope class for ZonoOpt library.
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition Defines.hpp:22
std::unique_ptr< HybZono > from_json(const std::string &filename)
Read a HybZono object from a JSON file.
Definition ZonoJson.cpp:71
void to_json(const HybZono &Z, const std::string &filename)
Write a HybZono object to a JSON file.
Definition ZonoJson.cpp:23
Definition ZonoOpt.hpp:51