Re: [eigen] Defining a SparseMatrix with RowMajor

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


Hey,
Maybe you're dealing with and version of Eigen or something, but it
works for me :\

I use this for "isRowMajor" : 
te <typename _Scalar, typename _Index>
bool isRowMajor(Eigen::SparseMatrix<_Scalar, Eigen::RowMajor, _Index>)
{
	return true;
}
	template <typename _Scalar, typename _Index>
bool isRowMajor(Eigen::SparseMatrix<_Scalar, Eigen::ColMajor,
		_Index>)
{
	return false;
}

Cheers,
Michael Tao

On Wed, Sep 26, 2012 at 06:39:05PM +0200, Philipp Berger wrote:
> Hi,
> 
> I've been playing around with Eigens SparseMatrix and am now trying to
> implement an export function to my own SparseMatrix class. As my own
> class uses CSR/CRS plus some additional details, I planned on copying
> the data from the Eigen SM after calling makeCompressed() through
> valuePtr(), innerIndexPtr() and outerIndexPtr().
> 
> But after some tests and many printf's, it seems I am unable to define
> the Eigen SM as RowMajor.
> I used:
> Eigen::SparseMatrix<int, 1> esm(10, 10);
> 
> But the resulting matrix is always ColMajor. What is the correct way to
> define a RowMajor Eigen SparseMatrix? I could not find any hints on that.
> 
> Additionally, I would like to know how I can detect whether a given
> SparseMatrix is RowMajor or ColMajor - there seems to be no function
> like "isRowMajor()", etc. - but that is required for me to export the
> data through valuePtr(), innerIndexPtr() and outerIndexPtr() - or is
> this a misunderstanding on my side?
> 
> Thank you very much, I appreciate your help,
> 
> Philipp
> 





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