<commit_before>const base = require('./base');
const mats = require('./matrices');


export const integerMethods = base.arithmetic().register(
  require('./integers').methods()
);
export const integers = integerMethods.ops();

export const rationalMethods = integerMethods.register(
  require('./fractions').methods(integers, ['Integer', 'LongInt'], 'Fraction')
);
export const rationals = rationalMethods.ops();

export const matrixMethods = rationalMethods.register(
  mats.methods(rationals, ['Integer', 'LongInt', 'Fraction'], true)
);
export const matrices = matrixMethods.ops();

export const intMatrixMethods = integerMethods.register(
  mats.methods(integers, ['Integer', 'LongInt'], false)
);
export const intMatrices = intMatrixMethods.ops();


export const floatMethods = rationalMethods.register(
  require('./floats').methods(rationals)
);
export const floats = floatMethods.ops();

export const floatMatrixMethods = floatMethods.register(
  mats.methods(floats, ['Integer', 'Float', 'ImpreciseInteger', 'Fraction'],
               true, Math.pow(2, -50))
);
export const floatMatrices = floatMatrixMethods.ops();


if (require.main == module) {
  Array.prototype.toString = function() {
    return '[ ' + this.map(x => x.toString()).join(', ') + ' ]';
  };

  const ops = matrices;

  const V = [1, 2, 3];
  const M = [[1, 2, 3], [4, 5, 6]];

  console.log(ops.shape(V));
  console.log(ops.negative(V));
  console.log(ops.transposed(V));
  console.log(ops.squareNorm(V));
  console.log(ops.plus(V, [3, 2, 1]));
  console.log(ops.plus(V, 2));
  console.log(ops.minus(V, [0, 1, 2]));
  console.log(ops.minus(V, 1));
  console.log(ops.minus(1, V));
  console.log(ops.idiv(V, 2));
  console.log(ops.crossProduct([1, 0, 0], [1, 2, 0]));

  console.log();
  console.log(ops.negative(M));<commit_msg>use new Number.isSafeInteger() method in typeOf()<commit_after>const base = require('./base');
const mats = require('./matrices');


export const integerMethods = base.arithmetic().register(
  require('./integers').methods()
);
export const integers = integerMethods.ops();

export const rationalMethods = integerMethods.register(
  require('./fractions').methods(integers, ['Integer', 'LongInt'], 'Fraction')
);
export const rationals = rationalMethods.ops();

export const matrixMethods = rationalMethods.register(
  mats.methods(rationals, ['Integer', 'LongInt', 'Fraction'], true)
);
export const matrices = matrixMethods.ops();

export const intMatrixMethods = integerMethods.register(
  mats.methods(integers, ['Integer', 'LongInt'], false)
);
export const intMatrices = intMatrixMethods.ops();


export const floatMethods = rationalMethods.register(
  require('./floats').methods(rationals)
);
export const floats = floatMethods.ops();

export const floatMatrixMethods = floatMethods.register(
  mats.methods(floats, ['Integer', 'Float', 'Fraction'], true, Math.pow(2, -50))
);
export const floatMatrices = floatMatrixMethods.ops();


if (require.main == module) {
  Array.prototype.toString = function() {
    return '[ ' + this.map(x => x.toString()).join(', ') + ' ]';
  };

  const ops = matrices;

  const V = [1, 2, 3];
  const M = [[1, 2, 3], [4, 5, 6]];

  console.log(ops.shape(V));
  console.log(ops.negative(V));
  console.log(ops.transposed(V));
  console.log(ops.squareNorm(V));
  console.log(ops.plus(V, [3, 2, 1]));
  console.log(ops.plus(V, 2));
  console.log(ops.minus(V, [0, 1, 2]));
  console.log(ops.minus(V, 1));
  console.log(ops.minus(1, V));
  console.log(ops.idiv(V, 2));
  console.log(ops.crossProduct([1, 0, 0], [1, 2, 0]));

  console.log();
  console.log(ops.negative(M));
{'fraction_non_alphanumeric': 0.18865836791147994, 'fraction_numerical': 0.015491009681881052, 'mean_word_length': 4.976859504132231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2848005', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1162, 'n_words': 261}