COPP C++ API
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
copp::MatrixView Class Reference

Non-owning view of a two-dimensional double matrix. More...

#include <core.hpp>

Public Member Functions

constexpr MatrixView () noexcept=default
constexpr MatrixView (const double *data, std::size_t rows, std::size_t cols, MatrixLayout layout, std::size_t leading_dim) noexcept
constexpr const double * data () const noexcept
constexpr std::size_t rows () const noexcept
constexpr std::size_t cols () const noexcept
constexpr MatrixLayout layout () const noexcept
constexpr std::size_t leading_dim () const noexcept
constexpr std::size_t storage_size () const noexcept

Static Public Member Functions

static constexpr MatrixView column_major (const double *data, std::size_t rows, std::size_t cols) noexcept
static constexpr MatrixView strided_column_major (const double *data, std::size_t rows, std::size_t cols, std::size_t leading_dim) noexcept
static constexpr MatrixView row_major (const double *data, std::size_t rows, std::size_t cols) noexcept

Detailed Description

Non-owning view of a two-dimensional double matrix.

MatrixView is for input only. It stores pointer, shape, layout, and leading dimension. It never owns memory. For column-major data, leading_dim is the physical stride between two adjacent columns. For row-major data, leading_dim is the physical stride between two adjacent rows.

The logical element (row, col) is interpreted as:

The view only borrows memory; the caller owns the backing data. Functions that need to keep data after the call copy it into Rust-owned storage.

std::vector<double> values{
0.0, 0.0,
0.5, 0.25,
1.0, 1.0,
};
auto row_major = copp::MatrixView::row_major(values.data(), 3, 2);
static constexpr MatrixView row_major(const double *data, std::size_t rows, std::size_t cols) noexcept
Definition core.hpp:234
static Path from_waypoints(MatrixView waypoints, SplineConfig config={})
Build a spline path from waypoint positions.

Definition at line 204 of file core.hpp.

Constructor & Destructor Documentation

◆ MatrixView() [1/2]

copp::MatrixView::MatrixView ( )
constexprdefaultnoexcept

◆ MatrixView() [2/2]

copp::MatrixView::MatrixView ( const double * data,
std::size_t rows,
std::size_t cols,
MatrixLayout layout,
std::size_t leading_dim )
inlineconstexprnoexcept

Definition at line 209 of file core.hpp.

Member Function Documentation

◆ column_major()

constexpr MatrixView copp::MatrixView::column_major ( const double * data,
std::size_t rows,
std::size_t cols )
inlinestaticconstexprnoexcept

Definition at line 217 of file core.hpp.

◆ strided_column_major()

constexpr MatrixView copp::MatrixView::strided_column_major ( const double * data,
std::size_t rows,
std::size_t cols,
std::size_t leading_dim )
inlinestaticconstexprnoexcept

Definition at line 225 of file core.hpp.

◆ row_major()

constexpr MatrixView copp::MatrixView::row_major ( const double * data,
std::size_t rows,
std::size_t cols )
inlinestaticconstexprnoexcept

Definition at line 234 of file core.hpp.

◆ data()

const double * copp::MatrixView::data ( ) const
inlineconstexprnoexcept

Definition at line 242 of file core.hpp.

◆ rows()

std::size_t copp::MatrixView::rows ( ) const
inlineconstexprnoexcept

Definition at line 243 of file core.hpp.

◆ cols()

std::size_t copp::MatrixView::cols ( ) const
inlineconstexprnoexcept

Definition at line 244 of file core.hpp.

◆ layout()

MatrixLayout copp::MatrixView::layout ( ) const
inlineconstexprnoexcept

Definition at line 245 of file core.hpp.

◆ leading_dim()

std::size_t copp::MatrixView::leading_dim ( ) const
inlineconstexprnoexcept

Definition at line 246 of file core.hpp.

◆ storage_size()

std::size_t copp::MatrixView::storage_size ( ) const
inlineconstexprnoexcept

Definition at line 248 of file core.hpp.


The documentation for this class was generated from the following file: