[ create a new paste ] login | about

Link: http://codepad.org/EepVDx2C    [ raw code | fork ]

eshamay - C++, pasted on Jun 21:
    using namespace boost::numeric::ublas;
    typedef matrix<double> matrix_t;
    typedef matrix_slice<matrix_t> submatrix;

    class Tensor : public matrix_t {
        
      public:
        Tensor (const int M, const int N) : matrix_t(M, N) { }
        Tensor (const matrix_t& t) : matrix_t(t) { }
        virtual ~Tensor() { }

        submatrix SubMatrix (const int s1, const int e1, const int s2, const int e2) const;

  
        void Print() const;
    
    }; // tensor


    submatrix Tensor::SubMatrix (const int s1, const int e1, const int s2, const int e2) const
    { return submatrix(*this, slice(s1, 1, e1), slice(s2, 1, e2)); }

    void Tensor::Print() const
    { std::cout << *this << std::endl; }


Create a new paste based on this one


Comments: