<commit_before>package org.jblas;

import org.jblas.util.LibraryLoader;
import org.jblas.util.Logger;

/**
 * Help class for loading libraries needed for NativeBlas
 *
 * The only use of this class is to have NativeBlas inherit from this class.
 *
 * User: <NAME>
 * Date: 10/24/12
 * Time: 3:15 PM
 */
class NativeBlasLibraryLoader {
  static void loadLibraryAndCheckErrors() {
    try {
      try {
        loadDependentLibraries();
        System.loadLibrary("jblas");
      } catch (UnsatisfiedLinkError e) {
        Logger.getLogger().config(
            "BLAS native library not found in path. Copying native library "
                + "from the archive. Consider installing the library somewhere "
                + "in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH).");
        new LibraryLoader().loadLibrary("jblas", true, false);
      }
      // Let's do some quick tests to see whether we trigger some errors
      // when dependent libraries cannot be found
      double[] a = new double[1];
      NativeBlas.dgemm('N', 'N', 1, 1, 1, 1.0, a, 0, 1, a, 0, 1, 1.0, a, 0, 1);
    } catch (UnsatisfiedLinkError e) {
      String arch = System.getProperty("os.arch");
      String name = System.getProperty("os.name");

      if (name.startsWith("Windows") && e.getMessage().contains("Can't find dependent libraries")) {
        System.err.println("On Windows, you need some additional support libraries.\n" +
          "For example, you can install the two packages in cygwin:\n" +
          "\n" +
          "   mingw64-x86_64-gcc-core   mingw64-x86_64-gfortran\n" +
          "\n" +
          "and add the directory <cygwin-home>\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin to your path.\n\n" +
          "For more information, see http://github.com/mikiobraun/jblas/wiki/Missing-Libraries");
      } else if (name.equals("Linux") && arch.equals("amd64")) {
        System.err.println("On Linux 64bit, you need additional support libraries.\n" +
          "You need to install libgfortran3.\n\n" +
          "For example for debian or Ubuntu, type \"sudo apt-get install libgfortran3\"\n\n" +
          "For more information, see https://github.com/mikiobraun/jblas/wiki/Missing-Libraries");
      }
    }
  }

  public static void loadDependentLibraries() {
    String arch = System.getProperty("os.arch");
    String name = System.getProperty("os.name");

    LibraryLoader loader = new LibraryLoader();

    if (name.startsWith("Windows") && arch.equals("amd64")) {
      loader.loadLibrary("libgcc_s_sjlj-1", false, true);
      loader.loadLibrary("libgfortran-3", false, true);
    } else if (name.equals("Linux") && arch.equals("amd64")) {
      loader.loadLibrary("gfortran", false, true);
    }
  }
}<commit_msg>hm also seems to need libc... which is probably a bit too much of hassle...<commit_after>package org.jblas;

import org.jblas.util.LibraryLoader;
import org.jblas.util.Logger;

/**
 * Help class for loading libraries needed for NativeBlas
 *
 * The only use of this class is to have NativeBlas inherit from this class.
 *
 * User: <NAME>
 * Date: 10/24/12
 * Time: 3:15 PM
 */
class NativeBlasLibraryLoader {
  static void loadLibraryAndCheckErrors() {
    try {
      try {
        loadDependentLibraries();
        System.loadLibrary("jblas");
      } catch (UnsatisfiedLinkError e) {
        Logger.getLogger().config(
            "BLAS native library not found in path. Copying native library "
                + "from the archive. Consider installing the library somewhere "
                + "in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH).");
        new LibraryLoader().loadLibrary("jblas", true, false);
      }
      // Let's do some quick tests to see whether we trigger some errors
      // when dependent libraries cannot be found
      double[] a = new double[1];
      NativeBlas.dgemm('N', 'N', 1, 1, 1, 1.0, a, 0, 1, a, 0, 1, 1.0, a, 0, 1);
    } catch (UnsatisfiedLinkError e) {
      String arch = System.getProperty("os.arch");
      String name = System.getProperty("os.name");

      if (name.startsWith("Windows") && e.getMessage().contains("Can't find dependent libraries")) {
        System.err.println("On Windows, you need some additional support libraries.\n" +
          "For example, you can install the two packages in cygwin:\n" +
          "\n" +
          "   mingw64-x86_64-gcc-core   mingw64-x86_64-gfortran\n" +
          "\n" +
          "and add the directory <cygwin-home>\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin to your path.\n\n" +
          "For more information, see http://github.com/mikiobraun/jblas/wiki/Missing-Libraries");
      } else if (name.equals("Linux") && arch.equals("amd64")) {
        System.err.println("On Linux 64bit, you need additional support libraries.\n" +
          "You need to install libgfortran3.\n\n" +
          "For example for debian or Ubuntu, type \"sudo apt-get install libgfortran3\"\n\n" +
          "For more information, see https://github.com/mikiobraun/jblas/wiki/Missing-Libraries");
      }
    }
  }

  public static void loadDependentLibraries() {
    String arch = System.getProperty("os.arch");
    String name = System.getProperty("os.name");

    LibraryLoader loader = new LibraryLoader();

    if (name.startsWith("Windows") && arch.equals("amd64")) {
      loader.loadLibrary("libgcc_s_sjlj-1", false, true);
      loader.loadLibrary("libgfortran-3", false, true);
    } else if (name.equals("Linux") && arch.equals("amd64")) {
      //loader.loadLibrary("gfortran", false, true);
    }
  }
}
{'fraction_non_alphanumeric': 0.13539791141519625, 'fraction_numerical': 0.01980554555275477, 'mean_word_length': 2.766101694915254, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1081601', 'n_tokens_mistral': 1814, 'n_tokens_neox': 1706, 'n_words': 476}