diff --git a/src/entry/deprecatedAny.js b/src/entry/deprecatedAny.js index 843cf14ff..b57fb00df 100644 --- a/src/entry/deprecatedAny.js +++ b/src/entry/deprecatedAny.js @@ -63,7 +63,7 @@ import { typeOf, Unit, variance -} from './functionsAny' +} from './functionsAny.generated' import { AccessorNode, ArrayNode, diff --git a/src/entry/evaluateAny.js b/src/entry/evaluateAny.js index 4b7023b6d..5df7a522b 100644 --- a/src/entry/evaluateAny.js +++ b/src/entry/evaluateAny.js @@ -2,6 +2,7 @@ // a circular reference between math -> evaluate -> simplify -> evaluate // so it is impure. +import { config } from './configReadonly' import { createApplyTransform } from '../expression/transform/apply.transform' import { createColumnTransform } from '../expression/transform/column.transform' import { createConcatTransform } from '../expression/transform/concat.transform' @@ -99,7 +100,6 @@ import { composition, concat, conductanceQuantum, - config, conj, cos, cosh, @@ -318,7 +318,7 @@ import { xgcd, xor, zeros -} from './functionsAny' +} from './functionsAny.generated' const math = {} // NOT pure! const mathWithTransform = {} // NOT pure! diff --git a/src/entry/evaluateNumber.js b/src/entry/evaluateNumber.js index c0da884c7..2770b00ca 100644 --- a/src/entry/evaluateNumber.js +++ b/src/entry/evaluateNumber.js @@ -1,3 +1,4 @@ +import { config } from './configReadonly' import { e, phi, pi, tau } from '../plain/number' import { version } from '../version' import { createApplyTransform } from '../expression/transform/apply.transform' @@ -79,7 +80,6 @@ import { compareNatural, compareText, composition, - config, cos, cosh, cot, @@ -179,7 +179,7 @@ import { unaryMinus, unaryPlus, unequal, variance, xgcd, xor -} from './functionsNumber' +} from './functionsNumber.generated' const math = {} // NOT pure! const mathWithTransform = {} // NOT pure! diff --git a/src/entry/functionsAny.generated.js b/src/entry/functionsAny.generated.js new file mode 100644 index 000000000..685aa86e9 --- /dev/null +++ b/src/entry/functionsAny.generated.js @@ -0,0 +1,550 @@ +/** + * THIS FILE IS AUTO-GENERATED + * DON'T MAKE CHANGES HERE + */ +import { config } from './configReadonly' +import { + createResultSet, + createComplexClass, + createRangeClass, + createEye, + createFalse, + createNull, + createTrue, + createBigNumberClass, + createMatrixClass, + createE, + createI, + createLN10, + createLOG10E, + createNaN, + createPi, + createSQRT1_2, // eslint-disable-line camelcase + createTau, + createEfimovFactor, + createFineStructure, + createSackurTetrode, + createWeakMixingAngle, + createFractionClass, + createLN2, + createPhi, + createSQRT2, + createDenseMatrixClass, + createInfinity, + createTyped, + createIsInteger, + createIsNumeric, + createIsPositive, + createIsNaN, + createEqualScalar, + createNumber, + createBoolean, + createComplex, + createSplitUnit, + createUnaryPlus, + createApply, + createCube, + createExpm1, + createLog10, + createMultiplyScalar, + createSign, + createSquare, + createBitNot, + createArg, + createIm, + createNot, + createFilter, + createForEach, + createMap, + createErf, + createFormat, + createIsPrime, + createAcos, + createAcot, + createAcsc, + createAsec, + createAsin, + createAtan, + createAtanh, + createCosh, + createCoth, + createCsch, + createSech, + createSinh, + createTanh, + createCombinations, + createPickRandom, + createRandomInt, + createLOG2E, + createClone, + createHasNumericValue, + createTypeOf, + createString, + createFraction, + createUnaryMinus, + createAddScalar, + createExp, + createLog2, + createSqrt, + createConj, + createGetMatrixDataType, + createMode, + createPrint, + createAcosh, + createAcsch, + createAsinh, + createCos, + createCsc, + createSin, + createVersion, + createIsNegative, + createSparseMatrixClass, + createMatrix, + createCbrt, + createGcd, + createMod, + createNthRoot, + createXgcd, + createBitAnd, + createBitXor, + createOr, + createConcat, + createDiag, + createIdentity, + createOnes, + createReshape, + createSize, + createSubset, + createZeros, + createTo, + createRound, + createLeftShift, + createRightLogShift, + createCompare, + createCompareText, + createSmaller, + createLarger, + createUnequal, + createMax, + createImmutableDenseMatrixClass, + createFibonacciHeapClass, + createSparse, + createAcoth, + createAtan2, + createSec, + createAdd, + createTrace, + createRandom, + createComposition, + createIsZero, + createAbs, + createFloor, + createMultiply, + createDotMultiply, + createRe, + createFlatten, + createResize, + createSqueeze, + createProd, + createPow, + createDotPow, + createRightArithShift, + createCompareNatural, + createEqualText, + createLargerEq, + createPartitionSelect, + createMin, + createSpaClass, + createAsech, + createTan, + createSetSize, + createNorm, + createQuantileSeq, + createGamma, + createBignumber, + createLcm, + createBitOr, + createKron, + createTranspose, + createNumeric, + createAnd, + createSmallerEq, + createSort, + createCot, + createDot, + createSum, + createFactorial, + createPermutations, + createCeil, + createSubtract, + createCross, + createCtranspose, + createEqual, + createIndexClass, + createSetCartesian, + createSetDistinct, + createSetIsSubset, + createSetPowerset, + createIndex, + createFix, + createRange, + createDivideScalar, + createNthRoots, + createLsolve, + createDeepEqual, + createSetDifference, + createSetMultiplicity, + createHypot, + createLup, + createSlu, + createDet, + createDistance, + createStirlingS2, + createCatalan, + createXor, + createRow, + createDotDivide, + createUnitClass, + createCreateUnit, + createSetSymDifference, + createQr, + createInv, + createSqrtm, + createIntersect, + createBellNumbers, + createAtomicMass, + createBohrMagneton, + createBoltzmann, + createConductanceQuantum, + createDeuteronMass, + createElectronMass, + createFaraday, + createFirstRadiation, + createGravitationConstant, + createHartreeEnergy, + createKlitzing, + createMagneticConstant, + createMolarMass, + createMolarPlanckConstant, + createNeutronMass, + createPlanckCharge, + createPlanckLength, + createPlanckTemperature, + createProtonMass, + createReducedPlanckConstant, + createSecondRadiation, + createStefanBoltzmann, + createVacuumImpedance, + createColumn, + createUsolve, + createSetIntersect, + createLusolve, + createExpm, + createAvogadro, + createClassicalElectronRadius, + createElectricConstant, + createFermiCoupling, + createGravity, + createLoschmidt, + createMolarMassC12, + createNuclearMagneton, + createPlanckMass, + createQuantumOfCirculation, + createSpeedOfLight, + createWienDisplacement, + createLog, + createUnitFunction, + createDivide, + createMedian, + createVariance, + createStd, + createMultinomial, + createBohrRadius, + createElementaryCharge, + createInverseConductanceQuantum, + createMolarVolume, + createPlanckTime, + createThomsonCrossSection, + createLog1p, + createMean, + createGasConstant, + createPlanckConstant, + createSetUnion, + createKldivergence, + createCoulomb, + createRydberg, + createMad, + createMagneticFluxQuantum +} from '../factoriesAny' + +export const ResultSet = /* #__PURE__ */ createResultSet({}) +export const Complex = /* #__PURE__ */ createComplexClass({}) +export const Range = /* #__PURE__ */ createRangeClass({}) +export const eye = /* #__PURE__ */ createEye({}) +export const _false = /* #__PURE__ */ createFalse({}) +export const _null = /* #__PURE__ */ createNull({}) +export const _true = /* #__PURE__ */ createTrue({}) +export const BigNumber = /* #__PURE__ */ createBigNumberClass({ config }) +export const Matrix = /* #__PURE__ */ createMatrixClass({}) +export const e = /* #__PURE__ */ createE({ BigNumber, config }) +export const i = /* #__PURE__ */ createI({ Complex }) +export const LN10 = /* #__PURE__ */ createLN10({ BigNumber, config }) +export const LOG10E = /* #__PURE__ */ createLOG10E({ BigNumber, config }) +export const _NaN = /* #__PURE__ */ createNaN({ BigNumber, config }) +export const pi = /* #__PURE__ */ createPi({ BigNumber, config }) +export const SQRT1_2 = /* #__PURE__ */ createSQRT1_2({ BigNumber, config }) +export const tau = /* #__PURE__ */ createTau({ BigNumber, config }) +export const efimovFactor = /* #__PURE__ */ createEfimovFactor({ BigNumber, config }) +export const fineStructure = /* #__PURE__ */ createFineStructure({ BigNumber, config }) +export const sackurTetrode = /* #__PURE__ */ createSackurTetrode({ BigNumber, config }) +export const weakMixingAngle = /* #__PURE__ */ createWeakMixingAngle({ BigNumber, config }) +export const Fraction = /* #__PURE__ */ createFractionClass({}) +export const LN2 = /* #__PURE__ */ createLN2({ BigNumber, config }) +export const phi = /* #__PURE__ */ createPhi({ BigNumber, config }) +export const SQRT2 = /* #__PURE__ */ createSQRT2({ BigNumber, config }) +export const DenseMatrix = /* #__PURE__ */ createDenseMatrixClass({ Matrix }) +export const _Infinity = /* #__PURE__ */ createInfinity({ BigNumber, config }) +export const typed = /* #__PURE__ */ createTyped({ BigNumber, Complex, DenseMatrix, Fraction }) +export const isInteger = /* #__PURE__ */ createIsInteger({ typed }) +export const isNumeric = /* #__PURE__ */ createIsNumeric({ typed }) +export const isPositive = /* #__PURE__ */ createIsPositive({ typed }) +export const isNaN = /* #__PURE__ */ createIsNaN({ typed }) +export const equalScalar = /* #__PURE__ */ createEqualScalar({ config, typed }) +export const number = /* #__PURE__ */ createNumber({ typed }) +export const boolean = /* #__PURE__ */ createBoolean({ typed }) +export const complex = /* #__PURE__ */ createComplex({ Complex, typed }) +export const splitUnit = /* #__PURE__ */ createSplitUnit({ typed }) +export const unaryPlus = /* #__PURE__ */ createUnaryPlus({ BigNumber, config, typed }) +export const apply = /* #__PURE__ */ createApply({ isInteger, typed }) +export const cube = /* #__PURE__ */ createCube({ typed }) +export const expm1 = /* #__PURE__ */ createExpm1({ Complex, typed }) +export const log10 = /* #__PURE__ */ createLog10({ Complex, config, typed }) +export const multiplyScalar = /* #__PURE__ */ createMultiplyScalar({ typed }) +export const sign = /* #__PURE__ */ createSign({ BigNumber, Fraction, typed }) +export const square = /* #__PURE__ */ createSquare({ typed }) +export const bitNot = /* #__PURE__ */ createBitNot({ typed }) +export const arg = /* #__PURE__ */ createArg({ typed }) +export const im = /* #__PURE__ */ createIm({ typed }) +export const not = /* #__PURE__ */ createNot({ typed }) +export const filter = /* #__PURE__ */ createFilter({ typed }) +export const forEach = /* #__PURE__ */ createForEach({ typed }) +export const map = /* #__PURE__ */ createMap({ typed }) +export const erf = /* #__PURE__ */ createErf({ typed }) +export const format = /* #__PURE__ */ createFormat({ typed }) +export const isPrime = /* #__PURE__ */ createIsPrime({ typed }) +export const acos = /* #__PURE__ */ createAcos({ Complex, config, typed }) +export const acot = /* #__PURE__ */ createAcot({ BigNumber, typed }) +export const acsc = /* #__PURE__ */ createAcsc({ BigNumber, Complex, config, typed }) +export const asec = /* #__PURE__ */ createAsec({ BigNumber, Complex, config, typed }) +export const asin = /* #__PURE__ */ createAsin({ Complex, config, typed }) +export const atan = /* #__PURE__ */ createAtan({ typed }) +export const atanh = /* #__PURE__ */ createAtanh({ Complex, config, typed }) +export const cosh = /* #__PURE__ */ createCosh({ typed }) +export const coth = /* #__PURE__ */ createCoth({ BigNumber, typed }) +export const csch = /* #__PURE__ */ createCsch({ BigNumber, typed }) +export const sech = /* #__PURE__ */ createSech({ BigNumber, typed }) +export const sinh = /* #__PURE__ */ createSinh({ typed }) +export const tanh = /* #__PURE__ */ createTanh({ typed }) +export const combinations = /* #__PURE__ */ createCombinations({ typed }) +export const pickRandom = /* #__PURE__ */ createPickRandom({ config, typed }) +export const randomInt = /* #__PURE__ */ createRandomInt({ config, typed }) +export const LOG2E = /* #__PURE__ */ createLOG2E({ BigNumber, config }) +export const clone = /* #__PURE__ */ createClone({ typed }) +export const hasNumericValue = /* #__PURE__ */ createHasNumericValue({ isNumeric, typed }) +export const typeOf = /* #__PURE__ */ createTypeOf({ typed }) +export const string = /* #__PURE__ */ createString({ typed }) +export const fraction = /* #__PURE__ */ createFraction({ Fraction, typed }) +export const unaryMinus = /* #__PURE__ */ createUnaryMinus({ typed }) +export const addScalar = /* #__PURE__ */ createAddScalar({ typed }) +export const exp = /* #__PURE__ */ createExp({ typed }) +export const log2 = /* #__PURE__ */ createLog2({ Complex, config, typed }) +export const sqrt = /* #__PURE__ */ createSqrt({ Complex, config, typed }) +export const conj = /* #__PURE__ */ createConj({ typed }) +export const getMatrixDataType = /* #__PURE__ */ createGetMatrixDataType({ typed }) +export const mode = /* #__PURE__ */ createMode({ isNaN, isNumeric, typed }) +export const print = /* #__PURE__ */ createPrint({ typed }) +export const acosh = /* #__PURE__ */ createAcosh({ Complex, config, typed }) +export const acsch = /* #__PURE__ */ createAcsch({ BigNumber, typed }) +export const asinh = /* #__PURE__ */ createAsinh({ typed }) +export const cos = /* #__PURE__ */ createCos({ typed }) +export const csc = /* #__PURE__ */ createCsc({ BigNumber, typed }) +export const sin = /* #__PURE__ */ createSin({ typed }) +export const version = /* #__PURE__ */ createVersion({}) +export const isNegative = /* #__PURE__ */ createIsNegative({ typed }) +export const SparseMatrix = /* #__PURE__ */ createSparseMatrixClass({ Matrix, equalScalar, typed }) +export const matrix = /* #__PURE__ */ createMatrix({ DenseMatrix, Matrix, SparseMatrix, typed }) +export const cbrt = /* #__PURE__ */ createCbrt({ BigNumber, Complex, Fraction, config, isNegative, matrix, typed, unaryMinus }) +export const gcd = /* #__PURE__ */ createGcd({ BigNumber, DenseMatrix, equalScalar, matrix, typed }) +export const mod = /* #__PURE__ */ createMod({ DenseMatrix, equalScalar, matrix, typed }) +export const nthRoot = /* #__PURE__ */ createNthRoot({ BigNumber, equalScalar, matrix, typed }) +export const xgcd = /* #__PURE__ */ createXgcd({ BigNumber, config, matrix, typed }) +export const bitAnd = /* #__PURE__ */ createBitAnd({ equalScalar, matrix, typed }) +export const bitXor = /* #__PURE__ */ createBitXor({ DenseMatrix, matrix, typed }) +export const or = /* #__PURE__ */ createOr({ DenseMatrix, equalScalar, matrix, typed }) +export const concat = /* #__PURE__ */ createConcat({ isInteger, matrix, typed }) +export const diag = /* #__PURE__ */ createDiag({ DenseMatrix, SparseMatrix, matrix, typed }) +export const identity = /* #__PURE__ */ createIdentity({ BigNumber, DenseMatrix, SparseMatrix, config, matrix, typed }) +export const ones = /* #__PURE__ */ createOnes({ BigNumber, config, matrix, typed }) +export const reshape = /* #__PURE__ */ createReshape({ isInteger, matrix, typed }) +export const size = /* #__PURE__ */ createSize({ config, matrix, typed }) +export const subset = /* #__PURE__ */ createSubset({ matrix, typed }) +export const zeros = /* #__PURE__ */ createZeros({ BigNumber, config, matrix, typed }) +export const to = /* #__PURE__ */ createTo({ matrix, typed }) +export const round = /* #__PURE__ */ createRound({ BigNumber, DenseMatrix, equalScalar, matrix, typed, zeros }) +export const leftShift = /* #__PURE__ */ createLeftShift({ DenseMatrix, equalScalar, matrix, typed, zeros }) +export const rightLogShift = /* #__PURE__ */ createRightLogShift({ DenseMatrix, equalScalar, matrix, typed, zeros }) +export const compare = /* #__PURE__ */ createCompare({ BigNumber, DenseMatrix, Fraction, config, equalScalar, matrix, typed }) +export const compareText = /* #__PURE__ */ createCompareText({ matrix, typed }) +export const smaller = /* #__PURE__ */ createSmaller({ DenseMatrix, config, matrix, typed }) +export const larger = /* #__PURE__ */ createLarger({ DenseMatrix, config, matrix, typed }) +export const unequal = /* #__PURE__ */ createUnequal({ DenseMatrix, config, equalScalar, matrix, typed }) +export const max = /* #__PURE__ */ createMax({ larger, typed }) +export const ImmutableDenseMatrix = /* #__PURE__ */ createImmutableDenseMatrixClass({ DenseMatrix, smaller }) +export const FibonacciHeap = /* #__PURE__ */ createFibonacciHeapClass({ larger, smaller }) +export const sparse = /* #__PURE__ */ createSparse({ SparseMatrix, typed }) +export const acoth = /* #__PURE__ */ createAcoth({ BigNumber, Complex, config, typed }) +export const atan2 = /* #__PURE__ */ createAtan2({ BigNumber, DenseMatrix, equalScalar, matrix, typed }) +export const sec = /* #__PURE__ */ createSec({ BigNumber, typed }) +export const add = /* #__PURE__ */ createAdd({ DenseMatrix, SparseMatrix, addScalar, equalScalar, matrix, typed }) +export const trace = /* #__PURE__ */ createTrace({ add, matrix, typed }) +export const random = /* #__PURE__ */ createRandom({ config, matrix, typed }) +export const composition = /* #__PURE__ */ createComposition({ addScalar, combinations, isInteger, isNegative, isPositive, larger, typed }) +export const isZero = /* #__PURE__ */ createIsZero({ typed }) +export const abs = /* #__PURE__ */ createAbs({ typed }) +export const floor = /* #__PURE__ */ createFloor({ config, round, typed }) +export const multiply = /* #__PURE__ */ createMultiply({ addScalar, equalScalar, matrix, multiplyScalar, typed }) +export const dotMultiply = /* #__PURE__ */ createDotMultiply({ equalScalar, matrix, multiplyScalar, typed }) +export const re = /* #__PURE__ */ createRe({ typed }) +export const flatten = /* #__PURE__ */ createFlatten({ matrix, typed }) +export const resize = /* #__PURE__ */ createResize({ config, matrix }) +export const squeeze = /* #__PURE__ */ createSqueeze({ matrix, typed }) +export const prod = /* #__PURE__ */ createProd({ multiply, typed }) +export const pow = /* #__PURE__ */ createPow({ Complex, config, fraction, identity, matrix, multiply, number, typed }) +export const dotPow = /* #__PURE__ */ createDotPow({ DenseMatrix, equalScalar, matrix, pow, typed }) +export const rightArithShift = /* #__PURE__ */ createRightArithShift({ DenseMatrix, equalScalar, matrix, typed, zeros }) +export const compareNatural = /* #__PURE__ */ createCompareNatural({ compare, typed }) +export const equalText = /* #__PURE__ */ createEqualText({ compareText, isZero, typed }) +export const largerEq = /* #__PURE__ */ createLargerEq({ DenseMatrix, config, matrix, typed }) +export const partitionSelect = /* #__PURE__ */ createPartitionSelect({ compare, isNaN, isNumeric, typed }) +export const min = /* #__PURE__ */ createMin({ smaller, typed }) +export const Spa = /* #__PURE__ */ createSpaClass({ FibonacciHeap, addScalar, equalScalar }) +export const asech = /* #__PURE__ */ createAsech({ BigNumber, Complex, config, typed }) +export const tan = /* #__PURE__ */ createTan({ typed }) +export const setSize = /* #__PURE__ */ createSetSize({ compareNatural, typed }) +export const norm = /* #__PURE__ */ createNorm({ abs, add, conj, equalScalar, larger, matrix, multiply, pow, smaller, sqrt, typed }) +export const quantileSeq = /* #__PURE__ */ createQuantileSeq({ add, compare, multiply, partitionSelect, typed }) +export const gamma = /* #__PURE__ */ createGamma({ BigNumber, Complex, config, multiplyScalar, pow, typed }) +export const bignumber = /* #__PURE__ */ createBignumber({ BigNumber, typed }) +export const lcm = /* #__PURE__ */ createLcm({ equalScalar, matrix, typed }) +export const bitOr = /* #__PURE__ */ createBitOr({ DenseMatrix, equalScalar, matrix, typed }) +export const kron = /* #__PURE__ */ createKron({ matrix, multiplyScalar, typed }) +export const transpose = /* #__PURE__ */ createTranspose({ matrix, typed }) +export const numeric = /* #__PURE__ */ createNumeric({ bignumber, fraction, number }) +export const and = /* #__PURE__ */ createAnd({ equalScalar, matrix, not, typed, zeros }) +export const smallerEq = /* #__PURE__ */ createSmallerEq({ DenseMatrix, config, matrix, typed }) +export const sort = /* #__PURE__ */ createSort({ compare, compareNatural, matrix, typed }) +export const cot = /* #__PURE__ */ createCot({ BigNumber, typed }) +export const dot = /* #__PURE__ */ createDot({ add, multiply, typed }) +export const sum = /* #__PURE__ */ createSum({ bignumber, fraction, add, config, typed }) +export const factorial = /* #__PURE__ */ createFactorial({ gamma, typed }) +export const permutations = /* #__PURE__ */ createPermutations({ factorial, typed }) +export const ceil = /* #__PURE__ */ createCeil({ config, round, typed }) +export const subtract = /* #__PURE__ */ createSubtract({ DenseMatrix, addScalar, equalScalar, matrix, typed, unaryMinus }) +export const cross = /* #__PURE__ */ createCross({ matrix, multiply, subtract, typed }) +export const ctranspose = /* #__PURE__ */ createCtranspose({ conj, transpose, typed }) +export const equal = /* #__PURE__ */ createEqual({ DenseMatrix, equalScalar, matrix, typed }) +export const Index = /* #__PURE__ */ createIndexClass({ ImmutableDenseMatrix }) +export const setCartesian = /* #__PURE__ */ createSetCartesian({ DenseMatrix, Index, compareNatural, size, subset, typed }) +export const setDistinct = /* #__PURE__ */ createSetDistinct({ DenseMatrix, Index, compareNatural, size, subset, typed }) +export const setIsSubset = /* #__PURE__ */ createSetIsSubset({ Index, compareNatural, size, subset, typed }) +export const setPowerset = /* #__PURE__ */ createSetPowerset({ Index, compareNatural, size, subset, typed }) +export const index = /* #__PURE__ */ createIndex({ Index, typed }) +export const fix = /* #__PURE__ */ createFix({ Complex, ceil, floor, typed }) +export const range = /* #__PURE__ */ createRange({ bignumber, matrix, config, larger, largerEq, smaller, smallerEq, typed }) +export const divideScalar = /* #__PURE__ */ createDivideScalar({ numeric, typed }) +export const nthRoots = /* #__PURE__ */ createNthRoots({ Complex, config, divideScalar, typed }) +export const lsolve = /* #__PURE__ */ createLsolve({ DenseMatrix, divideScalar, equalScalar, matrix, multiplyScalar, subtract, typed }) +export const deepEqual = /* #__PURE__ */ createDeepEqual({ equal, typed }) +export const setDifference = /* #__PURE__ */ createSetDifference({ DenseMatrix, Index, compareNatural, size, subset, typed }) +export const setMultiplicity = /* #__PURE__ */ createSetMultiplicity({ Index, compareNatural, size, subset, typed }) +export const hypot = /* #__PURE__ */ createHypot({ abs, addScalar, divideScalar, isPositive, multiplyScalar, smaller, sqrt, typed }) +export const lup = /* #__PURE__ */ createLup({ DenseMatrix, Spa, SparseMatrix, abs, addScalar, divideScalar, equalScalar, larger, matrix, multiplyScalar, subtract, typed, unaryMinus }) +export const slu = /* #__PURE__ */ createSlu({ SparseMatrix, abs, add, divideScalar, larger, largerEq, multiply, subtract, transpose, typed }) +export const det = /* #__PURE__ */ createDet({ lup, matrix, multiply, subtract, typed, unaryMinus }) +export const distance = /* #__PURE__ */ createDistance({ abs, addScalar, divideScalar, multiplyScalar, sqrt, subtract, typed, unaryMinus }) +export const stirlingS2 = /* #__PURE__ */ createStirlingS2({ addScalar, combinations, divideScalar, factorial, isInteger, isNegative, larger, multiplyScalar, pow, subtract, typed }) +export const catalan = /* #__PURE__ */ createCatalan({ addScalar, combinations, divideScalar, isInteger, isNegative, multiplyScalar, typed }) +export const xor = /* #__PURE__ */ createXor({ DenseMatrix, matrix, typed }) +export const row = /* #__PURE__ */ createRow({ Index, matrix, range, typed }) +export const dotDivide = /* #__PURE__ */ createDotDivide({ DenseMatrix, divideScalar, equalScalar, matrix, typed }) +export const Unit = /* #__PURE__ */ createUnitClass({ BigNumber, Complex, Fraction, abs, addScalar, config, divideScalar, equal, fix, format, isNumeric, multiplyScalar, number, pow, round, subtract }) +export const createUnit = /* #__PURE__ */ createCreateUnit({ Unit, typed }) +export const setSymDifference = /* #__PURE__ */ createSetSymDifference({ Index, concat, setDifference, size, subset, typed }) +export const qr = /* #__PURE__ */ createQr({ addScalar, conj, divideScalar, identity, isZero, matrix, multiplyScalar, sign, sqrt, subtract, typed, unaryMinus, unequal, zeros }) +export const inv = /* #__PURE__ */ createInv({ abs, addScalar, det, divideScalar, identity, matrix, multiply, typed, unaryMinus }) +export const sqrtm = /* #__PURE__ */ createSqrtm({ abs, add, identity, inv, max, multiply, size, sqrt, subtract, typed }) +export const intersect = /* #__PURE__ */ createIntersect({ abs, add, addScalar, config, divideScalar, equalScalar, matrix, multiply, multiplyScalar, smaller, subtract, typed }) +export const bellNumbers = /* #__PURE__ */ createBellNumbers({ addScalar, isInteger, isNegative, stirlingS2, typed }) +export const atomicMass = /* #__PURE__ */ createAtomicMass({ BigNumber, Unit, config }) +export const bohrMagneton = /* #__PURE__ */ createBohrMagneton({ BigNumber, Unit, config }) +export const boltzmann = /* #__PURE__ */ createBoltzmann({ BigNumber, Unit, config }) +export const conductanceQuantum = /* #__PURE__ */ createConductanceQuantum({ BigNumber, Unit, config }) +export const deuteronMass = /* #__PURE__ */ createDeuteronMass({ BigNumber, Unit, config }) +export const electronMass = /* #__PURE__ */ createElectronMass({ BigNumber, Unit, config }) +export const faraday = /* #__PURE__ */ createFaraday({ BigNumber, Unit, config }) +export const firstRadiation = /* #__PURE__ */ createFirstRadiation({ BigNumber, Unit, config }) +export const gravitationConstant = /* #__PURE__ */ createGravitationConstant({ BigNumber, Unit, config }) +export const hartreeEnergy = /* #__PURE__ */ createHartreeEnergy({ BigNumber, Unit, config }) +export const klitzing = /* #__PURE__ */ createKlitzing({ BigNumber, Unit, config }) +export const magneticConstant = /* #__PURE__ */ createMagneticConstant({ BigNumber, Unit, config }) +export const molarMass = /* #__PURE__ */ createMolarMass({ BigNumber, Unit, config }) +export const molarPlanckConstant = /* #__PURE__ */ createMolarPlanckConstant({ BigNumber, Unit, config }) +export const neutronMass = /* #__PURE__ */ createNeutronMass({ BigNumber, Unit, config }) +export const planckCharge = /* #__PURE__ */ createPlanckCharge({ BigNumber, Unit, config }) +export const planckLength = /* #__PURE__ */ createPlanckLength({ BigNumber, Unit, config }) +export const planckTemperature = /* #__PURE__ */ createPlanckTemperature({ BigNumber, Unit, config }) +export const protonMass = /* #__PURE__ */ createProtonMass({ BigNumber, Unit, config }) +export const reducedPlanckConstant = /* #__PURE__ */ createReducedPlanckConstant({ BigNumber, Unit, config }) +export const secondRadiation = /* #__PURE__ */ createSecondRadiation({ BigNumber, Unit, config }) +export const stefanBoltzmann = /* #__PURE__ */ createStefanBoltzmann({ BigNumber, Unit, config }) +export const vacuumImpedance = /* #__PURE__ */ createVacuumImpedance({ BigNumber, Unit, config }) +export const column = /* #__PURE__ */ createColumn({ Index, matrix, range, typed }) +export const usolve = /* #__PURE__ */ createUsolve({ DenseMatrix, divideScalar, equalScalar, matrix, multiplyScalar, subtract, typed }) +export const setIntersect = /* #__PURE__ */ createSetIntersect({ DenseMatrix, Index, compareNatural, size, subset, typed }) +export const lusolve = /* #__PURE__ */ createLusolve({ DenseMatrix, lsolve, lup, matrix, slu, typed, usolve }) +export const expm = /* #__PURE__ */ createExpm({ abs, add, identity, inv, multiply, typed }) +export const avogadro = /* #__PURE__ */ createAvogadro({ BigNumber, Unit, config }) +export const classicalElectronRadius = /* #__PURE__ */ createClassicalElectronRadius({ BigNumber, Unit, config }) +export const electricConstant = /* #__PURE__ */ createElectricConstant({ BigNumber, Unit, config }) +export const fermiCoupling = /* #__PURE__ */ createFermiCoupling({ BigNumber, Unit, config }) +export const gravity = /* #__PURE__ */ createGravity({ BigNumber, Unit, config }) +export const loschmidt = /* #__PURE__ */ createLoschmidt({ BigNumber, Unit, config }) +export const molarMassC12 = /* #__PURE__ */ createMolarMassC12({ BigNumber, Unit, config }) +export const nuclearMagneton = /* #__PURE__ */ createNuclearMagneton({ BigNumber, Unit, config }) +export const planckMass = /* #__PURE__ */ createPlanckMass({ BigNumber, Unit, config }) +export const quantumOfCirculation = /* #__PURE__ */ createQuantumOfCirculation({ BigNumber, Unit, config }) +export const speedOfLight = /* #__PURE__ */ createSpeedOfLight({ BigNumber, Unit, config }) +export const wienDisplacement = /* #__PURE__ */ createWienDisplacement({ BigNumber, Unit, config }) +export const log = /* #__PURE__ */ createLog({ Complex, config, divideScalar, typed }) +export const unit = /* #__PURE__ */ createUnitFunction({ Unit, typed }) +export const divide = /* #__PURE__ */ createDivide({ divideScalar, equalScalar, inv, matrix, multiply, typed }) +export const median = /* #__PURE__ */ createMedian({ add, compare, divide, partitionSelect, typed }) +export const variance = /* #__PURE__ */ createVariance({ add, apply, divide, isNaN, multiply, subtract, typed }) +export const std = /* #__PURE__ */ createStd({ sqrt, typed, variance }) +export const multinomial = /* #__PURE__ */ createMultinomial({ add, divide, factorial, isInteger, isPositive, multiply, typed }) +export const bohrRadius = /* #__PURE__ */ createBohrRadius({ BigNumber, Unit, config }) +export const elementaryCharge = /* #__PURE__ */ createElementaryCharge({ BigNumber, Unit, config }) +export const inverseConductanceQuantum = /* #__PURE__ */ createInverseConductanceQuantum({ BigNumber, Unit, config }) +export const molarVolume = /* #__PURE__ */ createMolarVolume({ BigNumber, Unit, config }) +export const planckTime = /* #__PURE__ */ createPlanckTime({ BigNumber, Unit, config }) +export const thomsonCrossSection = /* #__PURE__ */ createThomsonCrossSection({ BigNumber, Unit, config }) +export const log1p = /* #__PURE__ */ createLog1p({ Complex, config, divideScalar, log, typed }) +export const mean = /* #__PURE__ */ createMean({ add, divide, typed }) +export const gasConstant = /* #__PURE__ */ createGasConstant({ BigNumber, Unit, config }) +export const planckConstant = /* #__PURE__ */ createPlanckConstant({ BigNumber, Unit, config }) +export const setUnion = /* #__PURE__ */ createSetUnion({ Index, concat, setIntersect, setSymDifference, size, subset, typed }) +export const kldivergence = /* #__PURE__ */ createKldivergence({ divide, dotDivide, isNumeric, log, matrix, multiply, sum, typed }) +export const coulomb = /* #__PURE__ */ createCoulomb({ BigNumber, Unit, config }) +export const rydberg = /* #__PURE__ */ createRydberg({ BigNumber, Unit, config }) +export const mad = /* #__PURE__ */ createMad({ abs, map, median, subtract, typed }) +export const magneticFluxQuantum = /* #__PURE__ */ createMagneticFluxQuantum({ BigNumber, Unit, config }) diff --git a/src/entry/functionsAny.js b/src/entry/functionsAny.js deleted file mode 100644 index 5bd08e0d7..000000000 --- a/src/entry/functionsAny.js +++ /dev/null @@ -1,696 +0,0 @@ -// TODO: auto generate this file - -import { createResultSet } from '../type/resultset/ResultSet' -import { createBigNumberClass } from '../type/bignumber/BigNumber' -import { createComplexClass } from '../type/complex/Complex' -import { createFractionClass } from '../type/fraction/Fraction' -import { createRangeClass } from '../type/matrix/Range' -import { createMatrixClass } from '../type/matrix/Matrix' -import { createDenseMatrixClass } from '../type/matrix/DenseMatrix' -import { createTyped } from '../core/function/typed' -import { createClone } from '../function/utils/clone' -import { createIsInteger } from '../function/utils/isInteger' -import { createIsNegative } from '../function/utils/isNegative' -import { createIsNumeric } from '../function/utils/isNumeric' -import { createHasNumericValue } from '../function/utils/hasNumericValue' -import { createIsPositive } from '../function/utils/isPositive' -import { createIsZero } from '../function/utils/isZero' -import { createIsNaN } from '../function/utils/isNaN' -import { createTypeOf } from '../function/utils/typeOf' -import { createEqualScalar } from '../function/relational/equalScalar' -import { createSparseMatrixClass } from '../type/matrix/SparseMatrix' -import { createNumber } from '../type/number' -import { createString } from '../type/string' -import { createBoolean } from '../type/boolean' -import { createBignumber } from '../type/bignumber/function/bignumber' -import { createComplex } from '../type/complex/function/complex' -import { createFraction } from '../type/fraction/function/fraction' -import { createMatrix } from '../type/matrix/function/matrix' -import { createSplitUnit } from '../type/unit/function/splitUnit' -import { createUnaryMinus } from '../function/arithmetic/unaryMinus' -import { createUnaryPlus } from '../function/arithmetic/unaryPlus' -import { createAbs } from '../function/arithmetic/abs' -import { createAddScalar } from '../function/arithmetic/addScalar' -import { createCbrt } from '../function/arithmetic/cbrt' -import { createCeil } from '../function/arithmetic/ceil' -import { createCube } from '../function/arithmetic/cube' -import { createExp } from '../function/arithmetic/exp' -import { createExpm1 } from '../function/arithmetic/expm1' -import { createFix } from '../function/arithmetic/fix' -import { createFloor } from '../function/arithmetic/floor' -import { createGcd } from '../function/arithmetic/gcd' -import { createLcm } from '../function/arithmetic/lcm' -import { createLog10 } from '../function/arithmetic/log10' -import { createLog2 } from '../function/arithmetic/log2' -import { createMod } from '../function/arithmetic/mod' -import { createMultiplyScalar } from '../function/arithmetic/multiplyScalar' -import { createMultiply } from '../function/arithmetic/multiply' -import { createNthRoot } from '../function/arithmetic/nthRoot' -import { createSign } from '../function/arithmetic/sign' -import { createSqrt } from '../function/arithmetic/sqrt' -import { createSquare } from '../function/arithmetic/square' -import { createSubtract } from '../function/arithmetic/subtract' -import { createXgcd } from '../function/arithmetic/xgcd' -import { createDotMultiply } from '../function/arithmetic/dotMultiply' -import { createBitAnd } from '../function/bitwise/bitAnd' -import { createBitNot } from '../function/bitwise/bitNot' -import { createBitOr } from '../function/bitwise/bitOr' -import { createBitXor } from '../function/bitwise/bitXor' -import { createArg } from '../function/complex/arg' -import { createConj } from '../function/complex/conj' -import { createIm } from '../function/complex/im' -import { createRe } from '../function/complex/re' -import { createNot } from '../function/logical/not' -import { createOr } from '../function/logical/or' -import { createXor } from '../function/logical/xor' -import { createConcat } from '../function/matrix/concat' -import { createCross } from '../function/matrix/cross' -import { createDiag } from '../function/matrix/diag' -import { createEye } from '../function/matrix/eye' -import { createFilter } from '../function/matrix/filter' -import { createFlatten } from '../function/matrix/flatten' -import { createForEach } from '../function/matrix/forEach' -import { createGetMatrixDataType } from '../function/matrix/getMatrixDataType' -import { createIdentity } from '../function/matrix/identity' -import { createKron } from '../function/matrix/kron' -import { createMap } from '../function/matrix/map' -import { createOnes } from '../function/matrix/ones' -import { createRange } from '../function/matrix/range' -import { createReshape } from '../function/matrix/reshape' -import { createResize } from '../function/matrix/resize' -import { createSize } from '../function/matrix/size' -import { createSqueeze } from '../function/matrix/squeeze' -import { createSubset } from '../function/matrix/subset' -import { createTranspose } from '../function/matrix/transpose' -import { createCtranspose } from '../function/matrix/ctranspose' -import { createZeros } from '../function/matrix/zeros' -import { createErf } from '../function/special/erf' -import { createMode } from '../function/statistics/mode' -import { createProd } from '../function/statistics/prod' -import { createFormat } from '../function/string/format' -import { createPrint } from '../function/string/print' -import { createTo } from '../function/unit/to' -import { createIsPrime } from '../function/utils/isPrime' -import { createNumeric } from '../function/utils/numeric' -import { createDivideScalar } from '../function/arithmetic/divideScalar' -import { createPow } from '../function/arithmetic/pow' -import { createRound } from '../function/arithmetic/round' -import { createLog } from '../function/arithmetic/log' -import { createLog1p } from '../function/arithmetic/log1p' -import { createNthRoots } from '../function/arithmetic/nthRoots' -import { createDotPow } from '../function/arithmetic/dotPow' -import { createDotDivide } from '../function/arithmetic/dotDivide' -import { createLsolve } from '../function/algebra/solver/lsolve' -import { createUsolve } from '../function/algebra/solver/usolve' -import { createLeftShift } from '../function/bitwise/leftShift' -import { createRightArithShift } from '../function/bitwise/rightArithShift' -import { createRightLogShift } from '../function/bitwise/rightLogShift' -import { createAnd } from '../function/logical/and' -import { createCompare } from '../function/relational/compare' -import { createCompareNatural } from '../function/relational/compareNatural' -import { createCompareText } from '../function/relational/compareText' -import { createEqual } from '../function/relational/equal' -import { createEqualText } from '../function/relational/equalText' -import { createSmaller } from '../function/relational/smaller' -import { createSmallerEq } from '../function/relational/smallerEq' -import { createLarger } from '../function/relational/larger' -import { createLargerEq } from '../function/relational/largerEq' -import { createDeepEqual } from '../function/relational/deepEqual' -import { createUnequal } from '../function/relational/unequal' -import { createPartitionSelect } from '../function/matrix/partitionSelect' -import { createSort } from '../function/matrix/sort' -import { createMax } from '../function/statistics/max' -import { createMin } from '../function/statistics/min' -import { createImmutableDenseMatrixClass } from '../type/matrix/ImmutableDenseMatrix' -import { createIndexClass } from '../type/matrix/MatrixIndex' -import { createFibonacciHeapClass } from '../type/matrix/FibonacciHeap' -import { createSpaClass } from '../type/matrix/Spa' -import { createUnitClass } from '../type/unit/Unit' -import { createUnitFunction } from '../type/unit/function/unit' -import { createSparse } from '../type/matrix/function/sparse' -import { createCreateUnit } from '../type/unit/function/createUnit' -import { createAcos } from '../function/trigonometry/acos' -import { createAcosh } from '../function/trigonometry/acosh' -import { createAcot } from '../function/trigonometry/acot' -import { createAcoth } from '../function/trigonometry/acoth' -import { createAcsc } from '../function/trigonometry/acsc' -import { createAcsch } from '../function/trigonometry/acsch' -import { createAsec } from '../function/trigonometry/asec' -import { createAsech } from '../function/trigonometry/asech' -import { createAsin } from '../function/trigonometry/asin' -import { createAsinh } from '../function/trigonometry/asinh' -import { createAtan } from '../function/trigonometry/atan' -import { createAtan2 } from '../function/trigonometry/atan2' -import { createAtanh } from '../function/trigonometry/atanh' -import { createCos } from '../function/trigonometry/cos' -import { createCosh } from '../function/trigonometry/cosh' -import { createCot } from '../function/trigonometry/cot' -import { createCoth } from '../function/trigonometry/coth' -import { createCsc } from '../function/trigonometry/csc' -import { createCsch } from '../function/trigonometry/csch' -import { createSec } from '../function/trigonometry/sec' -import { createSech } from '../function/trigonometry/sech' -import { createSin } from '../function/trigonometry/sin' -import { createSinh } from '../function/trigonometry/sinh' -import { createTan } from '../function/trigonometry/tan' -import { createTanh } from '../function/trigonometry/tanh' -import { createSetCartesian } from '../function/set/setCartesian' -import { createSetDifference } from '../function/set/setDifference' -import { createSetDistinct } from '../function/set/setDistinct' -import { createSetIntersect } from '../function/set/setIntersect' -import { createSetIsSubset } from '../function/set/setIsSubset' -import { createSetMultiplicity } from '../function/set/setMultiplicity' -import { createSetPowerset } from '../function/set/setPowerset' -import { createSetSize } from '../function/set/setSize' -import { createSetSymDifference } from '../function/set/setSymDifference' -import { createSetUnion } from '../function/set/setUnion' -import { createAdd } from '../function/arithmetic/add' -import { createHypot } from '../function/arithmetic/hypot' -import { createNorm } from '../function/arithmetic/norm' -import { createDot } from '../function/matrix/dot' -import { createTrace } from '../function/matrix/trace' -import { createIndex } from '../type/matrix/function' -import { createLup } from '../function/algebra/decomposition/lup' -import { createQr } from '../function/algebra/decomposition/qr' -import { createSlu } from '../function/algebra/decomposition/slu' -import { createLusolve } from '../function/algebra/solver/lusolve' -import { createDet } from '../function/matrix/det' -import { createInv } from '../function/matrix/inv' -import { createExpm } from '../function/matrix/expm' -import { createSqrtm } from '../function/matrix/sqrtm' -import { createDivide } from '../function/arithmetic/divide' -import { createDistance } from '../function/geometry/distance' -import { createIntersect } from '../function/geometry/intersect' -import { createSum } from '../function/statistics/sum' -import { createMean } from '../function/statistics/mean' -import { createMedian } from '../function/statistics/median' -import { createMad } from '../function/statistics/mad' -import { createVariance } from '../function/statistics/variance' -import { createQuantileSeq } from '../function/statistics/quantileSeq' -import { createStd } from '../function/statistics/std' -import { createCombinations } from '../function/probability/combinations' -import { createGamma } from '../function/probability/gamma' -import { createFactorial } from '../function/probability/factorial' -import { createKldivergence } from '../function/probability/kldivergence' -import { createMultinomial } from '../function/probability/multinomial' -import { createPermutations } from '../function/probability/permutations' -import { createPickRandom } from '../function/probability/pickRandom' -import { createRandom } from '../function/probability/random' -import { createRandomInt } from '../function/probability/randomInt' -import { createStirlingS2 } from '../function/combinatorics/stirlingS2' -import { createBellNumbers } from '../function/combinatorics/bellNumbers' -import { createCatalan } from '../function/combinatorics/catalan' -import { createComposition } from '../function/combinatorics/composition' -import { - createE, - createFalse, - createI, - createInfinity, - createLN10, - createLN2, - createLOG10E, - createLOG2E, - createNaN, - createNull, - createPhi, - createPi, - createSQRT1_2, // eslint-disable-line camelcase - createSQRT2, - createTau, - createTrue, - createVersion -} from '../constants' -import { - createAtomicMass, - createAvogadro, - createBohrMagneton, - createBohrRadius, - createBoltzmann, - createClassicalElectronRadius, - createConductanceQuantum, - createCoulomb, - createDeuteronMass, - createEfimovFactor, - createElectricConstant, - createElectronMass, - createElementaryCharge, - createFaraday, - createFermiCoupling, - createFineStructure, - createFirstRadiation, - createGasConstant, - createGravitationConstant, - createGravity, - createHartreeEnergy, - createInverseConductanceQuantum, - createKlitzing, - createLoschmidt, - createMagneticConstant, - createMagneticFluxQuantum, - createMolarMass, - createMolarMassC12, - createMolarPlanckConstant, - createMolarVolume, - createNeutronMass, - createNuclearMagneton, - createPlanckCharge, - createPlanckConstant, - createPlanckLength, - createPlanckMass, - createPlanckTemperature, - createPlanckTime, - createProtonMass, - createQuantumOfCirculation, - createReducedPlanckConstant, - createRydberg, - createSackurTetrode, - createSecondRadiation, - createSpeedOfLight, - createStefanBoltzmann, - createThomsonCrossSection, - createVacuumImpedance, - createWeakMixingAngle, - createWienDisplacement -} from '../type/unit/physicalConstants' -import { createApply } from '../function/matrix/apply' -import { createColumn } from '../function/matrix/column' -import { createRow } from '../function/matrix/row' -import { config } from './configReadonly' - -// ---------------------------------------------------------------------------- -// read-only config - -export { config } from './configReadonly' - -// ---------------------------------------------------------------------------- -// classes and functions - -// class (1) -export const ResultSet = /* #__PURE__ */ createResultSet() -export const BigNumber = /* #__PURE__ */ createBigNumberClass({ config }) -export const Complex = /* #__PURE__ */ createComplexClass() -export const Fraction = /* #__PURE__ */ createFractionClass() -export const Range = /* #__PURE__ */ createRangeClass() -export const Matrix = /* #__PURE__ */ createMatrixClass() -export const DenseMatrix = /* #__PURE__ */ createDenseMatrixClass({ Matrix }) - -// core (1) -export const typed = /* #__PURE__ */ createTyped({ BigNumber, Complex, Fraction, DenseMatrix }) - -// utils (1) -export const clone = /* #__PURE__ */ createClone({ typed }) -export const isInteger = /* #__PURE__ */ createIsInteger({ typed }) -export const isNegative = /* #__PURE__ */ createIsNegative({ typed }) -export const isNumeric = /* #__PURE__ */ createIsNumeric({ typed }) -export const hasNumericValue = /* #__PURE__ */ createHasNumericValue({ typed, isNumeric }) -export const isPositive = /* #__PURE__ */ createIsPositive({ typed }) -export const isZero = /* #__PURE__ */ createIsZero({ typed }) -export const isNaN = /* #__PURE__ */ createIsNaN({ typed }) -export const typeOf = /* #__PURE__ */ createTypeOf({ typed }) - -// relational (1) -export const equalScalar = /* #__PURE__ */ createEqualScalar({ config, typed }) - -// classes (1.1) -export const SparseMatrix = /* #__PURE__ */ createSparseMatrixClass({ typed, equalScalar, Matrix }) - -// create (1) -export const number = /* #__PURE__ */ createNumber({ typed }) -export const string = /* #__PURE__ */ createString({ typed }) -export const boolean = /* #__PURE__ */ createBoolean({ typed }) -export const bignumber = /* #__PURE__ */ createBignumber({ typed, BigNumber }) -export const complex = /* #__PURE__ */ createComplex({ typed, Complex }) -export const fraction = /* #__PURE__ */ createFraction({ typed, Fraction }) -export const matrix = /* #__PURE__ */ createMatrix({ typed, Matrix, DenseMatrix, SparseMatrix }) -export const splitUnit = /* #__PURE__ */ createSplitUnit({ typed }) - -// arithmetic (1) -export const unaryMinus = /* #__PURE__ */ createUnaryMinus({ typed }) -export const unaryPlus = /* #__PURE__ */ createUnaryPlus({ config, typed, BigNumber }) -export const abs = /* #__PURE__ */ createAbs({ typed }) -export const addScalar = /* #__PURE__ */ createAddScalar({ typed }) -export const cbrt = /* #__PURE__ */ createCbrt({ config, typed, isNegative, unaryMinus, matrix, Complex, BigNumber, Fraction }) -export const cube = /* #__PURE__ */ createCube({ typed }) -export const exp = /* #__PURE__ */ createExp({ typed }) -export const expm1 = /* #__PURE__ */ createExpm1({ typed, Complex }) -export const gcd = /* #__PURE__ */ createGcd({ typed, matrix, equalScalar, BigNumber, DenseMatrix }) -export const lcm = /* #__PURE__ */ createLcm({ typed, matrix, equalScalar }) -export const log10 = /* #__PURE__ */ createLog10({ config, typed, Complex }) -export const log2 = /* #__PURE__ */ createLog2({ config, typed, Complex }) -export const mod = /* #__PURE__ */ createMod({ typed, matrix, equalScalar, DenseMatrix }) -export const multiplyScalar = /* #__PURE__ */ createMultiplyScalar({ typed }) -export const multiply = /* #__PURE__ */ createMultiply({ typed, matrix, addScalar, multiplyScalar, equalScalar }) -export const nthRoot = /* #__PURE__ */ createNthRoot({ typed, matrix, equalScalar, BigNumber }) -export const sign = /* #__PURE__ */ createSign({ typed, BigNumber, Fraction }) -export const sqrt = /* #__PURE__ */ createSqrt({ config, typed, Complex }) -export const square = /* #__PURE__ */ createSquare({ typed }) -export const subtract = /* #__PURE__ */ createSubtract({ typed, matrix, equalScalar, addScalar, unaryMinus, DenseMatrix }) -export const xgcd = /* #__PURE__ */ createXgcd({ config, typed, matrix, BigNumber }) -export const dotMultiply = /* #__PURE__ */ createDotMultiply({ typed, matrix, equalScalar, multiplyScalar }) - -// bitwise (1) -export const bitAnd = /* #__PURE__ */ createBitAnd({ typed, matrix, equalScalar }) -export const bitNot = /* #__PURE__ */ createBitNot({ typed }) -export const bitOr = /* #__PURE__ */ createBitOr({ typed, matrix, equalScalar, DenseMatrix }) -export const bitXor = /* #__PURE__ */ createBitXor({ typed, matrix, DenseMatrix }) - -// complex (1) -export const arg = /* #__PURE__ */ createArg({ typed }) -export const conj = /* #__PURE__ */ createConj({ typed }) -export const im = /* #__PURE__ */ createIm({ typed }) -export const re = /* #__PURE__ */ createRe({ typed }) - -// logical (1) -export const not = /* #__PURE__ */ createNot({ typed }) -export const or = /* #__PURE__ */ createOr({ typed, matrix, equalScalar, DenseMatrix }) -export const xor = /* #__PURE__ */ createXor({ typed, matrix, DenseMatrix }) - -// matrix (1) -export const apply = /* #__PURE__ */ createApply({ typed, isInteger }) -export const concat = /* #__PURE__ */ createConcat({ typed, matrix, isInteger }) -export const cross = /* #__PURE__ */ createCross({ typed, matrix, subtract, multiply }) -export const diag = /* #__PURE__ */ createDiag({ typed, matrix, DenseMatrix, SparseMatrix }) -export const eye = /* #__PURE__ */ createEye({ typed, matrix }) -export const filter = /* #__PURE__ */ createFilter({ typed }) -export const flatten = /* #__PURE__ */ createFlatten({ typed, matrix }) -export const forEach = /* #__PURE__ */ createForEach({ typed }) -export const getMatrixDataType = /* #__PURE__ */ createGetMatrixDataType({ typed }) -export const identity = /* #__PURE__ */ createIdentity({ config, typed, matrix, BigNumber, DenseMatrix, SparseMatrix }) -export const kron = /* #__PURE__ */ createKron({ typed, matrix, multiplyScalar }) -export const map = /* #__PURE__ */ createMap({ typed }) -export const ones = /* #__PURE__ */ createOnes({ config, typed, matrix, BigNumber }) -export const reshape = /* #__PURE__ */ createReshape({ typed, isInteger, matrix }) -export const resize = /* #__PURE__ */ createResize({ config, matrix }) -export const size = /* #__PURE__ */ createSize({ config, typed, matrix }) -export const squeeze = /* #__PURE__ */ createSqueeze({ typed, matrix }) -export const subset = /* #__PURE__ */ createSubset({ typed, matrix }) -export const transpose = /* #__PURE__ */ createTranspose({ typed, matrix }) -export const ctranspose = /* #__PURE__ */ createCtranspose({ typed, transpose, conj }) -export const zeros = /* #__PURE__ */ createZeros({ config, typed, matrix, BigNumber }) - -// special (1) -export const erf = /* #__PURE__ */ createErf({ typed }) - -// statistics (1) -export const mode = /* #__PURE__ */ createMode({ typed, isNaN, isNumeric }) -export const prod = /* #__PURE__ */ createProd({ typed, multiply }) - -// string (1) -export const format = /* #__PURE__ */ createFormat({ typed }) -export const print = /* #__PURE__ */ createPrint({ typed }) - -// unit (1) -export const to = /* #__PURE__ */ createTo({ typed, matrix }) - -// utils (2) -export const isPrime = /* #__PURE__ */ createIsPrime({ typed }) -export const numeric = /* #__PURE__ */ createNumeric({ typed, number, bignumber, fraction }) - -// arithmetic (2) -export const divideScalar = /* #__PURE__ */ createDivideScalar({ typed, numeric }) -export const pow = /* #__PURE__ */ createPow({ config, typed, identity, multiply, matrix, number, fraction, Complex }) -export const round = /* #__PURE__ */ createRound({ typed, matrix, equalScalar, zeros, BigNumber, DenseMatrix }) -export const floor = /* #__PURE__ */ createFloor({ config, typed, round }) -export const ceil = /* #__PURE__ */ createCeil({ config, typed, round }) -export const fix = /* #__PURE__ */ createFix({ typed, Complex, ceil, floor }) -export const log = /* #__PURE__ */ createLog({ config, typed, divideScalar, Complex }) -export const log1p = /* #__PURE__ */ createLog1p({ config, typed, divideScalar, log, Complex }) -export const nthRoots = /* #__PURE__ */ createNthRoots({ config, typed, divideScalar, Complex }) -export const dotPow = /* #__PURE__ */ createDotPow({ typed, equalScalar, matrix, pow, DenseMatrix }) -export const dotDivide = /* #__PURE__ */ createDotDivide({ typed, matrix, equalScalar, divideScalar, DenseMatrix }) - -// algebra (2) -export const lsolve = /* #__PURE__ */ createLsolve({ typed, matrix, divideScalar, multiplyScalar, subtract, equalScalar, DenseMatrix }) -export const usolve = /* #__PURE__ */ createUsolve({ typed, matrix, divideScalar, multiplyScalar, subtract, equalScalar, DenseMatrix }) - -// bitwise (2) -export const leftShift = /* #__PURE__ */ createLeftShift({ typed, matrix, equalScalar, zeros, DenseMatrix }) -export const rightArithShift = /* #__PURE__ */ createRightArithShift({ typed, matrix, equalScalar, zeros, DenseMatrix }) -export const rightLogShift = /* #__PURE__ */ createRightLogShift({ typed, matrix, equalScalar, zeros, DenseMatrix }) - -// logical (2) -export const and = /* #__PURE__ */ createAnd({ typed, matrix, equalScalar, zeros, not }) - -// relational (2) -export const compare = /* #__PURE__ */ createCompare({ config, typed, equalScalar, matrix, BigNumber, Fraction, DenseMatrix }) -export const compareNatural = /* #__PURE__ */ createCompareNatural({ typed, compare }) -export const compareText = /* #__PURE__ */ createCompareText({ typed, matrix }) -export const equal = /* #__PURE__ */ createEqual({ config, typed, matrix, equalScalar, DenseMatrix }) -export const equalText = /* #__PURE__ */ createEqualText({ typed, compareText, isZero }) -export const smaller = /* #__PURE__ */ createSmaller({ config, typed, matrix, equalScalar, divideScalar, DenseMatrix }) -export const smallerEq = /* #__PURE__ */ createSmallerEq({ config, typed, matrix, DenseMatrix }) -export const larger = /* #__PURE__ */ createLarger({ config, typed, matrix, DenseMatrix }) -export const largerEq = /* #__PURE__ */ createLargerEq({ config, typed, matrix, DenseMatrix }) -export const deepEqual = /* #__PURE__ */ createDeepEqual({ config, typed, equal }) -export const unequal = /* #__PURE__ */ createUnequal({ config, typed, equalScalar, matrix, DenseMatrix }) - -// matrix (2) -export const partitionSelect = /* #__PURE__ */ createPartitionSelect({ typed, isNumeric, isNaN, compare }) -export const range = /* #__PURE__ */ createRange({ config, typed, matrix, smaller, smallerEq, larger, largerEq }) -export const sort = /* #__PURE__ */ createSort({ typed, matrix, compare, compareNatural }) - -// statistics (2) -export const max = /* #__PURE__ */ createMax({ typed, larger }) -export const min = /* #__PURE__ */ createMin({ typed, smaller }) - -// class (2) -export const ImmutableDenseMatrix = /* #__PURE__ */ createImmutableDenseMatrixClass({ smaller, DenseMatrix }) -export const Index = /* #__PURE__ */ createIndexClass({ ImmutableDenseMatrix }) -export const FibonacciHeap = /* #__PURE__ */ createFibonacciHeapClass({ smaller, larger }) -export const Spa = /* #__PURE__ */ createSpaClass({ addScalar, equalScalar, FibonacciHeap }) -export const Unit = /* #__PURE__ */ createUnitClass({ - config, - addScalar, - subtract, - multiplyScalar, - divideScalar, - pow, - abs, - fix, - round, - equal, - isNumeric, - format, - number, - Complex, - BigNumber, - Fraction -}) - -// constants -export const _true = /* #__PURE__ */ createTrue() -export const _false = /* #__PURE__ */ createFalse() -export const _null = /* #__PURE__ */ createNull() -export const _Infinity = /* #__PURE__ */ createInfinity({ config, BigNumber }) -export const _NaN = /* #__PURE__ */ createNaN({ config, BigNumber }) -export const pi = /* #__PURE__ */ createPi({ config, BigNumber }) -export const tau = /* #__PURE__ */ createTau({ config, BigNumber }) -export const e = /* #__PURE__ */ createE({ config, BigNumber }) -export const phi = /* #__PURE__ */ createPhi({ config, BigNumber }) -export const LN2 = /* #__PURE__ */ createLN2({ config, BigNumber }) -export const LN10 = /* #__PURE__ */ createLN10({ config, BigNumber }) -export const LOG2E = /* #__PURE__ */ createLOG2E({ config, BigNumber }) -export const LOG10E = /* #__PURE__ */ createLOG10E({ config, BigNumber }) -export const SQRT1_2 = /* #__PURE__ */ createSQRT1_2({ config, BigNumber }) -export const SQRT2 = /* #__PURE__ */ createSQRT2({ config, BigNumber }) -export const i = /* #__PURE__ */ createI({ config, Complex }) -export const version = /* #__PURE__ */ createVersion() - -// physical constants -const physicalConstantsDependencies = { - config, - BigNumber, - Unit -} - -// Universal constants -export const speedOfLight = /* #__PURE__ */ createSpeedOfLight(physicalConstantsDependencies) -export const gravitationConstant = /* #__PURE__ */ createGravitationConstant(physicalConstantsDependencies) -export const planckConstant = /* #__PURE__ */ createPlanckConstant(physicalConstantsDependencies) -export const reducedPlanckConstant = /* #__PURE__ */ createReducedPlanckConstant(physicalConstantsDependencies) - -// Electromagnetic constants -export const magneticConstant = /* #__PURE__ */ createMagneticConstant(physicalConstantsDependencies) -export const electricConstant = /* #__PURE__ */ createElectricConstant(physicalConstantsDependencies) -export const vacuumImpedance = /* #__PURE__ */ createVacuumImpedance(physicalConstantsDependencies) -export const coulomb = /* #__PURE__ */ createCoulomb(physicalConstantsDependencies) -export const elementaryCharge = /* #__PURE__ */ createElementaryCharge(physicalConstantsDependencies) -export const bohrMagneton = /* #__PURE__ */ createBohrMagneton(physicalConstantsDependencies) -export const conductanceQuantum = /* #__PURE__ */ createConductanceQuantum(physicalConstantsDependencies) -export const inverseConductanceQuantum = /* #__PURE__ */ createInverseConductanceQuantum(physicalConstantsDependencies) -export const magneticFluxQuantum = /* #__PURE__ */ createMagneticFluxQuantum(physicalConstantsDependencies) -export const nuclearMagneton = /* #__PURE__ */ createNuclearMagneton(physicalConstantsDependencies) -export const klitzing = /* #__PURE__ */ createKlitzing(physicalConstantsDependencies) - -// Atomic and nuclear constants -export const bohrRadius = /* #__PURE__ */ createBohrRadius(physicalConstantsDependencies) -export const classicalElectronRadius = /* #__PURE__ */ createClassicalElectronRadius(physicalConstantsDependencies) -export const electronMass = /* #__PURE__ */ createElectronMass(physicalConstantsDependencies) -export const fermiCoupling = /* #__PURE__ */ createFermiCoupling(physicalConstantsDependencies) -export const fineStructure = /* #__PURE__ */ createFineStructure(physicalConstantsDependencies) -export const hartreeEnergy = /* #__PURE__ */ createHartreeEnergy(physicalConstantsDependencies) -export const protonMass = /* #__PURE__ */ createProtonMass(physicalConstantsDependencies) -export const deuteronMass = /* #__PURE__ */ createDeuteronMass(physicalConstantsDependencies) -export const neutronMass = /* #__PURE__ */ createNeutronMass(physicalConstantsDependencies) -export const quantumOfCirculation = /* #__PURE__ */ createQuantumOfCirculation(physicalConstantsDependencies) -export const rydberg = /* #__PURE__ */ createRydberg(physicalConstantsDependencies) -export const thomsonCrossSection = /* #__PURE__ */ createThomsonCrossSection(physicalConstantsDependencies) -export const weakMixingAngle = /* #__PURE__ */ createWeakMixingAngle(physicalConstantsDependencies) -export const efimovFactor = /* #__PURE__ */ createEfimovFactor(physicalConstantsDependencies) - -// Physico-chemical constants -export const atomicMass = /* #__PURE__ */ createAtomicMass(physicalConstantsDependencies) -export const avogadro = /* #__PURE__ */ createAvogadro(physicalConstantsDependencies) -export const boltzmann = /* #__PURE__ */ createBoltzmann(physicalConstantsDependencies) -export const faraday = /* #__PURE__ */ createFaraday(physicalConstantsDependencies) -export const firstRadiation = /* #__PURE__ */ createFirstRadiation(physicalConstantsDependencies) -export const loschmidt = /* #__PURE__ */ createLoschmidt(physicalConstantsDependencies) -export const gasConstant = /* #__PURE__ */ createGasConstant(physicalConstantsDependencies) -export const molarPlanckConstant = /* #__PURE__ */ createMolarPlanckConstant(physicalConstantsDependencies) -export const molarVolume = /* #__PURE__ */ createMolarVolume(physicalConstantsDependencies) -export const sackurTetrode = /* #__PURE__ */ createSackurTetrode(physicalConstantsDependencies) -export const secondRadiation = /* #__PURE__ */ createSecondRadiation(physicalConstantsDependencies) -export const stefanBoltzmann = /* #__PURE__ */ createStefanBoltzmann(physicalConstantsDependencies) -export const wienDisplacement = /* #__PURE__ */ createWienDisplacement(physicalConstantsDependencies) - -// Adopted values -export const molarMass = /* #__PURE__ */ createMolarMass(physicalConstantsDependencies) -export const molarMassC12 = /* #__PURE__ */ createMolarMassC12(physicalConstantsDependencies) -export const gravity = /* #__PURE__ */ createGravity(physicalConstantsDependencies) - -// Natural units -export const planckLength = /* #__PURE__ */ createPlanckLength(physicalConstantsDependencies) -export const planckMass = /* #__PURE__ */ createPlanckMass(physicalConstantsDependencies) -export const planckTime = /* #__PURE__ */ createPlanckTime(physicalConstantsDependencies) -export const planckCharge = /* #__PURE__ */ createPlanckCharge(physicalConstantsDependencies) -export const planckTemperature = /* #__PURE__ */ createPlanckTemperature(physicalConstantsDependencies) - -// create (2) -export const sparse = /* #__PURE__ */ createSparse({ typed, SparseMatrix }) -export const unit = /* #__PURE__ */ createUnitFunction({ typed, Unit }) -export const createUnit = /* #__PURE__ */ createCreateUnit({ typed, Unit }) - -// trigonometry (2) -export const acos = /* #__PURE__ */ createAcos({ config, typed, Complex }) -export const acosh = /* #__PURE__ */ createAcosh({ config, typed, Complex }) -export const acot = /* #__PURE__ */ createAcot({ typed, BigNumber }) -export const acoth = /* #__PURE__ */ createAcoth({ config, typed, Complex, BigNumber }) -export const acsc = /* #__PURE__ */ createAcsc({ config, typed, Complex, BigNumber }) -export const acsch = /* #__PURE__ */ createAcsch({ typed, BigNumber }) -export const asec = /* #__PURE__ */ createAsec({ config, typed, Complex, BigNumber }) -export const asech = /* #__PURE__ */ createAsech({ config, typed, Complex, BigNumber }) -export const asin = /* #__PURE__ */ createAsin({ config, typed, Complex }) -export const asinh = /* #__PURE__ */ createAsinh({ typed }) -export const atan = /* #__PURE__ */ createAtan({ typed }) -export const atan2 = /* #__PURE__ */ createAtan2({ typed, matrix, equalScalar, BigNumber, DenseMatrix }) -export const atanh = /* #__PURE__ */ createAtanh({ config, typed, Complex }) -export const cos = /* #__PURE__ */ createCos({ typed }) -export const cosh = /* #__PURE__ */ createCosh({ typed }) -export const cot = /* #__PURE__ */ createCot({ typed, BigNumber }) -export const coth = /* #__PURE__ */ createCoth({ typed, BigNumber }) -export const csc = /* #__PURE__ */ createCsc({ typed, BigNumber }) -export const csch = /* #__PURE__ */ createCsch({ typed, BigNumber }) -export const sec = /* #__PURE__ */ createSec({ typed, BigNumber }) -export const sech = /* #__PURE__ */ createSech({ typed, BigNumber }) -export const sin = /* #__PURE__ */ createSin({ typed }) -export const sinh = /* #__PURE__ */ createSinh({ typed }) -export const tan = /* #__PURE__ */ createTan({ typed }) -export const tanh = /* #__PURE__ */ createTanh({ typed }) - -// set (2) -export const setCartesian = /* #__PURE__ */ createSetCartesian({ typed, size, subset, compareNatural, Index, DenseMatrix }) -export const setDifference = /* #__PURE__ */ createSetDifference({ typed, size, subset, compareNatural, Index, DenseMatrix }) -export const setDistinct = /* #__PURE__ */ createSetDistinct({ typed, size, subset, compareNatural, Index, DenseMatrix }) -export const setIntersect = /* #__PURE__ */ createSetIntersect({ typed, size, subset, compareNatural, Index, DenseMatrix }) -export const setIsSubset = /* #__PURE__ */ createSetIsSubset({ typed, size, subset, compareNatural, Index }) -export const setMultiplicity = /* #__PURE__ */ createSetMultiplicity({ typed, size, subset, compareNatural, Index }) -export const setPowerset = /* #__PURE__ */ createSetPowerset({ typed, size, subset, compareNatural, Index }) -export const setSize = /* #__PURE__ */ createSetSize({ typed, compareNatural }) -export const setSymDifference = /* #__PURE__ */ createSetSymDifference({ typed, size, concat, subset, setDifference, Index }) -export const setUnion = /* #__PURE__ */ createSetUnion({ typed, size, concat, subset, setIntersect, setSymDifference, Index }) - -// arithmetic (3) -export const add = /* #__PURE__ */ createAdd({ typed, matrix, addScalar, equalScalar, DenseMatrix, SparseMatrix }) -export const hypot = /* #__PURE__ */ createHypot({ typed, abs, addScalar, divideScalar, multiplyScalar, sqrt, smaller, isPositive }) -export const norm = /* #__PURE__ */ createNorm({ typed, abs, add, pow, conj, sqrt, multiply, equalScalar, larger, smaller, matrix }) - -// matrix (3) -export const dot = /* #__PURE__ */ createDot({ typed, add, multiply }) -export const trace = /* #__PURE__ */ createTrace({ typed, matrix, add }) -export const index = /* #__PURE__ */ createIndex({ typed, Index }) -export const column = /* #__PURE__ */ createColumn({ typed, Index, matrix, range }) -export const row = /* #__PURE__ */ createRow({ typed, Index, matrix, range }) - -// algebra (3) -export const lup = /* #__PURE__ */ createLup({ - typed, - matrix, - abs, - addScalar, - divideScalar, - multiplyScalar, - subtract, - larger, - equalScalar, - unaryMinus, - DenseMatrix, - SparseMatrix, - Spa -}) -export const qr = /* #__PURE__ */ createQr({ - typed, - matrix, - zeros, - identity, - isZero, - unequal, - sign, - sqrt, - conj, - unaryMinus, - addScalar, - divideScalar, - multiplyScalar, - subtract -}) -export const slu = /* #__PURE__ */ createSlu({ typed, abs, add, multiply, transpose, divideScalar, subtract, larger, largerEq, SparseMatrix }) -export const lusolve = /* #__PURE__ */ createLusolve({ typed, matrix, lup, slu, usolve, lsolve, DenseMatrix }) - -// matrix (4) -export const det = /* #__PURE__ */ createDet({ typed, matrix, subtract, multiply, unaryMinus, lup }) -export const inv = /* #__PURE__ */ createInv({ typed, matrix, divideScalar, addScalar, multiply, unaryMinus, det, identity, abs }) -export const expm = /* #__PURE__ */ createExpm({ typed, abs, add, identity, inv, multiply }) -export const sqrtm = /* #__PURE__ */ createSqrtm({ typed, abs, add, multiply, sqrt, subtract, inv, size, max, identity }) - -// arithmetic (4) -export const divide = /* #__PURE__ */ createDivide({ typed, matrix, multiply, equalScalar, divideScalar, inv }) - -// geometry (4) -export const distance = /* #__PURE__ */ createDistance({ typed, addScalar, subtract, multiplyScalar, divideScalar, unaryMinus, sqrt, abs }) -export const intersect = /* #__PURE__ */ createIntersect({ config, typed, abs, add, addScalar, matrix, multiply, multiplyScalar, divideScalar, subtract, smaller, equalScalar }) - -// statistics (4) -export const sum = /* #__PURE__ */ createSum({ config, typed, add, bignumber, fraction }) -export const mean = /* #__PURE__ */ createMean({ typed, add, divide }) -export const median = /* #__PURE__ */ createMedian({ typed, add, divide, compare, partitionSelect }) -export const mad = /* #__PURE__ */ createMad({ typed, abs, map, median, subtract }) -export const variance = /* #__PURE__ */ createVariance({ typed, add, subtract, multiply, divide, apply, isNaN }) -export const quantileSeq = /* #__PURE__ */ createQuantileSeq({ typed, add, multiply, partitionSelect, compare }) -export const std = /* #__PURE__ */ createStd({ typed, sqrt, variance }) - -// probability (4) -export const combinations = /* #__PURE__ */ createCombinations({ typed }) -export const gamma = /* #__PURE__ */ createGamma({ config, typed, multiplyScalar, pow, BigNumber, Complex }) -export const factorial = /* #__PURE__ */ createFactorial({ typed, gamma }) -export const kldivergence = /* #__PURE__ */ createKldivergence({ typed, matrix, divide, sum, multiply, dotDivide, log, isNumeric }) -export const multinomial = /* #__PURE__ */ createMultinomial({ typed, add, divide, multiply, factorial, isInteger, isPositive }) -export const permutations = /* #__PURE__ */ createPermutations({ typed, factorial }) -export const pickRandom = /* #__PURE__ */ createPickRandom({ typed, config }) -export const random = /* #__PURE__ */ createRandom({ typed, config, matrix }) -export const randomInt = /* #__PURE__ */ createRandomInt({ typed, config }) - -// combinatorics (4) -export const stirlingS2 = /* #__PURE__ */ createStirlingS2({ typed, addScalar, subtract, multiplyScalar, divideScalar, pow, factorial, combinations, isNegative, isInteger, larger }) -export const bellNumbers = /* #__PURE__ */ createBellNumbers({ typed, addScalar, isNegative, isInteger, stirlingS2 }) -export const catalan = /* #__PURE__ */ createCatalan({ typed, addScalar, divideScalar, multiplyScalar, combinations, isNegative, isInteger }) -export const composition = /* #__PURE__ */ createComposition({ typed, addScalar, combinations, isPositive, isNegative, isInteger, larger }) diff --git a/src/entry/functionsNumber.generated.js b/src/entry/functionsNumber.generated.js new file mode 100644 index 000000000..08095bc6a --- /dev/null +++ b/src/entry/functionsNumber.generated.js @@ -0,0 +1,304 @@ +/** + * THIS FILE IS AUTO-GENERATED + * DON'T MAKE CHANGES HERE + */ +import { config } from './configReadonly' +import { + createResultSet, + createTyped, + createIsNumeric, + createTypeOf, + createNumber, + createBoolean, + createFilter, + createMap, + createErf, + createFormat, + createIsPrime, + createRound, + createCompareText, + createSmaller, + createLarger, + createMax, + createE, + createFalse, + createLN10, + createLOG10E, + createNaN, + createPhi, + createSQRT1_2, // eslint-disable-line camelcase + createTau, + createVersion, + createPickRandom, + createRandomInt, + createIsNegative, + createIsZero, + createMatrix, + createUnaryPlus, + createAddScalar, + createCeil, + createExp, + createFix, + createGcd, + createLog10, + createMod, + createMultiply, + createSqrt, + createSubtract, + createBitAnd, + createBitOr, + createNot, + createXor, + createDivideScalar, + createLog, + createLeftShift, + createRightLogShift, + createAcos, + createAcot, + createAcsc, + createAsec, + createAsin, + createAtan, + createAtanh, + createCosh, + createCoth, + createCsch, + createSech, + createSinh, + createTanh, + createNorm, + createCombinations, + createRangeClass, + createHasNumericValue, + createString, + createForEach, + createProd, + createNumeric, + createEqualText, + createLargerEq, + createMin, + createInfinity, + createLOG2E, + createPi, + createSQRT2, + createRandom, + createIsInteger, + createIsNaN, + createAbs, + createCube, + createFloor, + createLog2, + createSign, + createXgcd, + createBitXor, + createSubset, + createLog1p, + createAnd, + createAcoth, + createAsech, + createAtan2, + createCot, + createSec, + createTan, + createDivide, + createClone, + createNthRoot, + createMode, + createCompare, + createSmallerEq, + createPartitionSelect, + createLN2, + createIsPositive, + createCbrt, + createLcm, + createSquare, + createOr, + createRightArithShift, + createAcsch, + createCos, + createSin, + createGamma, + createEqualScalar, + createRange, + createCompareNatural, + createUnequal, + createNull, + createFactorial, + createPermutations, + createComposition, + createUnaryMinus, + createMultiplyScalar, + createPow, + createAsinh, + createAdd, + createApply, + createEqual, + createHypot, + createMean, + createVariance, + createStd, + createStirlingS2, + createCatalan, + createExpm1, + createAcosh, + createPrint, + createTrue, + createMedian, + createQuantileSeq, + createBellNumbers, + createCsc, + createDeepEqual, + createMad, + createBitNot, + createSum, + createMultinomial +} from '../factoriesNumber' + +export const ResultSet = /* #__PURE__ */ createResultSet({}) +export const typed = /* #__PURE__ */ createTyped({}) +export const isNumeric = /* #__PURE__ */ createIsNumeric({ typed }) +export const typeOf = /* #__PURE__ */ createTypeOf({ typed }) +export const number = /* #__PURE__ */ createNumber({ typed }) +export const boolean = /* #__PURE__ */ createBoolean({ typed }) +export const filter = /* #__PURE__ */ createFilter({ typed }) +export const map = /* #__PURE__ */ createMap({ typed }) +export const erf = /* #__PURE__ */ createErf({ typed }) +export const format = /* #__PURE__ */ createFormat({ typed }) +export const isPrime = /* #__PURE__ */ createIsPrime({ typed }) +export const round = /* #__PURE__ */ createRound({ typed }) +export const compareText = /* #__PURE__ */ createCompareText({ typed }) +export const smaller = /* #__PURE__ */ createSmaller({ config, typed }) +export const larger = /* #__PURE__ */ createLarger({ config, typed }) +export const max = /* #__PURE__ */ createMax({ larger, typed }) +export const e = /* #__PURE__ */ createE({ config }) +export const _false = /* #__PURE__ */ createFalse({}) +export const LN10 = /* #__PURE__ */ createLN10({ config }) +export const LOG10E = /* #__PURE__ */ createLOG10E({ config }) +export const _NaN = /* #__PURE__ */ createNaN({ config }) +export const phi = /* #__PURE__ */ createPhi({ config }) +export const SQRT1_2 = /* #__PURE__ */ createSQRT1_2({ config }) +export const tau = /* #__PURE__ */ createTau({ config }) +export const version = /* #__PURE__ */ createVersion({}) +export const pickRandom = /* #__PURE__ */ createPickRandom({ config, typed }) +export const randomInt = /* #__PURE__ */ createRandomInt({ config, typed }) +export const isNegative = /* #__PURE__ */ createIsNegative({ typed }) +export const isZero = /* #__PURE__ */ createIsZero({ typed }) +export const matrix = /* #__PURE__ */ createMatrix({}) +export const unaryPlus = /* #__PURE__ */ createUnaryPlus({ typed }) +export const addScalar = /* #__PURE__ */ createAddScalar({ typed }) +export const ceil = /* #__PURE__ */ createCeil({ typed }) +export const exp = /* #__PURE__ */ createExp({ typed }) +export const fix = /* #__PURE__ */ createFix({ typed }) +export const gcd = /* #__PURE__ */ createGcd({ typed }) +export const log10 = /* #__PURE__ */ createLog10({ typed }) +export const mod = /* #__PURE__ */ createMod({ typed }) +export const multiply = /* #__PURE__ */ createMultiply({ typed }) +export const sqrt = /* #__PURE__ */ createSqrt({ typed }) +export const subtract = /* #__PURE__ */ createSubtract({ typed }) +export const bitAnd = /* #__PURE__ */ createBitAnd({ typed }) +export const bitOr = /* #__PURE__ */ createBitOr({ typed }) +export const not = /* #__PURE__ */ createNot({ typed }) +export const xor = /* #__PURE__ */ createXor({ typed }) +export const divideScalar = /* #__PURE__ */ createDivideScalar({ typed }) +export const log = /* #__PURE__ */ createLog({ typed }) +export const leftShift = /* #__PURE__ */ createLeftShift({ typed }) +export const rightLogShift = /* #__PURE__ */ createRightLogShift({ typed }) +export const acos = /* #__PURE__ */ createAcos({ typed }) +export const acot = /* #__PURE__ */ createAcot({ typed }) +export const acsc = /* #__PURE__ */ createAcsc({ typed }) +export const asec = /* #__PURE__ */ createAsec({ typed }) +export const asin = /* #__PURE__ */ createAsin({ typed }) +export const atan = /* #__PURE__ */ createAtan({ typed }) +export const atanh = /* #__PURE__ */ createAtanh({ typed }) +export const cosh = /* #__PURE__ */ createCosh({ typed }) +export const coth = /* #__PURE__ */ createCoth({ typed }) +export const csch = /* #__PURE__ */ createCsch({ typed }) +export const sech = /* #__PURE__ */ createSech({ typed }) +export const sinh = /* #__PURE__ */ createSinh({ typed }) +export const tanh = /* #__PURE__ */ createTanh({ typed }) +export const norm = /* #__PURE__ */ createNorm({ typed }) +export const combinations = /* #__PURE__ */ createCombinations({ typed }) +export const Range = /* #__PURE__ */ createRangeClass({}) +export const hasNumericValue = /* #__PURE__ */ createHasNumericValue({ isNumeric, typed }) +export const string = /* #__PURE__ */ createString({ typed }) +export const forEach = /* #__PURE__ */ createForEach({ typed }) +export const prod = /* #__PURE__ */ createProd({ multiply, typed }) +export const numeric = /* #__PURE__ */ createNumeric({ number }) +export const equalText = /* #__PURE__ */ createEqualText({ compareText, isZero, typed }) +export const largerEq = /* #__PURE__ */ createLargerEq({ config, typed }) +export const min = /* #__PURE__ */ createMin({ smaller, typed }) +export const _Infinity = /* #__PURE__ */ createInfinity({ config }) +export const LOG2E = /* #__PURE__ */ createLOG2E({ config }) +export const pi = /* #__PURE__ */ createPi({ config }) +export const SQRT2 = /* #__PURE__ */ createSQRT2({ config }) +export const random = /* #__PURE__ */ createRandom({ config, typed }) +export const isInteger = /* #__PURE__ */ createIsInteger({ typed }) +export const isNaN = /* #__PURE__ */ createIsNaN({ typed }) +export const abs = /* #__PURE__ */ createAbs({ typed }) +export const cube = /* #__PURE__ */ createCube({ typed }) +export const floor = /* #__PURE__ */ createFloor({ typed }) +export const log2 = /* #__PURE__ */ createLog2({ typed }) +export const sign = /* #__PURE__ */ createSign({ typed }) +export const xgcd = /* #__PURE__ */ createXgcd({ typed }) +export const bitXor = /* #__PURE__ */ createBitXor({ typed }) +export const subset = /* #__PURE__ */ createSubset({}) +export const log1p = /* #__PURE__ */ createLog1p({ typed }) +export const and = /* #__PURE__ */ createAnd({ typed }) +export const acoth = /* #__PURE__ */ createAcoth({ typed }) +export const asech = /* #__PURE__ */ createAsech({ typed }) +export const atan2 = /* #__PURE__ */ createAtan2({ typed }) +export const cot = /* #__PURE__ */ createCot({ typed }) +export const sec = /* #__PURE__ */ createSec({ typed }) +export const tan = /* #__PURE__ */ createTan({ typed }) +export const divide = /* #__PURE__ */ createDivide({ typed }) +export const clone = /* #__PURE__ */ createClone({ typed }) +export const nthRoot = /* #__PURE__ */ createNthRoot({ typed }) +export const mode = /* #__PURE__ */ createMode({ isNaN, isNumeric, typed }) +export const compare = /* #__PURE__ */ createCompare({ config, typed }) +export const smallerEq = /* #__PURE__ */ createSmallerEq({ config, typed }) +export const partitionSelect = /* #__PURE__ */ createPartitionSelect({ compare, isNaN, isNumeric, typed }) +export const LN2 = /* #__PURE__ */ createLN2({ config }) +export const isPositive = /* #__PURE__ */ createIsPositive({ typed }) +export const cbrt = /* #__PURE__ */ createCbrt({ typed }) +export const lcm = /* #__PURE__ */ createLcm({ typed }) +export const square = /* #__PURE__ */ createSquare({ typed }) +export const or = /* #__PURE__ */ createOr({ typed }) +export const rightArithShift = /* #__PURE__ */ createRightArithShift({ typed }) +export const acsch = /* #__PURE__ */ createAcsch({ typed }) +export const cos = /* #__PURE__ */ createCos({ typed }) +export const sin = /* #__PURE__ */ createSin({ typed }) +export const gamma = /* #__PURE__ */ createGamma({ typed }) +export const equalScalar = /* #__PURE__ */ createEqualScalar({ config, typed }) +export const range = /* #__PURE__ */ createRange({ matrix, config, larger, largerEq, smaller, smallerEq, typed }) +export const compareNatural = /* #__PURE__ */ createCompareNatural({ compare, typed }) +export const unequal = /* #__PURE__ */ createUnequal({ equalScalar, typed }) +export const _null = /* #__PURE__ */ createNull({}) +export const factorial = /* #__PURE__ */ createFactorial({ gamma, typed }) +export const permutations = /* #__PURE__ */ createPermutations({ factorial, typed }) +export const composition = /* #__PURE__ */ createComposition({ addScalar, combinations, isInteger, isNegative, isPositive, larger, typed }) +export const unaryMinus = /* #__PURE__ */ createUnaryMinus({ typed }) +export const multiplyScalar = /* #__PURE__ */ createMultiplyScalar({ typed }) +export const pow = /* #__PURE__ */ createPow({ typed }) +export const asinh = /* #__PURE__ */ createAsinh({ typed }) +export const add = /* #__PURE__ */ createAdd({ typed }) +export const apply = /* #__PURE__ */ createApply({ isInteger, typed }) +export const equal = /* #__PURE__ */ createEqual({ equalScalar, typed }) +export const hypot = /* #__PURE__ */ createHypot({ abs, addScalar, divideScalar, isPositive, multiplyScalar, smaller, sqrt, typed }) +export const mean = /* #__PURE__ */ createMean({ add, divide, typed }) +export const variance = /* #__PURE__ */ createVariance({ add, apply, divide, isNaN, multiply, subtract, typed }) +export const std = /* #__PURE__ */ createStd({ sqrt, typed, variance }) +export const stirlingS2 = /* #__PURE__ */ createStirlingS2({ addScalar, combinations, divideScalar, factorial, isInteger, isNegative, larger, multiplyScalar, pow, subtract, typed }) +export const catalan = /* #__PURE__ */ createCatalan({ addScalar, combinations, divideScalar, isInteger, isNegative, multiplyScalar, typed }) +export const expm1 = /* #__PURE__ */ createExpm1({ typed }) +export const acosh = /* #__PURE__ */ createAcosh({ typed }) +export const print = /* #__PURE__ */ createPrint({ typed }) +export const _true = /* #__PURE__ */ createTrue({}) +export const median = /* #__PURE__ */ createMedian({ add, compare, divide, partitionSelect, typed }) +export const quantileSeq = /* #__PURE__ */ createQuantileSeq({ add, compare, multiply, partitionSelect, typed }) +export const bellNumbers = /* #__PURE__ */ createBellNumbers({ addScalar, isInteger, isNegative, stirlingS2, typed }) +export const csc = /* #__PURE__ */ createCsc({ typed }) +export const deepEqual = /* #__PURE__ */ createDeepEqual({ equal, typed }) +export const mad = /* #__PURE__ */ createMad({ abs, map, median, subtract, typed }) +export const bitNot = /* #__PURE__ */ createBitNot({ typed }) +export const sum = /* #__PURE__ */ createSum({ add, config, typed }) +export const multinomial = /* #__PURE__ */ createMultinomial({ add, divide, factorial, isInteger, isPositive, multiply, typed }) diff --git a/src/entry/functionsNumber.js b/src/entry/functionsNumber.js deleted file mode 100644 index 9e97673fe..000000000 --- a/src/entry/functionsNumber.js +++ /dev/null @@ -1,548 +0,0 @@ -import { - absNumber, - acoshNumber, - acosNumber, - acothNumber, - acotNumber, - acschNumber, - acscNumber, - addNumber, - andNumber, - asechNumber, - asecNumber, - asinhNumber, - asinNumber, - atan2Number, - atanhNumber, - atanNumber, - bitAndNumber, - bitNotNumber, - bitOrNumber, - bitXorNumber, - cbrtNumber, - ceilNumber, - combinationsNumber, - coshNumber, - cosNumber, - cothNumber, - cotNumber, - cschNumber, - cscNumber, - cubeNumber, - divideNumber, - expm1Number, - expNumber, - fixNumber, - floorNumber, - gammaNumber, - gcdNumber, - isIntegerNumber, - isNaNNumber, - isNegativeNumber, - isPositiveNumber, - isZeroNumber, - lcmNumber, - leftShiftNumber, - log10Number, - log1pNumber, - log2Number, - logNumber, - modNumber, - multiplyNumber, - normNumber, - notNumber, - orNumber, - powNumber, - rightArithShiftNumber, - rightLogShiftNumber, - sechNumber, - secNumber, - signNumber, - sinhNumber, - sinNumber, - sqrtNumber, - squareNumber, - subtractNumber, - tanhNumber, - tanNumber, - unaryMinusNumber, - unaryPlusNumber, - xgcdNumber, - xorNumber -} from '../plain/number' -import { createResultSet } from '../type/resultset/ResultSet' -import { createRangeClass } from '../type/matrix/Range' -import { createTyped } from '../core/function/typed' -import { createClone } from '../function/utils/clone' -import { createIsNumeric } from '../function/utils/isNumeric' -import { createHasNumericValue } from '../function/utils/hasNumericValue' -import { createTypeOf } from '../function/utils/typeOf' -import { createEqualScalarNumber } from '../function/relational/equalScalar' -import { createNumber } from '../type/number' -import { createString } from '../type/string' -import { createBoolean } from '../type/boolean' -import { createNthRootNumber } from '../function/arithmetic/nthRoot' -import { createErf } from '../function/special/erf' -import { createMode } from '../function/statistics/mode' -import { createProd } from '../function/statistics/prod' -import { createFormat } from '../function/string/format' -import { createPrint } from '../function/string/print' -import { createIsPrime } from '../function/utils/isPrime' -import { createRoundNumber } from '../function/arithmetic/round' -import { createCompareNumber } from '../function/relational/compare' -import { createCompareNatural } from '../function/relational/compareNatural' -import { createCompareTextNumber } from '../function/relational/compareText' -import { createEqualText } from '../function/relational/equalText' -import { createSmallerNumber } from '../function/relational/smaller' -import { createSmallerEqNumber } from '../function/relational/smallerEq' -import { createLargerNumber } from '../function/relational/larger' -import { createLargerEqNumber } from '../function/relational/largerEq' -import { createDeepEqual } from '../function/relational/deepEqual' -import { createUnequalNumber } from '../function/relational/unequal' -import { createPartitionSelect } from '../function/matrix/partitionSelect' -import { createMax } from '../function/statistics/max' -import { createMin } from '../function/statistics/min' -import { createHypot } from '../function/arithmetic/hypot' -import { createSum } from '../function/statistics/sum' -import { createMean } from '../function/statistics/mean' -import { createMedian } from '../function/statistics/median' -import { createMad } from '../function/statistics/mad' -import { createVariance } from '../function/statistics/variance' -import { createQuantileSeq } from '../function/statistics/quantileSeq' -import { createStd } from '../function/statistics/std' -import { createFactorial } from '../function/probability/factorial' -import { createMultinomial } from '../function/probability/multinomial' -import { createPermutations } from '../function/probability/permutations' -import { createPickRandom } from '../function/probability/pickRandom' -import { createRandom } from '../function/probability/random' -import { createRandomInt } from '../function/probability/randomInt' -import { createStirlingS2 } from '../function/combinatorics/stirlingS2' -import { createBellNumbers } from '../function/combinatorics/bellNumbers' -import { createCatalan } from '../function/combinatorics/catalan' -import { createComposition } from '../function/combinatorics/composition' -import { createNumeric } from '../function/utils/numeric' -import { createEqualNumber } from '../function/relational/equal' -import { createFilter } from '../function/matrix/filter' -import { createForEach } from '../function/matrix/forEach' -import { createMap } from '../function/matrix/map' -import { createRange } from '../function/matrix/range' -import { createSubset } from '../factoriesNumber' -import { noMatrix } from '../utils/noop' -import { createApply } from '../function/matrix/apply' -import { config } from './configReadonly' - -// ---------------------------------------------------------------------------- -// read-only config - -export { config } from './configReadonly' - -// ---------------------------------------------------------------------------- -// classes and functions - -// class (1) -export const ResultSet = /* #__PURE__ */ createResultSet() -// export const BigNumber = /* #__PURE__ */ createBigNumberClass({ config }) -// export const Complex = /* #__PURE__ */ createComplexClass({ config }) -// export const Fraction = /* #__PURE__ */ createFractionClass() -export const Range = /* #__PURE__ */ createRangeClass() -// export const Matrix = /* #__PURE__ */ createMatrixClass() -// export const DenseMatrix = /* #__PURE__ */ createDenseMatrixClass({ Matrix }) - -// core (1) -export const typed = /* #__PURE__ */ createTyped({}) - -// utils (1) -export const clone = /* #__PURE__ */ createClone({ typed }) -export const isInteger = /* #__PURE__ */ typed(isIntegerNumber) -export const isNegative = /* #__PURE__ */ typed(isNegativeNumber) -export const isNumeric = /* #__PURE__ */ createIsNumeric({ typed }) -export const hasNumericValue = /* #__PURE__ */ createHasNumericValue({ typed, isNumeric }) -export const isPositive = /* #__PURE__ */ typed(isPositiveNumber) -export const isZero = /* #__PURE__ */ typed(isZeroNumber) -export const isNaN = /* #__PURE__ */ typed(isNaNNumber) -export const typeOf = /* #__PURE__ */ createTypeOf({ typed }) - -// relational (1) -export const equalScalar = /* #__PURE__ */ createEqualScalarNumber({ config, typed }) - -// classes (1.1) -// export const SparseMatrix = /* #__PURE__ */ createSparseMatrixClass({ typed, equalScalar, Matrix }) - -// create (1) -export const number = /* #__PURE__ */ createNumber({ typed }) -export const string = /* #__PURE__ */ createString({ typed }) -export const boolean = /* #__PURE__ */ createBoolean({ typed }) -// export const bignumber = /* #__PURE__ */ createBignumber({ typed, BigNumber }) -// export const complex = /* #__PURE__ */ createComplex({ typed, Complex }) -// export const fraction = /* #__PURE__ */ createFraction({ typed, Fraction }) -export const matrix = /* #__PURE__ */ noMatrix // FIXME: remove export, currently required because of subset.transform dependency -// export const splitUnit = /* #__PURE__ */ createSplitUnit({ typed }) - -// arithmetic (1) -export const unaryMinus = /* #__PURE__ */ typed(unaryMinusNumber) -export const unaryPlus = /* #__PURE__ */ typed(unaryPlusNumber) -export const abs = /* #__PURE__ */ typed(absNumber) -export const addScalar = /* #__PURE__ */ typed(addNumber) -export const cbrt = /* #__PURE__ */ typed(cbrtNumber) -export const ceil = /* #__PURE__ */ typed(ceilNumber) -export const cube = /* #__PURE__ */ typed(cubeNumber) -export const exp = /* #__PURE__ */ typed(expNumber) -export const expm1 = /* #__PURE__ */ typed(expm1Number) -export const fix = /* #__PURE__ */ typed(fixNumber) -export const floor = /* #__PURE__ */ typed(floorNumber) -export const gcd = /* #__PURE__ */ typed(gcdNumber) -export const lcm = /* #__PURE__ */ typed(lcmNumber) -export const log10 = /* #__PURE__ */ typed(log10Number) -export const log2 = /* #__PURE__ */ typed(log2Number) -export const mod = /* #__PURE__ */ typed(modNumber) -export const multiplyScalar = /* #__PURE__ */ typed(multiplyNumber) -export const multiply = /* #__PURE__ */ multiplyScalar -export const nthRoot = /* #__PURE__ */ createNthRootNumber({ typed }) -export const sign = /* #__PURE__ */ typed(signNumber) -export const sqrt = /* #__PURE__ */ typed(sqrtNumber) -export const square = /* #__PURE__ */ typed(squareNumber) -export const subtract = /* #__PURE__ */ typed(subtractNumber) -export const xgcd = /* #__PURE__ */ typed(xgcdNumber) -// export const dotMultiply = /* #__PURE__ */ createDotMultiply({ typed, matrix, equalScalar, multiplyScalar }) - -// bitwise (1) -export const bitAnd = /* #__PURE__ */ typed(bitAndNumber) -export const bitNot = /* #__PURE__ */ typed(bitNotNumber) -export const bitOr = /* #__PURE__ */ typed(bitOrNumber) -export const bitXor = /* #__PURE__ */ typed(bitXorNumber) - -// complex (1) -// export const arg = /* #__PURE__ */ createArg({ typed }) -// export const conj = /* #__PURE__ */ createConj({ typed }) -// export const im = /* #__PURE__ */ createIm({ typed }) -// export const re = /* #__PURE__ */ createRe({ typed }) - -// logical (1) -export const not = /* #__PURE__ */ typed(notNumber) -export const or = /* #__PURE__ */ typed(orNumber) -export const xor = /* #__PURE__ */ typed(xorNumber) - -// matrix (1) -export const apply = /* #__PURE__ */ createApply({ typed, isInteger }) -// export const concat = /* #__PURE__ */ createConcat({ typed, matrix, isInteger }) -// export const cross = /* #__PURE__ */ createCross({ typed, matrix, subtract, multiply }) -// export const diag = /* #__PURE__ */ createDiag({ typed, matrix, DenseMatrix, SparseMatrix }) -// export const eye = /* #__PURE__ */ createEye({ typed, matrix }) -export const filter = /* #__PURE__ */ createFilter({ typed }) -// export const flatten = /* #__PURE__ */ createFlatten({ typed, matrix }) -export const forEach = /* #__PURE__ */ createForEach({ typed }) -// export const getMatrixDataType = /* #__PURE__ */ createGetMatrixDataType({ typed }) -// export const identity = /* #__PURE__ */ createIdentity({ config, typed, matrix, BigNumber, DenseMatrix, SparseMatrix }) -// export const kron = /* #__PURE__ */ createKron({ typed, matrix, multiplyScalar }) -export const map = /* #__PURE__ */ createMap({ typed }) -// export const ones = /* #__PURE__ */ createOnes({ config, typed, matrix, BigNumber }) -// export const reshape = /* #__PURE__ */ createReshape({ typed, isInteger, matrix }) -// export const resize = /* #__PURE__ */ createResize({ config, matrix }) -// export const size = /* #__PURE__ */ createSize({ config, typed, matrix }) -// export const squeeze = /* #__PURE__ */ createSqueeze({ typed, matrix }) -// FIXME: have a light weight implementation of subset -export const subset = /* #__PURE__ */ createSubset({ typed, matrix }) -// export const transpose = /* #__PURE__ */ createTranspose({ typed, matrix }) -// export const ctranspose = /* #__PURE__ */ createCtranspose({ typed, transpose, conj }) -// export const zeros = /* #__PURE__ */ createZeros({ config, typed, matrix, BigNumber }) -// TODO: provide number+array implementations for map, filter, forEach, zeros, ...? -// TODO: create range implementation for range? - -// special (1) -export const erf = /* #__PURE__ */ createErf({ typed }) - -// statistics (1) -export const mode = /* #__PURE__ */ createMode({ typed, isNaN, isNumeric }) -export const prod = /* #__PURE__ */ createProd({ typed, multiply }) - -// string (1) -export const format = /* #__PURE__ */ createFormat({ typed }) -export const print = /* #__PURE__ */ createPrint({ typed }) - -// unit (1) -// export const to = /* #__PURE__ */ createTo({ typed, matrix }) - -// utils (2) -export const isPrime = /* #__PURE__ */ createIsPrime({ typed }) -export const numeric = /* #__PURE__ */ createNumeric({ typed, number }) - -// arithmetic (2) -export const divideScalar = /* #__PURE__ */ typed(divideNumber) -export const pow = /* #__PURE__ */ typed(powNumber) -export const round = /* #__PURE__ */ createRoundNumber({ typed }) -export const log = /* #__PURE__ */ typed(logNumber) -export const log1p = /* #__PURE__ */ typed(log1pNumber) -// export const nthRoots = /* #__PURE__ */ createNthRoots({ config, typed, divideScalar, Complex }) -// export const dotPow = /* #__PURE__ */ createDotPow({ typed, equalScalar, matrix, pow, DenseMatrix }) -// export const dotDivide = /* #__PURE__ */ createDotDivide({ typed, matrix, equalScalar, divideScalar, DenseMatrix }) - -// algebra (2) -// export const lsolve = /* #__PURE__ */ createLsolve({ typed, matrix, divideScalar, multiplyScalar, subtract, equalScalar, DenseMatrix }) -// export const usolve = /* #__PURE__ */ createUsolve({ typed, matrix, divideScalar, multiplyScalar, subtract, equalScalar, DenseMatrix }) - -// bitwise (2) -export const leftShift = /* #__PURE__ */ typed(leftShiftNumber) -export const rightArithShift = /* #__PURE__ */ typed(rightArithShiftNumber) -export const rightLogShift = /* #__PURE__ */ typed(rightLogShiftNumber) - -// logical (2) -export const and = /* #__PURE__ */ typed(andNumber) - -// relational (2) -export const compare = /* #__PURE__ */ createCompareNumber({ config, typed }) -export const compareNatural = /* #__PURE__ */ createCompareNatural({ typed, compare }) -export const compareText = /* #__PURE__ */ createCompareTextNumber({ typed }) -export const equal = /* #__PURE__ */ createEqualNumber({ typed, equalScalar }) -export const equalText = /* #__PURE__ */ createEqualText({ typed, compareText, isZero }) -export const smaller = /* #__PURE__ */ createSmallerNumber({ config, typed }) -export const smallerEq = /* #__PURE__ */ createSmallerEqNumber({ config, typed }) -export const larger = /* #__PURE__ */ createLargerNumber({ config, typed }) -export const largerEq = /* #__PURE__ */ createLargerEqNumber({ config, typed }) -export const deepEqual = /* #__PURE__ */ createDeepEqual({ config, typed, equal }) -export const unequal = /* #__PURE__ */ createUnequalNumber({ config, typed, equalScalar }) - -// matrix (2) -export const partitionSelect = /* #__PURE__ */ createPartitionSelect({ typed, isNumeric, isNaN, compare }) -export const range = /* #__PURE__ */ createRange({ config, typed, smaller, smallerEq, larger, largerEq }) -// export const sort = /* #__PURE__ */ createSort({ typed, matrix, compare, compareNatural }) - -// statistics (2) -export const max = /* #__PURE__ */ createMax({ typed, larger }) -export const min = /* #__PURE__ */ createMin({ typed, smaller }) - -// class (2) -// export const ImmutableDenseMatrix = /* #__PURE__ */ createImmutableDenseMatrixClass({ smaller, DenseMatrix }) -// export const Index = /* #__PURE__ */ createIndexClass({ ImmutableDenseMatrix }) -// export const FibonacciHeap = /* #__PURE__ */ createFibonacciHeapClass({ smaller, larger }) -// export const Spa = /* #__PURE__ */ createSpaClass({ addScalar, equalScalar, FibonacciHeap }) -// export const Unit = /* #__PURE__ */ createUnitClass({ -// config, -// addScalar, -// subtract, -// multiplyScalar, -// divideScalar, -// pow, -// abs, -// fix, -// round, -// equal, -// isNumeric, -// format, -// number, -// Complex, -// BigNumber, -// Fraction -// }) - -// constants -export const _true = true -export const _false = false -export const _null = null -export const _Infinity = Infinity -export const _NaN = NaN -export { pi, tau, e, phi } from '../plain/number' -export const LN2 = Math.LN2 -export const LN10 = Math.LN10 -export const LOG2E = Math.LOG2E -export const LOG10E = Math.LOG10E -export const SQRT1_2 = Math.SQRT1_2 -export const SQRT2 = Math.SQRT2 -// export const i = /* #__PURE__ */ createI({ config, Complex }) -export { version } from '../version' - -// // physical constants -// const pyhiscalConstantsDependencies = { -// config, -// BigNumber, -// Unit -// } -// -// // Universal constants -// export const speedOfLight = /* #__PURE__ */ createSpeedOfLight(pyhiscalConstantsDependencies) -// export const gravitationConstant = /* #__PURE__ */ createGravitationConstant(pyhiscalConstantsDependencies) -// export const planckConstant = /* #__PURE__ */ createPlanckConstant(pyhiscalConstantsDependencies) -// export const reducedPlanckConstant = /* #__PURE__ */ createReducedPlanckConstant(pyhiscalConstantsDependencies) -// -// // Electromagnetic constants -// export const magneticConstant = /* #__PURE__ */ createMagneticConstant(pyhiscalConstantsDependencies) -// export const electricConstant = /* #__PURE__ */ createElectricConstant(pyhiscalConstantsDependencies) -// export const vacuumImpedance = /* #__PURE__ */ createVacuumImpedance(pyhiscalConstantsDependencies) -// export const coulomb = /* #__PURE__ */ createCoulomb(pyhiscalConstantsDependencies) -// export const elementaryCharge = /* #__PURE__ */ createElementaryCharge(pyhiscalConstantsDependencies) -// export const bohrMagneton = /* #__PURE__ */ createBohrMagneton(pyhiscalConstantsDependencies) -// export const conductanceQuantum = /* #__PURE__ */ createConductanceQuantum(pyhiscalConstantsDependencies) -// export const inverseConductanceQuantum = /* #__PURE__ */ createInverseConductanceQuantum(pyhiscalConstantsDependencies) -// export const magneticFluxQuantum = /* #__PURE__ */ createMagneticFluxQuantum(pyhiscalConstantsDependencies) -// export const nuclearMagneton = /* #__PURE__ */ createNuclearMagneton(pyhiscalConstantsDependencies) -// export const klitzing = /* #__PURE__ */ createKlitzing(pyhiscalConstantsDependencies) -// -// // Atomic and nuclear constants -// export const bohrRadius = /* #__PURE__ */ createBohrRadius(pyhiscalConstantsDependencies) -// export const classicalElectronRadius = /* #__PURE__ */ createClassicalElectronRadius(pyhiscalConstantsDependencies) -// export const electronMass = /* #__PURE__ */ createElectronMass(pyhiscalConstantsDependencies) -// export const fermiCoupling = /* #__PURE__ */ createFermiCoupling(pyhiscalConstantsDependencies) -// export const fineStructure = /* #__PURE__ */ createFineStructure(pyhiscalConstantsDependencies) -// export const hartreeEnergy = /* #__PURE__ */ createHartreeEnergy(pyhiscalConstantsDependencies) -// export const protonMass = /* #__PURE__ */ createProtonMass(pyhiscalConstantsDependencies) -// export const deuteronMass = /* #__PURE__ */ createDeuteronMass(pyhiscalConstantsDependencies) -// export const neutronMass = /* #__PURE__ */ createNeutronMass(pyhiscalConstantsDependencies) -// export const quantumOfCirculation = /* #__PURE__ */ createQuantumOfCirculation(pyhiscalConstantsDependencies) -// export const rydberg = /* #__PURE__ */ createRydberg(pyhiscalConstantsDependencies) -// export const thomsonCrossSection = /* #__PURE__ */ createThomsonCrossSection(pyhiscalConstantsDependencies) -// export const weakMixingAngle = /* #__PURE__ */ createWeakMixingAngle(pyhiscalConstantsDependencies) -// export const efimovFactor = /* #__PURE__ */ createEfimovFactor(pyhiscalConstantsDependencies) -// -// // Physico-chemical constants -// export const atomicMass = /* #__PURE__ */ createAtomicMass(pyhiscalConstantsDependencies) -// export const avogadro = /* #__PURE__ */ createAvogadro(pyhiscalConstantsDependencies) -// export const boltzmann = /* #__PURE__ */ createBoltzmann(pyhiscalConstantsDependencies) -// export const faraday = /* #__PURE__ */ createFaraday(pyhiscalConstantsDependencies) -// export const firstRadiation = /* #__PURE__ */ createFirstRadiation(pyhiscalConstantsDependencies) -// export const loschmidt = /* #__PURE__ */ createLoschmidt(pyhiscalConstantsDependencies) -// export const gasConstant = /* #__PURE__ */ createGasConstant(pyhiscalConstantsDependencies) -// export const molarPlanckConstant = /* #__PURE__ */ createMolarPlanckConstant(pyhiscalConstantsDependencies) -// export const molarVolume = /* #__PURE__ */ createMolarVolume(pyhiscalConstantsDependencies) -// export const sackurTetrode = /* #__PURE__ */ createSackurTetrode(pyhiscalConstantsDependencies) -// export const secondRadiation = /* #__PURE__ */ createSecondRadiation(pyhiscalConstantsDependencies) -// export const stefanBoltzmann = /* #__PURE__ */ createStefanBoltzmann(pyhiscalConstantsDependencies) -// export const wienDisplacement = /* #__PURE__ */ createWienDisplacement(pyhiscalConstantsDependencies) -// -// // Adopted values -// export const molarMass = /* #__PURE__ */ createMolarMass(pyhiscalConstantsDependencies) -// export const molarMassC12 = /* #__PURE__ */ createMolarMassC12(pyhiscalConstantsDependencies) -// export const gravity = /* #__PURE__ */ createGravity(pyhiscalConstantsDependencies) -// -// // Natural units -// export const planckLength = /* #__PURE__ */ createPlanckLength(pyhiscalConstantsDependencies) -// export const planckMass = /* #__PURE__ */ createPlanckMass(pyhiscalConstantsDependencies) -// export const planckTime = /* #__PURE__ */ createPlanckTime(pyhiscalConstantsDependencies) -// export const planckCharge = /* #__PURE__ */ createPlanckCharge(pyhiscalConstantsDependencies) -// export const planckTemperature = /* #__PURE__ */ createPlanckTemperature(pyhiscalConstantsDependencies) - -// create (2) -// export const sparse = /* #__PURE__ */ createSparse({ typed, SparseMatrix }) -// export const unit = /* #__PURE__ */ createUnitFactory({ typed, Unit }) -// export const createUnit = /* #__PURE__ */ createCreateUnit({ typed, Unit }) - -// trigonometry (2) -export const acos = /* #__PURE__ */ typed(acosNumber) -export const acosh = /* #__PURE__ */ typed(acoshNumber) -export const acot = /* #__PURE__ */ typed(acotNumber) -export const acoth = /* #__PURE__ */ typed(acothNumber) -export const acsc = /* #__PURE__ */ typed(acscNumber) -export const acsch = /* #__PURE__ */ typed(acschNumber) -export const asec = /* #__PURE__ */ typed(asecNumber) -export const asech = /* #__PURE__ */ typed(asechNumber) -export const asin = /* #__PURE__ */ typed(asinNumber) -export const asinh = /* #__PURE__ */ typed(asinhNumber) -export const atan = /* #__PURE__ */ typed(atanNumber) -export const atan2 = /* #__PURE__ */ typed(atan2Number) -export const atanh = /* #__PURE__ */ typed(atanhNumber) -export const cos = /* #__PURE__ */ typed(cosNumber) -export const cosh = /* #__PURE__ */ typed(coshNumber) -export const cot = /* #__PURE__ */ typed(cotNumber) -export const coth = /* #__PURE__ */ typed(cothNumber) -export const csc = /* #__PURE__ */ typed(cscNumber) -export const csch = /* #__PURE__ */ typed(cschNumber) -export const sec = /* #__PURE__ */ typed(secNumber) -export const sech = /* #__PURE__ */ typed(sechNumber) -export const sin = /* #__PURE__ */ typed(sinNumber) -export const sinh = /* #__PURE__ */ typed(sinhNumber) -export const tan = /* #__PURE__ */ typed(tanNumber) -export const tanh = /* #__PURE__ */ typed(tanhNumber) - -// set (2) -// export const setCartesian = /* #__PURE__ */ createSetCartesian({ typed, size, subset, compareNatural, Index, DenseMatrix }) -// export const setDifference = /* #__PURE__ */ createSetDifference({ typed, size, subset, compareNatural, Index, DenseMatrix }) -// export const setDistinct = /* #__PURE__ */ createSetDistinct({ typed, size, subset, compareNatural, Index, DenseMatrix }) -// export const setIntersect = /* #__PURE__ */ createSetIntersect({ typed, size, subset, compareNatural, Index, DenseMatrix }) -// export const setIsSubset = /* #__PURE__ */ createSetIsSubset({ typed, size, subset, compareNatural, Index }) -// export const setMultiplicity = /* #__PURE__ */ createSetMultiplicity({ typed, size, subset, compareNatural, Index }) -// export const setPowerset = /* #__PURE__ */ createSetPowerset({ typed, size, subset, compareNatural, Index }) -// export const setSize = /* #__PURE__ */ createSetSize({ typed, compareNatural }) -// export const setSymDifference = /* #__PURE__ */ createSetSymDifference({ typed, size, concat, subset, setDifference, Index }) -// export const setUnion = /* #__PURE__ */ createSetUnion({ typed, size, concat, subset, setIntersect, setSymDifference, Index }) - -// arithmetic (3) -export const add = /* #__PURE__ */ typed(addNumber) -export const hypot = /* #__PURE__ */ createHypot({ typed, abs, addScalar, divideScalar, multiplyScalar, sqrt, smaller, isPositive }) -export const norm = /* #__PURE__ */ typed(normNumber) - -// matrix (3) -// export const dot = /* #__PURE__ */ createDot({ typed, add, multiply }) -// export const trace = /* #__PURE__ */ createTrace({ typed, matrix, add }) -// export const index = /* #__PURE__ */ createIndex({ typed, Index }) - -// algebra (3) -// export const lup = /* #__PURE__ */ createLup({ -// typed, -// matrix, -// abs, -// addScalar, -// divideScalar, -// multiplyScalar, -// subtract, -// larger, -// equalScalar, -// unaryMinus, -// DenseMatrix, -// SparseMatrix, -// Spa -// }) -// export const qr = /* #__PURE__ */ createQr({ -// typed, -// matrix, -// zeros, -// identity, -// isZero, -// unequal, -// sign, -// sqrt, -// conj, -// unaryMinus, -// addScalar, -// divideScalar, -// multiplyScalar, -// subtract -// }) -// export const slu = /* #__PURE__ */ createSlu({ typed, abs, add, multiply, transpose, divideScalar, subtract, larger, largerEq, SparseMatrix }) -// export const lusolve = /* #__PURE__ */ createLusolve({ typed, matrix, lup, slu, usolve, lsolve, DenseMatrix }) - -// matrix (4) -// export const det = /* #__PURE__ */ createDet({ typed, matrix, subtract, multiply, unaryMinus, lup }) -// export const inv = /* #__PURE__ */ createInv({ typed, matrix, divideScalar, addScalar, multiply, unaryMinus, det, identity, abs }) -// export const expm = /* #__PURE__ */ createExpm({ typed, abs, add, identity, inv, multiply }) -// export const sqrtm = /* #__PURE__ */ createSqrtm({ typed, abs, add, multiply, sqrt, subtract, inv, size, max, identity }) - -// arithmetic (4) -export const divide = /* #__PURE__ */ typed(divideNumber) - -// geometry (4) -// export const distance = /* #__PURE__ */ createDistance({ typed, addScalar, subtract, multiplyScalar, divideScalar, unaryMinus, sqrt, abs }) -// export const intersect = /* #__PURE__ */ createIntersect({ config, typed, abs, add, addScalar, matrix, multiply, multiplyScalar, divideScalar, subtract, smaller, equalScalar }) - -// statistics (4) -export const sum = /* #__PURE__ */ createSum({ config, typed, add }) -export const mean = /* #__PURE__ */ createMean({ typed, add, divide }) -export const median = /* #__PURE__ */ createMedian({ typed, add, divide, compare, partitionSelect }) -export const mad = /* #__PURE__ */ createMad({ typed, abs, map, median, subtract }) -export const variance = /* #__PURE__ */ createVariance({ typed, add, subtract, multiply, divide, apply, isNaN }) -export const quantileSeq = /* #__PURE__ */ createQuantileSeq({ typed, add, multiply, partitionSelect, compare }) -export const std = /* #__PURE__ */ createStd({ typed, sqrt, variance }) - -// probability (4) -export const combinations = /* #__PURE__ */ typed(combinationsNumber) -export const gamma = /* #__PURE__ */ typed(gammaNumber) -export const factorial = /* #__PURE__ */ createFactorial({ typed, gamma }) -// export const kldivergence = /* #__PURE__ */ createKldivergence({ typed, matrix, divide, sum, multiply, dotDivide, log, isNumeric }) -export const multinomial = /* #__PURE__ */ createMultinomial({ typed, add, divide, multiply, factorial, isInteger, isPositive }) -export const permutations = /* #__PURE__ */ createPermutations({ typed, factorial }) -export const pickRandom = /* #__PURE__ */ createPickRandom({ typed, config }) -export const random = /* #__PURE__ */ createRandom({ typed, config, matrix }) -export const randomInt = /* #__PURE__ */ createRandomInt({ typed, config }) - -// combinatorics (4) -export const stirlingS2 = /* #__PURE__ */ createStirlingS2({ typed, addScalar, subtract, multiplyScalar, divideScalar, pow, factorial, combinations, isNegative, isInteger, larger }) -export const bellNumbers = /* #__PURE__ */ createBellNumbers({ typed, addScalar, isNegative, isInteger, stirlingS2 }) -export const catalan = /* #__PURE__ */ createCatalan({ typed, addScalar, divideScalar, multiplyScalar, combinations, isNegative, isInteger }) -export const composition = /* #__PURE__ */ createComposition({ typed, addScalar, combinations, isPositive, isNegative, isInteger, larger }) diff --git a/src/entry/mainAny.js b/src/entry/mainAny.js index 1c1b4ceb0..e95021e62 100644 --- a/src/entry/mainAny.js +++ b/src/entry/mainAny.js @@ -1,5 +1,8 @@ +// configuration +export { config } from './configReadonly' + // functions and constants -export * from './functionsAny' +export * from './functionsAny.generated' export * from './evaluateAny' export * from './typeChecks' diff --git a/src/entry/mainNumber.js b/src/entry/mainNumber.js index e5c2b0737..43ec26666 100644 --- a/src/entry/mainNumber.js +++ b/src/entry/mainNumber.js @@ -1,5 +1,8 @@ +// configuration +export { config } from './configReadonly' + // functions and constants -export * from './functionsNumber' +export * from './functionsNumber.generated' export * from './evaluateNumber' export * from './typeChecks' diff --git a/tools/entryGenerator.js b/tools/entryGenerator.js index acffe1e22..4677010e6 100644 --- a/tools/entryGenerator.js +++ b/tools/entryGenerator.js @@ -12,6 +12,26 @@ const IGNORED_DEPENDENCIES = { 'classes': true } +const IGNORED_FACTORIES = { + 'typeof': true, + 'var': true, + 'eval': true, + 'E': true, + 'PI': true +} + +const FACTORY_NAMES_ES6_MAPPING = { + 'true': '_true', + 'false': '_false', + 'NaN': '_NaN', + 'null': '_null', + 'Infinity': '_Infinity' +} + +const IGNORED_DEPENDENCIES_ES6 = { + 'on': true +} + const dependenciesIndexTemplate = Handlebars.compile(`/** * THIS FILE IS AUTO-GENERATED * DON'T MAKE CHANGES HERE @@ -40,36 +60,67 @@ export const {{name}} = {{braceOpen}}{{eslintComment}} } `) +const pureFunctionsTemplate = Handlebars.compile(`/** + * THIS FILE IS AUTO-GENERATED + * DON'T MAKE CHANGES HERE + */ +import { config } from './configReadonly' +import { + {{#factories}} + {{factoryName}}{{#unless @last}},{{/unless}}{{eslintComment}} + {{/factories}} +} from '../factories{{suffix}}' + +{{#factories}} +export const {{name}} = /* #__PURE__ */ {{factoryName ~}} +({{braceOpen}}{{#if dependencies}} {{/if ~}} +{{#dependencies ~}} +{{name}}{{#unless @last}}, {{/unless ~}} +{{/dependencies ~}} +{{#if dependencies}} {{/if ~}}}) +{{/factories}} +`) + exports.generateEntryFiles = function () { const factoriesAny = require('../lib/factoriesAny') const factoriesNumber = require('../lib/factoriesNumber') - generateIndexFile({ + generateDependenciesFiles({ suffix: 'Any', factories: factoriesAny, entryFolder: ENTRY_FOLDER }) - generateIndexFile({ + generateDependenciesFiles({ + suffix: 'Number', + factories: factoriesNumber, + entryFolder: ENTRY_FOLDER + }) + + generateFunctionsFiles({ + suffix: 'Any', + factories: factoriesAny, + entryFolder: ENTRY_FOLDER + }) + + generateFunctionsFiles({ suffix: 'Number', factories: factoriesNumber, entryFolder: ENTRY_FOLDER }) } -exports.generateEntryFiles() // TODO: cleanup +exports.generateEntryFiles() // FIXME: cleanup /** - * Generate the following index files - * dependenciesAny.js - * dependenciesNumber.js + * Generate index files like + * dependenciesAny.generated.js + * dependenciesNumber.generated.js + * And the individual files for every dependencies collection. */ -// TODO: refactor this function: create template files and fill these in -function generateIndexFile ({ - suffix, - factories, - entryFolder -}) { +function generateDependenciesFiles ({ suffix, factories, entryFolder }) { + const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars + // a map containing: // { // 'sqrt': true, @@ -92,8 +143,8 @@ function generateIndexFile ({ return { suffix, factoryName, - braceOpen: '{', - name: getDependenciesName(factoryName, factories), + braceOpen, + name: getDependenciesName(factoryName, factories), // FIXME: rename name with dependenciesName, and functionName with name fileName: './dependencies' + suffix + '/' + getDependenciesFileName(factoryName) + '.generated', eslintComment: factoryName === 'createSQRT1_2' ? ' // eslint-disable-line camelcase' @@ -141,13 +192,95 @@ function generateIndexFile ({ fs.writeFileSync(path.join(entryFolder, 'dependencies' + suffix + '.generated.js'), generated) } +/** + * Generate index files like + * functionsAny.generated.js + * evaluateAny.generated.js + */ +function generateFunctionsFiles ({ suffix, factories, entryFolder }) { + const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars + + // sort the factories, and split them in three groups: + // - transform: the transform functions + // - impure: the functions that depend on `math` or `mathWithTransform` (directly or indirectly), + // - pure: the rest + const pureFactories = [] + const impureFactories = [] + const transformFactories = [] + sortFactories(values(factories)) + .filter(factory => !IGNORED_FACTORIES[factory.fn]) + .forEach(factory => { + if (isTransform(factory)) { + transformFactories.push(factory) + } else if ( + contains(factory.dependencies, 'math') || + contains(factory.dependencies, 'mathWithTransform') || + contains(factory.dependencies, 'classes') || + isTransform(factory) || + factory.dependencies.some(dependency => { + return impureFactories.find(f => f.fn === stripOptionalNotation(dependency)) + }) + ) { + impureFactories.push(factory) + } else { + pureFactories.push(factory) + } + }) + + // a map containing: + // { + // 'sqrt': true, + // 'subset': true, + // ... + // } + const pureExists = { + config: true + } + pureFactories.forEach(factory => { + pureExists[factory.fn] = true + }) + + // create file with all functions: functionsAny.js, functionsNumber.js + fs.writeFileSync(path.join(entryFolder, 'functions' + suffix + '.generated.js'), pureFunctionsTemplate({ + suffix, + factories: pureFactories.map(factory => { + const name = FACTORY_NAMES_ES6_MAPPING[factory.fn] || factory.fn + + return { + braceOpen, + factoryName: findKey(factories, factory), // TODO: find a better way to match the factory names + eslintComment: name === 'SQRT1_2' + ? ' // eslint-disable-line camelcase' + : undefined, + name, + dependencies: factory.dependencies + .map(stripOptionalNotation) + .filter(dependency => !IGNORED_DEPENDENCIES_ES6[dependency]) + .filter(dependency => { + // TODO: this code is duplicated. extract it in a separate function + if (!pureExists[dependency]) { + if (factory.dependencies.indexOf(dependency) !== -1) { + throw new Error(`Required dependency "${dependency}" missing for factory "${factory.fn}"`) + } + + return false + } + + return true + }) + .map(dependency => ({ name: dependency })) + } + }) + })) +} + function getDependenciesName (factoryName, factories) { if (!factories) { throw new Error(`Cannot create dependencies name: factories is undefined`) } const factory = factories[factoryName] - const transform = factory.meta && factory.meta.isTransformFunction ? 'Transform' : '' + const transform = isTransform(factory) ? 'Transform' : '' return factory.fn + transform + 'Dependencies' } @@ -172,13 +305,26 @@ function findFactoryName (factories, name) { return undefined } +function findKey (object, value) { + for (const key in object) { + if (object.hasOwnProperty(key)) { + if (object[key] === value) { + return key + } + } + } + + return undefined +} + /** * Sort the factories in such a way that their dependencies are resolved. * @param {Array} factories * @return {Array} Returns sorted factories */ -// TODO: cleanup the function sortFactories if we don't need it in the end -exports.sortFactories = function (factories) { +exports.sortFactories = sortFactories + +function sortFactories (factories) { const loaded = {} const leftOverFactories = factories.slice() const sortedFactories = [] @@ -204,7 +350,7 @@ exports.sortFactories = function (factories) { for (let i = 0; i < leftOverFactories.length; i++) { const factory = leftOverFactories[i] if (allDependenciesResolved(factory.dependencies)) { - if (!factory.meta || !factory.meta.isTransformFunction) { + if (!isTransform(factory)) { loaded[factory.fn] = true } sortedFactories.push(factory) @@ -223,11 +369,18 @@ exports.sortFactories = function (factories) { return sortedFactories } -// TODO: cleanup the function values if we don't need it in the end -exports.values = function (object) { +function values (object) { return Object.keys(object).map(key => object[key]) } +function contains (array, item) { + return array.indexOf(item) !== -1 +} + +function isTransform (factory) { + return (factory && factory.meta && factory.meta.isTransformFunction === true) || false +} + function stripOptionalNotation (dependency) { return dependency && dependency[0] === '?' ? dependency.slice(1)