Thread: solid tutorial suggestion

  1. #31
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Why are you incrementing index twice (a second time after inserting)?

  2. #32
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Which line does the error appear on? (I'm assuming the error was "not dereferencable".) If the error was on the call line, are we sure that it wasn't complaining about bloom (as opposed to searchhash)?

  3. #33
    Registered User
    Join Date
    Sep 2012
    Posts
    86
    int i is to increment through the string2 strings, index is to get a value for each hash function of that string

    The error doesn't appear on a line, during executing it pops up "debug assertion failed" and "vector subscript out of range"

    By placing some cout<< statements the error occurs on the searchhash call line.

    I know its not complaining about bloom because my inserthash function works. Also, search works if I do not return a value and don't declare stringtruth (so all lines with reference not included) its prints out everything else required.

  4. #34
    Registered User
    Join Date
    Sep 2012
    Posts
    86
    Okay, it worked when I took stringtruth.resize out of the loop.

    Now, I'm running into an issue. It's calculating everything as a true positive or false negative when it should have some in the other two... is my logic flawed...

    Code:
    for (i = 0; i < size - 1; i++){
      myset::iterator it = fp.find(vectorString2[i]);
      if (it != fp.end()){
       if (bloomprediction[i] = 1){
        tp++;
       }
       if (bloomprediction[i] = 0){
        fn++;
       }
      }
      else if (it == fp.end()){
       if (bloomprediction[i] = 1){
        fpos++;
       }
       if (bloomprediction[i] = 0){
        tn++;
        cout << "this tn" << tn << endl;
       }
      }
     }

  5. #35
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> for (i = 0; i < size - 1; i++)

    The loop condition should check that i < size, not size-1.

    >> if (bloomprediction[i] = 1)

    Remember: '=' is for assignment, '==' for comparison.
    Last edited by Sebastiani; 10-23-2013 at 08:57 PM.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I have a feeling this movie will be solid win!
    By Cynic in forum General Discussions
    Replies: 16
    Last Post: 03-25-2012, 01:40 AM
  2. Suggestion for the tutorial quizzes answer key.
    By Warrax in forum C++ Programming
    Replies: 1
    Last Post: 04-15-2007, 12:12 PM
  3. Replies: 3
    Last Post: 04-04-2002, 05:27 PM
  4. Direct X + C = Solid App?
    By fatpotatohead in forum Game Programming
    Replies: 1
    Last Post: 09-03-2001, 04:37 PM