#include <iostream>
#include <tensor2D.h>

template<typename T>
Tensor2D<T>::Tensor2D(int rows,int cols) {
      r=rows;
      c=cols;
      data = new T*[r];
      for (int i=0;i<r;i++) {
               data[i]=new T[c];
               for (int j=0;j<c;j++) {
                        data[i][j]= new T;
               }
      }
}

template<typename T>
Tensor2D<T>::Tensor2D(const Tensor2D &other) {
        r=other.r;
        c=other.c;
        data=new T*[r]
        for (int i=0;i<r;i++) {
                 data[i]=new T[c];
                 for (int j=0;j<c;j++) {
                          data[i][j]=other.data[i][j];
                 }
        }
}

template<typename T>
T& Tensor2D<T>:: operator=(const Tensor2D &other) {
       if (this==&other)
               return *this;
       delete [] data;
       r=other.r;
       c=other.c;
       data=new T*[r];
       for (int i=0;i<r;i++) {
                data[i]=new T[c];
                for (int j=0;j<c;j++) {
                         data[i][j]=other.data[i][j];
                }
      }
      return *this;

}
   
