home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / c / math_classes.lha / math_classes / matrix / libmatrix / mat_transpose.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-18  |  263 b   |  18 lines

  1. #include "Matrix.h"
  2.  
  3.  
  4. Matrix transpose(const Matrix& m)
  5.     {
  6.     Matrix a(m.cols(),m.rows());
  7.     unsigned int i,j;
  8.     if(m.cols() ==0 || m.rows()==0)error("bad size");
  9.     for (i=1;i<=m.rows();i++)
  10.         {
  11.         for(j=1;j<=m.cols();j++)
  12.             {
  13.             a(j,i)=m(i,j);
  14.             }
  15.         }
  16.     return a;
  17.     }
  18.