Skip to content

Commit

Permalink
Insert one more function.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuDutSik committed Jul 22, 2024
1 parent 75eee0f commit 76f3d57
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src_matrix/MAT_Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -2909,6 +2909,25 @@ MyMatrix<T> MatrixFromVectorFamily(std::vector<MyVector<T>> const &ListVect) {
return M;
}

template<typename T>
MyMatrix<T> MatrixFromPairVector(std::pair<MyVector<T>, MyVector<T>> const& pair) {
int n1 = pair.first.size();
int n2 = pair.second.size();
if (n1 != n2) {
std::cerr << "n1=" << n1 << " n2=" << n2 << "\n";
std::cerr << "Vector lengths are not homogeneous\n";
throw TerminalException{1};
}
int n = n1;
MyMatrix<T> M(2,n);
for (int i=0; i<n; i++) {
M(0, i) = pair.first(i);
M(1, i) = pair.second(i);
}
return M;
}


template <typename T>
MyMatrix<T>
MatrixFromVectorFamilyDim(int const &dim,
Expand Down

0 comments on commit 76f3d57

Please sign in to comment.