<commit_before>#ifndef _ALL_ALGORITHMS_HPP_
#define _ALL_ALGORITHMS_HPP_

#include "common.hpp"
#include "mkl.h"

// New fast algorithms
#include "fast234_20_144.hpp"
#include "fast243_20_144.hpp"
#include "fast322_11_50.hpp"
#include "fast323_15_103.hpp"
#include "fast323_15_89.hpp"
#include "fast324_20_144.hpp"
#include "fast332_15_103.hpp"
#include "fast333_23_125.hpp"
#include "fast333_23_152.hpp"
#include "fast333_23_221.hpp"
#include "fast342_20_144.hpp"
#include "fast422_14_84.hpp"
#include "fast423_20_144.hpp"
#include "fast424_26_206.hpp"
#include "fast424_26_257.hpp"
#include "fast432_20_144.hpp"
#include "fast433_29_234.hpp"
#include "fast442_26_257.hpp"
#include "fast522_18_99.hpp"

// Other fast algorithms and classical algorithms
#include "bini322.hpp"
#include "classical222.hpp"
#include "classical333.hpp"
#include "hk332_15_94.hpp"
#include "hk323_15_84.hpp"
#include "hk323_15_94.hpp"
#include "smirnov333_23_128.hpp"
#include "smirnov333_23_139.hpp"
#include "smirnov336_40_960.hpp"
#include "strassen.hpp"

// All of the algorithms
enum {
  MKL,
  BINI332,
  CLASSICAL222,
  CLASSICAL333,
  SMIRNOV333_23_128,
  SMIRNOV333_23_139,
  SMIRNOV336_40_960,
  HK332_15_94,
  HK323_15_94,
  HK323_15_84,
  STRASSEN,
  FAST322_11_50,
  FAST323_15_103,
  FAST323_15_89,
  FAST332_15_103,
  FAST333_23_125,
  FAST333_23_152,
  FAST333_23_221,
  FAST432_20_144,
  FAST423_20_144,
  FAST324_20_144,
  FAST342_20_144,
  FAST234_20_144,
  FAST243_20_144,
  FAST422_14_84,
  FAST424_26_257,
  FAST424_26_206,
  FAST433_29_234,
  FAST522_18_99,
};


template <typename Scalar>
void RunAlgorithm(int algorithm, Matrix<Scalar>& A, Matrix<Scalar>& B,
				  Matrix<Scalar>& C1, int num_steps) {
    switch (algorithm) {
    case MKL:
      // Just run the classical version with zero steps of recursion.
      classical222_8_24::FastMatmul(A, B, C1, 0);
      break;
    case BINI332:
      bini322::FastMatmul(A, B, C1, num_steps);
      break;
    case CLASSICAL222:
      classical222_8_24::FastMatmul(A, B, C1, num_steps);
      break;
    case CLASSICAL333:
      classical333_27_81::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST322_11_50:
      grey322_11_50::FastMatmul(A, B, C1, num_steps);      
      break;
    case FAST332_15_103:
      grey332_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST323_15_103:
      grey323_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST323_15_89:
      grey323_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_125:
      grey333_23_125::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_152:
      grey333_23_152::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_221:
      grey333_23_221::FastMatmul(A, B, C1, num_steps);
      break;<commit_msg>Add bini as a special case.<commit_after>#ifndef _ALL_ALGORITHMS_HPP_
#define _ALL_ALGORITHMS_HPP_

#include "common.hpp"
#include "mkl.h"

// New fast algorithms
#include "fast234_20_144.hpp"
#include "fast243_20_144.hpp"
#include "fast322_11_50.hpp"
#include "fast323_15_103.hpp"
#include "fast323_15_89.hpp"
#include "fast324_20_144.hpp"
#include "fast332_15_103.hpp"
#include "fast333_23_125.hpp"
#include "fast333_23_152.hpp"
#include "fast333_23_221.hpp"
#include "fast342_20_144.hpp"
#include "fast422_14_84.hpp"
#include "fast423_20_144.hpp"
#include "fast424_26_206.hpp"
#include "fast424_26_257.hpp"
#include "fast432_20_144.hpp"
#include "fast433_29_234.hpp"
#include "fast442_26_257.hpp"
#include "fast522_18_99.hpp"

// Other fast algorithms and classical algorithms
#include "bini322.hpp"
#include "classical222.hpp"
#include "classical333.hpp"
#include "hk332_15_94.hpp"
#include "hk323_15_84.hpp"
#include "hk323_15_94.hpp"
#include "smirnov333_23_128.hpp"
#include "smirnov333_23_139.hpp"
#include "smirnov336_40_960.hpp"
#include "strassen.hpp"

// All of the algorithms
enum {
  MKL,
  BINI332,
  CLASSICAL222,
  CLASSICAL333,
  SMIRNOV333_23_128,
  SMIRNOV333_23_139,
  SMIRNOV336_40_960,
  HK332_15_94,
  HK323_15_94,
  HK323_15_84,
  STRASSEN,
  FAST322_11_50,
  FAST323_15_103,
  FAST323_15_89,
  FAST332_15_103,
  FAST333_23_125,
  FAST333_23_152,
  FAST333_23_221,
  FAST432_20_144,
  FAST423_20_144,
  FAST324_20_144,
  FAST342_20_144,
  FAST234_20_144,
  FAST243_20_144,
  FAST422_14_84,
  FAST424_26_257,
  FAST424_26_206,
  FAST433_29_234,
  FAST522_18_99,
};


template <typename Scalar>
void RunAlgorithm(int algorithm, Matrix<Scalar>& A, Matrix<Scalar>& B,
				  Matrix<Scalar>& C1, int num_steps) {
    switch (algorithm) {
    case MKL:
      // Just run the classical version with zero steps of recursion.
      classical222_8_24::FastMatmul(A, B, C1, 0);
      break;
    case BINI332:
	  double x;
	  // These values of x provide the minimum error, on average.
	  switch (num_steps) {
	  case 2:
		x = 1e-4;
		break;
	  case 3:
		x = 1e-2;
		break;
	  case 4:
		x = 1e-1;
		break;
	  case 0:
	  case 1:
	  default:
		x = 1e-8;
		break;
	  }
      bini322::FastMatmul(A, B, C1, num_steps, x);
      break;
    case CLASSICAL222:
      classical222_8_24::FastMatmul(A, B, C1, num_steps);
      break;
    case CLASSICAL333:
      classical333_27_81::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST322_11_50:
      grey322_11_50::FastMatmul(A, B, C1, num_steps);      
      break;
    case FAST332_15_103:
      grey332_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST323_15_103:
      grey323_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST323_15_89:
      grey323_15_103::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_125:
      grey333_23_125::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_152:
      grey333_23_152::FastMatmul(A, B, C1, num_steps);
      break;
    case FAST333_23_221:
      grey333_23_221::FastMatmul(A, B, C1, num_steps);
      break;
{'fraction_non_alphanumeric': 0.1077184054283291, 'fraction_numerical': 0.18846480067854113, 'mean_word_length': 4.140366172624237, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4305909', 'n_tokens_mistral': 3239, 'n_tokens_neox': 2506, 'n_words': 466}