#include <iostream>
#include <vector>   
#include <cmath>
using namespace std;
#include <cblas.h>

// Inner product
double benchmark_A(const vector<double> &x, const vector<double> &y)
{
   
   
    return cblas_ddot(x.size(),x.data(),1,y.data(),1);

}

//Matrix-vector product
vector<double> benchmark_B(const vector<double> &A, const vector<double> &x)
{
    unsigned int N = x.size();
    unsigned int M = A.size() / N;
    vector<double> b(M, 0.0);

    cblas_dgemv(CblasRowMajor,CblasNoTrans,M,N,1,A.data(),N,x.data(),1,0.0,b.data(),1);

    return b;
}


//Matrix-Matrix product
vector<double> benchmark_C(const vector<double> &A, const vector<double> &B, unsigned int M)
{
    unsigned int L = A.size()/M;
    unsigned int N = B.size()/L;
    vector<double> C(M*N,0.0);
    
    cblas_dgemm(CblasRowMajor,CblasNoTrans,CblasNoTrans,M,N,L,1.0,A.data(),L,B.data(),N,0.0,C.data(),N);

    return C;

}



