Re: returning a ublas matrix from a function

sanann <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <[email protected]>
Thank you. I am just a beginner, i am more used to matlab due to which i get
confused quite quickly. However i slowly came over the problem. but i now
face a new problem if possible for you can explain with a little patience it
would be of great help.


#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

using namespace boost;
using namespace boost::numeric::ublas;


typedef boost::numeric::ublas::matrix<double> BMT;

BMT fun(int w,int h)
  {

    BMT M[3]=
          {
        boost::numeric::ublas::scalar_matrix<double>(w, h),
        boost::numeric::ublas::scalar_matrix<double>(w, h),
        boost::numeric::ublas::scalar_matrix<double>(w, h)
    };

  return M[2];
  }

int main()
{

    unsigned w,h;
    w = 2;
    h = 2;
    boost::numeric::ublas::scalar_matrix<double> Z[3];
    Z[3]=fun(w,h);

    std::cout<<fun&lt;&lt;std::endl;
    return 0;
}

and I end up with error: no match for 'operator=' (operand types are
'boost::numeric::ublas::scalar_matrix&lt;double>' and 'BMT {aka
boost::numeric::ublas::matrix<double>}')
     Z[3]=fun(w,h);
         ^

is my approach correct or have I misunderstood something?
thanks in advance



--
View this message in context: http://boost.2283326.n4.nabble.com/returning-a-ublas-matrix-from-a-function-tp4666050p4666061.html
Sent from the Boost - uBLAS mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.