Hi all,<br><br>While compiling ITK master, I ran into this error: <br><br>1>D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_c_vector.txx(261) : error C2039: 'arg_max' : is not a member of 'vnl_sse<double>'<br>
1> D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_sse.h(261) : see declaration of 'vnl_sse<double>'<br>1> D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_c_vector.txx(259) : while compiling class template member function 'unsigned int vnl_c_vector<T>::arg_max(const T *,unsigned int)'<br>
1> with<br>1> [<br>1> T=double<br>1> ]<br>1> ..\..\..\..\..\..\..\..\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl\Templates\vnl_c_vector+double-.cxx(3) : see reference to class template instantiation 'vnl_c_vector<T>' being compiled<br>
1> with<br>1> [<br>1> T=double<br>1> ]<br><br>Apparently, vnl_sse<float> and vnl_sse<double> are missing the methods arg_min and arg_max. Adding them proved to be very simple - I simply copied over the generic implementation and specialized it. I'm attaching my patch below.<br>
<br>Could someone take a look and see if this is OK?<br><br>Regards,<br>Shash<br><br>diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h<br>index 5af0f7c..94138a5 100644<br>
-- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h<br>++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h<br>@@ -543,6 +543,27 @@ class vnl_sse<double><br> _mm_store_sd(&ret,min);<br> return ret;<br>
}<br> static VNL_SSE_FORCE_INLINE unsigned arg_max(const double* v, unsigned n)<br> {<br> if (n==0) return unsigned(-1); // the maximum of an empty set is undefined<br> double tmp = *v;<br> unsigned idx = 0;<br> for (unsigned i=1; i<n; ++i)<br>
if (*++v > tmp)<br> tmp = *v, idx = i;<br> return idx;<br> }<br><br> static VNL_SSE_FORCE_INLINE unsigned arg_min(const double* v, unsigned n)<br> {<br> if (n==0) return unsigned(-1); // the minimum of an empty set is undefined<br>
double tmp = *v;<br> unsigned idx = 0;<br> for (unsigned i=1; i<n; ++i)<br> if (*++v < tmp)<br> tmp = *v, idx = i;<br> return idx;<br> }<br>};<br><br>//: SSE2 implementation for single precision floating point (32 bit)<br>
@@ -880,6 +901,27 @@ class vnl_sse<float><br><br> return ret;<br> }<br>static VNL_SSE_FORCE_INLINE unsigned arg_max(const float* v, unsigned n)<br> {<br> if (n==0) return unsigned(-1); // the maximum of an empty set is undefined<br>
float tmp = *v;<br> unsigned idx = 0;<br> for (unsigned i=1; i<n; ++i)<br> if (*++v > tmp)<br> tmp = *v, idx = i;<br> return idx;<br> }<br><br> static VNL_SSE_FORCE_INLINE unsigned arg_min(const float* v, unsigned n)<br>
{<br> if (n==0) return unsigned(-1); // the minimum of an empty set is undefined<br> float tmp = *v;<br> unsigned idx = 0;<br> for (unsigned i=1; i<n; ++i)<br> if (*++v < tmp)<br> tmp = *v, idx = i;<br>
return idx;<br> }<br>};<br><br>#endif // VNL_CONFIG_ENABLE_SSE2<br><br>