float support for tensor
This commit is contained in:
1 parent
c711270e25
commit
b3b023bfc3
1 file changed
+26
@@ -1187,6 +1187,16 @@ std::cout<<"cblas_dgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC<<std::
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void auxmatmult<float>(int nn, int mm, int kk, float *r, const float *a, const float *b, float alpha, float beta, bool conjugate)
|
||||||
|
{
|
||||||
|
clock_t t0=clock();
|
||||||
|
cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, nn, mm, kk, alpha, a, kk, b, kk, beta, r, mm);
|
||||||
|
#ifdef TIMING
|
||||||
|
std::cout<<"cblas_sgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC<<std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void auxmatmult<std::complex<double> >(int nn, int mm, int kk, std::complex<double> *r, const std::complex<double> *a, const std::complex<double> *b, std::complex<double> alpha, std::complex<double> beta, bool conjugate)
|
void auxmatmult<std::complex<double> >(int nn, int mm, int kk, std::complex<double> *r, const std::complex<double> *a, const std::complex<double> *b, std::complex<double> alpha, std::complex<double> beta, bool conjugate)
|
||||||
{
|
{
|
||||||
@@ -1197,6 +1207,16 @@ std::cout<<"cblas_zgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC<<std::
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void auxmatmult<std::complex<float> >(int nn, int mm, int kk, std::complex<float> *r, const std::complex<float> *a, const std::complex<float> *b, std::complex<float> alpha, std::complex<float> beta, bool conjugate)
|
||||||
|
{
|
||||||
|
clock_t t0=clock();
|
||||||
|
cblas_cgemm(CblasRowMajor, CblasNoTrans, (conjugate?CblasConjTrans:CblasTrans), nn, mm, kk, &alpha, a, kk, b, kk, &beta, r, mm);
|
||||||
|
#ifdef TIMING
|
||||||
|
std::cout<<"cblas_cgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC<<std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -2646,6 +2666,12 @@ template std::ostream & operator<<(std::ostream &s, const Tensor<double> &x);
|
|||||||
template std::ostream & operator<<(std::ostream &s, const Tensor<std::complex<double> > &x);
|
template std::ostream & operator<<(std::ostream &s, const Tensor<std::complex<double> > &x);
|
||||||
template std::istream & operator>>(std::istream &s, Tensor<double> &x);
|
template std::istream & operator>>(std::istream &s, Tensor<double> &x);
|
||||||
template std::istream & operator>>(std::istream &s, Tensor<std::complex<double> > &x);
|
template std::istream & operator>>(std::istream &s, Tensor<std::complex<double> > &x);
|
||||||
|
template class Tensor<float>;
|
||||||
|
template class Tensor<std::complex<float> >;
|
||||||
|
template std::ostream & operator<<(std::ostream &s, const Tensor<float> &x);
|
||||||
|
template std::ostream & operator<<(std::ostream &s, const Tensor<std::complex<float> > &x);
|
||||||
|
template std::istream & operator>>(std::istream &s, Tensor<float> &x);
|
||||||
|
template std::istream & operator>>(std::istream &s, Tensor<std::complex<float> > &x);
|
||||||
|
|
||||||
|
|
||||||
}//namespace
|
}//namespace
|
||||||
Reference in new issue
Block a user