Re: [eigen] combine matrix blocks

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2009/11/27 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> 2009/11/27 Stefan Ulbrich <s.ulbrich@xxxxxxxxxxxxxx>:
>> Hello,
>> thank you for your answer. I managed to fix the error (I had a reference to
>> a temporary variable involved).
>> I think the MatrixView is a nice feature that I'd like to share with other
>> users or to see in a future Eigen release.
>> Is there a place - maybe on the wiki - where one can publish his own
>> plugins?
>
> Hm, we don't have anything like that, and the wiki is not quite the
> right tool anyway, instead what comes closest is patch queues on
> bitbucket.
> See:
> https://bitbucket.org/eigen/eigen/descendants/

....unless of course that is added to Eigen itself. I don't have time
at the moment to enter into another reviewing process, but the best
you could do in that direction is create either a patch queue or a
fork of eigen, with your stuff.

Benoit


>
> Benoit
>
>> best,
>> Stefan
>> Am 27.11.2009 um 00:15vorm. schrieb Gael Guennebaud:
>>
>> I don't really get it, but it seems you want to add a MatrixBase member
>> returning an IndirectView. Then the correct way to write it is:
>>
>> template<typename Derived>
>> class MatrixBase : ......
>> {
>>  // ......
>>
>>   template<typename A, typename B>
>>   IndirectView<Derived,A,B> view(const A& a, const B& b) { return
>> IndirectView<Derived,A,B>(derived(), a, b); }
>>
>> };
>>
>> Does that help ?
>>
>> Also in your code you are mixing IndirectView and MatrixView, but I guess
>> that's just a copy paste typo.
>>
>> gael.
>>
>> On Thu, Nov 26, 2009 at 6:27 PM, Stefan Ulbrich <s.ulbrich@xxxxxxxxxxxxxx>
>> wrote:
>>>
>>> Hello,
>>> sorry for the very long delay, I could not find the time to continue the
>>> work on my project with Eigen.
>>> The matrix view/proxy works quite well (addressing of elements via two
>>> lists of indices). I only have still one problem. I want to hide the
>>> creation of a
>>> matrixview object within a member:
>>> MatrixView<MatrixXd,Dynamic,Dynamic> getView(){
>>> return m_matrix(range1,range2);
>>> }
>>> But it seems that this does not work .. for instance cout<<getView()
>>> gives me an exception in malloc.
>>> Do you have any idea what could go wrong?
>>> Thank you very much!
>>> Best,
>>> Stefan
>>>
>>>
>>> template<typename MatrixType, typename RowType, typename ColType> class
>>> MatrixView
>>> : public MatrixBase<MatrixView<MatrixType, RowType, ColType> >
>>> {
>>> public:
>>> EIGEN_GENERIC_PUBLIC_INTERFACE(IndirectMatrix)
>>> inline IndirectMatrix(const MatrixType& matrix, const RowType &rows, const
>>> ColType &cols)
>>> : m_matrix(matrix), m_rows(rows), m_cols(cols)
>>> {
>>> //std::cout << "Debug: " << m_rows.minCoeff() << "," << m_rows.maxCoeff()
>>> << "," << matrix.rows() << std::endl;
>>> //std::cout << "Debug: " << m_cols.minCoeff() << "," << m_cols.maxCoeff()
>>> << "," << matrix.cols() << std::endl << matrix << std::endl << m_matrix <<
>>> std::endl;
>>> ei_assert(m_rows.minCoeff() >= 0 && m_rows.maxCoeff() < matrix.rows()
>>> && m_cols.minCoeff() >= 0 && m_cols.maxCoeff() < matrix.cols());
>>> }
>>>
>>> EIGEN_INHERIT_ASSIGNMENT_OPERATORS(IndirectMatrix)
>>> inline int rows() const { return m_rows.rows(); }
>>> inline int cols() const { return m_cols.rows(); }
>>> inline Scalar& coeffRef(int row, int col)
>>> {
>>> return m_matrix.const_cast_derived().coeffRef(m_rows(row), m_cols(col));
>>> }
>>> inline const Scalar coeff(int row, int col) const
>>> {
>>> return m_matrix.coeff(m_rows(row), m_cols(col));
>>> }
>>> protected:
>>> const typename MatrixType::Nested m_matrix;
>>> const typename RowType::Nested m_rows;
>>> const typename ColType::Nested m_cols;
>>> };
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/