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 vectors y and z and flattens them into an Armadillo matrix surface with three columns. Each row in surface corresponds to a triplet (x, y, z).

Note

The function assumes that y and z have the same structure and size. If the sizes of x, y, and z do not match, the function returns without modifying surface.

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.