R Under development (unstable) (2024-02-26 r85990 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require("dse") Loading required package: dse Loading required package: tfplot Loading required package: tframe Attaching package: 'dse' The following objects are masked from 'package:stats': acf, simulate > Sys.info() sysname release version nodename machine "Windows" "Server x64" "build 20348" "CRANWIN3" "x86-64" login user effective_user "CRAN" "CRAN" "CRAN" > DSEversion() setRNG tframe dse "2024.2-1" "2015.12-1.1" "2024.2-2" > > fuzz.small <- 1e-14 > fuzz.large <- 1e-10 > digits <- 18 > all.ok <- TRUE > > > cat("dse test 7a...\n") dse test 7a... > d <-20 > true.roots <- c(-1/seq(d),1/seq(d),-seq(d),seq(d)) > A <- array(0, c(2,length(true.roots),length(true.roots))) > A[1,,] <- diag(1,length(true.roots)) > A[2,,] <- diag(-true.roots, length(true.roots)) > # the following relies on roots using by.poly=FALSE > # Splus needed options(expressions=1024) > tst <- sort(roots( ARMA(A=A, B=diag(1,length(true.roots)) ),by.poly=FALSE)) > good <- sort(true.roots) > error <- max(Mod(good - tst)) > cat("max. error ", max(error)) max. error 0> > if (any(is.na(error)) || any(is.nan(error)) || fuzz.small < error ) + {printTestValue(c(tst), digits=18) + all.ok <- FALSE + } > > # complex roots test > cat("dse test 7b...\n") dse test 7b... > > i <- pi*(1:10)/10.1 # this is half circle, but conjs also get generated > # div by 10.1 instead of 10 prevents a real root with = conj > true.roots <- complex(real=cos(i), imaginary=sin(i)) # on unit circle > # scale simplifies sorting > true.roots <- c(true.roots*(1+.2*1:10), true.roots*(1:10)/10) > A <- array(0, c(3,length(true.roots),length(true.roots))) > A[1,,] <- diag(1,length(true.roots)) > A[2,,] <- diag(-2*Re(true.roots), length(true.roots)) > A[3,,] <- diag(Re(true.roots*Conj(true.roots)), length(true.roots)) > est.roots <- roots( ARMA(A=A, B=diag(1,length(true.roots)) )) > ec <- 0<=Im(est.roots) > > z <- est.roots[ ec][order(Mod(est.roots[ ec]))] > zz <- true.roots[order(Mod(true.roots))] > > error <- max(Mod(z - zz)) > cat("max. error ", max(error)) max. error 9.200973e-15> > if (any(is.na(error)) || any(is.nan(error)) || fuzz.small < error ) + {printTestValue(c(z), digits=18) + printTestValue(c(zz), digits=18) + all.ok <- FALSE + } > > cat("dse test 7c...\n") dse test 7c... > > z <- est.roots[!ec][order(Mod(est.roots[!ec]))] > zz <- Conj(true.roots)[order(Mod(true.roots))] > error <- max(Mod(z - zz)) > cat("max. error ", max(error)) max. error 9.200973e-15> > if (any(is.na(error)) || any(is.nan(error)) || fuzz.small < error ) + {printTestValue(c(z), digits=18) + printTestValue(c(zz), digits=18) + all.ok <- FALSE + } > > > if (! all.ok) stop("some tests FAILED") > > > proc.time() user system elapsed 0.25 0.15 0.34