Re: [eigen] how to create a "virtual" array or matrix?

[ Thread Index | Date Index | More Archives ]

Thanks for the answer:

> welcome in Eigen 3.1. If you want to try doing it, you are very
> welcome. Yes, it would be slow because non-vectorizable. The only
> vectorizable case would be the case of contiguous rows/cols but then
> we have Block already for that. So it's OK, in my opinion, to be
> non-vectorizable here.
> The API should look like
>   VectorXi rowIndices(3);
>   rowIndices << 4, 8, 10;
>   VectorXi colIndices(4);
>   rowIndices << 0, 2, 5;
>   MatrixXd matrix(100, 100)
>   matrix.goodFunctionName(rowIndices, colIndices)  // returns a 3x4
I was thinking of the following names:

matrix.operator()( Matrix<int,1,Cols,...>, Matrix<int,1,Cols,...> )
matrix.operator()( Matrix<int,1,Cols,...>, Matrix<int,Rows,1,...> )
matrix.operator()( Matrix<int,Rows,1,...>, Matrix<int,1,Cols,...> )
matrix.operator()( Matrix<int,Rows,1,...>, Matrix<int,Rows,1,...> )

since it is syntaxic sugar, I think it should be ok to force such a
kind of parameters while allowing the nice use of operator()
but it raises the following question:

- does this use of operator() raise any conflict ?

(I think, forcing the use of the scalar int for the parameters, allows
to specialize latter for booleans. Using booleans instead of int has
an other meaning in matlab)

To code this class I take inspiration from class Minor as you suggest
but also class Block.
Reading the code for block, I find something curious.
In the traits for Block is tested if the original matrix expression
has zero rows or zero columns.

                RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows

in Block.h line 72

I do not understand why.
As the usage here is very similar, I would like to understand it to
know if I should test something similar.



Mail converted by MHonArc 2.6.19+