Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12
heres this Code: #include "Matrix.h" template <class T> Matrix<T>&#58;&#58;Matrix&#40;&#41; &#123; &#125; template <class T> Matrix<T>&#58;&#58;Matrix&#40;Matrix <T> &copy&#41; &#123; &#125; template <class T> Matrix<T>&#58;&#58;Matrix&#40;int r,int c&#41; &#123; mat.resize&#40;r&#41;; for&#40;int i=0;i<r;i++&#41; &#123; ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux User
    Join Date
    Apr 2003
    Location
    TEXAS
    Posts
    314

    heres this
    Code:
    #include "Matrix.h"
    
    template <class T>
    Matrix<T>&#58;&#58;Matrix&#40;&#41; &#123;
    &#125;
    
    template <class T>
    Matrix<T>&#58;&#58;Matrix&#40;Matrix <T> &copy&#41; &#123;
    &#125;
    
    template <class T>
    Matrix<T>&#58;&#58;Matrix&#40;int r,int c&#41; &#123;
      mat.resize&#40;r&#41;;
      for&#40;int i=0;i<r;i++&#41; &#123;
        mat&#91;i&#93;.resize&#40;c&#41;;
      &#125;
    &#125;
    
    template <class T>
    Matrix<T>&#58;&#58;~Matrix&#40;&#41; &#123;
    &#125;
    
    template <class T>
    Matrix<T>&#58;&#58;Matrix&#40;vector< vector<T> > &v&#41; &#123;
      
    &#125;
    
    template <class T>
    Matrix<T>&#58;&#58;Matrix&#40;T **v,int r,int c&#41; &#123;
      mat.resize&#40;r&#41;;
      for&#40;int i=0;i<r;i++&#41; &#123;
        mat&#91;i&#93;.resize&#40;c&#41;;
      &#125;
      
      for&#40;int i=0;i<r;i++&#41; &#123;
        for&#40;int j=0;j<c;j++&#41; &#123;
          mat&#91;i&#93;&#91;j&#93; = v&#91;i&#93;&#91;j&#93;;
        &#125;
      &#125;
    &#125;
    
    template <class T>
    void 
    Matrix<T>&#58;&#58;Set_Rows&#40;int r&#41; &#123;
      mat.resize&#40;r&#41;;
    &#125;
    
    template <class T>
    void 
    Matrix<T>&#58;&#58;Set_Cols&#40;int c&#41; &#123;
      for&#40;int i=0;i<mat.size&#40;&#41;;i++&#41;
        mat&#91;i&#93;.resize&#40;c&#41;;
    &#125;
    
    template <class T>
    void
    Matrix<T>&#58;&#58;Set&#40;T v,int r,int c&#41; &#123;
      mat&#91;r&#93;&#91;c&#93; = v;
    &#125;
    
    template <class T>
    T&
    Matrix<T>&#58;&#58;Get&#40;int r,int c&#41; const &#123;
      return mat&#91;r&#93;&#91;c&#93;;
    &#125;
    
    template <class T>
    int
    Matrix<T>&#58;&#58;Get_R_Size&#40;&#41; &#123;
      return mat.size&#40;&#41;;
    &#125;
    
    template <class T>
    int
    Matrix<T>&#58;&#58;Get_C_Size&#40;&#41;&#123;
      return mat&#91;0&#93;.size&#40;&#41;;
    &#125;
    
    template <class T>
    void
    Matrix<T>&#58;&#58;Clear&#40;&#41;&#123;
    &#125;
    The computer made me do it!! Slackware and SUSE too Gig\'em WHOOOOP!!
    \"God put me on this earth to accomplish a certain amount of tasks, At the rate I\'m going I will never die.\" (I don\'t know)

  2. #12
    Linux User
    Join Date
    Apr 2003
    Location
    TEXAS
    Posts
    314
    for some strange reason i had to include the matrix.cpp file instead the matrix.h file. anyway i got it to work thanx for the help.
    The computer made me do it!! Slackware and SUSE too Gig\'em WHOOOOP!!
    \"God put me on this earth to accomplish a certain amount of tasks, At the rate I\'m going I will never die.\" (I don\'t know)

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •