I have stumbled into something of a bug. I am using MSVC 2010 and boost 1.51.0. When compiling my code I get an error because internally a call is made to square root with an integer argument which has no appropriate overload. Here's a minimal example

#include <iostream>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>
#include <boost/numeric/ublas/io.hpp>

int main()
{
    namespace ublas = boost::numeric::ublas;

    ublas::scalar_matrix<int> A(5,5,1);
    ublas::vector<int> v(5, 0);
    v(0) = 0;
    v(1) = 1;
    v(2) = 2;
    v(3) = 3;
    v(4) = 4;
    ublas::diagonal_matrix<int> D(v.size(), v.data());
    std::cout << A << std::endl;
    std::cout << D << std::endl;

    ublas::matrix<int> result = ublas::prod(A,D);
    std::cout << result << std::endl;
}

It's worth noting that this only fails in a debug build. Defining NDEBUG causes this problem to go away. I'm guessing some sort of dimension checking is done internally and the square root function is templated according to the matrices' value types, but in my case that's an int. What's an appropriate workaround?

Regards,
George