|   Registered Member   
 | 
							I am using the minimization routines in the GSL like BFGS and the library makes callbacks to functions passing them a gsl_vector*.  These do not necessarily represent contiguous blocks of memory and thus I don't know how to Map an Eigen matrix on top of them.  Is there a way to make an Eigen matrix out of something that simply supports some set of needed operators, like operator[], size(), etc?  That way I could wrap gsl_vector* with a C++ class and pass that to Eigen.  If not, any suggestions on how to use the GSL with Eigen in these sorts of cases?
						 | 
|   Moderator   
 | 
							You can use a Map with an OuterStride (for matrices), or an InnerStride for vectors with increment != 1, some examples there: http://eigen.tuxfamily.org/dox/classEigen_1_1Map.html | 
|   Registered Member   
 | 
 With a gsl_vector I may not have access to knowing what strides to use. Is there a way I could have a matrix that had some alternative storage method. Suppose I did something silly like storing my matrices in a std::map with keys that are pair<int,int>. Is there a way I could get Eigen to use this storage as the matrix data and wrap it so I could leverage the algorithms and other code expecting a MatrixBase<T>. | 
|   Moderator   
 | 
							To this end you would have to write a matrix expression (i.e., a class inheriting MatrixBase<YourClass> and implementing cols(), rows(), coeff(), coeffRef() with internal::traits<YourClass> properly defined). However don't expect good performance if the storage is too fancy.
						 | 
|   Registered Member   
 | 
 Is there a place where I can see how to properly define internal::traits<MyClass>? | 
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]
 
		 
		 
		 
		