<commit_before>#include <fastlib/fastlib.h>
#include <armadillo>
#include "tools.h"

using namespace arma;
using namespace std;


void SpeedTest() {
  u32 k = 100;
  u32 n = 1000;
  
  mat X = randn(k, n);
  uvec rows_to_remove;
  u32 n_to_remove = 5;
  rows_to_remove.set_size(n_to_remove, 1);
  for(u32 i = 0; i < n_to_remove; i++) {
    rows_to_remove(i) = i;
  }


  //X.print("X");
  
  double n_secs_temp;
  double n_secs_mine = 0;
  double n_secs_theirs = 0;

  wall_clock timer;
  
  //start mine
  for(u32 t = 0; t < 1000; t++) {
    timer.tic();
    mat X_mod_mine;
    RemoveRows(X, rows_to_remove, X_mod_mine);
    n_secs_temp = timer.toc();
    n_secs_mine += n_secs_temp;
  }
  // end mine
  
  // start theirs
  for(u32 t = 0; t < 1000; t++) {
    mat X_mod_theirs = X;
    timer.tic();
    X_mod_theirs.shed_row(0);
    for(u32 i = 0; i < n_to_remove; i++) {
      X_mod_theirs.shed_row(rows_to_remove(i) - i);      
    }
    n_secs_temp = timer.toc();
    n_secs_theirs += n_secs_temp;
  }
  // end theirs
  
  //start mine
  for(u32 t = 0; t < 1000; t++) {
    timer.tic();
    mat X_mod_mine;
    RemoveRows(X, rows_to_remove, X_mod_mine);
    n_secs_temp = timer.toc();
    n_secs_mine += n_secs_temp;
  }
  n_secs_mine /= 2000.0;
  // end mine
  
  // start theirs
  for(u32 t = 0; t < 1000; t++) {
    mat X_mod_theirs = X;
    timer.tic();
    for(u32 i = 0; i < n_to_remove; i++) {
      X_mod_theirs.shed_row(rows_to_remove(i) - i);
    }
    n_secs_temp = timer.toc();
    n_secs_theirs += n_secs_temp;
  }
  n_secs_theirs /= 2000.0;
  // end theirs

  printf("mine:\t %e seconds\n", n_secs_mine);
  printf("theirs:\t %e seconds\n", n_secs_theirs);
}



int main(int argc, char* argv[]) {
  SpeedTest();
  return 1;
  mat X = randu(10,3);
  
  uvec rows_to_remove;
  rows_to_remove.set_size(3,1);
  
  
  rows_to_remove(0) = 1;
  rows_to_remove(1) = 3;
  rows_to_remove(2) = 5;
  
  mat X_mod;
  RemoveRows(X, rows_to_remove, X_mod);
  
  X.print("X");
  X_mod.print("X_mod");  
}
<commit_msg>cleaned up test for removerows<commit_after>#include <fastlib/fastlib.h>
#include <armadillo>
#include "tools.h"

using namespace arma;
using namespace std;


void SpeedTest() {
  u32 k = 100;
  u32 n = 1000;
  
  mat X = randn(k, n);
  uvec rows_to_remove;
  u32 n_to_remove = 1;
  rows_to_remove.set_size(n_to_remove, 1);
  for(u32 i = 0; i < n_to_remove; i++) {
    rows_to_remove(i) = i;
  }


  //X.print("X");
  
  double n_secs_temp;
  double n_secs_mine = 0;
  double n_secs_theirs = 0;

  wall_clock timer;
  
  //start mine
  for(u32 t = 0; t < 1000; t++) {
    timer.tic();
    mat X_mod_mine;
    RemoveRows(X, rows_to_remove, X_mod_mine);
    n_secs_temp = timer.toc();
    n_secs_mine += n_secs_temp;
  }
  // end mine
  
  // start theirs
  for(u32 t = 0; t < 1000; t++) {
    mat X_mod_theirs = X;
    timer.tic();
    for(u32 i = 0; i < n_to_remove; i++) {
      X_mod_theirs.shed_row(rows_to_remove(i) - i);      
    }
    n_secs_temp = timer.toc();
    n_secs_theirs += n_secs_temp;
  }
  // end theirs
  
  //start mine
  for(u32 t = 0; t < 1000; t++) {
    timer.tic();
    mat X_mod_mine;
    RemoveRows(X, rows_to_remove, X_mod_mine);
    n_secs_temp = timer.toc();
    n_secs_mine += n_secs_temp;
  }
  n_secs_mine /= 2000.0;
  // end mine
  
  // start theirs
  for(u32 t = 0; t < 1000; t++) {
    mat X_mod_theirs = X;
    timer.tic();
    for(u32 i = 0; i < n_to_remove; i++) {
      X_mod_theirs.shed_row(rows_to_remove(i) - i);
    }
    n_secs_temp = timer.toc();
    n_secs_theirs += n_secs_temp;
  }
  n_secs_theirs /= 2000.0;
  // end theirs

  printf("mine:\t %e seconds\n", n_secs_mine);
  printf("theirs:\t %e seconds\n", n_secs_theirs);
}



int main(int argc, char* argv[]) {
  SpeedTest();
  return 1;

  mat X = randu(10,3);
  
  uvec rows_to_remove;
  rows_to_remove.set_size(3,1);
  
  
  rows_to_remove(0) = 1;
  rows_to_remove(1) = 3;
  rows_to_remove(2) = 5;
  
  mat X_mod;
  RemoveRows(X, rows_to_remove, X_mod);
  
  X.print("X");
  X_mod.print("X_mod");  
}

{'fraction_non_alphanumeric': 0.15044687189672293, 'fraction_numerical': 0.03798411122144985, 'mean_word_length': 2.72365988909427, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '674096', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1815, 'n_words': 367}