From b3b023bfc3d9069285980d5c62984b414e1a2d70 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Thu, 5 Nov 2026 16:43:09 +0100 Subject: [PATCH] float support for tensor --- tensor.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tensor.cc b/tensor.cc index af8842c..6b7428a 100644 --- a/tensor.cc +++ b/tensor.cc @@ -1187,6 +1187,16 @@ std::cout<<"cblas_dgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC< +void auxmatmult(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< void auxmatmult >(int nn, int mm, int kk, std::complex *r, const std::complex *a, const std::complex *b, std::complex alpha, std::complex beta, bool conjugate) { @@ -1197,6 +1207,16 @@ std::cout<<"cblas_zgemm CPU time " << (clock()-t0)/(double)CLOCKS_PER_SEC< +void auxmatmult >(int nn, int mm, int kk, std::complex *r, const std::complex *a, const std::complex *b, std::complex alpha, std::complex 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< @@ -2646,6 +2666,12 @@ template std::ostream & operator<<(std::ostream &s, const Tensor &x); template std::ostream & operator<<(std::ostream &s, const Tensor > &x); template std::istream & operator>>(std::istream &s, Tensor &x); template std::istream & operator>>(std::istream &s, Tensor > &x); +template class Tensor; +template class Tensor >; +template std::ostream & operator<<(std::ostream &s, const Tensor &x); +template std::ostream & operator<<(std::ostream &s, const Tensor > &x); +template std::istream & operator>>(std::istream &s, Tensor &x); +template std::istream & operator>>(std::istream &s, Tensor > &x); }//namespace