Boost logo

Ublas :

Subject: Re: [ublas] returning a ublas matrix from a function
From: sanann (padalasaisandeep_at_[hidden])
Date: 2014-08-05 07:24:30

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];

    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

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

View this message in context:
Sent from the Boost - uBLAS mailing list archive at