Skip to content

Commit

Permalink
Fix compilation on Windows
Browse files Browse the repository at this point in the history
uint -> unsigned int (uint is not in the standard, so compilers
are not required to support it).

Commented out assert on undefined variable, and uncommented
line defining a variable used in a later assertion.
  • Loading branch information
gablank committed Apr 7, 2015
1 parent a8457b6 commit caac607
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/bspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ DenseMatrix BSpline::evalHessian(DenseVector x) const
std::vector<unsigned int> BSpline::getNumBasisFunctions() const
{
std::vector<unsigned int> ret;
for (uint i = 0; i < numVariables; i++)
for (unsigned int i = 0; i < numVariables; i++)
ret.push_back(basis.getNumBasisFunctions(i));
return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions src/bsplinebasis1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,14 @@ std::vector<double> BSplineBasis1D::computeKnotVector(std::vector<double> sample
{
assert(degree >= 1);
assert(samples.size() >= degree + 1);
//uint numSamples = samples.size();
unsigned int numSamples = samples.size();

uint numRemove = degree-1;
for (uint i = 0; i < numRemove; ++i)
unsigned int numRemove = degree-1;
for (unsigned int i = 0; i < numRemove; ++i)
{
// Distance to nearest neighbour
std::vector<double> distVec(samples.size(), 0);
for (uint i = 1; i < samples.size()-1; ++i)
for (unsigned int i = 1; i < samples.size()-1; ++i)
distVec.at(i) = samples.at(i+1) - samples.at(i-1);

auto nn = std::min_element(distVec.begin()+1, distVec.end()-1); // Cannot remove first and last element
Expand Down
2 changes: 1 addition & 1 deletion src/pspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void PSpline::getSecondOrderFiniteDifferenceMatrix(SparseMatrix &D)

// Number of basis functions (and coefficients) in each variable
std::vector<unsigned int> dims;
for (uint i = 0; i < numVariables; i++)
for (unsigned int i = 0; i < numVariables; i++)
dims.push_back(basis.getNumBasisFunctions(i));

std::reverse(dims.begin(), dims.end());
Expand Down
4 changes: 2 additions & 2 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void testSplineDerivative()

double kroneckerTestFunction(DenseVector x)
{
assert(x.rows() == dim);
// assert(x.rows() == dim);

double y = 1 + (.1 + 0.5*x(0) - x(0)*x(0) - 0.33*x(0)*x(0)*x(0))*(.1 + 0.5*x(1) - x(1)*x(1) - 2*x(1)*x(1)*x(1))*(.1 - 0.5*x(2) + x(2)*x(2) + 2*x(2)*x(2)*x(2))*(.1 - 0.5*x(3) + x(3)*x(3) + 2*x(3)*x(3)*x(3));
return y;
Expand Down Expand Up @@ -451,7 +451,7 @@ void localRefinementTest()
DenseMatrix coeffs = DenseMatrix::Ones(1,2);
std::vector<std::vector<double>> knots = {{1,1,1.000000001,1.000000001}};

std::vector<uint> degs = {1};
std::vector<unsigned int> degs = {1};
BSpline bs(coeffs, knots, degs);

/*
Expand Down

0 comments on commit caac607

Please sign in to comment.