Re: [eigen] how to create a "virtual" array or matrix? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] how to create a "virtual" array or matrix?
- From: Manuel Yguel <manuel.yguel@xxxxxxxxx>
- Date: Tue, 13 Jul 2010 11:36:21 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=1jq/EO/c7nsmlt+NMBTvKqogdANgdgYAZPr86B8ik0I=; b=cGqEWd+OvdQ4911W7sqKa5dM0wDxAEM+i0oDGsgGuiV2Xp69ha3y4/ZLlO4nHizCA5 Hhb+KTC/RzglEq0ysJ2UfUjiRrs4WiCoTpWXQATmdJ69n1JJoIzZVwqyZz0LMdPkfnf4 5qOq76sqQ8F06cCMNElOAxXHoSn/kOnLF9nx0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=FZsgfYDTr+WF1TPE7Y42Tn85jbXELWn3XbbIMdwYHiCO9ftbh4VFGAmoRNRwy6dWbM asDdm11T2/8vbsYU0OHlRTcYn8MaLn9kTR/T+Zhl81SiC0Qi2s4Bln5H2mzR6Vgfd54Y eJfcD7i8DDesaiNy1nzaCKE0vMgUzv4VlcbWg=
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.
Thanks,
Manuel