Template Function otyca::vector_to_mat
Function Documentation
-
template<typename T>
void otyca::vector_to_mat(const std::vector<T> &x, const std::vector<std::vector<T>> &y, const std::vector<std::vector<T>> &z, arma::Mat<T> &surface) Converts three vectors into an Armadillo matrix representation.
This function takes a vector
x
and two nested vectorsy
andz
and flattens them into an Armadillo matrixsurface
with three columns. Each row insurface
corresponds to a triplet (x, y, z).Note
The function assumes that
y
andz
have the same structure and size. If the sizes ofx
,y
, andz
do not match, the function returns without modifyingsurface
.- Template Parameters:
T – The data type of the elements in the vectors and matrix.
- Parameters:
x – A vector representing the first column of the output matrix.
y – A nested vector where each inner vector corresponds to y-values for a given x.
z – A nested vector where each inner vector corresponds to z-values for a given x.
surface – An output matrix where each row contains (x, y, z) triplets.