Mentions légales du service

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

Add Faust::MatDense::diagonal().

parent b635b646
No related branches found
No related tags found
No related merge requests found
......@@ -474,6 +474,8 @@ void spgemm(const Faust::MatSparse<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> &
*/
Faust::MatDense<FPP,Cpu> upper_tri(const bool diag=true) const;
Faust::Vect<FPP, Cpu> diagonal(int index);
/**
* \brief Returns the nonzeros indices.
*/
......
......@@ -1249,6 +1249,17 @@ Faust::MatDense<FPP, Cpu>* Faust::MatDense<FPP, Cpu>::randMat(faust_unsigned_int
}
return mat;
}
template<typename FPP>
Faust::Vect<FPP,Cpu> Faust::MatDense<FPP, Cpu>::diagonal(int index)
{
FPP data[this->getNbRow()-index];
for(int i=0;i < this->getNbRow()-index; i++)
data[i] = *(this->getData()+i+(this->getNbRow()*(i+index)));
Faust::Vect<FPP,Cpu> diag(this->getNbRow()-index, data);
return diag;
}
#ifdef __COMPILE_TIMERS__
template<typename FPP>
Faust::Timer Faust::MatDense<FPP,Cpu>::t_constr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment