SCIInstitute / ShapeWorks

ShapeWorks
http://sciinstitute.github.io/ShapeWorks/
Other
103 stars 32 forks source link

Switch to eigen matrix for inverse covariance matrix to fix #2117 #2118

Closed akenmorris closed 1 year ago

akenmorris commented 1 year ago

The problem seems to be that VNL can't allocate a matrix larger than 2^32 elements. It uses unsigned type (4-bytes) for the number of rows and columns, so the calculation of the allocation:

T* elmns = vnl_c_vector<T>::allocate_T(this->num_rows * this->num_cols);

will overflow when the number of elements exceeds 2^32. For ShapeWorks inverse covariance matrix, this would be a ~34GB matrix.