Skip to content

Releases: trizen/sidef

Version 3.80

18 May 23:52
Compare
Choose a tag to compare

Additions

  • Added the Number lpf(n) and gpf(n) methods. (b0114f6)
  • Added the Number fermat_factor(n, k=1e4) method. (e1e5781)
  • Added the Number is_prob_squarefree(n, k) method. (d4b422b)
  • Added the Number is_composite(n) method. (7d9bc24)
  • Added the Number is_fibonacci_pseudoprime(n). (b8379ca)
  • Added the Number is_perrin_pseudoprime(n). (a9ebae8)
  • Added the Number is_cube(n) method. (ec291e4)
  • Added the Number numify(n) method. (269a6b3)
  • Added the Number dirichlet_convolution(n, f, g) method. (33468e5, b467a89)
  • Added support for obj.SUPER::method_name(), which calls the parent method. (4671217)
  • Added the Set and Bag .each_2d{...}, .map_2d{...} and .grep_2d{...} methods. (b9a1c45)
  • Added the Array .each_2d{...}, .map_2d{...} and .grep_2d{...} methods.. (4713948, 4193637)
  • Added the Array .stack_by{...} method. (41c29ad)
  • Added the Array .split(indices...) method. (3c9a230)
  • Added the Array .avg and .avg_by {...} methods. (cac72ec, 2512a40)

