Mentions légales du service

Skip to content
Snippets Groups Projects
Commit deb039b9 authored by hhakim's avatar hhakim
Browse files

Add MatDiag::get_rows()/get_cols() (random rows specified by indices).

The return type is MatSparse because unordered rows/cols don't remain a diagonal matrix.
parent 172039e2
No related branches found
No related tags found
No related merge requests found
...@@ -86,6 +86,14 @@ int main() ...@@ -86,6 +86,14 @@ int main()
cout << "getrows(2,5)" << endl; cout << "getrows(2,5)" << endl;
MatGeneric<FPP,Cpu>* rows = diagMat.get_rows(2,5); MatGeneric<FPP,Cpu>* rows = diagMat.get_rows(2,5);
display_all_elts(*dynamic_cast<MatDiag<FPP>*>(rows)); display_all_elts(*dynamic_cast<MatDiag<FPP>*>(rows));
cout << "get_rows unordered 2, 3, 8" << endl;
faust_unsigned_int rids[3] = {2, 3, 8};
MatGeneric<FPP,Cpu>* sprows = diagMat.get_rows(rids, 3);
display_all_elts(*dynamic_cast<Faust::MatSparse<FPP,Cpu>*>(sprows));
cout << "get_cols unordered 2, 3, 8" << endl;
faust_unsigned_int cids[3] = {2, 3, 8};
MatGeneric<FPP,Cpu>* spcols = diagMat.get_cols(cids, 3);
display_all_elts(*dynamic_cast<Faust::MatSparse<FPP,Cpu>*>(spcols));
cout << "end of test_MatDiag" << endl; cout << "end of test_MatDiag" << endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -165,15 +165,12 @@ MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_rows(faust_unsigned_int row_id_start, fau ...@@ -165,15 +165,12 @@ MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_rows(faust_unsigned_int row_id_start, fau
template<typename FPP> template<typename FPP>
MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_cols(faust_unsigned_int* col_ids, faust_unsigned_int num_cols) const MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_cols(faust_unsigned_int* col_ids, faust_unsigned_int num_cols) const
{ {
//TODO return MatSparse<FPP,Cpu>(*this).get_cols(col_ids, num_cols);
return nullptr;
} }
template<typename FPP> template<typename FPP>
MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_rows(faust_unsigned_int* row_ids, faust_unsigned_int num_rows) const MatGeneric<FPP,Cpu>* MatDiag<FPP>::get_rows(faust_unsigned_int* row_ids, faust_unsigned_int num_rows) const
{ {
//TODO return MatSparse<FPP,Cpu>(*this).get_rows(row_ids, num_rows);
return nullptr;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment