Template Function otyca::array2
Function Documentation
-
template<typename T>
std::vector<std::array<T, 2>> otyca::array2(const std::vector<T> &x1s, const std::vector<std::vector<T>> &x2s) Combines two vectors into a vector of pairs of values.
This function takes two vectors,
x1s
andx2s
, wherex1s
is a vector of elements, andx2s
is a vector of vectors. It creates a vector of pairs, where each pair consists of an element fromx1s
and an element from each subvector ofx2s
, and returns the resulting vector of pairs.Note
The size of
x2s
must match the size ofx1s
, and the function iterates over each subvector inx2s
, pairing each element with the corresponding element inx1s
.- Template Parameters:
T – The type of elements in the vectors.
- Parameters:
x1s – The first vector containing elements that will form the first part of each pair.
x2s – The second vector containing subvectors, each of which contributes elements to the second part of each pair.
- Returns:
A vector of pairs, where each pair consists of an element from
x1s
and an element from each subvector inx2s
.