ZonoOpt 2.3.0
Loading...
Searching...
No Matches
ZonoJson.hpp
Go to the documentation of this file.
1#ifndef ZONOOPT_ZONO_JSON_HPP__
2#define ZONOOPT_ZONO_JSON_HPP__
3
16#include <fstream>
17#include <string>
18#include "nlohmann/json.hpp"
19#include "HybZono.hpp"
20
21namespace ZonoOpt
22{
30 void to_json(const HybZono& Z, const std::string& filename);
31
39 std::unique_ptr<HybZono> from_json(const std::string& filename);
40
41namespace detail
42{
43 void sparse_to_json(const Eigen::SparseMatrix<zono_float>& mat, nlohmann::json& j);
44 Eigen::SparseMatrix<zono_float> json_to_sparse(const nlohmann::json& j);
45 Eigen::Vector<zono_float, -1> std_2_eigen(const std::vector<zono_float>& vec);
46 std::vector<zono_float> eigen_2_std(const Eigen::Vector<zono_float, -1>& vec);
47}
48
49}
50
51
52#endif
Hybrid zonotope class for ZonoOpt library.
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition ZonoOpt.hpp:45
std::unique_ptr< HybZono > from_json(const std::string &filename)
Read a HybZono object from a JSON file.
Definition ZonoJson.cpp:56
void to_json(const HybZono &Z, const std::string &filename)
Write a HybZono object to a JSON file.
Definition ZonoJson.cpp:8
Definition ZonoOpt.hpp:58