Improvements

  • Allow definition of typeless subsets. (839dad8)
  • Support for slurpy define, static and const declarations. (1a4f63c, 0ddb798, d8135cc)
  • Support for using an earlier declared variable in const, static and define declarations. (ab3fdba)
  • Simpler Perl deparsing of const declarations. (d4c6170)
  • Better deparsing of subset blocks. (0eda2cf)
  • Improved the error messages for return types. (e60ad3f)
  • Included the namespace in the name of functions. (67d7b6f)
  • Better parsing and deparsing of the try/catch construct. (ee0de4e)
  • Added default Block identities for {Set,Bag} map* and grep* methods. (f28b296)
  • Extended Number sqrt_cfrac(n) to accept an optional argument. (d68c4e8)
  • Added a lookup table in the Number mertens(n) function for n = 10^k. (d3092e6)
  • Allow struct entries to be delimited by newlines (in addition to commas). (#100) (604c40f, f495bf6)

Changes

  • Enabled STDOUT autoflush by default. (c623be0)
  • Interactive mode: allow tabs to be used for identation (by inhibiting completion). (9a34c3d)

Bug-fixes

  • Stricter localization of function declarations. (4a9f6d2, 0eda2cf)
  • Create the multimethods in the exact order as they were defined. (ae5ba70)
  • Minor fix in bin/sidef when reading code from standard input. (e724f6e)
  • Fixed several in-place auto-conversion issues in the Number class. (8c2c273)
  • Fixed the line number of multi-line const declarations. (05da691)
  • Evaluate the Set and Bag .map{...} method in list context. (da00c40)
  • Perl deparser: no longer cache literals. (eafdc32)
  • Perl deparser: store each block into a lexical variable. (5911c5c)
  • Sidef deparser: corrected the deparsing of calls applied on an expression. (a223fdd)
  • Fixed the serialization of loaded Perl modules inside Block.ffork. (2c98143)

All changes: 3.70...3.80

Version 3.70

24 Mar 18:11
Compare
Choose a tag to compare

Additions

  • Added the Number sqrt_cfrac_period_len(n) method. (96931df)
  • Added the Number faulhaber_polynomial(n,x) for integer n>=0 and any x. (fac65fd)
  • Added the Number n.th { ... } method. (0b1b84e)
  • Added the Lazy.nth(n) method. (ff6cef3)
  • Added the Block.nth(n, range) method. (26307de)
  • Added the Block.first(n, [range]) method. (28b8ff9)
  • Added the Array digits2num(arr, base) method. (a0c5beb)
  • Added the Array .sum_kv {|k,v| ... } and .prod_kv {|k,v| ... } methods. (5cae375)
  • Added the Regex gmatches methods. (3fd44e6)
  • Added the Regex concat and union methods. (5740d21, 1f10474)
  • Added the Object methods is_object and is_typename. (#93) (5b08093)
  • Added the Vector pow method. (f46fdbc)
  • Added the Matrix vector_rows and vector_columns methods. (83c5fc9)
  • Added the NamedParam contructor to create named-parameter objects. (873db3c)
  • Added the aliases and in the Array, Set and Bag classes. (c972b0a)
  • Added the __COMPILED__ and __OPTIMIZED__ boolean parser-keywords. (c613d8a, 070dd43)

Improvements

  • Optimizations in String apply_escapes for very long strings. (ebd6334)
  • Optimization in Number arithmetic_derivative(n) for numbers with high prime-powers. (6ca0704)
  • Better deparsing of class names. (b2c5ce8)
  • Support return of multiple values from the try/catch construct. (#90) (9cdcaa4)
  • Allow commas to be used in %v(...). (e7ea8a1)
  • Use a much faster algorithm in Number mertens(n). (42064b5, bb3ccc9)
  • Extended the cache in Number prime(n) up to n = 10^6. (4555063)
  • Added a lookup table in Number nth_prime(n) for n = 10^k. (513dee5)
  • Added a lookup table for powers of 10 in Number prime_count(n). (15f8a30, cc9d0fc)
  • Optimization in Number prime_power_count(a, b) for b - a > 10^6. (84fc603)
  • Split Range count_by and accumulate_by in separate methods. (e7db649)
  • Extended Object.methods() to accept default arguments. (3fbdcba)
  • Simplifications in Array and RangeNum .sum* and .prod* methods. (4d785a6)
  • Allow functions to be provided wherever a block was previously required. (be7670a)
  • Extended the Array .first(n) and .last(n) methods to accept negative values of n. (ba080e8)

Changes

  • Compile a if b as b && a. (fee27d8)
  • Deprecated the Pair object. (d8af138)
  • Return an explicit undef where a scalar is expected. (#72) (a8e869d)

Bug-fixes

  • Workaround Perl's regex quanitifer limitation. (#75) (580a1e1, 9ff9627)
  • Prefer dynamical constants everywhere. (#77) (ae9a3aa)
  • Initialize const values at declaration. (#81) (3766edf)
  • Declare enum values in the current module (if any). (#83) (58d19f5)
  • Allow a topic variable (_) to be used inside a module. (#86) (92cd1e1)
  • Fixed the Sidef deparsing of inhereted classes defined in a module. (#78) (baf53b9)
  • Fixed the Sidef deparsing of the prefix-colon operator. (#84) (9244cf4)
  • Fixed an implicit method call on the topic variable (.method_name) inside a module. (#86) (b1eda0b)
  • Fixed the generated code for a constant const named v. (#95) (9f663c0)
  • Fixed the Sidef deparsing of subsets and structs defined inside a module. (#78) (49366b2, fbd8a56)
  • Fixed the error messages for include and import. (#74) (4815917)

All changes: 3.60...3.70

Version 3.60

07 Jan 00:45
Compare
Choose a tag to compare

Additions

  • Added the Vector built-in class. (858b6a4, 3602614, de75a77)
  • Added the %v(...) and %m(...;...) special quotes for creating a Vector or a Matrix. (5e79ebf)
  • Added the experimental pipeline operator |>. (2eecf31, af4cca0, 53a5b73)
  • Added the Array pipeline cross-product operator |X>. (d130fb9, 20c9ec9, 1101be3, 1a4a80a)
  • Added the Array pipeline zip operator |Z>. (9ff9150)
  • Added the Array and Range .none { ... } method. (d70da6b)
  • Added the Array .map_reduce {|a,b| ... } method. (7442459, e2f2482)
  • Added the Range accumulate and accumulate_by{} methods. (7dbd0d4)
  • Added the Number is_between(n, min, max) method. (c6c7d96)
  • Added the Number mertens(a, b) method. (2ad5ad5, 3f211d8)
  • Added the Number is_smooth_over_prod(n, k) method. (4e53852)
  • Added the Number prime_power_count(a, b) method. (606b32a)
  • Added the Number polygonal_inverse(n) method. (4e7f0b8)
  • Added the Number sum_primes(a,b) and inverse_totient_len(n) methods. (8b0d5cf)
  • Added the Number .factor_map {...} and .divisor_map {...} methods. (c231000)
  • Added the Number sum(...) and prod(...) methods. (7bfdefd)
  • Added the Number kronecker_delta(a, b) method (aliased as δ(a, b)). (5777769)
  • Added the Matrix .map {|v,i,j| ... } method to map the values of a matrix. (2e012ce)
  • Added the Matrix abs and neg entrywise methods. (db12040)
  • Added the Matrix t and prefix ~ aliases for transpose. (c471df3)
  • Added the String run method. (1a48166)
  • Added support for deleting variables from the current scope. (Python-like) (0f99842) (#54)

Improvements

  • Reimplemented the support for modules in a better way. (e745386)
  • Implemented support for class slurpy has attributes. (dfc0c0f)
  • Much faster algorithm in Number is_smooth(n,k). (4e53852)
  • Extended Hash.concat() to work with non-hash arguments. (534ffdc)
  • Allow typenames to be used with the smartmatch operator. (e50bb56) (#42)
  • Included the namespace of variables in the Did you mean? message. (247e76d)
  • Cached the bernoulli(n) function for input values of n <= 500. (31b5631, 0dc9d05)
  • More implicit conversions in the Array, Set and Bag classes. (15d60bc) (#67)
  • Extended the Number moebius function to accept an optional argument. (2ad5ad5)
  • Reimplemented the Number dedekind_psi(n,k) function for better performance. (e97b612)
  • Auto-detect if Math::Prime::Util is installed. (8b0d5cf)
  • String overloading support for Perl objects. (48f9c63) (#66)
  • Simplications and optimizations inside the Array, Math and RangeNum classes. (7bfdefd)
  • Extended the Number min(...) and max(...) methods to accept any number of arguments. (7bfdefd)

Changes

  • Swapped the order of parameters in the jordan_totient function. (603f6ae)
  • Moved the pair-operator : in the Object class. (2f33be5)
  • Classes are now lexically scoped. (a083d5a)
  • Changed the returned value of "".ord from NaN to nil. (ef52eaf)
  • Changed the aliases of is_subset and is_superset in the Bag and Set classes to has. (5332967)

Bug-fixes

  • Compare the refaddr() of objects only for objects of the same type. (ed16c73) (#46)
  • Minor fix for extremely long lines in error messages. (e7bd2d6) (#43)
  • Fixed several eval() issues. (c1eb97e) (#53)
  • Several minor fixes in the Number class. (677ef21)
  • Fixed some special cases of base conversions. (42845fe)
  • Minor fix for methods with non-alphanumeric names in interactive mode. (0a3cbbf)
  • Don't do auto-inheritance of class attributes in nested classes. (a083d5a) (#40)
  • Fixed the slurpy variables & parameters in interactive mode. (665b39e) (#52)
  • Fixed the String base64_encode() and base64_decode() methods. (ef52eaf)

All changes: 3.50...3.60

Version 3.50

13 Oct 22:05
Compare
Choose a tag to compare

Additions

  • Added the built-in Set(...) class. (86696c3)
  • Added the built-in Bag(...) class. (56e9b15)
  • Added the built-in Matrix(...) class. (0ecfd31)

Added the following Number methods, provided by Math::Prime::Util::GMP:

LucasUmod(p, q, n, m)                  # Lucas U_n(p, q) (mod m) function.
LucasVmod(p, q, n, m)                  # Lucas V_n(p, q) (mod m) function.
prime_count_lower(n)                   # lower bound for prime_count(n).
prime_count_upper(n)                   # upper bound for prime_count(n).
factorial_sum(n)                       # left factorial of `n` (also aliased as `left_factorial(n)`)
random_nbit_strong_prime(k)            # generate a random k-bit strong prime number.
random_maurer_nbit_prime(k)            # generate a random k-bit Marurer prime.

Primality testing methods:

is_fermat_pseudoprime(n,a,b,c,...)     # true if `n` is a Fermat pseudoprime to the provided bases.
is_euler_pseudoprime(n,a,b,c,...)      # true if `n` is an Euler-Jacobi pseudoprime, given a list of bases.
is_strong_pseudoprime(n,a,b,c,...)     # true if `n` is strong pseudoprime.
miller_rabin_random(n, k)              # true if `n` passes the Miller-Rabin primality test with `k` random bases.
is_lucas_pseudoprime(n)                # true if `n` is a Lucas pseudoprime.
is_strong_lucas_pseudoprime(n)         # true if `n` is a strong Lucas pseudoprime.
is_stronger_lucas_pseudoprime(n)       # true if `n` is an extra-strong Lucas pseudoprime (also aliased as `is_extra_strong_lucas_pseudoprime(n)`).
is_strongish_lucas_pseudoprime(n)      # true if `n` is almost an extra-strong Lucas pseudoprime.
is_plumb_pseudoprime(n)                # true if `n` passes Colin Plumb's Euler Criterion primality test.
is_frobenius_pseudoprime(n,a,b)        # true if `n` is a Frobenius probable prime with respect to the polynomial `x^2 - ax + b`
is_frobenius_underwood_pseudoprime(n)  # true if `n` passes the efficient Frobenius test of Paul Underwood.
is_frobenius_khashin_pseudoprime(n)    # true if `n` passes the Frobenius test of Sergey Khashin.
is_bpsw_prime(n)                       # true if `n` passes the BPSW primality test (extra-strong variant).
is_aks_prime(n)                        # true if `n` passes the Agrawal-Kayal-Saxena (AKS) primality test.
is_nminus1_prime(n)                    # true if `n` can be proved prime using the factorization of `n-1`.
is_nplus1_prime(n)                     # true if `n` can be proved prime using the factorization of `n+1`.
is_ecpp_prime(n)                       # true if `n` can be proved prime using the Elliptic Curve Primality Proving algorithm.

Factorization methods:

trial_factor(n, limit)                 # trial division
prho_factor(n, r)                      # Pollard rho method
pbrent_factor(n, r)                    # Pollard-Brent rho method
pminus1_factor(n, B1)                  # Pollard p-1 method
pplus1_factor(n, B1)                   # Williams' p+1 method
holf_factor(n, r)                      # Hart's OLF method (variant of Fermat's method)
squfof_factor(n, r)                    # Shanks' SQUFOF method
ecm_factor(n, B1, curves)              # Hendrik Lenstra's elliptic curve method (ECM)
qs_factor(n)                           # Pomerance's Quadratic Sieve method (SIMPQS)

Other additions:

  • Added the Array.combine{...} method. (34a5ab7)
  • Added the Array gcd(), gcd_by{...}, lcm() and lcm_by{...} methods. (60d9044)
  • Added the Number bit_scan0(n,k), bit_scan1(n,k) and hamdist(n,m) methods. (b6cde74)

Improvements

  • Allow whitespace and comments between if/elsif/else branches. (f9c8be2)
  • Minor optimization in Number square_sigma(n, k). (30ed913)
  • Optimization in Number nth_prime(n) for large values of n. (2e5562c)
  • Extended the Number catalan method to support an additional argument. (b397996)
  • Speed-up in Number fibmod(n, m) and lucasmod(n, m). (a4d5f24)
  • Allow an optional plus sign in front of a fraction or integer in a base != 10. (3dbd844)
  • Re-implemented the Number gcdext(n, k) method, using Math::GMPz. (6ba5ccd)
  • Extended Number gcd() and lcm() to support an arbitrary number of arguments. (befafda)
  • Added constant-folding support for the value assigned to const and define constants. (d8bec4c)

Bug-fixes

  • Fixed Number square_sigma0(n) to be able to return arbitrary large integers. (10ec737)

All changes: 3.19...3.50

Version 3.19

31 Jul 09:09
Compare
Choose a tag to compare

Additions

  • Added the String s.rotate(n) method. (4e76b98)
  • Added the Number dedekind_psi(n, k) method. (e345b1b)
  • Added the Number is_powerful(n) method. (fadb79a)
  • Added the Number is_congruent(n, k, m) method. (8e45439)
  • Added the Number prime_divisors(n) method. (ed1700b)
  • Added the Number prime_udivisors method. (f019b8d)
  • Added the Number prime_power_divisors(n) method. (15b960b)
  • Added the Number prime_power_udivisors(n) method. (c548f17)
  • Added the Number square_divisors(n) method. (533e927)
  • Added the Number square_udivisors(n) method. (b9c0f15)
  • Added the Number squarefree_divisors(n) method. (ee7010a)
  • Added the Number squarefree_udivisors(n) method. (6fec76e)
  • Added the Number prime_sigma(n, k) method. (5e9bc5b)
  • Added the Number prime_usigma(n, k) method. (5e9bc5b)
  • Added the Number prime_power_sigma(n, k) method. (d58c77a)
  • Added the Number prime_power_usigma(n, k) method. (c5b0ed5)
  • Added the Number square_sigma(n, k) method. (dffe2e4)
  • Added the Number square_usigma(n, k) method. (3ec7857)
  • Added the Number squarefree_sigma(n, k) method. (7270aab)
  • Added the Number squarefree_usigma(n, k) method. (7ce0273)
  • Added the Number methods: msb(n) and lsb(n). (09c8d65)

Improvements

  • Extended the String strip(), strip_left() and strip_right() methods. (cd8ef4b)
  • Added constant-folding support for File("...") and Dir("...") (at -O1). (75a20ff)
  • Minor optimization in sqrt(n) and log(n) for negative real values of n. (ab296de)
  • Minor optimization in the comparison and equality checking of objects of the same type. (7142929)
  • Extended sqrtmod(a, n) method to work with composite numbers n. (acb3edf, 0f97de2)

Changes

  • Allow a nil value as an argument to a for-in loop. (df8862e)

Bug-fixes

  • Use dynamical constants in all blocks. (0707150)
  • Always return a fraction-string from Number.base() when the number is a fraction. (d8de05d)
  • Minor fix in the deparsing of complex number with special values, such as Inf, -Inf or NaN. (3d93c5c)

All changes: 3.18...3.19

Version 3.18

04 Jul 20:40
Compare
Choose a tag to compare

Additions

  • Added support for array-like indexing on strings. (#36) (925b3cf)
  • Added the Number usigma(n, k) and usigma0(n) methods. (85aa07c)
  • Added the Number udivisors(n) method (unitary divisors of n). (ed3ad9c, 81d7ebc)
  • Added the Number ramanujan_sum(n, k) method. (db809e0)
  • Added the Number fibmod(n,m) and lucasmod(n,m) methods. (2ec17c8, 33379b3)
  • Added the Number cyclotomic_polynomial(n, x) method. (c02de4f)
  • Added the Number secant_number(n) and tangent_number(n) methods. (8420101, ba50aa1)
  • Added the Number chebyshevT(n, x) and chebyshevU(n, x) methods. (c6bd296)
  • Added the Number HermiteH(n, x) and HermiteHe(n, x) methods. (8c795b0, 7d8af33)
  • Added the Number legendreP(n, x) method, which are the Legendre polynomials. (5e198a0)
  • Added the Number laguerreL(n, x) method, which are the Laguerre polynomials. (0f4ca50)
  • Added the Array matrix_pow method (also aliased as mpow and **). (1fdc91c, 5992c47)

Improvements

  • Minor optimization in Number prime_root(n). (56246a9)
  • Optimization: create the assertion error message only when the assertion fails. (873020d)
  • Optimization: use more direct binary splitting in the Number class. (c26ea5e)

Bug-fixes

  • Fixed a minor issue in Hash eq and same_keys methods. (8feb768, 82e895c)

All changes: 3.17...3.18

Version 3.17

30 May 21:52
Compare
Choose a tag to compare

Additions

  • Added the Array.rref() method (reduced row echelon form). (1f77458)
  • Added the Array.gauss_jordan_invert() method (matrix inversion). (1f77458)
  • Added the Array.gauss_jordan_solve(v) method. (1f77458)
  • Added the Number methods: bsearch, bsearch_le and bsearch_ge. (e09e762)
  • Added Number lnbernreal(n) method (also aliased as lnbern(n)). (a4fcb28)
  • Added the Number hyperfactorial(n) method. (1ef0b40)
  • Added the lnsuperfactorial(n) and lnhyperfactorial(n) methods. (15d9296, 5c1ae7c)
  • Added the Number bernoulli_polynomial(n, k) method. (53802c2, a0a7cdc)
  • Added the Number catalan(n) to return the n-th Catalan number. (59f1ac2)
  • Added the Array.map_cons(n, {...}) method. (28f0ab1)
  • Added the Number euler_number(n) method. (2c6f883)
  • Added the euler_polynomial(n, x) Number method. (c5c76bd, 7e7a966)
  • Added the Number geometric_sum(n, r) method. (b2c1f89, 4248165)
  • Added the Number quadratic_formula(a,b,c) method. (9480b35)
  • Added the Number iquadratic_formula(a,b,c) method. (9480b35)
  • Added the Number solve_pell(d, n) method to solve a generalized Pell equation. (f91e039)
  • Added the Number methods: approx_cmp, approx_lt, approx_le, approx_gt, approx_ge and approx_ne. (918d1ad)

Improvements

  • Extended the optimizations in Number digits(n, b) and sumdigits(n, b). (c85a90e)
  • Extended the supported base for numbers from 36 to 62. (c85a90e)
  • Optimization in Numberperfect_root(n) (11db384)
  • Various optimizations in the Perl deparser. (ec45264)
  • Optimized faulhaber_sum(n, k) to use the tangent numbers. (b4484a7)
  • Extended the Number float(x) method to convert x to any floating-point number, either real or complex (in this order). (0e32c24)

Changes

  • Renamed the Catalan constant from Num.catalan to Num.CatalanG. (b36cd44, ee2e120)
  • Changed the boolification of NaN from true to false. (9189641)

All changes: 3.16...3.17

Version 3.16

05 May 20:43
Compare
Choose a tag to compare

Additions

  • Added support for superscript Unicode powers (e.g.: a² + b²). (c39f9a8)
  • Added the Number inverse_euler_phi(n) method. (c401074)
  • Added the Number superfactorial(n) method (product of first n factorials). (44f2687)
  • Added the Number bit(n, k) method, which returns the k-th bit of integer n. (83928ec)
  • Added the Number setbit(n, k) and clearbit(n, k) methods. (0817f24)
  • Added the Number flipbit(n, k) method. (c5dd490)
  • Added Number lucasu(p, q, n) and lucasv(p, q, n) methods. (0d1e321)
  • Added Number consecutive_integer_lcm(n) (LCM of first n consecutive integers). (0d1e321)
  • Added Number random_bytes(n) (array with n random values between 0 and 255). (0d1e321)
  • Added Number random_string(n) (string with n random bytes). (0d1e321)
  • Added Number num2perm(n, k) (k-th permutation of [0, 1, ..., n-1]). (0d1e321)
  • Added Array perm2num(arr) (inverse of num2perm(n, k); finds k). (0d1e321)
  • Added Math: arithmetic_mean(), geometric_mean() and harmonic_mean(). (c46432b)
  • Added Number sumdigits(n, b) (sum of the digits of a number in a given base). (06e0dab)
  • Added the approximately-equal Number operator =~= (also available as ). (8550069, 897376b)
  • Added the ## special input token in bin/sidef to report the time in which the last result was computed. (6f12c1f)

Improvements

  • Extended the Optimizer to cover numeric ranges. (f972899)
  • Performance improvements in Array min_by{}, max_by{} and sort_by{}. (972a5b5)
  • Minor performance improvement in Number.sqrt_cfrac(). (b818f00)
  • Extended Object.dump() to dump undefined values as nil. (e267586)
  • Improved the performance in Number nth_prime(n) for values of n <= 10^7. (91a02de)
  • Extended Number fibonacci(n) to accept an optional argument specifying the Fibonacci order. (c80c3a4)

Changes

  • Minor change in the compilation code for the ternary operator. (b589bf5)

Bug-fixes

  • Minor fix in the decimal expansion of rational numbers. (613f980)
  • Fixed arithmetic_derivative(1) to return 0 instead of 1. (0fdf445)
  • Fixed Dir.home to work on more operating systems. (6cf2edb)

All changes: 3.15...3.16

Version 3.15

17 Feb 12:51
Compare
Choose a tag to compare

I'm happy to announce a new version of the Sidef programming language, which brings in some interesting new methods, along with many internal improvements and optimizations.

This release also comes with an interesting language feature, borrowed from the Julia programming language, which is the support for arbitrary nested one-line for-in loops (67f7105):

for x in (1..10), y in (x..10) {
    # ...
}

is equivalent with:

for x in (1..10) {
    for y in (x..10) {
        # ...
    }
}

The number of nested loops is virtually unlimited:

for a in (...), b in (...), c in (...), d in (...), ... {
    ...
}

Additions

Improvements

  • Support for one-line nested for-in loops (same as in Julia). (67f7105, 514bd8e, f1c6794)
  • Using mpfr_beta() when mpfr-4.0.0 is available. (4cfa15e)
  • Using mpfr_z_sub() when mpfr >= 3.1.0 is available. (f2f52fb)
  • Extended Lazy.first() to return the first item when no argument is provided. (f157ae3)
  • Extended Number.complex() to accept an optional argument. (3f33c77)
  • Switched to Hurwitz expansion for complex numbers in Number.as_cfrac(). (0ebb66f)
  • Reimplemented Number.rat_approx() for much better performance (~3x faster). (3e488c8)
  • Using a more efficient algorithm in Number.convergents(). (608aafc)
  • More efficient algorithm in computing the n-th Bell number in Number.bell(). (baa5ce9)
  • Minor simplification/optimization in Number.digits() when the base is not specified. (3099ee7)
  • Better performance in Array and RangeNumber prod() and prod_by() methods. (9ddade5)
  • Binary splitting in Array.sum(), Array.sum_by{}, Math.lcm() and Range.sum_by{}. (235ce7b)
  • Extended assert(bool), assert_eq(a, b) and assert_ne(a, b) to accept an optional argument. (ae8d8b1)

Changes

  • Reimplemented the given/when construct. (829307b)
  • Functions executed with .run() are now redirected to the .call() method. (11bf728)

Bug-fixes

  • Removed the special case for numbers with very big exponents in _str2frac(), as it could produce inexact results. (e02ca0d)

All changes: 3.10...3.15

Version 3.10

08 Dec 13:09
Compare
Choose a tag to compare

I'm happy to announce today an important release of Sidef, introducing built-in support for matrix operations, such as computing the determinant and the inverse of a square matrix and support for solving a system of linear equations, along with three new meta operators for scalar and entrywise operations on arbitrary nested arrays.

Additions

Added the following square matrix operations inside the Array class (5125aa9, 95eb696):

A.det              # determinant of a square matrix
A.inv              # inverse of a square matrix
A.msolve(vector)   # solution to a system of linear equations

Added the following general and scalar matrix operations inside the Array class (59eb68d, 4b1f63f):

A `mmul` B         # matrix multiplication
A `madd` B         # matrix addition
A `msub` B         # matrix subtraction

A `smul` scalar    # scalar multiplication
A `sdiv` scalar    # scalar division
A `sadd` scalar    # scalar addition
A `ssub` scalar    # scalar subtraction

Added the following three new meta operators: ~Wop (wise operator), ~Sop (scalar operator) and ~RSop (reverse scalar operator), implemented recursively with support for arbitrary nested arrays. The first two operators are also used internally in providing the scalar and entrywise matrix operations (4ff3c85, d88f7ee, 1de91f9):

say ([1,2,3] ~W  [4,5,6])   #=> [[1, 4], [2, 5], [3, 6]]
say ([1,2,3] ~W+ [4,5,6])   #=> [5, 7, 9]

say ([1,2,3] ~S  42)        #=> [[1, 42], [2, 42], [3, 42]]
say ([1,2,3] ~S+ 42)        #=> [43, 44, 45]

say ([3,4,5] ~RS  1)        #=> [[1, 3], [1, 4], [1, 5]]
say ([3,4,5] ~RS/ 1)        #=> [1/3, 1/4, 1/5]

Improvements

  • Simplified the Number.times{} method. (38509f6)
  • Simplifications and optimizations in the Number class. (339354f, 8043705, 79898a5)
  • ~60x faster decimal-expansion of a fraction, in Number __stringify__(). (9f8d838)
  • Sieve the primes with a variable step in Number.nth_prime(). (86801d9)
  • Optimized the RangeNum.sum() to use a closed-form expression for all ranges. (3dc5a89)
  • Unified the for-in loop with the Block iterators map, each and grep. (87490e4)
  • Reimplemented Number.prime_count() for better performance. (69b06b3, 9a16d87, 4c9d965)
  • Extended the unary dot operator to allow array and hash lookup (same as in Perl 6). (9e0551b)
  • Reimplemented Number.digit() and Number.digits() to support arbitrary large bases. (a47cf65, 4c041d9, ab09256, 7d1bec5)

Changes

  • Removed the built-in MultiArray class. (8f4528d)

Bug-fixes

  • Fixed polygonal_root(n, NaN) to return NaN instead of n. (c24158a)
  • Extended the Array eq and cmp methods to support cyclic references. (1bd9f0a, 1de91f9)
  • Extended the Hash eq method to support cyclic references. (69fd70a)

All changes: 3.05...3.10