Class vector_view_matrix (o2scl)

O2scl : Class List

template<class vec_t, class data_t = double>
class vector_view_matrix

View a vector as a matrix.

9/16/24: This class is used in vec_stats_ts.cpp to test the 2D FFTs.

Public Functions

inline vector_view_matrix(vec_t &v, size_t sz, size_t rows)

Create a matrix view of a vector with size sz.

inline data_t &operator()(size_t i, size_t j)

Return a reference.

inline const data_t &operator()(size_t i, size_t j) const

Return a const reference.

inline size_t size1() const

Return the number of rows.

inline size_t size2() const

Return the number of columns.

inline size_t array_index(size_t i, size_t j) const

Construct an array index from matrix indices.

inline void matrix_indices(size_t ii, size_t &i, size_t &j) const

Construct matrix indices from an array index.

Protected Attributes

vec_t &v_

A reference to the original vector.

size_t sz_

The vector size, equal to rows_ times cols_.

size_t rows_

The size of the first matrix index.

size_t cols_

The size of the second matrix index.