News for package 'ast2ast'

changes in ast2ast version 1.1.1

- New ODE/DAE solvers via the 'sundials' package (now in Imports):
  `cvode(rhs, y0, times, params, options = cvode_options(), jac)` and
  `ida(res, y0, yp0, times, params, id, options = ida_options(), jac)`.
  `params` may be any type (vector, scalar, `new_type` struct). Without `jac`
  the Jacobian comes from difference quotients. Both return a
  `length(times) x length(y0)` matrix.
- `cvode_options(reltol, abstol, stiff, max_steps, stats, linear_solver)` and
  `ida_options(reltol, abstol, max_steps, stats, linear_solver)`: every argument
  is optional; `stats = TRUE` prints solver statistics.
  `stiff = FALSE` uses ADAMS with fixed-point iteration (no Jacobian).
  `linear_solver = "sundials"` (default) or `"lapack"` (faster for large
  systems; with OpenBLAS it does not run in parallel inside `pmap`).
- `cvode` / `ida`: a vector `params` has to be a variable; an expression like
  `c(0.7)` is rejected at translation time.
- `jacobian`: `x` may be a `borrow_vec` for a `vec` parameter.
- Fixed: zero-length R vectors passed to translated functions no longer
  trigger an undefined-behaviour report (copy from R's dummy data pointer).

changes in ast2ast version 1.1

- Functions can be written as plain R functions: the body starts with
  `argtypes(...)`, optionally followed by `returntype(...)` (checked against
  the returned value). Inner functions `g <- function(...) { argtypes(...);
  returntype(...); ... }` need both. `fn()` stays available.
- New function `make_package(files, entry_points, package_dir)`: translates
  R files into the C++ code of an existing package, like
  `Rcpp::compileAttributes`. Only `entry_points` are exported; all other
  functions in the files are internal helpers. Runtime errors name package, file,
  line and function (`In 'mypkg: helpers.R:5 (helper): ...'`).
  `debug = FALSE` drops this line tracking for speed, as in `translate`.
- New functional `pmap(f, ncores, x, ...)`: like `map`, but the elements
  are processed in parallel on a thread pool (via RcppThread). Warnings
  raised inside `f` are reported in element order; errors report the line
  inside `f`. Functions that use the R API internally (currently `lbfgsb`)
  cannot be called inside `pmap` and are rejected at translation time.
- `pso` uses its own Mersenne-Twister RNG instead of R's RNG and takes a new
  `seed` argument: `pso(f, lower, upper, ngen, npop, error_threshold, global,
  seed[, data])`. Results are reproducible and independent of R's RNG state;
  `pso` can also be called inside `pmap`.
- Faster subsetting and subset assignment; common subsetting patterns now
  run faster than in base R.
- `jacobian_sparse(f, x[, data], colouring = ...)` and
  `jacobian_banded(f, x[, data], colouring = ...)`: `colouring` is required
  (forward mode only). Only the entries of f's sparsity pattern are
  computed (one forward sweep per colour) and stored as SUNDIALS does (CSC,
  0-based; LAPACK band layout with `mu`, `ml`, `ldim`). Fields are accessible
  in translated code (`J$data`, `J$indexptrs`, `J$mu`, ...); returned to R as
  a `Matrix::dgCMatrix` (Matrix is suggested).
- Named vectors: `new_layout(State, double, names = <R expression>)` in
  `types_f`, used as `named_vec(State)` /
  `named_borrow_vec(State)`. `y[["S30"]]` is resolved to an integer index at
  translation time (typo -> error with a suggestion). Names of R arguments are
  checked, returned named vectors carry their names; `vector("State")` and a
  declaration (`res |> type(named_vec(State))`) allocate one entry per name,
  `vector("State", n)` allocates n entries.
- Layouts for matrices, arrays and collections: `new_mat_layout(L, double,
  rownames = , colnames = )`, `new_array_layout(L, double, dimnames =
  list(...))`, `new_collection_layout(L, Struct, names = )`, used as
  `named_mat` / `named_borrow_mat`, `named_array` / `named_borrow_array`,
  `named_collection`. Each names argument is an R expression, `NULL` (no names)
  or an existing `new_layout()`. `m[["t1", "S30"]]` (also mixed with numbers)
  and `pts[["p1"]]` are resolved at translation time; dimnames / names of R
  arguments are checked and attached to returned objects.
- A `borrow_vec`/`borrow_mat`/`borrow_array` can be passed to an inner
  function that expects `vec`/`mat`/`array` (by value or `const()`): it is
  copied, with a warning at translation time. A mutable `ref()` parameter
  still requires the borrowed type.
- `jacobian` takes an optional `colouring` argument (forward mode): columns
  that share no row are computed in one sweep. `colouring = "static", n = <literal>`
  derives the sparsity pattern at translation time;
  `colouring = "runtime"` records it at every call from one reverse-mode run
  of `f`.
- `c(Inf, NaN, NA)` returned `NA NA NA` (the vector was inferred as logical);
  `Inf`/`NaN` in `c()` now make it double. `-Inf` is accepted inside `c()`.
- RcppThread is a new dependency (Imports and LinkingTo).
- Borrowed arguments (`borrow_vec`, `borrow_mat`, `borrow_array`) can now be
  combined with forward-mode differentiation for inner functions and for
  `output = "XPtr"`.

changes in ast2ast version 1.0

- Major release, and the first since the package was archived on CRAN.
  A great deal has changed; ast2ast is substantially more capable than
  version 0.3. Highlights follow.
- New tree-based type system with type inference, `const` checking,
  user-defined types (`new_type` / `slots`) and functions as types
  (`fn`, including inner functions and recursion).
- Automatic differentiation: forward mode and reverse (tape-based) mode.
- Root finding and optimization: uniroot, L-BFGS-B and nnls.
- Support for n-dimensional arrays and for collection types.
- Functional helpers: apply, map, Reduce, Filter.
- Runtime errors now report the originating R source line.
- A much larger set of supported base R functions and operators;
  see the vignettes for the current list.

changes in ast2ast version 0.30

- removed bug in cmr.
- refactored the conversion of sexp to SEXP

changes in ast2ast version 0.2.1

- all functions in C++ are now inlined

changes in ast2ast version 0.2

- code can now be translated to R function and external pointer
