Giter Club home page Giter Club logo

ccvt's People

ccvt's Issues

g++ doesn't like "typedef Site<Point> Site;" in ccvt_optimizer.h

What steps will reproduce the problem?
Compile with g++ versions 4.3 or 4.4

What is the expected output? What do you see instead?
compiling generates the error:
ccvt_optimizer.h:36: error: declaration of ‘typedef struct
ccvt::Site<Point> ccvt::Optimizer<Point, Metric>::Site’


What version of the product are you using? On what operating system?
g++ versions 4.3 or 4.4 on linux

Please provide any additional information below.
Renaming the typedef from Site to PointSite throughout ccvt_optimizer.h and
in main.cpp fixes the problem.

Original issue reported on code.google.com by [email protected] on 17 Jun 2009 at 8:02

compilation and run-time speed problems with nonconstant_density()

What steps will reproduce the problem?
compile with g++ version 4.3 or 4.4

What is the expected output? What do you see instead?
need () around "unsigned int" in the while statement.
RAND_MAX has the value MAX_INT, so adding 1 to it generates and overflow. 
If the value of RAND_MAX was less than MAX_INT, then taking "rand() %
(RAND_MAX + 1)" would be a no-op (since 0 <= rand() <= RAND_MAX), so that
whole expression might as well be left out.


What version of the product are you using? On what operating system?
version 0.1


Please provide any additional information below.
This function is painfully slow when run using the constants provided for
the constant_density() function.  Why not replace it with a different
function that generates the points explicitly as in the constant_density
case?  For instance:

void nonconstant_density(Point2::List& points, const int numberOfPoints,
const double torusSize) {
   double n = sqrt(double(numberOfPoints));
   for (int x = 0; x < n; ++x) {
     double dx = x / n;
     dx = (sin(4 * M_PI * dx) / (8 * M_PI) + dx) * torusSize;
     for (int y = 0; y < n; ++y) {
        double dy = y / n;
        dy = (sin(4 * M_PI * dy) / (8 * M_PI) + dy) * torusSize;
        points.push_back(Point2(dx, dy));
     }
   }
}

Not the same output, but gets the effect across much faster.

Original issue reported on code.google.com by [email protected] on 17 Jun 2009 at 8:15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.