You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R's rule for diag(x) is length(x) == 1 with no nrow/ncol, not rank 0.
quickr tested the rank, so a literal (diag(3L)) and a constant-folded
local took the identity path while a declared integer(1) argument fell
through to the vector constructor and produced a 1x1 matrix holding n
instead of the n-by-n identity -- wrong in both shape and values.
Both the handler and infer_dest_diag() now use passes_as_scalar(), so
lowering and destination inference cannot disagree about which form a
call takes.
R derives the size with as.integer(x), which also makes diag(3.7) the
3x3 identity. Size expressions gain as.integer() so quickr can spell the
same thing: INT() in Fortran (truncates toward zero, like R), a cast in
the C bridge, and r2size() folds a literal instead of rejecting a
non-whole double. The two renderers that spell a dim by deparsing --
bind_dim_string() and blas_int() -- route through one small rewriter so
the R name cannot leak into emitted Fortran.
0 commit comments