Boost logo

Ublas :

Subject: Re: [ublas] returning a ublas matrix from a function
From: sanann (padalasaisandeep_at_[hidden])
Date: 2014-08-05 09:00:29

The basic thing that i want to do is
1. have a bunch of matrices either in a function or in a class.
2. these would be manipulated and the output needs to be returned inorder to
use it for further manipulation.
3. so assign 3 matrices into an array.
4. now th problem i face is using this array in an external code.

for example.

#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]=
        scalar_matrix<double>(w, h),
        scalar_matrix<double>(w, h),
        scalar_matrix<double>(w, h)
  return M[0];

here i want to have all the matrices stored in array M how do i do that?

int main()

    unsigned w,h;
    w = 3;
    h = 3;


    return 0;

it would be of great help if you can guide me

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