cyqlone develop
Fast, parallel and vectorized solver for linear systems with optimal control structure.
Loading...
Searching...
No Matches
matio.cpp File Reference
#include <cyqlone/matio.hpp>
#include <cyqlone/ocp.hpp>
#include <batmat/linalg/copy.hpp>
#include <guanaqo/string-util.hpp>
#include <matio.h>
#include <algorithm>
#include <climits>
#include <concepts>
#include <cstring>
#include <filesystem>
#include <format>
#include <memory>
#include <span>
#include <stdexcept>
#include <vector>

Go to the source code of this file.

Classes

struct  cyqlone::matio_traits< float >
struct  cyqlone::matio_traits< double >
struct  cyqlone::matio_traits< I >

Namespaces

namespace  cyqlone

Typedefs

using cyqlone::MatVarPtr = std::unique_ptr<matvar_t, decltype(&Mat_VarFree)>

Functions

template<class T, size_t N>
MatVarPtr cyqlone::create_tensor_var (const char *name, std::span< const T > buffer, std::array< index_t, N > dims)
template<class T, size_t N>
void cyqlone::write_tensor (mat_t *matfp, const char *name, std::span< const T > buffer, std::array< index_t, N > dims)
MatFilePtr cyqlone::open_mat (const std::filesystem::path &filename, MatioOpenMode mode=MatioOpenMode::Read)
 Opens a .mat file for reading or writing.
MatFilePtr cyqlone::create_mat (const std::filesystem::path &filename)
 Create and open a new .mat file for writing.
template<class T>
void cyqlone::add_to_mat_impl (mat_t *mat, const std::string &varname, guanaqo::MatrixView< const T, index_t > data)
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, float value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, double value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, unsigned short value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, unsigned int value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, unsigned long value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, unsigned long long value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, short value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, int value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, long value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, long long value)
 Add a value to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, guanaqo::MatrixView< const double, index_t > data)
 Add a matrix to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, guanaqo::MatrixView< const float, index_t > data)
 Add a matrix to an open .mat file.
template<class T>
void cyqlone::add_to_mat_impl (mat_t *mat, const std::string &varname, batmat::matrix::View< const T, index_t > data)
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, batmat::matrix::View< const double, index_t > data)
 Add a batch of matrices to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, batmat::matrix::View< const float, index_t > data)
 Add a batch of matrices to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const float > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const double > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const unsigned short > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const unsigned int > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const unsigned long > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const unsigned long long > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const short > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const int > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const long > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, std::span< const long long > data)
 Add a vector to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, const SparseMatrix &matrix)
 Add a sparse matrix to an open .mat file.
void cyqlone::add_to_mat (mat_t *mat, const std::string &varname, const LinearOCPStorage &ocp)
 Add the data from a LinearOCPStorage to an open .mat file.
void cyqlone::validate_mat_var (const matvar_t *var, const std::string &name, int expected_rank)
void cyqlone::read_from_mat (mat_t *mat, const std::string &varname, LinearOCPStorage &ocp)
 Load a LinearOCPStorage from a .mat file.
auto cyqlone::open_vector_var (mat_t *mat, const std::string &varname)
void cyqlone::read_from_mat (mat_t *mat, const std::string &varname, std::span< float > data)
 Load a vector from an open .mat file.
void cyqlone::read_from_mat (mat_t *mat, const std::string &varname, std::span< double > data)
 Load a vector from an open .mat file.
void cyqlone::read_from_mat (mat_t *mat, const std::string &varname, std::vector< float > &data)
 Load a vector from an open .mat file.
void cyqlone::read_from_mat (mat_t *mat, const std::string &varname, std::vector< double > &data)
 Load a vector from an open .mat file.
void cyqlone::ocp_dump_mat (const std::filesystem::path &filename, const LinearOCPStorage &ocp)
 Dump the data from a LinearOCPStorage to a new .mat file.