Boost logo

Ublas :

Subject: Re: [ublas] Slicing
From: Ralf Denzer (Ralf.Denzer_at_[hidden])
Date: 2008-11-28 10:32:17


Hi Markus,

ok, I didn't understood exactly what you are trying to do. Sorry, but anyway

> ublas::row(G, i) = ublas::row(ublas::prod(GF, X), j);
> G and X are dense ublas::matrix<double>. I want to ignore the same columns in G and X. However, I cannot even define an indirect array as suggested via:
> ublas::indirect_array<ublas::matrix_row<ublas::matrix<double> > > g_indices;

Is it possible to use a ublas::project() in your case?

Maybe something like this (untested, I don't know if ublas::project(ublas::row(G, i), ia) ) etc. compiles)

// define an indirect_array with those column indices you are interrested, e.g.
const unsigned n = 3;
ublas::indirect_array<> ia(n);
ia(0) = 1;
ia(1) = 2;
ia(2) = 4;
// and then (but this maybe not what you like to do?)
// "I want to ignore the same columns in G and X" ???
ublas::project(ublas::row(G, i), ia) = ublas::project(ublas::row(ublas::prod(GF, X), j), ia);
// or is it more like this ?
ublas::project(ublas::row(G, i), ia) = ublas::row(ublas::prod(GF, ublas::project(X, ublas::indirect_array<>::all(), ia), j);

I don't know if this compiles and even if so, if it is fast.
Maybe you need to replace 'GF' in 'prod' by
ublas::project(GF, ia, ublas::indirect_array<>::all()) or so.

Ciao

Ralf

____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123