0s autopkgtest [23:27:01]: starting date and time: 2026-02-09 23:27:01+0000 0s autopkgtest [23:27:01]: git checkout: 4b346b80 nova: make wait_reboot return success even when a no-op 0s autopkgtest [23:27:01]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.9gyizegc/out --timeout-copy=6000 --needs-internet=try --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:r-cran-ggplot2 --apt-upgrade r-cran-matrixstats --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=r-cran-ggplot2/4.0.2+dfsg-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-cpu2-ram4-disk20-ppc64el --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@sto01-ppc64el-4.secgroup --name adt-resolute-ppc64el-r-cran-matrixstats-20260209-232701-juju-7f2275-prod-proposed-migration-environment-2-6a8a0b78-1aab-4015-b68b-a6d0dc16e5b9 --image adt/ubuntu-resolute-ppc64el-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-autopkgtest-workers-ppc64el -e TERM=linux --mirror=http://ftpmaster.internal/ubuntu/ 4s Creating nova instance adt-resolute-ppc64el-r-cran-matrixstats-20260209-232701-juju-7f2275-prod-proposed-migration-environment-2-6a8a0b78-1aab-4015-b68b-a6d0dc16e5b9 from image adt/ubuntu-resolute-ppc64el-server-20260209.img (UUID f7f31435-4cd1-4090-aa55-59cfefa097ca)... 115s autopkgtest [23:28:56]: testbed dpkg architecture: ppc64el 115s autopkgtest [23:28:56]: testbed apt version: 3.1.15 116s autopkgtest [23:28:57]: @@@@@@@@@@@@@@@@@@@@ test bed setup 116s autopkgtest [23:28:57]: testbed release detected to be: None 117s autopkgtest [23:28:58]: updating testbed package index (apt update) 117s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 117s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 117s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 117s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 117s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 120s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 120s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 120s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main ppc64el Packages [246 kB] 120s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/universe ppc64el Packages [1534 kB] 123s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse ppc64el Packages [19.4 kB] 123s Fetched 3774 kB in 6s (606 kB/s) 124s Reading package lists... 124s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 124s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 125s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 125s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 125s Reading package lists... 125s Reading package lists... 126s Building dependency tree... 126s Reading state information... 126s Calculating upgrade... 126s The following packages will be upgraded: 126s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 126s libip6tc2 libxtables12 wget 126s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 126s Need to get 3125 kB of archives. 126s After this operation, 78.8 kB of additional disk space will be used. 126s Get:1 http://ftpmaster.internal/ubuntu resolute/main ppc64el iptables ppc64el 1.8.11-2ubuntu3 [464 kB] 126s Get:2 http://ftpmaster.internal/ubuntu resolute/main ppc64el libip4tc2 ppc64el 1.8.11-2ubuntu3 [27.8 kB] 126s Get:3 http://ftpmaster.internal/ubuntu resolute/main ppc64el libip6tc2 ppc64el 1.8.11-2ubuntu3 [28.2 kB] 126s Get:4 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxtables12 ppc64el 1.8.11-2ubuntu3 [41.2 kB] 126s Get:5 http://ftpmaster.internal/ubuntu resolute/main ppc64el iproute2 ppc64el 6.18.0-1ubuntu1 [1458 kB] 128s Get:6 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcryptsetup12 ppc64el 2:2.8.0-1ubuntu3 [404 kB] 128s Get:7 http://ftpmaster.internal/ubuntu resolute/main ppc64el wget ppc64el 1.25.0-2ubuntu4 [401 kB] 128s Get:8 http://ftpmaster.internal/ubuntu resolute/main ppc64el cryptsetup-bin ppc64el 2:2.8.0-1ubuntu3 [250 kB] 128s Get:9 http://ftpmaster.internal/ubuntu resolute/main ppc64el dracut-install ppc64el 109-11ubuntu1 [51.3 kB] 129s dpkg-preconfigure: unable to re-open stdin: No such file or directory 129s Fetched 3125 kB in 3s (1194 kB/s) 129s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 122003 files and directories currently installed.) 129s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_ppc64el.deb ... 129s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 129s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_ppc64el.deb ... 129s Unpacking libip4tc2:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 129s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_ppc64el.deb ... 129s Unpacking libip6tc2:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 130s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_ppc64el.deb ... 130s Unpacking libxtables12:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 130s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_ppc64el.deb ... 130s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 130s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_ppc64el.deb ... 130s Unpacking libcryptsetup12:ppc64el (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 130s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_ppc64el.deb ... 130s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 130s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_ppc64el.deb ... 130s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 130s Preparing to unpack .../8-dracut-install_109-11ubuntu1_ppc64el.deb ... 130s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 131s Setting up libip4tc2:ppc64el (1.8.11-2ubuntu3) ... 131s Setting up wget (1.25.0-2ubuntu4) ... 131s Setting up libip6tc2:ppc64el (1.8.11-2ubuntu3) ... 131s Setting up libxtables12:ppc64el (1.8.11-2ubuntu3) ... 131s Setting up dracut-install (109-11ubuntu1) ... 131s Setting up libcryptsetup12:ppc64el (2:2.8.0-1ubuntu3) ... 131s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 131s Setting up iptables (1.8.11-2ubuntu3) ... 131s Setting up iproute2 (6.18.0-1ubuntu1) ... 131s Processing triggers for man-db (2.13.1-1build1) ... 133s Processing triggers for install-info (7.2-5) ... 133s Processing triggers for libc-bin (2.42-2ubuntu4) ... 133s autopkgtest [23:29:14]: upgrading testbed (apt dist-upgrade and autopurge) 133s Reading package lists... 133s Building dependency tree... 133s Reading state information... 133s Calculating upgrade... 133s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 133s Reading package lists... 134s Building dependency tree... 134s Reading state information... 134s Solving dependencies... 134s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 136s autopkgtest [23:29:17]: testbed running kernel: Linux 6.19.0-3-generic #3-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 23 20:13:51 UTC 2026 136s autopkgtest [23:29:17]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 138s Get:1 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (dsc) [2228 B] 138s Get:2 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (tar) [212 kB] 138s Get:3 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (diff) [4864 B] 138s gpgv: Signature made Sat Jan 18 11:46:01 2025 UTC 138s gpgv: using RSA key 724D609337113C710550D7473C26763F6C67E6E2 138s gpgv: Can't check signature: No public key 138s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.5.0-1.dsc: no acceptable signature found 138s autopkgtest [23:29:19]: testing package r-cran-matrixstats version 1.5.0-1 139s autopkgtest [23:29:20]: build not needed 141s autopkgtest [23:29:22]: test run-unit-test: preparing testbed 141s Reading package lists... 142s Building dependency tree... 142s Reading state information... 142s Solving dependencies... 142s The following NEW packages will be installed: 142s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 142s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libdatrie1 142s libdeflate0 libfontconfig1 libgfortran5 libgomp1 libgraphite2-3 142s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 142s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 142s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 142s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 142s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 142s libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 142s r-cran-base64enc r-cran-cli r-cran-commonmark r-cran-digest r-cran-evaluate 142s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 142s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle r-cran-markdown 142s r-cran-matrixstats r-cran-microbenchmark r-cran-r.cache r-cran-r.devices 142s r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils r-cran-r6 142s r-cran-rcolorbrewer r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs 142s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml tcl tcl8.6 unzip 142s x11-common xdg-utils zip 142s 0 upgraded, 87 newly installed, 0 to remove and 0 not upgraded. 142s Need to get 73.9 MB of archives. 142s After this operation, 182 MB of additional disk space will be used. 142s Get:1 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-dejavu-mono all 2.37-8build1 [502 kB] 142s Get:2 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-dejavu-core all 2.37-8build1 [834 kB] 144s Get:3 http://ftpmaster.internal/ubuntu resolute/main ppc64el fontconfig-config ppc64el 2.17.1-3ubuntu1 [38.5 kB] 144s Get:4 http://ftpmaster.internal/ubuntu resolute/main ppc64el libfontconfig1 ppc64el 2.17.1-3ubuntu1 [193 kB] 144s Get:5 http://ftpmaster.internal/ubuntu resolute/main ppc64el fontconfig ppc64el 2.17.1-3ubuntu1 [182 kB] 144s Get:6 http://ftpmaster.internal/ubuntu resolute/universe ppc64el fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 144s Get:7 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 150s Get:8 http://ftpmaster.internal/ubuntu resolute/main ppc64el libblas3 ppc64el 3.12.1-7ubuntu1 [291 kB] 150s Get:9 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpixman-1-0 ppc64el 0.46.4-1 [347 kB] 150s Get:10 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxcb-render0 ppc64el 1.17.0-2ubuntu1 [17.4 kB] 150s Get:11 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxcb-shm0 ppc64el 1.17.0-2ubuntu1 [6072 B] 150s Get:12 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxrender1 ppc64el 1:0.9.12-1 [23.0 kB] 150s Get:13 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcairo2 ppc64el 1.18.4-3 [759 kB] 152s Get:14 http://ftpmaster.internal/ubuntu resolute/main ppc64el libdatrie1 ppc64el 0.2.14-1 [22.7 kB] 152s Get:15 http://ftpmaster.internal/ubuntu resolute/main ppc64el libdeflate0 ppc64el 1.23-2build1 [64.1 kB] 152s Get:16 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgfortran5 ppc64el 15.2.0-12ubuntu1 [620 kB] 153s Get:17 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgomp1 ppc64el 15.2.0-12ubuntu1 [169 kB] 153s Get:18 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgraphite2-3 ppc64el 1.3.14-11ubuntu1 [85.3 kB] 153s Get:19 http://ftpmaster.internal/ubuntu resolute/main ppc64el libharfbuzz0b ppc64el 12.3.2-1 [663 kB] 155s Get:20 http://ftpmaster.internal/ubuntu resolute/main ppc64el x11-common all 1:7.7+24ubuntu1 [22.4 kB] 155s Get:21 http://ftpmaster.internal/ubuntu resolute/main ppc64el libice6 ppc64el 2:1.1.1-1build1 [51.9 kB] 155s Get:22 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg-turbo8 ppc64el 2.1.5-4ubuntu3 [214 kB] 155s Get:23 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg8 ppc64el 8c-2ubuntu11 [2148 B] 155s Get:24 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 155s Get:25 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 155s Get:26 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 155s Get:27 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 155s Get:28 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblapack3 ppc64el 3.12.1-7ubuntu1 [2960 kB] 160s Get:29 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblerc4 ppc64el 4.0.0+ds-5ubuntu2 [315 kB] 160s Get:30 http://ftpmaster.internal/ubuntu resolute/main ppc64el libthai-data all 0.1.30-1 [155 kB] 160s Get:31 http://ftpmaster.internal/ubuntu resolute/main ppc64el libthai0 ppc64el 0.1.30-1 [22.5 kB] 160s Get:32 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpango-1.0-0 ppc64el 1.57.0-1 [283 kB] 160s Get:33 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpangoft2-1.0-0 ppc64el 1.57.0-1 [61.2 kB] 160s Get:34 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpangocairo-1.0-0 ppc64el 1.57.0-1 [31.0 kB] 160s Get:35 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpaper2 ppc64el 2.2.5-0.3build1 [18.1 kB] 160s Get:36 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpaper-utils ppc64el 2.2.5-0.3build1 [15.7 kB] 160s Get:37 http://ftpmaster.internal/ubuntu resolute/main ppc64el libsharpyuv0 ppc64el 1.5.0-0.1build1 [24.7 kB] 160s Get:38 http://ftpmaster.internal/ubuntu resolute/main ppc64el libsm6 ppc64el 2:1.2.6-1build1 [18.6 kB] 160s Get:39 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtcl8.6 ppc64el 8.6.17+dfsg-1build1 [1239 kB] 162s Get:40 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjbig0 ppc64el 2.1-6.1ubuntu3 [37.1 kB] 162s Get:41 http://ftpmaster.internal/ubuntu resolute/main ppc64el libwebp7 ppc64el 1.5.0-0.1build1 [330 kB] 162s Get:42 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtiff6 ppc64el 4.7.0-3ubuntu3 [307 kB] 162s Get:43 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxft2 ppc64el 2.3.6-1build2 [61.6 kB] 163s Get:44 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxss1 ppc64el 1:1.2.3-1build4 [7470 B] 163s Get:45 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtk8.6 ppc64el 8.6.17-1 [968 kB] 164s Get:46 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxt6t64 ppc64el 1:1.2.1-1.3 [203 kB] 164s Get:47 http://ftpmaster.internal/ubuntu resolute/universe ppc64el node-normalize.css all 8.0.1-5.1 [10.4 kB] 164s Get:48 http://ftpmaster.internal/ubuntu resolute/main ppc64el zip ppc64el 3.0-15ubuntu3 [198 kB] 164s Get:49 http://ftpmaster.internal/ubuntu resolute/main ppc64el unzip ppc64el 6.0-29ubuntu1 [200 kB] 164s Get:50 http://ftpmaster.internal/ubuntu resolute/main ppc64el xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 164s Get:51 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-base-core ppc64el 4.5.2-1ubuntu2 [29.3 MB] 219s Get:52 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-base64enc ppc64el 0.1-3-3build1 [29.3 kB] 219s Get:53 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-cli ppc64el 3.6.4-1 [1411 kB] 222s Get:54 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-commonmark ppc64el 1.9.5-1 [142 kB] 222s Get:55 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-digest ppc64el 0.6.39-1 [238 kB] 222s Get:56 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-evaluate all 1.0.5-1 [117 kB] 222s Get:57 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-farver ppc64el 2.1.2-1 [1389 kB] 225s Get:58 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-glue ppc64el 1.8.0-1 [165 kB] 225s Get:59 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-rlang ppc64el 1.1.5-3 [1738 kB] 228s Get:60 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 228s Get:61 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 228s Get:62 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-isoband ppc64el 0.2.7-1 [1486 kB] 231s Get:63 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-s7 ppc64el 0.2.0-1 [330 kB] 231s Get:64 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-labeling all 0.4.3-1 [62.1 kB] 231s Get:65 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r6 all 2.6.1-1 [101 kB] 231s Get:66 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 231s Get:67 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-viridislite all 0.4.3-1 [1088 kB] 233s Get:68 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-scales all 1.4.0-1 [725 kB] 234s Get:69 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-vctrs ppc64el 0.6.5-1 [1399 kB] 236s Get:70 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-withr all 3.0.2+dfsg-1 [214 kB] 236s Get:71 http://ftpmaster.internal/ubuntu resolute-proposed/universe ppc64el r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 245s Get:72 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-xfun ppc64el 0.55+dfsg-1 [589 kB] 246s Get:73 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-highr all 0.11+dfsg-1 [38.5 kB] 246s Get:74 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-yaml ppc64el 2.3.10-1 [123 kB] 246s Get:75 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 258s Get:76 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-knitr all 1.51+dfsg-1 [847 kB] 260s Get:77 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-markdown all 1.13-1 [162 kB] 261s Get:78 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-matrixstats ppc64el 1.5.0-1 [578 kB] 262s Get:79 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-microbenchmark ppc64el 1.5.0-1 [67.9 kB] 262s Get:80 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 262s Get:81 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.oo all 1.27.1-1 [978 kB] 265s Get:82 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.utils all 2.13.0-1 [1423 kB] 268s Get:83 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.cache all 0.17.0-1 [117 kB] 268s Get:84 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.devices all 2.17.3+ds-1 [400 kB] 271s Get:85 http://ftpmaster.internal/ubuntu resolute/main ppc64el tcl8.6 ppc64el 8.6.17+dfsg-1build1 [14.8 kB] 271s Get:86 http://ftpmaster.internal/ubuntu resolute/main ppc64el tcl ppc64el 8.6.16build1 [4204 B] 272s Get:87 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 277s Preconfiguring packages ... 277s Fetched 73.9 MB in 2min 15s (549 kB/s) 277s Selecting previously unselected package fonts-dejavu-mono. 277s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 122006 files and directories currently installed.) 277s Preparing to unpack .../00-fonts-dejavu-mono_2.37-8build1_all.deb ... 277s Unpacking fonts-dejavu-mono (2.37-8build1) ... 277s Selecting previously unselected package fonts-dejavu-core. 277s Preparing to unpack .../01-fonts-dejavu-core_2.37-8build1_all.deb ... 277s Unpacking fonts-dejavu-core (2.37-8build1) ... 277s Selecting previously unselected package fontconfig-config. 277s Preparing to unpack .../02-fontconfig-config_2.17.1-3ubuntu1_ppc64el.deb ... 277s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 277s Selecting previously unselected package libfontconfig1:ppc64el. 277s Preparing to unpack .../03-libfontconfig1_2.17.1-3ubuntu1_ppc64el.deb ... 277s Unpacking libfontconfig1:ppc64el (2.17.1-3ubuntu1) ... 277s Selecting previously unselected package fontconfig. 277s Preparing to unpack .../04-fontconfig_2.17.1-3ubuntu1_ppc64el.deb ... 277s Unpacking fontconfig (2.17.1-3ubuntu1) ... 277s Selecting previously unselected package fonts-glyphicons-halflings. 277s Preparing to unpack .../05-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 277s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 277s Selecting previously unselected package fonts-mathjax. 277s Preparing to unpack .../06-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 277s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 277s Selecting previously unselected package libblas3:ppc64el. 277s Preparing to unpack .../07-libblas3_3.12.1-7ubuntu1_ppc64el.deb ... 277s Unpacking libblas3:ppc64el (3.12.1-7ubuntu1) ... 277s Selecting previously unselected package libpixman-1-0:ppc64el. 277s Preparing to unpack .../08-libpixman-1-0_0.46.4-1_ppc64el.deb ... 277s Unpacking libpixman-1-0:ppc64el (0.46.4-1) ... 277s Selecting previously unselected package libxcb-render0:ppc64el. 277s Preparing to unpack .../09-libxcb-render0_1.17.0-2ubuntu1_ppc64el.deb ... 277s Unpacking libxcb-render0:ppc64el (1.17.0-2ubuntu1) ... 277s Selecting previously unselected package libxcb-shm0:ppc64el. 277s Preparing to unpack .../10-libxcb-shm0_1.17.0-2ubuntu1_ppc64el.deb ... 277s Unpacking libxcb-shm0:ppc64el (1.17.0-2ubuntu1) ... 277s Selecting previously unselected package libxrender1:ppc64el. 277s Preparing to unpack .../11-libxrender1_1%3a0.9.12-1_ppc64el.deb ... 277s Unpacking libxrender1:ppc64el (1:0.9.12-1) ... 277s Selecting previously unselected package libcairo2:ppc64el. 277s Preparing to unpack .../12-libcairo2_1.18.4-3_ppc64el.deb ... 277s Unpacking libcairo2:ppc64el (1.18.4-3) ... 277s Selecting previously unselected package libdatrie1:ppc64el. 277s Preparing to unpack .../13-libdatrie1_0.2.14-1_ppc64el.deb ... 277s Unpacking libdatrie1:ppc64el (0.2.14-1) ... 277s Selecting previously unselected package libdeflate0:ppc64el. 277s Preparing to unpack .../14-libdeflate0_1.23-2build1_ppc64el.deb ... 277s Unpacking libdeflate0:ppc64el (1.23-2build1) ... 277s Selecting previously unselected package libgfortran5:ppc64el. 277s Preparing to unpack .../15-libgfortran5_15.2.0-12ubuntu1_ppc64el.deb ... 277s Unpacking libgfortran5:ppc64el (15.2.0-12ubuntu1) ... 278s Selecting previously unselected package libgomp1:ppc64el. 278s Preparing to unpack .../16-libgomp1_15.2.0-12ubuntu1_ppc64el.deb ... 278s Unpacking libgomp1:ppc64el (15.2.0-12ubuntu1) ... 278s Selecting previously unselected package libgraphite2-3:ppc64el. 278s Preparing to unpack .../17-libgraphite2-3_1.3.14-11ubuntu1_ppc64el.deb ... 278s Unpacking libgraphite2-3:ppc64el (1.3.14-11ubuntu1) ... 278s Selecting previously unselected package libharfbuzz0b:ppc64el. 278s Preparing to unpack .../18-libharfbuzz0b_12.3.2-1_ppc64el.deb ... 278s Unpacking libharfbuzz0b:ppc64el (12.3.2-1) ... 278s Selecting previously unselected package x11-common. 278s Preparing to unpack .../19-x11-common_1%3a7.7+24ubuntu1_all.deb ... 278s Unpacking x11-common (1:7.7+24ubuntu1) ... 278s Selecting previously unselected package libice6:ppc64el. 278s Preparing to unpack .../20-libice6_2%3a1.1.1-1build1_ppc64el.deb ... 278s Unpacking libice6:ppc64el (2:1.1.1-1build1) ... 278s Selecting previously unselected package libjpeg-turbo8:ppc64el. 278s Preparing to unpack .../21-libjpeg-turbo8_2.1.5-4ubuntu3_ppc64el.deb ... 278s Unpacking libjpeg-turbo8:ppc64el (2.1.5-4ubuntu3) ... 278s Selecting previously unselected package libjpeg8:ppc64el. 278s Preparing to unpack .../22-libjpeg8_8c-2ubuntu11_ppc64el.deb ... 278s Unpacking libjpeg8:ppc64el (8c-2ubuntu11) ... 278s Selecting previously unselected package libjs-bootstrap. 278s Preparing to unpack .../23-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 278s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 278s Selecting previously unselected package libjs-highlight.js. 278s Preparing to unpack .../24-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 278s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 278s Selecting previously unselected package libjs-jquery. 278s Preparing to unpack .../25-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 278s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 278s Selecting previously unselected package libjs-jquery-datatables. 278s Preparing to unpack .../26-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 278s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 278s Selecting previously unselected package liblapack3:ppc64el. 278s Preparing to unpack .../27-liblapack3_3.12.1-7ubuntu1_ppc64el.deb ... 278s Unpacking liblapack3:ppc64el (3.12.1-7ubuntu1) ... 278s Selecting previously unselected package liblerc4:ppc64el. 278s Preparing to unpack .../28-liblerc4_4.0.0+ds-5ubuntu2_ppc64el.deb ... 278s Unpacking liblerc4:ppc64el (4.0.0+ds-5ubuntu2) ... 278s Selecting previously unselected package libthai-data. 278s Preparing to unpack .../29-libthai-data_0.1.30-1_all.deb ... 278s Unpacking libthai-data (0.1.30-1) ... 278s Selecting previously unselected package libthai0:ppc64el. 278s Preparing to unpack .../30-libthai0_0.1.30-1_ppc64el.deb ... 278s Unpacking libthai0:ppc64el (0.1.30-1) ... 278s Selecting previously unselected package libpango-1.0-0:ppc64el. 278s Preparing to unpack .../31-libpango-1.0-0_1.57.0-1_ppc64el.deb ... 278s Unpacking libpango-1.0-0:ppc64el (1.57.0-1) ... 278s Selecting previously unselected package libpangoft2-1.0-0:ppc64el. 278s Preparing to unpack .../32-libpangoft2-1.0-0_1.57.0-1_ppc64el.deb ... 278s Unpacking libpangoft2-1.0-0:ppc64el (1.57.0-1) ... 278s Selecting previously unselected package libpangocairo-1.0-0:ppc64el. 278s Preparing to unpack .../33-libpangocairo-1.0-0_1.57.0-1_ppc64el.deb ... 278s Unpacking libpangocairo-1.0-0:ppc64el (1.57.0-1) ... 278s Selecting previously unselected package libpaper2:ppc64el. 278s Preparing to unpack .../34-libpaper2_2.2.5-0.3build1_ppc64el.deb ... 278s Unpacking libpaper2:ppc64el (2.2.5-0.3build1) ... 278s Selecting previously unselected package libpaper-utils. 278s Preparing to unpack .../35-libpaper-utils_2.2.5-0.3build1_ppc64el.deb ... 278s Unpacking libpaper-utils (2.2.5-0.3build1) ... 278s Selecting previously unselected package libsharpyuv0:ppc64el. 278s Preparing to unpack .../36-libsharpyuv0_1.5.0-0.1build1_ppc64el.deb ... 278s Unpacking libsharpyuv0:ppc64el (1.5.0-0.1build1) ... 278s Selecting previously unselected package libsm6:ppc64el. 278s Preparing to unpack .../37-libsm6_2%3a1.2.6-1build1_ppc64el.deb ... 278s Unpacking libsm6:ppc64el (2:1.2.6-1build1) ... 278s Selecting previously unselected package libtcl8.6:ppc64el. 278s Preparing to unpack .../38-libtcl8.6_8.6.17+dfsg-1build1_ppc64el.deb ... 278s Unpacking libtcl8.6:ppc64el (8.6.17+dfsg-1build1) ... 278s Selecting previously unselected package libjbig0:ppc64el. 278s Preparing to unpack .../39-libjbig0_2.1-6.1ubuntu3_ppc64el.deb ... 278s Unpacking libjbig0:ppc64el (2.1-6.1ubuntu3) ... 278s Selecting previously unselected package libwebp7:ppc64el. 278s Preparing to unpack .../40-libwebp7_1.5.0-0.1build1_ppc64el.deb ... 278s Unpacking libwebp7:ppc64el (1.5.0-0.1build1) ... 278s Selecting previously unselected package libtiff6:ppc64el. 278s Preparing to unpack .../41-libtiff6_4.7.0-3ubuntu3_ppc64el.deb ... 278s Unpacking libtiff6:ppc64el (4.7.0-3ubuntu3) ... 278s Selecting previously unselected package libxft2:ppc64el. 278s Preparing to unpack .../42-libxft2_2.3.6-1build2_ppc64el.deb ... 278s Unpacking libxft2:ppc64el (2.3.6-1build2) ... 278s Selecting previously unselected package libxss1:ppc64el. 278s Preparing to unpack .../43-libxss1_1%3a1.2.3-1build4_ppc64el.deb ... 278s Unpacking libxss1:ppc64el (1:1.2.3-1build4) ... 278s Selecting previously unselected package libtk8.6:ppc64el. 278s Preparing to unpack .../44-libtk8.6_8.6.17-1_ppc64el.deb ... 278s Unpacking libtk8.6:ppc64el (8.6.17-1) ... 278s Selecting previously unselected package libxt6t64:ppc64el. 278s Preparing to unpack .../45-libxt6t64_1%3a1.2.1-1.3_ppc64el.deb ... 278s Unpacking libxt6t64:ppc64el (1:1.2.1-1.3) ... 278s Selecting previously unselected package node-normalize.css. 278s Preparing to unpack .../46-node-normalize.css_8.0.1-5.1_all.deb ... 278s Unpacking node-normalize.css (8.0.1-5.1) ... 278s Selecting previously unselected package zip. 278s Preparing to unpack .../47-zip_3.0-15ubuntu3_ppc64el.deb ... 278s Unpacking zip (3.0-15ubuntu3) ... 278s Selecting previously unselected package unzip. 278s Preparing to unpack .../48-unzip_6.0-29ubuntu1_ppc64el.deb ... 278s Unpacking unzip (6.0-29ubuntu1) ... 278s Selecting previously unselected package xdg-utils. 278s Preparing to unpack .../49-xdg-utils_1.2.1-2ubuntu2_all.deb ... 278s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 278s Selecting previously unselected package r-base-core. 278s Preparing to unpack .../50-r-base-core_4.5.2-1ubuntu2_ppc64el.deb ... 278s Unpacking r-base-core (4.5.2-1ubuntu2) ... 279s Selecting previously unselected package r-cran-base64enc. 279s Preparing to unpack .../51-r-cran-base64enc_0.1-3-3build1_ppc64el.deb ... 279s Unpacking r-cran-base64enc (0.1-3-3build1) ... 279s Selecting previously unselected package r-cran-cli. 279s Preparing to unpack .../52-r-cran-cli_3.6.4-1_ppc64el.deb ... 279s Unpacking r-cran-cli (3.6.4-1) ... 279s Selecting previously unselected package r-cran-commonmark. 279s Preparing to unpack .../53-r-cran-commonmark_1.9.5-1_ppc64el.deb ... 279s Unpacking r-cran-commonmark (1.9.5-1) ... 279s Selecting previously unselected package r-cran-digest. 279s Preparing to unpack .../54-r-cran-digest_0.6.39-1_ppc64el.deb ... 279s Unpacking r-cran-digest (0.6.39-1) ... 279s Selecting previously unselected package r-cran-evaluate. 279s Preparing to unpack .../55-r-cran-evaluate_1.0.5-1_all.deb ... 279s Unpacking r-cran-evaluate (1.0.5-1) ... 279s Selecting previously unselected package r-cran-farver. 279s Preparing to unpack .../56-r-cran-farver_2.1.2-1_ppc64el.deb ... 279s Unpacking r-cran-farver (2.1.2-1) ... 279s Selecting previously unselected package r-cran-glue. 279s Preparing to unpack .../57-r-cran-glue_1.8.0-1_ppc64el.deb ... 279s Unpacking r-cran-glue (1.8.0-1) ... 279s Selecting previously unselected package r-cran-rlang. 279s Preparing to unpack .../58-r-cran-rlang_1.1.5-3_ppc64el.deb ... 279s Unpacking r-cran-rlang (1.1.5-3) ... 279s Selecting previously unselected package r-cran-lifecycle. 279s Preparing to unpack .../59-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 279s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 279s Selecting previously unselected package r-cran-gtable. 279s Preparing to unpack .../60-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 279s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 279s Selecting previously unselected package r-cran-isoband. 279s Preparing to unpack .../61-r-cran-isoband_0.2.7-1_ppc64el.deb ... 279s Unpacking r-cran-isoband (0.2.7-1) ... 279s Selecting previously unselected package r-cran-s7. 279s Preparing to unpack .../62-r-cran-s7_0.2.0-1_ppc64el.deb ... 279s Unpacking r-cran-s7 (0.2.0-1) ... 279s Selecting previously unselected package r-cran-labeling. 279s Preparing to unpack .../63-r-cran-labeling_0.4.3-1_all.deb ... 279s Unpacking r-cran-labeling (0.4.3-1) ... 279s Selecting previously unselected package r-cran-r6. 279s Preparing to unpack .../64-r-cran-r6_2.6.1-1_all.deb ... 279s Unpacking r-cran-r6 (2.6.1-1) ... 279s Selecting previously unselected package r-cran-rcolorbrewer. 279s Preparing to unpack .../65-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 279s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 279s Selecting previously unselected package r-cran-viridislite. 279s Preparing to unpack .../66-r-cran-viridislite_0.4.3-1_all.deb ... 279s Unpacking r-cran-viridislite (0.4.3-1) ... 279s Selecting previously unselected package r-cran-scales. 279s Preparing to unpack .../67-r-cran-scales_1.4.0-1_all.deb ... 279s Unpacking r-cran-scales (1.4.0-1) ... 279s Selecting previously unselected package r-cran-vctrs. 279s Preparing to unpack .../68-r-cran-vctrs_0.6.5-1_ppc64el.deb ... 279s Unpacking r-cran-vctrs (0.6.5-1) ... 279s Selecting previously unselected package r-cran-withr. 279s Preparing to unpack .../69-r-cran-withr_3.0.2+dfsg-1_all.deb ... 279s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 279s Selecting previously unselected package r-cran-ggplot2. 279s Preparing to unpack .../70-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 279s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 279s Selecting previously unselected package r-cran-xfun. 279s Preparing to unpack .../71-r-cran-xfun_0.55+dfsg-1_ppc64el.deb ... 279s Unpacking r-cran-xfun (0.55+dfsg-1) ... 279s Selecting previously unselected package r-cran-highr. 279s Preparing to unpack .../72-r-cran-highr_0.11+dfsg-1_all.deb ... 279s Unpacking r-cran-highr (0.11+dfsg-1) ... 279s Selecting previously unselected package r-cran-yaml. 279s Preparing to unpack .../73-r-cran-yaml_2.3.10-1_ppc64el.deb ... 279s Unpacking r-cran-yaml (2.3.10-1) ... 279s Selecting previously unselected package libjs-mathjax. 279s Preparing to unpack .../74-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 279s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 280s Selecting previously unselected package r-cran-knitr. 280s Preparing to unpack .../75-r-cran-knitr_1.51+dfsg-1_all.deb ... 280s Unpacking r-cran-knitr (1.51+dfsg-1) ... 280s Selecting previously unselected package r-cran-markdown. 280s Preparing to unpack .../76-r-cran-markdown_1.13-1_all.deb ... 280s Unpacking r-cran-markdown (1.13-1) ... 280s Selecting previously unselected package r-cran-matrixstats. 280s Preparing to unpack .../77-r-cran-matrixstats_1.5.0-1_ppc64el.deb ... 280s Unpacking r-cran-matrixstats (1.5.0-1) ... 280s Selecting previously unselected package r-cran-microbenchmark. 280s Preparing to unpack .../78-r-cran-microbenchmark_1.5.0-1_ppc64el.deb ... 280s Unpacking r-cran-microbenchmark (1.5.0-1) ... 280s Selecting previously unselected package r-cran-r.methodss3. 280s Preparing to unpack .../79-r-cran-r.methodss3_1.8.2-1_all.deb ... 280s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 280s Selecting previously unselected package r-cran-r.oo. 280s Preparing to unpack .../80-r-cran-r.oo_1.27.1-1_all.deb ... 280s Unpacking r-cran-r.oo (1.27.1-1) ... 280s Selecting previously unselected package r-cran-r.utils. 280s Preparing to unpack .../81-r-cran-r.utils_2.13.0-1_all.deb ... 280s Unpacking r-cran-r.utils (2.13.0-1) ... 280s Selecting previously unselected package r-cran-r.cache. 280s Preparing to unpack .../82-r-cran-r.cache_0.17.0-1_all.deb ... 280s Unpacking r-cran-r.cache (0.17.0-1) ... 280s Selecting previously unselected package r-cran-r.devices. 280s Preparing to unpack .../83-r-cran-r.devices_2.17.3+ds-1_all.deb ... 280s Unpacking r-cran-r.devices (2.17.3+ds-1) ... 280s Selecting previously unselected package tcl8.6. 280s Preparing to unpack .../84-tcl8.6_8.6.17+dfsg-1build1_ppc64el.deb ... 280s Unpacking tcl8.6 (8.6.17+dfsg-1build1) ... 280s Selecting previously unselected package tcl. 280s Preparing to unpack .../85-tcl_8.6.16build1_ppc64el.deb ... 280s Unpacking tcl (8.6.16build1) ... 280s Selecting previously unselected package r-cran-r.rsp. 280s Preparing to unpack .../86-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 280s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 280s Setting up libgraphite2-3:ppc64el (1.3.14-11ubuntu1) ... 280s Setting up libpixman-1-0:ppc64el (0.46.4-1) ... 280s Setting up libsharpyuv0:ppc64el (1.5.0-0.1build1) ... 280s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 280s Setting up liblerc4:ppc64el (4.0.0+ds-5ubuntu2) ... 280s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 280s Setting up libxrender1:ppc64el (1:0.9.12-1) ... 280s Setting up libdatrie1:ppc64el (0.2.14-1) ... 280s Setting up libxcb-render0:ppc64el (1.17.0-2ubuntu1) ... 280s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 280s Setting up unzip (6.0-29ubuntu1) ... 280s Setting up x11-common (1:7.7+24ubuntu1) ... 280s Setting up libdeflate0:ppc64el (1.23-2build1) ... 280s Setting up libxcb-shm0:ppc64el (1.17.0-2ubuntu1) ... 280s Setting up libgomp1:ppc64el (15.2.0-12ubuntu1) ... 280s Setting up libjbig0:ppc64el (2.1-6.1ubuntu3) ... 280s Setting up zip (3.0-15ubuntu3) ... 280s Setting up libblas3:ppc64el (3.12.1-7ubuntu1) ... 280s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/blas/libblas.so.3 to provide /usr/lib/powerpc64le-linux-gnu/libblas.so.3 (libblas.so.3-powerpc64le-linux-gnu) in auto mode 280s Setting up fonts-dejavu-mono (2.37-8build1) ... 280s Setting up libtcl8.6:ppc64el (8.6.17+dfsg-1build1) ... 281s Setting up fonts-dejavu-core (2.37-8build1) ... 281s Setting up libjpeg-turbo8:ppc64el (2.1.5-4ubuntu3) ... 281s Setting up libgfortran5:ppc64el (15.2.0-12ubuntu1) ... 281s Setting up libwebp7:ppc64el (1.5.0-0.1build1) ... 281s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 281s Setting up libharfbuzz0b:ppc64el (12.3.2-1) ... 281s Setting up libthai-data (0.1.30-1) ... 281s Setting up libxss1:ppc64el (1:1.2.3-1build4) ... 281s Setting up libpaper2:ppc64el (2.2.5-0.3build1) ... 281s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 281s Setting up node-normalize.css (8.0.1-5.1) ... 281s Setting up xdg-utils (1.2.1-2ubuntu2) ... 281s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 281s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 281s Setting up libjpeg8:ppc64el (8c-2ubuntu11) ... 281s Setting up libice6:ppc64el (2:1.1.1-1build1) ... 281s Setting up tcl8.6 (8.6.17+dfsg-1build1) ... 281s Setting up liblapack3:ppc64el (3.12.1-7ubuntu1) ... 281s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/powerpc64le-linux-gnu/liblapack.so.3 (liblapack.so.3-powerpc64le-linux-gnu) in auto mode 281s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 281s Setting up libpaper-utils (2.2.5-0.3build1) ... 281s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 281s Setting up libthai0:ppc64el (0.1.30-1) ... 281s Setting up libtiff6:ppc64el (4.7.0-3ubuntu3) ... 281s Setting up tcl (8.6.16build1) ... 281s Setting up libfontconfig1:ppc64el (2.17.1-3ubuntu1) ... 281s Setting up libsm6:ppc64el (2:1.2.6-1build1) ... 281s Setting up fontconfig (2.17.1-3ubuntu1) ... 283s Regenerating fonts cache... done. 283s Setting up libxft2:ppc64el (2.3.6-1build2) ... 283s Setting up libtk8.6:ppc64el (8.6.17-1) ... 283s Setting up libpango-1.0-0:ppc64el (1.57.0-1) ... 283s Setting up libcairo2:ppc64el (1.18.4-3) ... 283s Setting up libxt6t64:ppc64el (1:1.2.1-1.3) ... 283s Setting up libpangoft2-1.0-0:ppc64el (1.57.0-1) ... 283s Setting up libpangocairo-1.0-0:ppc64el (1.57.0-1) ... 283s Setting up r-base-core (4.5.2-1ubuntu2) ... 283s Creating config file /etc/R/Renviron with new version 283s Setting up r-cran-labeling (0.4.3-1) ... 283s Setting up r-cran-farver (2.1.2-1) ... 283s Setting up r-cran-viridislite (0.4.3-1) ... 283s Setting up r-cran-commonmark (1.9.5-1) ... 283s Setting up r-cran-r6 (2.6.1-1) ... 283s Setting up r-cran-microbenchmark (1.5.0-1) ... 283s Setting up r-cran-rlang (1.1.5-3) ... 283s Setting up r-cran-matrixstats (1.5.0-1) ... 283s Setting up r-cran-xfun (0.55+dfsg-1) ... 283s Setting up r-cran-withr (3.0.2+dfsg-1) ... 283s Setting up r-cran-base64enc (0.1-3-3build1) ... 283s Setting up r-cran-digest (0.6.39-1) ... 283s Setting up r-cran-yaml (2.3.10-1) ... 283s Setting up r-cran-evaluate (1.0.5-1) ... 283s Setting up r-cran-highr (0.11+dfsg-1) ... 283s Setting up r-cran-glue (1.8.0-1) ... 283s Setting up r-cran-cli (3.6.4-1) ... 283s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 283s Setting up r-cran-r.methodss3 (1.8.2-1) ... 283s Setting up r-cran-markdown (1.13-1) ... 283s Setting up r-cran-s7 (0.2.0-1) ... 283s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 283s Setting up r-cran-isoband (0.2.7-1) ... 283s Setting up r-cran-scales (1.4.0-1) ... 283s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 283s Setting up r-cran-knitr (1.51+dfsg-1) ... 283s Setting up r-cran-vctrs (0.6.5-1) ... 283s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 283s Setting up r-cran-r.oo (1.27.1-1) ... 283s Setting up r-cran-r.utils (2.13.0-1) ... 283s Setting up r-cran-r.devices (2.17.3+ds-1) ... 283s Setting up r-cran-r.cache (0.17.0-1) ... 283s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 283s Processing triggers for libc-bin (2.42-2ubuntu4) ... 283s Processing triggers for man-db (2.13.1-1build1) ... 284s Processing triggers for install-info (7.2-5) ... 285s autopkgtest [23:31:46]: test run-unit-test: [----------------------- 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > library("matrixStats") 286s > 286s > allocArray_R <- function(nrow, ncol, value = NA) { 286s + array(data = value, dim = dim) 286s + } 286s > 286s > values <- list( 286s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 286s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 286s + .Machine$double.xmin, .Machine$double.xmax, 286s + .Machine$double.eps, .Machine$double.neg.eps, 286s + FALSE, TRUE, NA 286s + ) 286s > 286s > dim <- c(2L, 4L, 3L) 286s > for (value in values) { 286s + x0 <- allocArray_R(dim, value = value) 286s + x <- allocArray(dim, value = value) 286s + if (!identical(x, x0)) { 286s + str(list(dim = dim, value = value, x = x, x0 = x0)) 286s + stopifnot(identical(x, x0)) 286s + } 286s + } 286s > 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > library("matrixStats") 286s > 286s > allocMatrix_R <- function(nrow, ncol, value = NA) { 286s + matrix(data = value, nrow = nrow, ncol = ncol) 286s + } 286s > 286s > values <- list( 286s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 286s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 286s + .Machine$double.xmin, .Machine$double.xmax, 286s + .Machine$double.eps, .Machine$double.neg.eps, 286s + FALSE, TRUE, NA 286s + ) 286s > 286s > nrow <- 2L 286s > ncol <- 3L 286s > for (value in values) { 286s + x0 <- allocMatrix_R(nrow, ncol, value = value) 286s + x <- allocMatrix(nrow, ncol, value = value) 286s + if (!identical(x, x0)) { 286s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 286s + stopifnot(identical(x, x0)) 286s + } 286s + } 286s > 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > library("matrixStats") 286s > 286s > allocVector_R <- function(length, value = NA) { 286s + x <- vector(mode = typeof(value), length = length) 286s + if (!is.finite(value) || value != 0) x[] <- value 286s + x 286s + } 286s > 286s > values <- list( 286s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 286s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 286s + .Machine$double.xmin, .Machine$double.xmax, 286s + .Machine$double.eps, .Machine$double.neg.eps, 286s + FALSE, TRUE, NA 286s + ) 286s > 286s > n <- 10L 286s > for (value in values) { 286s + x0 <- allocVector_R(n, value = value) 286s + x <- allocVector(n, value = value) 286s + if (!identical(x, x0)) { 286s + str(list(n = n, value = value, x = x, x0 = x0)) 286s + stopifnot(identical(x, x0)) 286s + } 286s + } 286s > 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > library("matrixStats") 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Setup 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > data <- data.frame( 286s + logical = c(TRUE, FALSE, TRUE), 286s + integer = 1:3, 286s + double = seq(from = 1.0, to = 3.0, by = 1.0), 286s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 286s + character = letters[1:3], 286s + stringsAsFactors = FALSE 286s + ) 286s > 286s > modes <- names(data) 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Special cases 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > cat("NULL...\n") 286s NULL... 286s > stopifnot(identical(anyMissing(NULL), FALSE)) 286s > cat("NULL...done\n") 286s NULL...done 286s > 286s > cat("raw...\n") 286s raw... 286s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 286s > cat("raw...done\n") 286s raw...done 286s > 286s > cat("list(NULL)...\n") 286s list(NULL)... 286s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 286s > cat("list(NULL)...done\n") 286s list(NULL)...done 286s > 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Scalars, vectors, and matrices of various modes 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > for (mode in modes) { 286s + cat(sprintf("Mode: %s...\n", mode)) 286s + values <- data[[mode]] 286s + 286s + # Scalars 286s + cat(" scalar\n") 286s + x <- values[1L] 286s + print(x) 286s + stopifnot(identical(anyMissing(x), FALSE)) 286s + is.na(x) <- TRUE 286s + print(x) 286s + stopifnot(identical(anyMissing(x), TRUE)) 286s + 286s + # Vectors 286s + cat(" vector\n") 286s + x <- values 286s + print(x) 286s + stopifnot(identical(anyMissing(x), FALSE)) 286s + is.na(x)[2L] <- TRUE 286s + print(x) 286s + stopifnot(identical(anyMissing(x), TRUE)) 286s + 286s + # Matrices 286s + cat(" matrix\n") 286s + x <- matrix(c(values, values), ncol = 2L) 286s + print(x) 286s + stopifnot(identical(anyMissing(x), FALSE)) 286s + is.na(x)[2L] <- TRUE 286s + print(x) 286s + stopifnot(identical(anyMissing(x), TRUE)) 286s + 286s + cat(sprintf("Mode: %s...done\n", mode)) 286s + } # for (mode ...) 286s Mode: logical... 286s scalar 286s [1] TRUE 286s [1] NA 286s vector 286s [1] TRUE FALSE TRUE 286s [1] TRUE NA TRUE 286s matrix 286s [,1] [,2] 286s [1,] TRUE TRUE 286s [2,] FALSE FALSE 286s [3,] TRUE TRUE 286s [,1] [,2] 286s [1,] TRUE TRUE 286s [2,] NA FALSE 286s [3,] TRUE TRUE 286s Mode: logical...done 286s Mode: integer... 286s scalar 286s [1] 1 286s [1] NA 286s vector 286s [1] 1 2 3 286s [1] 1 NA 3 286s matrix 286s [,1] [,2] 286s [1,] 1 1 286s [2,] 2 2 286s [3,] 3 3 286s [,1] [,2] 286s [1,] 1 1 286s [2,] NA 2 286s [3,] 3 3 286s Mode: integer...done 286s Mode: double... 286s scalar 286s [1] 1 286s [1] NA 286s vector 286s [1] 1 2 3 286s [1] 1 NA 3 286s matrix 286s [,1] [,2] 286s [1,] 1 1 286s [2,] 2 2 286s [3,] 3 3 286s [,1] [,2] 286s [1,] 1 1 286s [2,] NA 2 286s [3,] 3 3 286s Mode: double...done 286s Mode: complex... 286s scalar 286s [1] 1+1i 286s [1] NA 286s vector 286s [1] 1+1i 2+1i 3+1i 286s [1] 1+1i NA 3+1i 286s matrix 286s [,1] [,2] 286s [1,] 1+1i 1+1i 286s [2,] 2+1i 2+1i 286s [3,] 3+1i 3+1i 286s [,1] [,2] 286s [1,] 1+1i 1+1i 286s [2,] NA 2+1i 286s [3,] 3+1i 3+1i 286s Mode: complex...done 286s Mode: character... 286s scalar 286s [1] "a" 286s [1] NA 286s vector 286s [1] "a" "b" "c" 286s [1] "a" NA "c" 286s matrix 286s [,1] [,2] 286s [1,] "a" "a" 286s [2,] "b" "b" 286s [3,] "c" "c" 286s [,1] [,2] 286s [1,] "a" "a" 286s [2,] NA "b" 286s [3,] "c" "c" 286s Mode: character...done 286s > 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Data frames 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > cat("data.frame...\n") 286s data.frame... 286s > x <- data 286s > stopifnot(identical(anyMissing(x), FALSE)) 286s > for (mode in modes) { 286s + x <- data 286s + is.na(x[[mode]])[2L] <- TRUE 286s + print(x) 286s + stopifnot(identical(anyMissing(x), TRUE)) 286s + } # for (mode ...) 286s logical integer double complex character 286s 1 TRUE 1 1 1+1i a 286s 2 NA 2 2 2+1i b 286s 3 TRUE 3 3 3+1i c 286s logical integer double complex character 286s 1 TRUE 1 1 1+1i a 286s 2 FALSE NA 2 2+1i b 286s 3 TRUE 3 3 3+1i c 286s logical integer double complex character 286s 1 TRUE 1 1 1+1i a 286s 2 FALSE 2 NA 2+1i b 286s 3 TRUE 3 3 3+1i c 286s logical integer double complex character 286s 1 TRUE 1 1 1+1i a 286s 2 FALSE 2 2 NA b 286s 3 TRUE 3 3 3+1i c 286s logical integer double complex character 286s 1 TRUE 1 1 1+1i a 286s 2 FALSE 2 2 2+1i 286s 3 TRUE 3 3 3+1i c 286s > cat("data.frame...done\n") 286s data.frame...done 286s > 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Lists 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > cat("list...\n") 286s list... 286s > x <- as.list(data) 286s > stopifnot(identical(anyMissing(x), FALSE)) 286s > for (mode in modes) { 286s + x <- as.list(data) 286s + is.na(x[[mode]])[2L] <- TRUE 286s + print(x) 286s + stopifnot(identical(anyMissing(x), TRUE)) 286s + } # for (mode ...) 286s $logical 286s [1] TRUE NA TRUE 286s 286s $integer 286s [1] 1 2 3 286s 286s $double 286s [1] 1 2 3 286s 286s $complex 286s [1] 1+1i 2+1i 3+1i 286s 286s $character 286s [1] "a" "b" "c" 286s 286s $logical 286s [1] TRUE FALSE TRUE 286s 286s $integer 286s [1] 1 NA 3 286s 286s $double 286s [1] 1 2 3 286s 286s $complex 286s [1] 1+1i 2+1i 3+1i 286s 286s $character 286s [1] "a" "b" "c" 286s 286s $logical 286s [1] TRUE FALSE TRUE 286s 286s $integer 286s [1] 1 2 3 286s 286s $double 286s [1] 1 NA 3 286s 286s $complex 286s [1] 1+1i 2+1i 3+1i 286s 286s $character 286s [1] "a" "b" "c" 286s 286s $logical 286s [1] TRUE FALSE TRUE 286s 286s $integer 286s [1] 1 2 3 286s 286s $double 286s [1] 1 2 3 286s 286s $complex 286s [1] 1+1i NA 3+1i 286s 286s $character 286s [1] "a" "b" "c" 286s 286s $logical 286s [1] TRUE FALSE TRUE 286s 286s $integer 286s [1] 1 2 3 286s 286s $double 286s [1] 1 2 3 286s 286s $complex 286s [1] 1+1i 2+1i 3+1i 286s 286s $character 286s [1] "a" NA "c" 286s 286s > cat("list...done\n") 286s list...done 286s > 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 286s > library("matrixStats") 286s > 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > # Subsetted tests 286s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286s > source("utils/validateIndicesFramework.R") 286s > x <- runif(4, min = -3, max = 3) 286s > x[2] <- NA 286s > for (mode in c("integer", "numeric")) { 286s + storage.mode(x) <- mode 286s + for (idxs in index_cases) { 286s + validateIndicesTestVector(x, idxs, 286s + ftest = anyMissing, fsure = function(x, ...) { 286s + anyValue(x, value = NA) 286s + }) 286s + } 286s + } 286s > 286s 286s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 286s Copyright (C) 2025 The R Foundation for Statistical Computing 286s Platform: powerpc64le-unknown-linux-gnu 286s 286s R is free software and comes with ABSOLUTELY NO WARRANTY. 286s You are welcome to redistribute it under certain conditions. 286s Type 'license()' or 'licence()' for distribution details. 286s 286s R is a collaborative project with many contributors. 286s Type 'contributors()' for more information and 286s 'citation()' on how to cite R or R packages in publications. 286s 286s Type 'demo()' for some demos, 'help()' for on-line help, or 286s 'help.start()' for an HTML browser interface to help. 286s Type 'q()' to quit R. 286s 287s > ## Don't test with valgrind 287s > if (Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 287s + 287s + Loading required namespace: base64enc 287s ## 3. Make sure all suggested packages are installed / can be loaded 287s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 287s + "R.devices", "R.rsp") 287s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 287s + html <- matrixStats:::benchmark("binCounts") 287s + print(html) 287s + } 287s + 287s + rm(list = "pkgs") 287s + 287s + } 287s Loading required namespace: ggplot2 287s Loading required namespace: knitr 287s Loading required namespace: markdown 287s Loading required namespace: microbenchmark 287s Loading required namespace: R.devices 287s Loading required namespace: R.rsp 288s integer: unsorted 291s integer: sorted 292s double: unsorted 294s double: sorted 296s RspFileProduct: 296s Pathname: /tmp/autopkgtest.6915Cs/autopkgtest_tmp/reports/binCounts.html 296s File size: 66.55 kB (68147 bytes) 296s Content type: text/html 296s Metadata 'author': 'Henrik Bengtsson' 296s Metadata 'title': 'binCounts() benchmarks' 296s Metadata 'date': '2014-05-25' 296s Has processor: FALSE 296s Warning message: 296s In par(parT) : argument 1 does not name a graphical parameter 296s > 296s 296s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 296s Copyright (C) 2025 The R Foundation for Statistical Computing 296s Platform: powerpc64le-unknown-linux-gnu 296s 296s R is free software and comes with ABSOLUTELY NO WARRANTY. 296s You are welcome to redistribute it under certain conditions. 296s Type 'license()' or 'licence()' for distribution details. 296s 296s R is a collaborative project with many contributors. 296s Type 'contributors()' for more information and 296s 'citation()' on how to cite R or R packages in publications. 296s 296s Type 'demo()' for some demos, 'help()' for on-line help, or 296s 'help.start()' for an HTML browser interface to help. 296s Type 'q()' to quit R. 296s 296s > library("matrixStats") 296s > library("stats") 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Local functions 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 296s + n0 <- graphics::hist(x, breaks = bx, right = right, 296s + include.lowest = TRUE, plot = FALSE)$counts 296s + } 296s > 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Non-sorted and sorted positions 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > nx <- 1000L # Number of data points 296s > nb <- 200L # Number of bins 296s > 296s > # Uniformely distributed bins 296s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 296s > bx <- c(-1, bx, 2) 296s > 296s > # Sample data points 296s > set.seed(0xBEEF) 296s > x <- runif(nx, min = 0, max = 1) 296s > 296s > for (kk in 1:2) { 296s + n0 <- binCounts_hist(x, bx = bx) 296s + n1 <- binCounts(x, bx = bx) 296s + # Sanity check 296s + stopifnot(identical(n1, n0)) 296s + 296s + # Check reversed 296s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 296s + stopifnot(identical(n1r, n1)) 296s + 296s + # Retry with a sorted vector 296s + x <- sort(x) 296s + } # for (kk in 1:2) 296s > 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Missing values 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > x <- 1:40 296s > x[20] <- NA_integer_ 296s > nx <- length(x) 296s > 296s > # Bins 296s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 296s > 296s > y_smooth0 <- binCounts_hist(x, bx = bx) 296s > y_smooth <- binCounts(x, bx = bx) 296s > # Sanity check 296s > stopifnot(all.equal(y_smooth, y_smooth0)) 296s > 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Border cases 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > x <- 1:10 296s > bx <- min(x) - c(10, 1) 296s > y_smooth <- binCounts(x, bx = bx) 296s > stopifnot(all.equal(y_smooth, 0L)) 296s > bx <- range(x) 296s > y_smooth <- binCounts(x, bx = bx) 296s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 296s > bx <- max(x) + c(1, 10) 296s > y_smooth <- binCounts(x, bx = bx) 296s > stopifnot(all.equal(y_smooth, 0L)) 296s > 296s > # Every second empty 296s > x <- 1:10 296s > bx <- rep(x, each = 2L) 296s > y_smooth <- binCounts(x, bx = bx) 296s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 296s > ## NOTE: binCounts_hist() does not give the same last bin count 296s > 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Exception handling 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Zero bin boundaries (invalid bin definition) 296s > bx <- double(0L) 296s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 296s > stopifnot(inherits(res, "try-error")) 296s > 296s > # One bin boundary (invalid bin definition) 296s > bx <- double(1L) 296s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 296s > stopifnot(inherits(res, "try-error")) 296s > 296s 296s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 296s Copyright (C) 2025 The R Foundation for Statistical Computing 296s Platform: powerpc64le-unknown-linux-gnu 296s 296s R is free software and comes with ABSOLUTELY NO WARRANTY. 296s You are welcome to redistribute it under certain conditions. 296s Type 'license()' or 'licence()' for distribution details. 296s 296s R is a collaborative project with many contributors. 296s Type 'contributors()' for more information and 296s 'citation()' on how to cite R or R packages in publications. 296s 296s Type 'demo()' for some demos, 'help()' for on-line help, or 296s 'help.start()' for an HTML browser interface to help. 296s Type 'q()' to quit R. 296s 296s > library("matrixStats") 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Local functions 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 296s + n0 <- graphics::hist(x, breaks = bx, right = right, 296s + include.lowest = TRUE, plot = FALSE)$counts 296s + } 296s > 296s > 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > # Subsetted tests 296s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 296s > source("utils/validateIndicesFramework.R") 296s > x <- runif(6, min = -6, max = 6) 296s > storage.mode(x) <- "integer" 296s > bx <- c(-6, 0, 3, 4, 10) 296s > for (idxs in index_cases) { 296s + validateIndicesTestVector(x, idxs, 296s + ftest = binCounts, fsure = binCounts_hist, 296s + bx = bx, right = FALSE) 296s + validateIndicesTestVector(x, idxs, 296s + ftest = binCounts, fsure = binCounts_hist, 296s + bx = bx, right = TRUE) 296s + } 296s > 297s 297s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 297s Copyright (C) 2025 The R Foundation for Statistical Computing 297s Platform: powerpc64le-unknown-linux-gnu 297s 297s R is free software and comes with ABSOLUTELY NO WARRANTY. 297s You are welcome to redistribute it under certain conditions. 297s Type 'license()' or 'licence()' for distribution details. 297s 297s R is a collaborative project with many contributors. 297s Type 'contributors()' for more information and 297s 'citation()' on how to cite R or R packages in publications. 297s 297s Type 'demo()' for some demos, 'help()' for on-line help, or 297s 'help.start()' for an HTML browser interface to help. 297s Type 'q()' to quit R. 297s 297s > library("matrixStats") 297s > library("stats") 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Naive R implementation of binMeans() 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 297s + n_smooth <- length(bx) - 1L 297s + res <- double(n_smooth) 297s + counts <- rep(NaN, times = n_smooth) 297s + 297s + if (na.rm) { 297s + keep <- !is.na(x) & !is.na(y) 297s + x <- x[keep] 297s + y <- y[keep] 297s + } 297s + 297s + # For each bin... 297s + for (kk in seq_len(n_smooth)) { 297s + if (right) { 297s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 297s + } else { 297s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 297s + } 297s + y_kk <- y[idxs] 297s + res[kk] <- mean(y_kk) 297s + counts[kk] <- length(idxs) 297s + } # for (kk ...) 297s + 297s + if (count) attr(res, "count") <- counts 297s + res 297s + } 297s > 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Case #1 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > x <- 1:100 297s > nx <- length(x) 297s > y <- double(nx) 297s > y[1:25] <- 5 297s > y[51:75] <- -5 297s > y <- y + rnorm(nx) 297s > 297s > # Bins 297s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 297s > 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 297s > y_smooth <- binMeans(y, x = x, bx = bx) 297s > n_smooth <- binCounts(x, bx = bx) 297s > # Sanity check 297s > stopifnot(all.equal(y_smooth, y_smooth0)) 297s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 297s > 297s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 297s + count = FALSE, right = TRUE)) 297s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 297s + count = FALSE, right = TRUE)) 297s > # Sanity check 297s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 297s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 297s > 297s > 297s > # Integer input 297s > y <- as.integer(y) 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 297s > y_smooth <- binMeans(y, x = x, bx = bx) 297s > n_smooth <- binCounts(x, bx = bx) 297s > # Sanity check 297s > stopifnot(is.integer(y), 297s + all.equal(y_smooth, y_smooth0), 297s + all.equal(attr(y_smooth, "count"), n_smooth)) 297s > 297s > # Logical input 297s > y <- as.logical(y) 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 297s > y_smooth <- binMeans(y, x = x, bx = bx) 297s > n_smooth <- binCounts(x, bx = bx) 297s > # Sanity check 297s > stopifnot(is.logical(y), 297s + all.equal(y_smooth, y_smooth0), 297s + all.equal(attr(y_smooth, "count"), n_smooth)) 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Case #2 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > nx <- 1e3 297s > x <- runif(nx) 297s > y <- runif(nx) 297s > 297s > nb <- 10 297s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 297s > bx1 <- c(bx[-1], bx[nb] + 1) 297s > 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 297s > y_smooth <- binMeans(y, x = x, bx = bx1) 297s > n_smooth <- binCounts(x, bx = bx1) 297s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 297s > 297s > # Sanity check 297s > stopifnot(all.equal(y_smooth, y_smooth0)) 297s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 297s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Empty bins 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > x <- c(6:8, 16:19) 297s > nx <- length(x) 297s > y <- runif(nx) 297s > bx <- c(0, 5, 10, 15, 20, 25) 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 297s > y_smooth <- binMeans(y, x = x, bx = bx) 297s > n_smooth <- binCounts(x, bx = bx) 297s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 297s > stopifnot(all.equal(y_smooth, y_smooth0)) 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Missing values 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > x <- 1:100 297s > x[50] <- NA_integer_ 297s > nx <- length(x) 297s > y <- double(nx) 297s > y[1:25] <- 5 297s > y[51:75] <- -5 297s > y[82:92] <- NA_real_ 297s > y <- y + rnorm(nx) 297s > 297s > # Bins 297s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 297s > 297s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 297s > y_smooth <- binMeans(y, x = x, bx = bx) 297s > # Sanity check 297s > stopifnot(all.equal(y_smooth, y_smooth0)) 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Exception handling 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Zero bin boundaries (invalid bin definition) 297s > bx <- double(0L) 297s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 297s > stopifnot(inherits(res, "try-error")) 297s > 297s > # One bin boundary (invalid bin definition) 297s > bx <- double(1L) 297s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 297s > stopifnot(inherits(res, "try-error")) 297s > 297s 297s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 297s Copyright (C) 2025 The R Foundation for Statistical Computing 297s Platform: powerpc64le-unknown-linux-gnu 297s 297s R is free software and comes with ABSOLUTELY NO WARRANTY. 297s You are welcome to redistribute it under certain conditions. 297s Type 'license()' or 'licence()' for distribution details. 297s 297s R is a collaborative project with many contributors. 297s Type 'contributors()' for more information and 297s 'citation()' on how to cite R or R packages in publications. 297s 297s Type 'demo()' for some demos, 'help()' for on-line help, or 297s 'help.start()' for an HTML browser interface to help. 297s Type 'q()' to quit R. 297s 297s > library("matrixStats") 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Naive R implementation of binMeans() 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 297s + n_smooth <- length(bx) - 1L 297s + res <- double(n_smooth) 297s + counts <- rep(NaN, times = n_smooth) 297s + 297s + if (na.rm) { 297s + keep <- !is.na(x) & !is.na(y) 297s + x <- x[keep] 297s + y <- y[keep] 297s + } 297s + 297s + # For each bin... 297s + for (kk in seq_len(n_smooth)) { 297s + if (right) { 297s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 297s + } else { 297s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 297s + } 297s + y_kk <- y[idxs] 297s + res[kk] <- mean(y_kk) 297s + counts[kk] <- length(idxs) 297s + } # for (kk ...) 297s + 297s + if (count) attr(res, "count") <- counts 297s + res 297s + } 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Subsetted tests 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > source("utils/validateIndicesFramework.R") 297s > y <- runif(6, min = -6, max = 6) 297s > x <- runif(6, min = -6, max = 6) 297s > storage.mode(x) <- "integer" 297s > bx <- c(-6, 0, 3, 4, 10) 297s > for (idxs in index_cases) { 297s + for (na.rm in c(TRUE, FALSE)) { 297s + validateIndicesTestVector_w(y, x, idxs, 297s + ftest = binMeans, fsure = binMeans0, 297s + bx = bx, na.rm = na.rm, 297s + count = TRUE, right = FALSE) 297s + validateIndicesTestVector_w(y, x, idxs, 297s + ftest = binMeans, fsure = binMeans0, 297s + bx = bx, na.rm = na.rm, 297s + count = TRUE, right = TRUE) 297s + } 297s + } 297s > 297s 297s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 297s Copyright (C) 2025 The R Foundation for Statistical Computing 297s Platform: powerpc64le-unknown-linux-gnu 297s 297s R is free software and comes with ABSOLUTELY NO WARRANTY. 297s You are welcome to redistribute it under certain conditions. 297s Type 'license()' or 'licence()' for distribution details. 297s 297s R is a collaborative project with many contributors. 297s Type 'contributors()' for more information and 297s 'citation()' on how to cite R or R packages in publications. 297s 297s Type 'demo()' for some demos, 'help()' for on-line help, or 297s 'help.start()' for an HTML browser interface to help. 297s Type 'q()' to quit R. 297s 297s > library("matrixStats") 297s > 297s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 297s + if (is.na(value)) { 297s + counts <- sum(is.na(x)) 297s + } else { 297s + counts <- sum(x == value, na.rm = na.rm) 297s + } 297s + as.integer(counts) 297s + } 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Data type: integer and numeric 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > for (mode in c("integer", "double")) { 297s + x <- runif(20 * 5, min = -3, max = 3) 297s + x[sample.int(length(x), size = 7)] <- 0 297s + storage.mode(x) <- mode 297s + 297s + for (na.rm in c(FALSE, TRUE)) { 297s + # Count zeros 297s + n0 <- count_R(x, value = 0, na.rm = na.rm) 297s + n1 <- count(x, value = 0, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + all <- allValue(x, value = 0, na.rm = na.rm) 297s + any <- anyValue(x, value = 0, na.rm = na.rm) 297s + 297s + # Count NAs 297s + n0 <- count_R(x, value = NA, na.rm = na.rm) 297s + n1 <- count(x, value = NA, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + all <- allValue(x, value = NA, na.rm = na.rm) 297s + any <- anyValue(x, value = NA, na.rm = na.rm) 297s + 297s + if (mode == "integer") { 297s + ux <- unique(as.vector(x)) 297s + n0 <- n1 <- integer(length(x)) 297s + for (value in ux) { 297s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 297s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + } 297s + stopifnot(all(n0 == ncol(x))) 297s + } # if (mode == "integer") 297s + 297s + } # for (na.rm ...) 297s + } # for (mode ...) 297s > 297s > # All NAs 297s > na_list <- list(NA_integer_, NA_real_, NaN) 297s > for (na_value in na_list) { 297s + x <- rep(na_value, times = 10L) 297s + for (na.rm in c(FALSE, TRUE)) { 297s + n0 <- count_R(x, na.rm = na.rm) 297s + n1 <- count(x, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + 297s + # Count NAs 297s + n0 <- count_R(x, value = NA, na.rm = na.rm) 297s + n1 <- count(x, value = NA, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + any <- anyValue(x, value = NA, na.rm = na.rm) 297s + all <- allValue(x, value = NA, na.rm = na.rm) 297s + stopifnot(any) 297s + stopifnot(all) 297s + } 297s + } # for (na_value ...) 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Data type: logical 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > x <- logical(length = 10L) 297s > x[3:7] <- TRUE 297s > 297s > # Row/column counts 297s > for (na.rm in c(FALSE, TRUE)) { 297s + n0 <- count_R(x, na.rm = na.rm) 297s + n1 <- count(x, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + 297s + n_true <- count(x, value = TRUE, na.rm = na.rm) 297s + n_false <- count(x, value = FALSE, na.rm = na.rm) 297s + stopifnot(n_true + n_false == ncol(x)) 297s + 297s + # Count NAs 297s + n0 <- count_R(x, value = NA, na.rm = na.rm) 297s + n1 <- count(x, value = NA, na.rm = na.rm) 297s + stopifnot(identical(n1, n0)) 297s + } 297s > 297s 297s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 297s Copyright (C) 2025 The R Foundation for Statistical Computing 297s Platform: powerpc64le-unknown-linux-gnu 297s 297s R is free software and comes with ABSOLUTELY NO WARRANTY. 297s You are welcome to redistribute it under certain conditions. 297s Type 'license()' or 'licence()' for distribution details. 297s 297s R is a collaborative project with many contributors. 297s Type 'contributors()' for more information and 297s 'citation()' on how to cite R or R packages in publications. 297s 297s Type 'demo()' for some demos, 'help()' for on-line help, or 297s 'help.start()' for an HTML browser interface to help. 297s Type 'q()' to quit R. 297s 297s > library("matrixStats") 297s > 297s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 297s + if (is.na(value)) { 297s + counts <- sum(is.na(x)) 297s + } else { 297s + counts <- sum(x == value, na.rm = na.rm) 297s + } 297s + as.integer(counts) 297s + } 297s > 297s > 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > # Subsetted tests 297s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 297s > source("utils/validateIndicesFramework.R") 297s > x <- runif(6, min = -3, max = 3) 297s > storage.mode(x) <- "integer" 297s > for (idxs in index_cases) { 297s + validateIndicesTestVector(x, idxs, 297s + ftest = count, fsure = count_R, 297s + value = 0, na.rm = TRUE) 297s + validateIndicesTestVector(x, idxs, 297s + ftest = count, fsure = count_R, 297s + value = 0, na.rm = FALSE) 297s + validateIndicesTestVector(x, idxs, 297s + ftest = count, fsure = count_R, 297s + value = NA_integer_) 297s + } 297s > 297s 297s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 297s Copyright (C) 2025 The R Foundation for Statistical Computing 297s Platform: powerpc64le-unknown-linux-gnu 297s 297s R is free software and comes with ABSOLUTELY NO WARRANTY. 297s You are welcome to redistribute it under certain conditions. 297s Type 'license()' or 'licence()' for distribution details. 297s 297s R is a collaborative project with many contributors. 297s Type 'contributors()' for more information and 297s 'citation()' on how to cite R or R packages in publications. 297s 297s Type 'demo()' for some demos, 'help()' for on-line help, or 297s 'help.start()' for an HTML browser interface to help. 297s Type 'q()' to quit R. 297s 297s > library("matrixStats") 297s > 297s > diff2_R <- function(..., useNames = TRUE){ 297s + res <- diff(...) 297s + if (!useNames) names(res) <- NULL 297s + res 297s + } 297s > 297s > set.seed(0x42) 297s > 297s > for (mode in c("integer", "double")) { 297s + x <- rnorm(10, sd = 5) 297s + storage.mode(x) <- mode 297s + str(x) 297s + 297s + for (has_na in c(FALSE, TRUE)) { 297s + for (setNames in c(TRUE, FALSE)) { 297s + for (useNames in c(TRUE, FALSE)) { 297s + if (has_na) { 297s + x[sample(1:10, size = 3)] <- NA 297s + } 297s + if (setNames) { 297s + names(x) <- LETTERS[1:10] 297s + } 297s + for (l in 1:3) { 297s + for (d in 1:4) { 297s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 297s + mode, has_na, l, d, setNames, useNames)) 297s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 297s + str(y0) 297s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 297s + str(y1) 297s + stopifnot(identical(y1, y0)) 297s + } 297s + } 297s + } 297s + } 297s + } # for (has_na ...) 297s + } 298s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 298s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 298s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 298s Named int [1:8] 11 -3 1 -1 2 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] 11 -3 1 -1 2 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 298s Named int [1:7] -14 4 -2 3 7 -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] -14 4 -2 3 7 -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 298s Named int [1:6] 18 -6 5 4 -31 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] 18 -6 5 4 -31 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 298s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 298s Named int [1:6] 6 -2 1 12 5 -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] 6 -2 1 12 5 -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 298s Named int [1:4] -5 14 4 -27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] -5 14 4 -27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 298s Named int [1:2] 9 -41 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named int [1:2] 9 -41 298s - attr(*, "names")= chr [1:2] "I" "J" 298s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 298s Named int [1:7] -11 -2 -5 -3 7 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] -11 -2 -5 -3 7 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 298s Named int [1:4] 8 9 8 6 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] 8 9 8 6 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 298s Named int -2 298s - attr(*, "names")= chr "J" 298s Named int -2 298s - attr(*, "names")= chr "J" 298s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 298s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 298s int [1:8] 11 -3 1 -1 2 9 -15 6 298s int [1:8] 11 -3 1 -1 2 9 -15 6 298s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 298s int [1:7] -14 4 -2 3 7 -24 21 298s int [1:7] -14 4 -2 3 7 -24 21 298s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 298s int [1:6] 18 -6 5 4 -31 45 298s int [1:6] 18 -6 5 4 -31 45 298s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 298s int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 298s int [1:6] 6 -2 1 12 5 -15 298s int [1:6] 6 -2 1 12 5 -15 298s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 298s int [1:4] -5 14 4 -27 298s int [1:4] -5 14 4 -27 298s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 298s int [1:2] 9 -41 298s int [1:2] 9 -41 298s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 298s int [1:7] -11 -2 -5 -3 7 3 3 298s int [1:7] -11 -2 -5 -3 7 3 3 298s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 298s int [1:4] 8 9 8 6 298s int [1:4] 8 9 8 6 298s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 298s int -2 298s int -2 298s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 298s int(0) 298s int(0) 298s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 298s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 298s Named int [1:8] 11 -3 1 -1 2 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] 11 -3 1 -1 2 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 298s Named int [1:7] -14 4 -2 3 7 -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] -14 4 -2 3 7 -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 298s Named int [1:6] 18 -6 5 4 -31 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] 18 -6 5 4 -31 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 298s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 298s Named int [1:6] 6 -2 1 12 5 -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] 6 -2 1 12 5 -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 298s Named int [1:4] -5 14 4 -27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] -5 14 4 -27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 298s Named int [1:2] 9 -41 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named int [1:2] 9 -41 298s - attr(*, "names")= chr [1:2] "I" "J" 298s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 298s Named int [1:7] -11 -2 -5 -3 7 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] -11 -2 -5 -3 7 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 298s Named int [1:4] 8 9 8 6 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] 8 9 8 6 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 298s Named int -2 298s - attr(*, "names")= chr "J" 298s Named int -2 298s - attr(*, "names")= chr "J" 298s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 298s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 298s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 298s int [1:8] 11 -3 1 -1 2 9 -15 6 298s int [1:8] 11 -3 1 -1 2 9 -15 6 298s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 298s int [1:7] -14 4 -2 3 7 -24 21 298s int [1:7] -14 4 -2 3 7 -24 21 298s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 298s int [1:6] 18 -6 5 4 -31 45 298s int [1:6] 18 -6 5 4 -31 45 298s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 298s int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s int [1:8] -9 -1 -3 -3 -2 9 3 -6 298s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 298s int [1:6] 6 -2 1 12 5 -15 298s int [1:6] 6 -2 1 12 5 -15 298s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 298s int [1:4] -5 14 4 -27 298s int [1:4] -5 14 4 -27 298s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 298s int [1:2] 9 -41 298s int [1:2] 9 -41 298s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 298s int [1:7] -11 -2 -5 -3 7 3 3 298s int [1:7] -11 -2 -5 -3 7 3 3 298s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 298s int [1:4] 8 9 8 6 298s int [1:4] 8 9 8 6 298s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 298s int -2 298s int -2 298s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 298s int(0) 298s int(0) 298s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 298s Named int [1:9] NA NA NA NA NA 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named int [1:9] NA NA NA NA NA 0 9 -6 0 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 298s Named int [1:8] NA NA NA NA NA 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] NA NA NA NA NA 9 -15 6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 298s Named int [1:7] NA NA NA NA NA -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] NA NA NA NA NA -24 21 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 298s Named int [1:6] NA NA NA NA NA 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] NA NA NA NA NA 45 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 298s Named int [1:8] -9 NA NA NA NA 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] -9 NA NA NA NA 9 3 -6 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 298s Named int [1:6] NA NA NA NA NA -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] NA NA NA NA NA -15 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 298s Named int [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named int [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 298s Named int [1:7] NA NA -5 NA NA 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] NA NA -5 NA NA 3 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 298s Named int [1:4] NA NA 8 NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] NA NA 8 NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 298s Named int NA 298s - attr(*, "names")= chr "J" 298s Named int NA 298s - attr(*, "names")= chr "J" 298s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 298s int [1:9] NA NA NA NA NA 0 9 NA NA 298s int [1:9] NA NA NA NA NA 0 9 NA NA 298s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 298s int [1:8] NA NA NA NA NA 9 NA NA 298s int [1:8] NA NA NA NA NA 9 NA NA 298s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 298s int [1:7] NA NA NA NA NA NA NA 298s int [1:7] NA NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 298s int [1:6] NA NA NA NA NA NA 298s int [1:6] NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 298s int [1:8] NA NA NA NA NA 9 NA -6 298s int [1:8] NA NA NA NA NA 9 NA -6 298s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 298s int [1:6] NA NA NA NA NA -15 298s int [1:6] NA NA NA NA NA -15 298s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 298s int [1:4] NA NA NA NA 298s int [1:4] NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 298s int [1:2] NA NA 298s int [1:2] NA NA 298s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 298s int [1:7] NA NA NA NA NA NA 3 298s int [1:7] NA NA NA NA NA NA 3 298s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 298s int [1:4] NA NA NA NA 298s int [1:4] NA NA NA NA 298s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 298s int NA 298s int NA 298s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 298s int(0) 298s int(0) 298s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 298s Named int [1:9] NA NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named int [1:9] NA NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 298s Named int [1:8] NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 298s Named int [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 298s Named int [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 298s Named int [1:8] NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named int [1:8] NA NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 298s Named int [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named int [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 298s Named int [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named int [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 298s Named int [1:7] NA NA NA NA NA NA 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named int [1:7] NA NA NA NA NA NA 3 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named int [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 298s Named int NA 298s - attr(*, "names")= chr "J" 298s Named int NA 298s - attr(*, "names")= chr "J" 298s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s Named int(0) 298s - attr(*, "names")= chr(0) 298s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 298s int [1:9] NA NA NA NA NA NA NA NA NA 298s int [1:9] NA NA NA NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 298s int [1:8] NA NA NA NA NA NA NA NA 298s int [1:8] NA NA NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 298s int [1:7] NA NA NA NA NA NA NA 298s int [1:7] NA NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 298s int [1:6] NA NA NA NA NA NA 298s int [1:6] NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 298s int [1:8] NA NA NA NA NA NA NA NA 298s int [1:8] NA NA NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 298s int [1:6] NA NA NA NA NA NA 298s int [1:6] NA NA NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 298s int [1:4] NA NA NA NA 298s int [1:4] NA NA NA NA 298s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 298s int [1:2] NA NA 298s int [1:2] NA NA 298s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 298s int [1:7] NA NA NA NA NA NA 3 298s int [1:7] NA NA NA NA NA NA 3 298s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 298s int [1:4] NA NA NA NA 298s int [1:4] NA NA NA NA 298s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 298s int NA 298s int NA 298s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 298s int(0) 298s int(0) 298s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 298s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 298s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 298s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 298s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 298s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 298s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 298s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 298s Named num [1:4] 0.368 42.988 15.396 -29.313 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] 0.368 42.988 15.396 -29.313 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 298s Named num [1:2] 15 -72.3 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named num [1:2] 15 -72.3 298s - attr(*, "names")= chr [1:2] "I" "J" 298s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 298s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 298s Named num [1:4] -23.52 7.92 11.38 23.27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] -23.52 7.92 11.38 23.27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 298s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 298s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 298s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 298s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 298s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 298s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 298s num [1:4] 0.368 42.988 15.396 -29.313 298s num [1:4] 0.368 42.988 15.396 -29.313 298s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 298s num [1:2] 15 -72.3 298s num [1:2] 15 -72.3 298s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 298s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 298s num [1:4] -23.52 7.92 11.38 23.27 298s num [1:4] -23.52 7.92 11.38 23.27 298s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 298s num 46.8 298s num 46.8 298s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 298s num(0) 298s num(0) 298s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 298s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 298s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 298s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 298s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 298s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 298s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 298s Named num [1:4] 0.368 42.988 15.396 -29.313 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] 0.368 42.988 15.396 -29.313 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 298s Named num [1:2] 15 -72.3 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named num [1:2] 15 -72.3 298s - attr(*, "names")= chr [1:2] "I" "J" 298s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 298s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 298s Named num [1:4] -23.52 7.92 11.38 23.27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] -23.52 7.92 11.38 23.27 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 298s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 298s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 298s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 298s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 298s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 298s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 298s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 298s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 298s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 298s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 298s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 298s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 298s num [1:4] 0.368 42.988 15.396 -29.313 298s num [1:4] 0.368 42.988 15.396 -29.313 298s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 298s num [1:2] 15 -72.3 298s num [1:2] 15 -72.3 298s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 298s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 298s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 298s num [1:4] -23.52 7.92 11.38 23.27 298s num [1:4] -23.52 7.92 11.38 23.27 298s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 298s num 46.8 298s num 46.8 298s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 298s num(0) 298s num(0) 298s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 298s Named num [1:9] -2.929 0.673 8.826 NA NA ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named num [1:9] -2.929 0.673 8.826 NA NA ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 298s Named num [1:8] 3.6 8.15 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] 3.6 8.15 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 298s Named num [1:7] 4.55 NA NA NA NA ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 4.55 NA NA NA NA ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 298s Named num [1:8] -2.26 9.5 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] -2.26 9.5 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 298s Named num [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named num [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 298s Named num [1:7] 6.57 NA NA -16.95 NA ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] 6.57 NA NA -16.95 NA ... 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 298s Named num [1:4] -23.5 NA NA 23.3 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] -23.5 NA NA 23.3 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s Named num 46.8 298s - attr(*, "names")= chr "J" 298s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 298s num [1:9] NA 0.673 8.826 NA NA ... 298s num [1:9] NA 0.673 8.826 NA NA ... 298s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 298s num [1:8] NA 8.15 NA NA NA ... 298s num [1:8] NA 8.15 NA NA NA ... 298s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 298s num [1:7] NA NA NA NA NA NA NA 298s num [1:7] NA NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 298s num [1:6] NA NA NA NA NA NA 298s num [1:6] NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 298s num [1:8] NA 9.5 NA NA NA ... 298s num [1:8] NA 9.5 NA NA NA ... 298s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 298s num [1:6] NA NA NA NA NA NA 298s num [1:6] NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 298s num [1:4] NA NA NA NA 298s num [1:4] NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 298s num [1:2] NA NA 298s num [1:2] NA NA 298s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 298s num [1:7] NA NA NA NA NA NA NA 298s num [1:7] NA NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 298s num [1:4] NA NA NA NA 298s num [1:4] NA NA NA NA 298s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 298s num NA 298s num NA 298s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 298s num(0) 298s num(0) 298s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 298s Named num [1:9] NA 0.673 8.826 NA NA ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s Named num [1:9] NA 0.673 8.826 NA NA ... 298s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 298s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 298s Named num [1:8] NA 8.15 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] NA 8.15 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 298s Named num [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 298s Named num [1:8] NA 9.5 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s Named num [1:8] NA 9.5 NA NA NA ... 298s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 298s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s Named num [1:6] NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 298s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 298s Named num [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s Named num [1:2] NA NA 298s - attr(*, "names")= chr [1:2] "I" "J" 298s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 298s Named num [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s Named num [1:7] NA NA NA NA NA NA NA 298s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 298s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s Named num [1:4] NA NA NA NA 298s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 298s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 298s Named num NA 298s - attr(*, "names")= chr "J" 298s Named num NA 298s - attr(*, "names")= chr "J" 298s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s Named num(0) 298s - attr(*, "names")= chr(0) 298s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 298s num [1:9] NA 0.673 8.826 NA NA ... 298s num [1:9] NA 0.673 8.826 NA NA ... 298s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 298s num [1:8] NA 8.15 NA NA NA ... 298s num [1:8] NA 8.15 NA NA NA ... 298s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 298s num [1:7] NA NA NA NA NA NA NA 298s num [1:7] NA NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 298s num [1:6] NA NA NA NA NA NA 298s num [1:6] NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 298s num [1:8] NA 9.5 NA NA NA ... 298s num [1:8] NA 9.5 NA NA NA ... 298s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 298s num [1:6] NA NA NA NA NA NA 298s num [1:6] NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 298s num [1:4] NA NA NA NA 298s num [1:4] NA NA NA NA 298s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 298s num [1:2] NA NA 298s num [1:2] NA NA 298s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 298s num [1:7] NA NA NA NA NA NA NA 298s num [1:7] NA NA NA NA NA NA NA 298s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 298s num [1:4] NA NA NA NA 298s num [1:4] NA NA NA NA 298s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 298s num NA 298s num NA 298s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 298s num(0) 298s num(0) 298s > 298s 298s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 298s Copyright (C) 2025 The R Foundation for Statistical Computing 298s Platform: powerpc64le-unknown-linux-gnu 298s 298s R is free software and comes with ABSOLUTELY NO WARRANTY. 298s You are welcome to redistribute it under certain conditions. 298s Type 'license()' or 'licence()' for distribution details. 298s 298s R is a collaborative project with many contributors. 298s Type 'contributors()' for more information and 298s 'citation()' on how to cite R or R packages in publications. 298s 298s Type 'demo()' for some demos, 'help()' for on-line help, or 298s 'help.start()' for an HTML browser interface to help. 298s Type 'q()' to quit R. 298s 298s > library("matrixStats") 298s > 298s > diff2_R <- function(..., useNames=NA){ 298s + res <- diff(...) 298s + if (!useNames) names(res) <- NULL 298s + res 298s + } 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > # Subsetted tests 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > source("utils/validateIndicesFramework.R") 298s > x <- runif(6, min = -6, max = 6) 298s > for (setNames in c(TRUE, FALSE)) { 298s + if (setNames) names(x) <- LETTERS[1:6] 298s + else names(x) <- NULL 298s + for (l in 1:2) { 298s + for (d in 1:2) { 298s + for (idxs in index_cases) { 298s + for (useNames in c(TRUE, FALSE)) { 298s + validateIndicesTestVector(x, idxs, 298s + ftest = diff2, fsure = diff2_R, 298s + lag = l, differences = d, useNames = useNames) 298s + } 298s + } 298s + } 298s + } 298s + } 298s > 298s 298s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 298s Copyright (C) 2025 The R Foundation for Statistical Computing 298s Platform: powerpc64le-unknown-linux-gnu 298s 298s R is free software and comes with ABSOLUTELY NO WARRANTY. 298s You are welcome to redistribute it under certain conditions. 298s Type 'license()' or 'licence()' for distribution details. 298s 298s R is a collaborative project with many contributors. 298s Type 'contributors()' for more information and 298s 'citation()' on how to cite R or R packages in publications. 298s 298s Type 'demo()' for some demos, 'help()' for on-line help, or 298s 'help.start()' for an HTML browser interface to help. 298s Type 'q()' to quit R. 298s 298s > library("matrixStats") 298s > 298s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 298s + n <- prod(dim) 298s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 298s + if (!is.null(idxs)) 298s + x <- x[idxs] 298s + as.vector(x) 298s + } 298s > 298s > 298s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 298s + n <- prod(dim) 298s + if (is.null(idxs)) { 298s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 298s + as.vector(x) 298s + } else { 298s + idxs <- idxs - 1L 298s + cols <- idxs %/% dim[2L] 298s + rows <- idxs %% dim[2L] 298s + cols + dim[1L] * rows + 1L 298s + } 298s + } 298s > 298s > 298s > dim <- c(5L, 4L) 298s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 298s > y <- t(x) 298s > idxs_by_cols <- seq_along(x) 298s > 298s > # Assign by columns 298s > x[idxs_by_cols] <- idxs_by_cols 298s > print(x) 298s [,1] [,2] [,3] [,4] 298s [1,] 1 6 11 16 298s [2,] 2 7 12 17 298s [3,] 3 8 13 18 298s [4,] 4 9 14 19 298s [5,] 5 10 15 20 298s > 298s > # Truth 298s > y0 <- t(x) 298s > idxs_by_rows <- as.vector(y0) 298s > 298s > # Assert 298s > idxs <- indexByRow(dim) 298s > stopifnot(all.equal(idxs, idxs_by_rows)) 298s > y <- x 298s > y[idxs_by_rows] <- idxs 298s > print(y) 298s [,1] [,2] [,3] [,4] 298s [1,] 1 6 11 16 298s [2,] 2 7 12 17 298s [3,] 3 8 13 18 298s [4,] 4 9 14 19 298s [5,] 5 10 15 20 298s > stopifnot(all(as.vector(y) == as.vector(x))) 298s > 298s > idxs_R1 <- indexByRow_R1(dim) 298s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 298s > 298s > idxs_R2 <- indexByRow_R2(dim) 298s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 298s > 298s > # Assert 298s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 298s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 298s > 298s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 298s > stopifnot(all(idxs == idxs_by_rows)) 298s > 298s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 298s > stopifnot(all(idxs_R1 == idxs_by_rows)) 298s > 298s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 298s > stopifnot(all(idxs_R2 == idxs_by_rows)) 298s > 298s > 298s > ## DEFUNCT: Backward compatibility 298s > res <- tryCatch({ 298s + idxs1 <- indexByRow(x) 298s + }, error = identity) 298s > stopifnot(inherits(res, "error")) 298s > 298s > 298s > ## Exceptions: 298s > ## Too large matrices are not supported, which happens 298s > ## when prod(dim) > .Machine$integer.max 298s > dim_too_large <- c(.Machine$integer.max, 2L) 298s > res <- tryCatch({ 298s + idxs <- indexByRow(dim_too_large, idxs = 1L) 298s + }, error = identity) 298s > stopifnot(inherits(res, "error")) 298s > 298s > ## Non-positive indices are not supported 298s > res <- tryCatch({ 298s + idxs <- indexByRow(c(1,1), idxs = 0L) 298s + }, error = identity) 298s > stopifnot(inherits(res, "error")) 298s > 298s > res <- tryCatch({ 298s + idxs <- indexByRow(c(1,1), idxs = -1L) 298s + }, error = identity) 298s > stopifnot(inherits(res, "error")) 298s > 298s 298s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 298s Copyright (C) 2025 The R Foundation for Statistical Computing 298s Platform: powerpc64le-unknown-linux-gnu 298s 298s R is free software and comes with ABSOLUTELY NO WARRANTY. 298s You are welcome to redistribute it under certain conditions. 298s Type 'license()' or 'licence()' for distribution details. 298s 298s R is a collaborative project with many contributors. 298s Type 'contributors()' for more information and 298s 'citation()' on how to cite R or R packages in publications. 298s 298s Type 'demo()' for some demos, 'help()' for on-line help, or 298s 'help.start()' for an HTML browser interface to help. 298s Type 'q()' to quit R. 298s 298s > library("matrixStats") 298s > library("stats") 298s > 298s > logSumExp_R <- function(lx, na.rm = FALSE) { 298s + log(sum(exp(lx), na.rm = na.rm)) 298s + } 298s > 298s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 298s > 298s > for (mode in c("integer", "double")) { 298s + cat("mode: ", mode, "\n", sep = "") 298s + 298s + set.seed(1) 298s + x <- runif(20, min = 1.0, max = 3.0) 298s + storage.mode(x) <- mode 298s + str(x) 298s + 298s + ## The logarithm of the harmonic mean 298s + y0 <- log(1 / mean(1 / x)) 298s + print(y0) ## -1.600885 298s + 298s + lx <- log(x) 298s + y1 <- log(length(x)) - logSumExp(-lx) 298s + print(y1) ## [1] -1.600885 298s + 298s + # Sanity check 298s + stopifnot(all.equal(y1, y0)) 298s + 298s + y2 <- log(length(x)) - logSumExp_R(-lx) 298s + # Sanity check 298s + stopifnot(all.equal(y2, y0)) 298s + } # for (mode ...) 298s mode: integer 298s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 298s [1] 0.3215836 298s [1] 0.3215836 298s mode: double 298s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 298s [1] 0.6673156 298s [1] 0.6673156 298s > 298s > 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > # Missing values 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > ## NA values 298s > lx <- c(1, 2, 3) 298s > lx[2] <- NA_real_ 298s > y0 <- logSumExp_R(lx, na.rm = FALSE) 298s > y <- logSumExp(lx, na.rm = FALSE) 298s > print(y) 298s [1] NA 298s > stopifnot(identical(y, NA_real_)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > y0 <- logSumExp_R(lx, na.rm = TRUE) 298s > y <- logSumExp(lx, na.rm = TRUE) 298s > print(y) 298s [1] 3.126928 298s > stopifnot(all.equal(y, y0)) 298s > 298s > ## NaN values 298s > lx <- c(1, 2, 3) 298s > lx[2] <- NaN 298s > y0 <- logSumExp_R(lx, na.rm = FALSE) 298s > y <- logSumExp(lx, na.rm = FALSE) 298s > print(y) 298s [1] NA 298s > stopifnot(identical(y, NA_real_)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > y0 <- logSumExp_R(lx, na.rm = TRUE) 298s > y <- logSumExp(lx, na.rm = TRUE) 298s > print(y) 298s [1] 3.126928 298s > stopifnot(all.equal(y, y0)) 298s > 298s > 298s > 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > # Corner cases 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > ## Zero-length vectors 298s > lx <- numeric(0L) 298s > y0 <- logSumExp_R(lx) 298s > y <- logSumExp(lx) 298s > print(y) 298s [1] -Inf 298s > stopifnot(identical(y, -Inf)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > ## Vectors of length one 298s > lx <- 1.0 298s > y0 <- logSumExp_R(lx) 298s > y <- logSumExp(lx) 298s > print(y) 298s [1] 1 298s > stopifnot(identical(y, lx)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > lx <- NA_real_ 298s > y0 <- logSumExp_R(lx, na.rm = TRUE) 298s > y <- logSumExp(lx, na.rm = TRUE) 298s > print(y) 298s [1] -Inf 298s > stopifnot(identical(y, -Inf)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > ## All missing values 298s > lx <- c(NA_real_, NA_real_) 298s > y0 <- logSumExp_R(lx, na.rm = TRUE) 298s > y <- logSumExp(lx, na.rm = TRUE) 298s > print(y) 298s [1] -Inf 298s > stopifnot(identical(y, -Inf)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > lx <- c(NA_real_, NA_real_) 298s > y0 <- logSumExp_R(lx, na.rm = FALSE) 298s > y <- logSumExp(lx, na.rm = FALSE) 298s > print(y) 298s [1] NA 298s > stopifnot(identical(y, NA_real_)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > 298s > ## +Inf values 298s > lx <- c(1, 2, +Inf) 298s > y0 <- logSumExp_R(lx) 298s > y <- logSumExp(lx) 298s > print(y) 298s [1] Inf 298s > stopifnot(identical(y, +Inf)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > ## First element is a missing value, cf. PR #33 298s > lx <- c(NA_real_, 1) 298s > y0 <- logSumExp_R(lx) 298s > print(y0) 298s [1] NA 298s > y <- logSumExp(lx, na.rm = FALSE) 298s > print(y) 298s [1] NA 298s > stopifnot(identical(y, NA_real_)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > y0 <- logSumExp_R(lx, na.rm = TRUE) 298s > print(y0) 298s [1] 1 298s > y <- logSumExp(lx, na.rm = TRUE) 298s > print(y) 298s [1] 1 298s > stopifnot(identical(y, 1)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > ## Multiple -Inf values, cf. issue #84 298s > lx <- c(-Inf, -Inf) 298s > y0 <- logSumExp_R(lx) 298s > y <- logSumExp(lx) 298s > print(y) 298s [1] -Inf 298s > stopifnot(identical(y, -Inf)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s > lx <- c(-Inf, 5, -Inf) 298s > y0 <- logSumExp_R(lx) 298s > y <- logSumExp(lx) 298s > print(y) 298s [1] 5 298s > stopifnot(identical(y, 5)) 298s > stopifnot(all.equal(y, y0)) 298s > 298s 298s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 298s Copyright (C) 2025 The R Foundation for Statistical Computing 298s Platform: powerpc64le-unknown-linux-gnu 298s 298s R is free software and comes with ABSOLUTELY NO WARRANTY. 298s You are welcome to redistribute it under certain conditions. 298s Type 'license()' or 'licence()' for distribution details. 298s 298s R is a collaborative project with many contributors. 298s Type 'contributors()' for more information and 298s 'citation()' on how to cite R or R packages in publications. 298s 298s Type 'demo()' for some demos, 'help()' for on-line help, or 298s 'help.start()' for an HTML browser interface to help. 298s Type 'q()' to quit R. 298s 298s > library("matrixStats") 298s > 298s > logSumExp_R <- function(lx, na.rm = FALSE) { 298s + log(sum(exp(lx), na.rm = na.rm)) 298s + } 298s > 298s > 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > # Subsetted tests 298s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 298s > source("utils/validateIndicesFramework.R") 298s > x <- runif(6, min = -6, max = 6) 298s > for (idxs in index_cases) { 298s + validateIndicesTestVector(x, idxs, 298s + ftest = logSumExp, fsure = logSumExp_R, 298s + na.rm = FALSE) 298s + validateIndicesTestVector(x, idxs, 298s + ftest = logSumExp, fsure = logSumExp_R, 298s + na.rm = TRUE) 298s + } 299s > 299s 299s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: powerpc64le-unknown-linux-gnu 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 299s > library("matrixStats") 299s > 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > # Consistency checks 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > set.seed(1) 299s > 299s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 299s + if (is.null(idxs)) { 299s + mean(x, na.rm = na.rm) 299s + } else { 299s + mean(x[idxs], na.rm = na.rm) 299s + } 299s + } # mean2_R() 299s > 299s > 299s > cat("Consistency checks:\n") 299s Consistency checks: 299s > for (kk in 1:20) { 299s + cat("Random test #", kk, "\n", sep = "") 299s + 299s + # Simulate data in a matrix of any shape 299s + n <- sample(100L, size = 1L) 299s + x <- rnorm(n, sd = 100) 299s + 299s + # Add NAs? 299s + if ((kk %% 4) %in% c(3, 0)) { 299s + cat("Adding NAs\n") 299s + nna <- sample(n, size = 1L) 299s + na_values <- c(NA_real_, NaN) 299s + t <- sample(na_values, size = nna, replace = TRUE) 299s + x[sample(length(x), size = nna)] <- t 299s + } 299s + 299s + # Integer or double? 299s + if ((kk %% 4) %in% c(2, 0)) { 299s + cat("Coercing to integers\n") 299s + storage.mode(x) <- "integer" 299s + } 299s + 299s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 299s + 299s + # Sum over all 299s + y0 <- mean2_R(x, na.rm = na.rm) 299s + y1 <- mean2(x, na.rm = na.rm) 299s + stopifnot(all.equal(y1, y0)) 299s + 299s + # Sum over subset 299s + nidxs <- sample(n, size = 1L) 299s + idxs <- sample(n, size = nidxs) 299s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 299s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 299s + stopifnot(all.equal(y1, y0)) 299s + 299s + if (storage.mode(x) == "integer") { 299s + storage.mode(x) <- "logical" 299s + 299s + y0 <- mean2_R(x, na.rm = na.rm) 299s + y1 <- mean2(x, na.rm = na.rm) 299s + stopifnot(all.equal(y1, y0)) 299s + 299s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 299s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 299s + stopifnot(all.equal(y1, y0)) 299s + } 299s + } # for (kk ...) 299s Random test #1 299s Random test #2 299s Coercing to integers 299s Random test #3 299s Adding NAs 299s Random test #4 299s Adding NAs 299s Coercing to integers 299s Random test #5 299s Random test #6 299s Coercing to integers 299s Random test #7 299s Adding NAs 299s Random test #8 299s Adding NAs 299s Coercing to integers 299s Random test #9 299s Random test #10 299s Coercing to integers 299s Random test #11 299s Adding NAs 299s Random test #12 299s Adding NAs 299s Coercing to integers 299s Random test #13 299s Random test #14 299s Coercing to integers 299s Random test #15 299s Adding NAs 299s Random test #16 299s Adding NAs 299s Coercing to integers 299s Random test #17 299s Random test #18 299s Coercing to integers 299s Random test #19 299s Adding NAs 299s Random test #20 299s Adding NAs 299s Coercing to integers 299s > 299s > 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > # Special cases 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > for (na.rm in c(FALSE, TRUE)) { 299s + # Averaging over zero elements (integers) 299s + x <- integer(0) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + x <- 1:5 299s + idxs <- integer(0) 299s + s1 <- mean(x[idxs], na.rm = na.rm) 299s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over NA_integer_:s 299s + x <- rep(NA_integer_, times = 5L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + x <- rep(NA_integer_, times = 5L) 299s + idxs <- 1:3 299s + s1 <- mean(x[idxs], na.rm = na.rm) 299s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + 299s + # Averaging over zero elements (doubles) 299s + x <- double(0) 299s + s1 <- mean(x) 299s + s2 <- mean2(x) 299s + stopifnot(identical(s1, s2)) 299s + 299s + x <- as.double(1:10) 299s + idxs <- integer(0) 299s + s1 <- mean(x[idxs]) 299s + s2 <- mean2(x, idxs = idxs) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over NA_real_:s 299s + x <- rep(NA_real_, times = 5L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + x <- rep(NA_real_, times = 5L) 299s + idxs <- 1:3 299s + s1 <- mean(x[idxs], na.rm = na.rm) 299s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over -Inf:s 299s + x <- rep(-Inf, times = 3L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over +Inf:s 299s + x <- rep(+Inf, times = 3L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over mix of -Inf:s and +Inf:s 299s + x <- rep(c(-Inf, +Inf), times = 3L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over mix of -Inf:s and +Inf:s and numerics 299s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + stopifnot(identical(s1, s2)) 299s + 299s + # Averaging over mix of NaN, NA, +Inf, and numerics 299s + x <- c(NaN, NA, +Inf, 3.14) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + if (na.rm) { 299s + stopifnot(identical(s2, s1)) 299s + } else { 299s + stopifnot(is.na(s1), is.na(s2)) 299s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 299s + ## returned here (as one would expect). NaN might very well be returned, 299s + ## when both NA and NaN are involved. This is an accepted feature in R, 299s + ## which is documented in help("is.nan"). See also 299s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 299s + ## Thus, we cannot guarantee that s1 is identical to s0. 299s + } 299s + 299s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 299s + x <- c(NA_real_, NaN, +Inf, 3.14) 299s + s1 <- mean(x, na.rm = na.rm) 299s + s2 <- mean2(x, na.rm = na.rm) 299s + if (na.rm) { 299s + stopifnot(identical(s2, s1)) 299s + } else { 299s + stopifnot(is.na(s1), is.na(s2)) 299s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 299s + ## returned here (as one would expect). NaN might very well be returned, 299s + ## when both NA and NaN are involved. This is an accepted feature in R, 299s + ## which is documented in help("is.nan"). See also 299s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 299s + ## Thus, we cannot guarantee that s1 is identical to s0. 299s + } 299s + } 299s > 299s > 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > # Argument 'idxs' 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > x <- 1:5 299s > idxs_list <- list( 299s + integer = 1:3, 299s + double = as.double(1:3), 299s + logical = (x <= 3) 299s + ) 299s > 299s > for (idxs in idxs_list) { 299s + cat("idxs:\n") 299s + str(idxs) 299s + s1 <- mean(x[idxs], na.rm = TRUE) 299s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 299s + stopifnot(identical(s1, s2)) 299s + } 299s idxs: 299s int [1:3] 1 2 3 299s idxs: 299s num [1:3] 1 2 3 299s idxs: 299s logi [1:5] TRUE TRUE TRUE FALSE FALSE 299s > 299s 299s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: powerpc64le-unknown-linux-gnu 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 299s > library("matrixStats") 299s > 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > # Subsetted tests 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > source("utils/validateIndicesFramework.R") 299s > x <- runif(6, min = -6, max = 6) 299s > storage.mode(x) <- "integer" 299s > for (idxs in index_cases) { 299s + validateIndicesTestVector(x, idxs, 299s + ftest = mean2, fsure = mean, 299s + na.rm = FALSE) 299s + validateIndicesTestVector(x, idxs, 299s + ftest = mean2, fsure = mean, 299s + na.rm = TRUE) 299s + } 299s > 299s 299s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: powerpc64le-unknown-linux-gnu 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 299s > library("matrixStats") 299s > 299s > for (mode in c("integer", "double")) { 299s + cat("mode: ", mode, "\n", sep = "") 299s + 299s + # Empty vector 299s + x <- 0 299s + storage.mode(x) <- mode 299s + y <- prod(x, na.rm = TRUE) 299s + print(y) 299s + z <- product(x, na.rm = TRUE) 299s + print(z) 299s + stopifnot(all.equal(z, y)) 299s + 299s + # Test negative values 299s + x <- c(1, -4, 2) 299s + storage.mode(x) <- mode 299s + y <- prod(x, na.rm = TRUE) 299s + print(y) 299s + z <- product(x, na.rm = TRUE) 299s + print(z) 299s + stopifnot(all.equal(z, y)) 299s + 299s + # Test missing values 299s + x <- c(1, NA, NaN, 2) 299s + storage.mode(x) <- mode 299s + y <- prod(x, na.rm = TRUE) 299s + print(y) 299s + z <- product(x, na.rm = TRUE) 299s + print(z) 299s + stopifnot(all.equal(z, y)) 299s + 299s + x <- c(1, NA, NaN, 2) 299s + storage.mode(x) <- mode 299s + y <- prod(x, na.rm = FALSE) 299s + print(y) 299s + z <- product(x, na.rm = FALSE) 299s + print(z) 299s + stopifnot(all(is.na(z), is.na(y))) 299s + 299s + x <- c(1, NaN, 2) 299s + storage.mode(x) <- mode 299s + y <- prod(x, na.rm = FALSE) 299s + print(y) 299s + stopifnot(is.na(y)) 299s + z <- product(x, na.rm = FALSE) 299s + print(z) 299s + stopifnot(is.na(z)) 299s + 299s + } # for (mode ...) 299s mode: integer 299s [1] 0 299s [1] 0 299s [1] -8 299s [1] -8 299s [1] 2 299s [1] 2 299s [1] NA 299s [1] NA 299s [1] NA 299s [1] NA 299s mode: double 299s [1] 0 299s [1] 0 299s [1] -8 299s [1] -8 299s [1] 2 299s [1] 2 299s [1] NA 299s [1] NA 299s [1] NaN 299s [1] NA 299s > 299s > 299s > # NAs following 0s 299s > x <- c(0L, NA_integer_) 299s > y <- prod(x, na.rm = FALSE) 299s > print(y) 299s [1] NA 299s > z <- product(x, na.rm = FALSE) 299s > print(z) 299s [1] NA 299s > stopifnot(identical(z, y)) 299s > 299s 299s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: powerpc64le-unknown-linux-gnu 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 299s > library("matrixStats") 299s > 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > # Subsetted tests 299s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 299s > source("utils/validateIndicesFramework.R") 299s > x <- runif(6, min = -6, max = 6) 299s > storage.mode(x) <- "integer" 299s > for (idxs in index_cases) { 299s + validateIndicesTestVector(x, idxs, 299s + ftest = product, fsure = prod, 299s + na.rm = TRUE) 299s + validateIndicesTestVector(x, idxs, 299s + ftest = product, fsure = prod, 299s + na.rm = FALSE) 299s + } 299s > 299s 299s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 299s Copyright (C) 2025 The R Foundation for Statistical Computing 299s Platform: powerpc64le-unknown-linux-gnu 299s 299s R is free software and comes with ABSOLUTELY NO WARRANTY. 299s You are welcome to redistribute it under certain conditions. 299s Type 'license()' or 'licence()' for distribution details. 299s 299s R is a collaborative project with many contributors. 299s Type 'contributors()' for more information and 299s 'citation()' on how to cite R or R packages in publications. 299s 299s Type 'demo()' for some demos, 'help()' for on-line help, or 299s 'help.start()' for an HTML browser interface to help. 299s Type 'q()' to quit R. 299s 300s > library("matrixStats") 300s > library("utils") ## utils::str 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Local functions 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > psortKM_R <- function(x, k, m) { 300s + x <- sort(x) 300s + x[(k - m + 1):k] 300s + } 300s > 300s > psortKM_R2 <- function(x, k, m) { 300s + partial <- (k - m + 1):k 300s + x <- sort.int(x, partial = partial) 300s + x[partial] 300s + } 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Consistency checks 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > set.seed(1) 300s > 300s > cat("Consistency checks:\n") 300s Consistency checks: 300s > x <- 1:30 300s > x[18:20] <- 20 300s > y <- sample(x) 300s > cat("x:\n") 300s x: 300s > str(x) 300s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 300s > cat("sample(x):\n") 300s sample(x): 300s > str(y) 300s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 300s > 300s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 300s + for (m in 1:min(5L, k)) { 300s + px0 <- psortKM_R(x, k = k, m = m) 300s + px0b <- psortKM_R2(x, k = k, m = m) 300s + stopifnot(identical(px0b, px0)) 300s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 300s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 300s + print(px1) 300s + stopifnot(identical(px1, px0)) 300s + 300s + py0 <- psortKM_R(y, k = k, m = m) 300s + py0b <- psortKM_R2(y, k = k, m = m) 300s + stopifnot(identical(py0b, py0)) 300s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 300s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 300s + print(py1) 300s + stopifnot(identical(py1, py0)) 300s + stopifnot(identical(py1, px1)) 300s + } # for (m ...) 300s + } # for (k ...) 300s .psortKM(x, k = 1, m = 1): 300s [1] 1 300s .psortKM(y, k = 1, m = 1): 300s [1] 1 300s .psortKM(x, k = 2, m = 1): 300s [1] 2 300s .psortKM(y, k = 2, m = 1): 300s [1] 2 300s .psortKM(x, k = 2, m = 2): 300s [1] 1 2 300s .psortKM(y, k = 2, m = 2): 300s [1] 1 2 300s .psortKM(x, k = 20, m = 1): 300s [1] 20 300s .psortKM(y, k = 20, m = 1): 300s [1] 20 300s .psortKM(x, k = 20, m = 2): 300s [1] 20 20 300s .psortKM(y, k = 20, m = 2): 300s [1] 20 20 300s .psortKM(x, k = 20, m = 3): 300s [1] 20 20 20 300s .psortKM(y, k = 20, m = 3): 300s [1] 20 20 20 300s .psortKM(x, k = 20, m = 4): 300s [1] 17 20 20 20 300s .psortKM(y, k = 20, m = 4): 300s [1] 17 20 20 20 300s .psortKM(x, k = 20, m = 5): 300s [1] 16 17 20 20 20 300s .psortKM(y, k = 20, m = 5): 300s [1] 16 17 20 20 20 300s .psortKM(x, k = 21, m = 1): 300s [1] 21 300s .psortKM(y, k = 21, m = 1): 300s [1] 21 300s .psortKM(x, k = 21, m = 2): 300s [1] 20 21 300s .psortKM(y, k = 21, m = 2): 300s [1] 20 21 300s .psortKM(x, k = 21, m = 3): 300s [1] 20 20 21 300s .psortKM(y, k = 21, m = 3): 300s [1] 20 20 21 300s .psortKM(x, k = 21, m = 4): 300s [1] 20 20 20 21 300s .psortKM(y, k = 21, m = 4): 300s [1] 20 20 20 21 300s .psortKM(x, k = 21, m = 5): 300s [1] 17 20 20 20 21 300s .psortKM(y, k = 21, m = 5): 300s [1] 17 20 20 20 21 300s .psortKM(x, k = 30, m = 1): 300s [1] 30 300s .psortKM(y, k = 30, m = 1): 300s [1] 30 300s .psortKM(x, k = 30, m = 2): 300s [1] 29 30 300s .psortKM(y, k = 30, m = 2): 300s [1] 29 30 300s .psortKM(x, k = 30, m = 3): 300s [1] 28 29 30 300s .psortKM(y, k = 30, m = 3): 300s [1] 28 29 30 300s .psortKM(x, k = 30, m = 4): 300s [1] 27 28 29 30 300s .psortKM(y, k = 30, m = 4): 300s [1] 27 28 29 30 300s .psortKM(x, k = 30, m = 5): 300s [1] 26 27 28 29 30 300s .psortKM(y, k = 30, m = 5): 300s [1] 26 27 28 29 30 300s > 300s 300s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 300s Copyright (C) 2025 The R Foundation for Statistical Computing 300s Platform: powerpc64le-unknown-linux-gnu 300s 300s R is free software and comes with ABSOLUTELY NO WARRANTY. 300s You are welcome to redistribute it under certain conditions. 300s Type 'license()' or 'licence()' for distribution details. 300s 300s R is a collaborative project with many contributors. 300s Type 'contributors()' for more information and 300s 'citation()' on how to cite R or R packages in publications. 300s 300s Type 'demo()' for some demos, 'help()' for on-line help, or 300s 'help.start()' for an HTML browser interface to help. 300s Type 'q()' to quit R. 300s 300s > library("matrixStats") 300s > 300s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 300s + if (is.na(value)) { 300s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 300s + } else { 300s + y <- x == value 300s + 300s + # Preserve dimnames attribute 300s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 300s + if (!isTRUE(all.equal(dim(y), dim))) { 300s + dim(y) <- dim 300s + dimnames(y) <- dimnames(x) 300s + } 300s + 300s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 300s + } 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 300s + if (is.na(value)) { 300s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 300s + } else { 300s + y <- x == value 300s + 300s + # Preserve dimnames attribute 300s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 300s + if (!isTRUE(all.equal(dim(y), dim))) { 300s + dim(y) <- dim 300s + dimnames(y) <- dimnames(x) 300s + } 300s + 300s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 300s + } 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 300s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Data type: logical 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 300s > x[7:8, 2:3] <- TRUE 300s > x[1:3, ] <- TRUE 300s > x[, 1] <- TRUE 300s > x[4, ] <- FALSE 300s > x[, 4] <- FALSE 300s > x[2, ] <- FALSE 300s > x[3, ] <- TRUE 300s > 300s > # To check names attribute 300s > dimnames <- list(letters[1:10], LETTERS[1:4]) 300s > 300s > for (kk in 1:3) { 300s + if (kk == 2) { 300s + x[2, 2] <- NA 300s + } else if (kk == 3) { 300s + x[, 2] <- NA 300s + x[2, ] <- NA 300s + } 300s + 300s + # Test with and without dimnames on x 300s + for (setDimnames in c(TRUE, FALSE)) { 300s + dimnames(x) <- if (setDimnames) dimnames else NULL 300s + 300s + for (na.rm in c(FALSE, TRUE)) { 300s + # Check names attribute 300s + for (useNames in c(TRUE, FALSE)) { 300s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 300s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 300s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 300s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 300s + stopifnot(identical(m1, m0)) 300s + stopifnot(identical(m2, m0)) 300s + 300s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 300s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 300s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 300s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 300s + stopifnot(identical(m1, m0)) 300s + stopifnot(identical(m2, m0)) 300s + 300s + m0 <- rowAnyMissings_R(x, useNames = useNames) 300s + m1 <- rowAnyMissings(x, useNames = useNames) 300s + m2 <- colAnyMissings(t(x), useNames = useNames) 300s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 300s + stopifnot(identical(m1, m0)) 300s + stopifnot(identical(m2, m0)) 300s + } 300s + } 300s + } 300s + } # for (kk ...) 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "any()" 300s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s List of 4 300s $ : chr "all()" 300s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 300s List of 4 300s $ : chr "any()" 300s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 300s List of 4 300s $ : chr "anyMissing()" 300s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Data type: integer 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 300s > x[2, ] <- 7L 300s > x[3, 1] <- 7L 300s > x[2:3, 3:4] <- NA_integer_ 300s > 300s > # To check names attribute 300s > dimnames <- list(letters[1:4], LETTERS[1:5]) 300s > 300s > # Row/column counts 300s > value <- 7L 300s > 300s > # Test with and without dimnames on x 300s > for (setDimnames in c(TRUE, FALSE)) { 300s + dimnames(x) <- if (setDimnames) dimnames else NULL 300s + for (na.rm in c(FALSE, TRUE)) { 300s + # Check names attribute 300s + for (useNames in c(TRUE, FALSE)) { 300s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 300s + stopifnot(identical(r1, r0)) 300s + stopifnot(identical(r2, r1)) 300s + if (!useNames && !setDimnames) { 300s + for (rr in seq_len(nrow(x))) { 300s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, r1[rr])) 300s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, r1[rr])) 300s + } 300s + } 300s + 300s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 300s + stopifnot(identical(r1, r0)) 300s + stopifnot(identical(r2, r1)) 300s + if (!useNames && !setDimnames) { 300s + for (rr in seq_len(nrow(x))) { 300s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, r1[rr])) 300s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, r1[rr])) 300s + } 300s + } 300s + } 300s + } 300s + } 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > x <- matrix(0, nrow = 4L, ncol = 5L) 300s > x[2:4, 2] <- (1:3) / 4 300s > x[2, 2:4] <- (1:3) / 4 300s > x[3:4, 3] <- (3:4) / 4 300s > x[3, 3:4] <- (3:4) / 4 300s > x[1:4, 5] <- (1:4) / 5 300s > x[4, 4] <- NA_real_ 300s > 300s > # To check names attribute 300s > dimnames <- list(letters[1:4], LETTERS[1:5]) 300s > 300s > for (value in c(TRUE, FALSE)) { 300s + for (na.rm in c(FALSE, TRUE)) { 300s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 300s + y <- rowAnys(x, na.rm = na.rm, value = value) 300s + stopifnot(identical(y, y0)) 300s + # Check names attribute 300s + dimnames(x) <- dimnames 300s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 300s + stopifnot(all.equal(y, y0)) 300s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 300s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 300s + stopifnot(all.equal(y, y0)) 300s + dimnames(x) <- NULL 300s + 300s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 300s + y <- colAnys(x, na.rm = na.rm, value = value) 300s + stopifnot(identical(y, y0)) 300s + # Check names attribute 300s + dimnames(x) <- dimnames 300s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 300s + stopifnot(all.equal(y, y0)) 300s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 300s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 300s + stopifnot(all.equal(y, y0)) 300s + dimnames(x) <- NULL 300s + 300s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 300s + y <- rowAlls(x, na.rm = na.rm, value = value) 300s + stopifnot(identical(y, y0)) 300s + # Check names attribute 300s + dimnames(x) <- dimnames 300s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 300s + stopifnot(all.equal(y, y0)) 300s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 300s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 300s + stopifnot(all.equal(y, y0)) 300s + dimnames(x) <- NULL 300s + 300s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 300s + y <- colAlls(x, na.rm = na.rm, value = value) 300s + stopifnot(identical(y, y0)) 300s + print(y0) 300s + # Check names attribute 300s + dimnames(x) <- dimnames 300s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 300s + stopifnot(all.equal(y, y0)) 300s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 300s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 300s + stopifnot(all.equal(y, y0)) 300s + dimnames(x) <- NULL 300s + } ## for (na.rm ...) 300s + } ## for(value ...) 300s [1] FALSE FALSE FALSE FALSE TRUE 300s [1] FALSE FALSE FALSE FALSE TRUE 300s [1] TRUE FALSE FALSE FALSE FALSE 300s [1] TRUE FALSE FALSE FALSE FALSE 300s > 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Data type: character (not sure if this should be supported) 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > all_R <- function(x, value = TRUE, ...) { 300s + if (is.na(value)) { 300s + all(is.na(x), ...) 300s + } else { 300s + all(x == value, ...) 300s + } 300s + } 300s > 300s > any_R <- function(x, value = TRUE, ...) { 300s + if (is.na(value)) { 300s + any(is.na(x), ...) 300s + } else { 300s + any(x == value, ...) 300s + } 300s + } 300s > 300s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 300s > x[2, ] <- "g" 300s > x[2:4, 3:4] <- NA_character_ 300s > 300s > # To check names attribute 300s > dimnames <- list(letters[1:10], LETTERS[1:5]) 300s > 300s > # Test with and without dimnames on x 300s > for (setDimnames in c(TRUE, FALSE)) { 300s + dimnames(x) <- if (setDimnames) dimnames else NULL 300s + 300s + # Row/column counts 300s + for (value in c("g", NA_character_)) { 300s + for (na.rm in c(FALSE, TRUE)) { 300s + # Check names attribute 300s + for (useNames in c(TRUE, FALSE)) { 300s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 300s + stopifnot(identical(r1, r0)) 300s + stopifnot(identical(r2, r1)) 300s + if (!useNames && !setDimnames) { 300s + for (rr in seq_len(nrow(x))) { 300s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 300s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, r1[rr])) 300s + stopifnot(identical(c, c0)) 300s + } 300s + } 300s + 300s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 300s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 300s + stopifnot(identical(r1, r0)) 300s + stopifnot(identical(r2, r1)) 300s + if (!useNames && !setDimnames) { 300s + for (rr in seq_len(nrow(x))) { 300s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 300s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 300s + stopifnot(identical(c, c0)) 300s + stopifnot(identical(c, r1[rr])) 300s + } 300s + } 300s + } 300s + } 300s + } 300s + } 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # NA 0 test 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > x <- matrix(0, nrow = 3L, ncol = 3L) 300s > x[1, ] <- c(NA_real_, NA_real_, 0) 300s > x[3, ] <- c(1, 0, 1) 300s > 300s > dimnames <- list(letters[1:3], LETTERS[1:3]) 300s > 300s > # Test with and without dimnames on x 300s > for (setDimnames in c(TRUE, FALSE)) { 300s + dimnames(x) <- if (setDimnames) dimnames else NULL 300s + # Check names attribute 300s + for (useNames in c(TRUE, FALSE)) { 300s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 300s + r1 <- rowAnys(x, value = 0, useNames = useNames) 300s + stopifnot(identical(r0, r1)) 300s + } 300s + } 300s > 300s 300s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 300s Copyright (C) 2025 The R Foundation for Statistical Computing 300s Platform: powerpc64le-unknown-linux-gnu 300s 300s R is free software and comes with ABSOLUTELY NO WARRANTY. 300s You are welcome to redistribute it under certain conditions. 300s Type 'license()' or 'licence()' for distribution details. 300s 300s R is a collaborative project with many contributors. 300s Type 'contributors()' for more information and 300s 'citation()' on how to cite R or R packages in publications. 300s 300s Type 'demo()' for some demos, 'help()' for on-line help, or 300s 'help.start()' for an HTML browser interface to help. 300s Type 'q()' to quit R. 300s 300s > library("matrixStats") 300s > 300s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 300s + if (is.na(value)) { 300s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 300s + } else { 300s + y <- x == value 300s + 300s + # Preserve dimnames attribute 300s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 300s + if (!isTRUE(all.equal(dim(y), dim))) { 300s + dim(y) <- dim 300s + dimnames(y) <- dimnames(x) 300s + } 300s + 300s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 300s + } 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 300s + if (is.na(value)) { 300s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 300s + } else { 300s + y <- x == value 300s + 300s + # Preserve dimnames attribute 300s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 300s + if (!isTRUE(all.equal(dim(y), dim))) { 300s + dim(y) <- dim 300s + dimnames(y) <- dimnames(x) 300s + } 300s + 300s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 300s + } 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 300s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 300s + if (!useNames) names(res) <- NULL 300s + res 300s + } 300s > 300s > 300s > all_R <- function(x, value = TRUE, ...) { 300s + if (is.na(value)) { 300s + all(is.na(x), ...) 300s + } else { 300s + all(x == value, ...) 300s + } 300s + } 300s > 300s > any_R <- function(x, value = TRUE, ...) { 300s + if (is.na(value)) { 300s + any(is.na(x), ...) 300s + } else { 300s + any(x == value, ...) 300s + } 300s + } 300s > 300s > 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > # Subsetted tests 300s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 300s > source("utils/validateIndicesFramework.R") 300s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 300s > storage.mode(x) <- "integer" 300s > x[2:3, ] <- NA_integer_ 300s > x[2, 1] <- 0L 300s > x[4:5, ] <- 0L 300s > x[4, 6] <- NA_integer_ 300s > 300s > # To check names attribute 300s > dimnames <- list(letters[1:6], LETTERS[1:6]) 300s > 300s > # Test with and without dimnames on x 300s > for (setDimnames in c(TRUE, FALSE)) { 300s + if (setDimnames) dimnames(x) <- dimnames 300s + else dimnames(x) <- NULL 300s + 300s + count <- 0L 300s + for (rows in index_cases) { 300s + for (cols in index_cases) { 300s + count <- count + 1L 300s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 300s + useNames <- c(TRUE, FALSE) 300s + useNames <- useNames[count %% length(useNames) + 1] 300s + 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAlls, fsure = rowAlls_R, 300s + value = 0, na.rm = TRUE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAlls, fsure = rowAlls_R, 300s + value = 0, na.rm = FALSE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAlls, fsure = rowAlls_R, 300s + value = NA_integer_, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAlls, fsure = rowAlls_R, 300s + value = 0, na.rm = TRUE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAlls, fsure = rowAlls_R, 300s + value = 0, na.rm = FALSE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAlls, fsure = rowAlls_R, 300s + value = NA_integer_, useNames = useNames) 300s + 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAnys, fsure = rowAnys_R, 300s + value = 0, na.rm = TRUE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAnys, fsure = rowAnys_R, 300s + value = 0, na.rm = FALSE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAnys, fsure = rowAnys_R, 300s + value = NA_integer_, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAnys, fsure = rowAnys_R, 300s + value = 0, na.rm = TRUE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAnys, fsure = rowAnys_R, 300s + value = 0, na.rm = FALSE, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAnys, fsure = rowAnys_R, 300s + value = NA_integer_, useNames = useNames) 300s + 300s + validateIndicesTestMatrix(x, rows, cols, 300s + ftest = rowAnyMissings, 300s + fsure = rowAnyMissings_R, useNames = useNames) 300s + validateIndicesTestMatrix(x, rows, cols, 300s + fcoltest = colAnyMissings, 300s + fsure = rowAnyMissings_R, useNames = useNames) 300s + } 300s + } 300s + } 302s > 302s > for (rr in seq_len(nrow(x))) { 302s + for (idxs in index_cases) { 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = allValue, fsure = all_R, 302s + value = 0, na.rm = TRUE) 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = allValue, fsure = all_R, 302s + value = 0, na.rm = FALSE) 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = allValue, fsure = all_R, 302s + value = NA_integer_) 302s + 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = anyValue, fsure = any_R, 302s + value = 0, na.rm = TRUE) 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = anyValue, fsure = any_R, 302s + value = 0, na.rm = FALSE) 302s + validateIndicesTestVector(x[rr, ], idxs, 302s + ftest = anyValue, fsure = any_R, 302s + value = NA_integer_) 302s + } 302s + } 302s > 302s > 302s > storage.mode(x) <- "character" 302s > # Test with and without dimnames on x 302s > for (setDimnames in c(TRUE, FALSE)) { 302s + if (setDimnames) dimnames(x) <- dimnames 302s + else dimnames(x) <- NULL 302s + for (rows in index_cases) { 302s + for (cols in index_cases) { 302s + # Check names attribute 302s + for (useNames in c(TRUE, FALSE)) { 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAlls, fsure = rowAlls_R, 302s + value = "0", na.rm = TRUE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAlls, fsure = rowAlls_R, 302s + value = "0", na.rm = FALSE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAlls, fsure = rowAlls_R, 302s + value = NA_character_, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAlls, fsure = rowAlls_R, 302s + value = "0", na.rm = TRUE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAlls, fsure = rowAlls_R, 302s + value = "0", na.rm = FALSE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAlls, fsure = rowAlls_R, 302s + value = NA_character_, useNames = useNames) 302s + 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAnys, fsure = rowAnys_R, 302s + value = "0", na.rm = TRUE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAnys, fsure = rowAnys_R, 302s + value = "0", na.rm = FALSE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAnys, fsure = rowAnys_R, 302s + value = NA_character_, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAnys, fsure = rowAnys_R, 302s + value = "0", na.rm = TRUE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAnys, fsure = rowAnys_R, 302s + value = "0", na.rm = FALSE, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAnys, fsure = rowAnys_R, 302s + value = NA_character_, useNames = useNames) 302s + 302s + validateIndicesTestMatrix(x, rows, cols, 302s + ftest = rowAnyMissings, 302s + fsure = rowAnyMissings_R, useNames = useNames) 302s + validateIndicesTestMatrix(x, rows, cols, 302s + fcoltest = colAnyMissings, 302s + fsure = rowAnyMissings_R, useNames = useNames) 302s + } 302s + } 302s + } 302s + } 306s > 306s > for (rr in seq_len(nrow(x))) { 306s + for (idxs in index_cases) { 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = allValue, fsure = all_R, 306s + value = "0", na.rm = TRUE) 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = allValue, fsure = all_R, 306s + value = "0", na.rm = FALSE) 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = allValue, fsure = all_R, 306s + value = NA_integer_) 306s + 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = anyValue, fsure = any_R, 306s + value = "0", na.rm = TRUE) 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = anyValue, fsure = any_R, 306s + value = "0", na.rm = FALSE) 306s + validateIndicesTestVector(x[rr, ], idxs, 306s + ftest = anyValue, fsure = any_R, 306s + value = NA_integer_) 306s + } 306s + } 306s > 306s 306s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 306s Copyright (C) 2025 The R Foundation for Statistical Computing 306s Platform: powerpc64le-unknown-linux-gnu 306s 306s R is free software and comes with ABSOLUTELY NO WARRANTY. 306s You are welcome to redistribute it under certain conditions. 306s Type 'license()' or 'licence()' for distribution details. 306s 306s R is a collaborative project with many contributors. 306s Type 'contributors()' for more information and 306s 'citation()' on how to cite R or R packages in publications. 306s 306s Type 'demo()' for some demos, 'help()' for on-line help, or 306s 'help.start()' for an HTML browser interface to help. 306s Type 'q()' to quit R. 306s 306s > library("matrixStats") 306s > 306s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 306s > rownames(X) <- LETTERS[1:nrow(X)] 306s > colnames(X) <- letters[1:ncol(X)] 306s > print(X) 306s a b c d e f 306s A 0.01025497 -0.6593715 1.0287515 0.8251938 -0.45447931 -0.72328523 306s B 0.40205859 0.3392334 -2.2127465 0.9370462 -0.60913550 0.30694072 306s C 0.95053458 0.3149597 -0.4597303 -0.6638242 -0.25172132 0.12700299 306s D 0.05908394 -1.2056169 -0.8748822 -0.6168038 -1.01107615 -0.52845144 306s E -0.03191306 0.3863861 0.9663769 0.5213049 1.00838850 1.18768806 306s F -1.51942322 2.5053741 0.3296145 2.5715243 -0.26380129 0.47233700 306s G 0.32843141 0.2560877 -1.0464909 -0.7715221 -0.87688468 -0.17963305 306s H -0.32823274 2.5861358 1.0430936 1.3319221 -0.35862212 0.39881971 306s I 1.52394422 -0.2979545 -0.7988760 0.3675855 -2.02027810 -0.83011575 306s J 0.58302347 -0.1175375 1.0983233 -0.5922336 0.08980061 -0.57924161 306s K -0.50640985 -0.3146129 0.7821323 0.5027618 0.21350098 -0.11374036 306s L -0.94705328 0.1899506 1.0091143 1.7328501 -1.46161424 1.41522768 306s M -0.31393763 0.2877288 -0.5938497 0.2780490 -1.44442125 -0.32095587 306s N -1.01604374 0.7668941 0.8466832 -1.8956374 0.72963788 -0.08633571 306s O -0.65026871 0.2321673 0.4641632 -1.4443066 0.56672960 1.21824437 306s P 2.12055101 0.4416810 -1.8625274 -0.7551623 0.21659158 0.18226401 306s Q -0.92435866 -0.4755094 0.2164567 1.4389228 -0.68169219 1.16675137 306s R -0.57375303 -0.7198568 -0.5087019 -0.1797252 -2.56664094 -0.39395620 306s S 0.08279251 -0.5355945 0.4938996 -0.6730173 -0.20305904 -1.30557032 306s T 0.74391399 0.1747715 -0.5991308 1.4209592 0.43947102 -0.05383183 306s > 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # Apply rowMeans() for 3 sets of 2 columns 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > nbr_of_sets <- 3L 306s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 306s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 306s > print(S) 306s s1 s2 s3 306s [1,] 1 3 5 306s [2,] 2 4 6 306s > 306s > Z <- rowAvgsPerColSet(X, S = S) 306s > print(Z) 306s s1 s2 s3 306s A -0.32455825 0.92697263 -0.58888227 306s B 0.37064598 -0.63785014 -0.15109739 306s C 0.63274714 -0.56177726 -0.06235916 306s D -0.57326647 -0.74584299 -0.76976379 306s E 0.17723654 0.74384091 1.09803828 306s F 0.49297544 1.45056937 0.10426786 306s G 0.29225957 -0.90900645 -0.52825886 306s H 1.12895152 1.18750780 0.02009880 306s I 0.61299487 -0.21564527 -1.42519693 306s J 0.23274300 0.25304485 -0.24472050 306s K -0.41051135 0.64244702 0.04988031 306s L -0.37855134 1.37098222 -0.02319328 306s M -0.01310441 -0.15790034 -0.88268856 306s N -0.12457482 -0.52447710 0.32165108 306s O -0.20905073 -0.49007171 0.89248698 306s P 1.28111598 -1.30884489 0.19942780 306s Q -0.69993401 0.82768975 0.24252959 306s R -0.64680492 -0.34421356 -1.48029857 306s S -0.22640099 -0.08955882 -0.75431468 306s T 0.45934275 0.41091422 0.19281959 306s > 306s > # Validation 306s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 306s + s3 = rowMeans(X[, 5:6])) 306s > stopifnot(identical(drop(Z), Z0)) 306s > 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # Apply colMeans() for 5 sets of 4 rows 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > nbr_of_sets <- 5L 306s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 306s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 306s > print(S) 306s s1 s2 s3 s4 s5 306s [1,] 1 5 9 13 17 306s [2,] 2 6 10 14 18 306s [3,] 3 7 11 15 19 306s [4,] 4 8 12 16 20 306s > 306s > Z <- colAvgsPerRowSet(X, S = S) 306s > print(Z) 306s a b c d e f 306s s1 0.35548302 -0.3026988 -0.62965188 0.1204030 -0.58160307 -0.20444824 306s s2 -0.38778440 1.4334959 0.32314852 0.9133073 -0.12272990 0.46980293 306s s3 0.16337614 -0.1350385 0.52267347 0.5027409 -0.79464769 -0.02696751 306s s4 0.03507523 0.4321178 -0.28638267 -0.9542643 0.01713445 0.24830420 306s s5 -0.16785130 -0.3890473 -0.09936908 0.5017849 -0.75298029 -0.14665174 306s > 306s > # Validation 306s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 306s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 306s + s5 = colMeans(X[17:20, ])) 306s > stopifnot(identical(drop(Z), Z0)) 306s > 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # When there is only one "complete" set 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > nbr_of_sets <- 1L 306s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 306s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 306s > print(S) 306s s1 306s [1,] 1 306s [2,] 2 306s [3,] 3 306s [4,] 4 306s [5,] 5 306s [6,] 6 306s > 306s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 306s > print(Z) 306s s1 306s A 0.004510703 306s B -0.139433848 306s C 0.002870238 306s D -0.696291084 306s E 0.673038575 306s F 0.682604223 306s G -0.381668582 306s H 0.778852708 306s I -0.342615776 306s J 0.080355783 306s K 0.093938661 306s L 0.323079200 306s M -0.351231105 306s N -0.109133611 306s O 0.064454850 306s P 0.057232966 306s Q 0.123428444 306s R -0.823772350 306s S -0.356758161 306s T 0.354358856 306s > 306s > Z0 <- rowMeans(X) 306s > stopifnot(identical(drop(Z), Z0)) 306s > 306s > 306s > nbr_of_sets <- 1L 306s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 306s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 306s > print(S) 306s s1 306s [1,] 1 306s [2,] 2 306s [3,] 3 306s [4,] 4 306s [5,] 5 306s [6,] 6 306s [7,] 7 306s [8,] 8 306s [9,] 9 306s [10,] 10 306s [11,] 11 306s [12,] 12 306s [13,] 13 306s [14,] 14 306s [15,] 15 306s [16,] 16 306s [17,] 17 306s [18,] 18 306s [19,] 19 306s [20,] 20 306s > 306s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 306s > print(Z) 306s a b c d e f 306s s1 -0.000340262 0.2077658 -0.03391633 0.2167944 -0.4469653 0.06800793 306s > 306s > Z0 <- colMeans(X) 306s > stopifnot(identical(drop(Z), Z0)) 306s > 306s > 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # Use weights 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > nbr_of_sets <- 3L 306s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 306s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 306s > print(S) 306s s1 s2 s3 306s [1,] 1 3 5 306s [2,] 2 4 6 306s > 306s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 306s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 306s > print(Z1) 306s s1 s2 s3 306s A -0.32455825 0.92697263 -0.58888227 306s B 0.37064598 -0.63785014 -0.15109739 306s C 0.63274714 -0.56177726 -0.06235916 306s D -0.57326647 -0.74584299 -0.76976379 306s E 0.17723654 0.74384091 1.09803828 306s F 0.49297544 1.45056937 0.10426786 306s G 0.29225957 -0.90900645 -0.52825886 306s H 1.12895152 1.18750780 0.02009880 306s I 0.61299487 -0.21564527 -1.42519693 306s J 0.23274300 0.25304485 -0.24472050 306s K -0.41051135 0.64244702 0.04988031 306s L -0.37855134 1.37098222 -0.02319328 306s M -0.01310441 -0.15790034 -0.88268856 306s N -0.12457482 -0.52447710 0.32165108 306s O -0.20905073 -0.49007171 0.89248698 306s P 1.28111598 -1.30884489 0.19942780 306s Q -0.69993401 0.82768975 0.24252959 306s R -0.64680492 -0.34421356 -1.48029857 306s S -0.22640099 -0.08955882 -0.75431468 306s T 0.45934275 0.41091422 0.19281959 306s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 306s > print(Z2) 306s a b c d e f 306s s1 0.2061568 -0.1600690 -0.5919975 0.881120 -0.5318074 -0.2081723 306s s2 0.5048093 -0.4453286 -0.6673063 -0.640314 -0.6313987 -0.2007242 306s s3 -0.7756681 1.4458801 0.6479957 1.546415 0.3722936 0.8300125 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # Result should always be a matrix, including when nrow(X) <= 1 306s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 306s > S <- matrix(1, nrow = 1L, ncol = 1L) 306s > Z1 <- rowAvgsPerColSet(X, S = S) 306s > stopifnot(is.matrix(Z1)) 306s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 306s > stopifnot(is.matrix(Z2)) 306s > 306s > 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > # Works with many, one or zero columns / rows 306s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 306s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 306s > S <- cbind(1:2, 3:4, 5:6) 306s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 306s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 306s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 306s + colSums2(X[S[,2], ,drop=FALSE]), 306s + colSums2(X[S[,3], ,drop=FALSE])) 306s > stopifnot(identical(Z2, Z2_ref)) 306s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 306s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 306s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 306s + colSums2(X[S[,2], ,drop=FALSE]), 306s + colSums2(X[S[,3], ,drop=FALSE])) 306s > stopifnot(identical(Z1, Z1_ref)) 306s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 306s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 306s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 306s > stopifnot(identical(Z0, unname(Z0_ref))) 306s > 306s > 306s > S <- rbind(1:4, 5:8) 306s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 306s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 306s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 306s + rowMeans2(X[,S[,2],drop=FALSE]), 306s + rowMeans2(X[,S[,3],drop=FALSE]), 306s + rowMeans2(X[,S[,4],drop=FALSE])) 306s > stopifnot(identical(Z2, Z2_ref)) 306s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 306s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 306s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 306s + rowMeans2(X[,S[,2],drop=FALSE]), 306s + rowMeans2(X[,S[,3],drop=FALSE]), 306s + rowMeans2(X[,S[,4],drop=FALSE])) 306s > stopifnot(identical(Z1, Z1_ref)) 306s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 306s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 306s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 306s > stopifnot(identical(Z0, Z0_ref)) 306s > 306s 306s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 306s Copyright (C) 2025 The R Foundation for Statistical Computing 306s Platform: powerpc64le-unknown-linux-gnu 306s 306s R is free software and comes with ABSOLUTELY NO WARRANTY. 306s You are welcome to redistribute it under certain conditions. 306s Type 'license()' or 'licence()' for distribution details. 306s 306s R is a collaborative project with many contributors. 306s Type 'contributors()' for more information and 306s 'citation()' on how to cite R or R packages in publications. 306s 306s Type 'demo()' for some demos, 'help()' for on-line help, or 306s 'help.start()' for an HTML browser interface to help. 306s Type 'q()' to quit R. 306s 307s > library("matrixStats") 307s > 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > # Subsetted tests 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > source("utils/validateIndicesFramework.R") 307s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 307s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 307s > for (rows in index_cases) { 307s + for (cols in index_cases) { 307s + if (is.null(rows)) { 307s + rows <- seq_len(nrow(x)) 307s + rows_finite <- rows 307s + } else { 307s + rows_finite <- rows[is.finite(rows)] 307s + } 307s + 307s + if (is.null(cols)) { 307s + cols <- seq_len(ncol(x)) 307s + cols_finite <- cols 307s + } else { 307s + cols_finite <- cols[is.finite(cols)] 307s + } 307s + 307s + suppressWarnings({ 307s + actual <- tryCatch({ 307s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 307s + FUN = rowMeans) 307s + }, error = function(c) "error") 307s + expect <- tryCatch({ 307s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 307s + }, error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(as.vector(actual), expect)) 307s + 307s + suppressWarnings({ 307s + actual <- tryCatch({ 307s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 307s + FUN = colMeans) 307s + }, error = function(c) "error") 307s + expect <- tryCatch({ 307s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 307s + }, error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(as.vector(actual), expect)) 307s + } 307s + } 307s > 307s 307s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 307s Copyright (C) 2025 The R Foundation for Statistical Computing 307s Platform: powerpc64le-unknown-linux-gnu 307s 307s R is free software and comes with ABSOLUTELY NO WARRANTY. 307s You are welcome to redistribute it under certain conditions. 307s Type 'license()' or 'licence()' for distribution details. 307s 307s R is a collaborative project with many contributors. 307s Type 'contributors()' for more information and 307s 'citation()' on how to cite R or R packages in publications. 307s 307s Type 'demo()' for some demos, 'help()' for on-line help, or 307s 'help.start()' for an HTML browser interface to help. 307s Type 'q()' to quit R. 307s 307s > library("matrixStats") 307s > 307s > x <- matrix(1:27, ncol = 3) 307s > 307s > # To check names attribute 307s > dimnames <- list(letters[1:9], LETTERS[1:3]) 307s > 307s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 307s + res <- x[, idxs] 307s + # Preserve names attribute? 307s + if (!useNames) names(res) <- NULL 307s + res 307s + } 307s > 307s > idxs <- 1L 307s > # Test with and without dimnames on x 307s > for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 307s + y <- rowCollapse(x, idxs, useNames = useNames) 307s + stopifnot(identical(y, y_truth)) 307s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 307s + stopifnot(identical(y2, y)) 307s + } 307s + } 307s > 307s > idxs <- 2L 307s > # Test with and without dimnames on x 307s > for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 307s + y <- rowCollapse(x, idxs, useNames = useNames) 307s + stopifnot(identical(y, y_truth)) 307s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 307s + stopifnot(identical(y2, y)) 307s + } 307s + } 307s > 307s > 307s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 307s + res <- c(x[1:5, 1], x[6:9, 3]) 307s + # Preserve names attribute? 307s + if (!useNames) names(res) <- NULL 307s + res 307s + } 307s > 307s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 307s > # Test with and without dimnames on x 307s > for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 307s + y <- rowCollapse(x, idxs, useNames = useNames) 307s + stopifnot(identical(y, y_truth)) 307s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 307s + stopifnot(identical(y2, y)) 307s + } 307s + } 307s > 307s > 307s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 307s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 307s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 307s + # Preserve names attribute? 307s + if (useNames) { 307s + names <- rownames(x) 307s + if (!is.null(names)) names(res) <- names 307s + } 307s + res 307s + } 307s > 307s > idxs <- 1:3 307s > # Test with and without dimnames on x 307s > for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 307s + y <- rowCollapse(x, idxs, useNames = useNames) 307s + stopifnot(identical(y, y_truth)) 307s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 307s + stopifnot(identical(y2, y)) 307s + } 307s + } 307s > 307s 307s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 307s Copyright (C) 2025 The R Foundation for Statistical Computing 307s Platform: powerpc64le-unknown-linux-gnu 307s 307s R is free software and comes with ABSOLUTELY NO WARRANTY. 307s You are welcome to redistribute it under certain conditions. 307s Type 'license()' or 'licence()' for distribution details. 307s 307s R is a collaborative project with many contributors. 307s Type 'contributors()' for more information and 307s 'citation()' on how to cite R or R packages in publications. 307s 307s Type 'demo()' for some demos, 'help()' for on-line help, or 307s 'help.start()' for an HTML browser interface to help. 307s Type 'q()' to quit R. 307s 307s > library("matrixStats") 307s > 307s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 307s + ans <- c() 307s + storage.mode(ans) <- storage.mode(x) 307s + for (ii in seq_len(length(idxs))) { 307s + ans[ii] <- x[ii, idxs[ii]] 307s + } 307s + 307s + # Preserve names attribute 307s + if (useNames) { 307s + names <- rownames(x) 307s + if (!is.null(names)) names(ans) <- names 307s + } 307s + 307s + ans 307s + } 307s > 307s > 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > # Subsetted tests 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > source("utils/validateIndicesFramework.R") 307s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 307s > storage.mode(x) <- "integer" 307s > 307s > # To check names attribute 307s > dimnames <- list(letters[1:6], LETTERS[1:6]) 307s > 307s > for (rows in index_cases) { 307s + if (is.null(rows)) rows <- seq_len(nrow(x)) 307s + 307s + for (idxs in list(2L, seq_len(6L))) { 307s + for (useNames in c(TRUE, FALSE)) { 307s + suppressWarnings({ 307s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 307s + error = function(c) "error") 307s + expect <- tryCatch({ 307s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 307s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 307s + }, error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(actual, expect)) 307s + 307s + suppressWarnings({ 307s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 307s + error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(actual, expect)) 307s + 307s + # Check names attribute 307s + dimnames(x) <- dimnames 307s + suppressWarnings({ 307s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 307s + error = function(c) "error") 307s + expect <- tryCatch({ 307s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 307s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 307s + }, error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(actual, expect)) 307s + 307s + suppressWarnings({ 307s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 307s + error = function(c) "error") 307s + }) 307s + stopifnot(all.equal(actual, expect)) 307s + 307s + dimnames(x) <- NULL 307s + } 307s + } 307s + } 307s > 307s 307s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 307s Copyright (C) 2025 The R Foundation for Statistical Computing 307s Platform: powerpc64le-unknown-linux-gnu 307s 307s R is free software and comes with ABSOLUTELY NO WARRANTY. 307s You are welcome to redistribute it under certain conditions. 307s Type 'license()' or 'licence()' for distribution details. 307s 307s R is a collaborative project with many contributors. 307s Type 'contributors()' for more information and 307s 'citation()' on how to cite R or R packages in publications. 307s 307s Type 'demo()' for some demos, 'help()' for on-line help, or 307s 'help.start()' for an HTML browser interface to help. 307s Type 'q()' to quit R. 307s 307s > library("matrixStats") 307s > 307s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 307s + if (is.na(value)) { 307s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 307s + sum(is.na(x)) 307s + ) 307s + } else { 307s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 307s + sum(x == value, na.rm = na.rm) 307s + ) 307s + } 307s + # Preserve names attribute 307s + names <- names(counts) 307s + counts <- as.integer(counts) 307s + if (useNames && !is.null(names)) names(counts) <- names 307s + counts 307s + } 307s > 307s > 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > # Data type: integer and numeric 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > for (mode in c("integer", "double")) { 307s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 307s + x[sample.int(length(x), size = 7L)] <- 0 307s + storage.mode(x) <- mode 307s + 307s + dimnames = list(letters[1:10], LETTERS[1:5]) 307s + 307s + # Test with and without dimnames on x 307s + for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + for (na.rm in c(FALSE, TRUE)) { 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + # Count zeros 307s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + 307s + # Count NAs 307s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + 307s + if (mode == "integer") { 307s + ux <- unique(as.vector(x)) 307s + r0 <- r1 <- r2 <- integer(nrow(x)) 307s + for (value in ux) { 307s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 307s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 307s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + } 307s + stopifnot(all(r0 == ncol(x))) 307s + } # if (mode == "integer") 307s + } # for (useNames ...) 307s + } # for (na.rm ...) 307s + } # for (setDimnames ...) 307s + } # for (mode ...) 307s > 307s > 307s > # All NAs 307s > na_list <- list(NA_integer_, NA_real_, NaN) 307s > for (na_value in na_list) { 307s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 307s + # Test with and without dimnames on x 307s + for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + for (na.rm in c(FALSE, TRUE)) { 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + 307s + # Count NAs 307s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 307s + stopifnot(all(r0 == ncol(x))) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + } 307s + } 307s + } 307s + } # for (na_value ...) 307s > 307s > 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > # Data type: logical 307s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 307s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 307s > x[7:8, 2:3] <- TRUE 307s > x[1:3, ] <- TRUE 307s > x[, 1] <- TRUE 307s > x[4, ] <- FALSE 307s > x[, 4] <- FALSE 307s > x[2, ] <- FALSE 307s > x[3, ] <- TRUE 307s > 307s > # To check names attribute 307s > dimnames <- list(letters[1:10], LETTERS[1:4]) 307s > 307s > # Test with and without dimnames on x 307s > for (setDimnames in c(TRUE, FALSE)) { 307s + if (setDimnames) dimnames(x) <- dimnames 307s + else dimnames(x) <- NULL 307s + # Row/column counts 307s + for (na.rm in c(FALSE, TRUE)) { 307s + # Check names attribute 307s + for (useNames in c(TRUE, FALSE)) { 307s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + 307s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 307s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 307s + stopifnot(r_true + r_false == ncol(x)) 307s + 307s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 307s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 307s + stopifnot(c_true + c_false == nrow(x)) 307s + 307s + # Count NAs 307s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 307s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 307s + stopifnot(identical(r1, r0)) 307s + stopifnot(identical(r2, r0)) 307s + } 307s + } 307s + } 308s > 308s > 308s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 308s > # Data type: character (not sure if this should be supported) 308s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 308s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 308s > x[2:3, 3:4] <- NA_character_ 308s > 308s > # Row/column counts 308s > for (na.rm in c(FALSE, TRUE)) { 308s + for (value in c("g", NA_character_)) { 308s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 308s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 308s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 308s + stopifnot(identical(r1, r0)) 308s + stopifnot(identical(r2, r0)) 308s + 308s + c <- count(x[1, ], value = value, na.rm = na.rm) 308s + stopifnot(identical(c, r1[1])) 308s + 308s + c <- count(x[2, ], value = value, na.rm = na.rm) 308s + stopifnot(identical(c, r1[2])) 308s + } 308s + } 308s > 308s > # NA row 308s > x <- matrix(0, nrow = 2L, ncol = 2L) 308s > x[1, ] <- NA_integer_ 308s > 308s > dimnames <- list(letters[1:2], LETTERS[1:2]) 308s > 308s > # Test with and without dimnames on x 308s > for (setDimnames in c(TRUE, FALSE)) { 308s + if (setDimnames) dimnames(x) <- dimnames 308s + else dimnames(x) <- NULL 308s + # Check names attribute 308s + for (useNames in c(TRUE, FALSE)) { 308s + r0 <- rowCounts(x, value = 0, useNames = useNames) 308s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 308s + stopifnot(identical(r0, r1)) 308s + } 308s + } 308s > 308s 308s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 308s Copyright (C) 2025 The R Foundation for Statistical Computing 308s Platform: powerpc64le-unknown-linux-gnu 308s 308s R is free software and comes with ABSOLUTELY NO WARRANTY. 308s You are welcome to redistribute it under certain conditions. 308s Type 'license()' or 'licence()' for distribution details. 308s 308s R is a collaborative project with many contributors. 308s Type 'contributors()' for more information and 308s 'citation()' on how to cite R or R packages in publications. 308s 308s Type 'demo()' for some demos, 'help()' for on-line help, or 308s 'help.start()' for an HTML browser interface to help. 308s Type 'q()' to quit R. 308s 308s > library("matrixStats") 308s > 308s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 308s + if (is.na(value)) { 308s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 308s + sum(is.na(x)) 308s + ) 308s + } else { 308s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 308s + sum(x == value, na.rm = na.rm) 308s + ) 308s + } 308s + # Preserve names attribute 308s + names <- names(counts) 308s + counts <- as.integer(counts) 308s + if (useNames && !is.null(names)) names(counts) <- names 308s + counts 308s + } # rowCounts_R() 308s > 308s > 308s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 308s > # Subsetted tests 308s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 308s > source("utils/validateIndicesFramework.R") 308s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 308s > x[2:3, 3:4] <- NA_real_ 308s > storage.mode(x) <- "integer" 308s > 308s > # To check names attribute 308s > dimnames <- list(letters[1:6], LETTERS[1:6]) 308s > 308s > # Test with and without dimnames on x 308s > for (setDimnames in c(TRUE, FALSE)) { 308s + if (setDimnames) dimnames(x) <- dimnames 308s + else dimnames(x) <- NULL 308s + for (rows in index_cases) { 308s + for (cols in index_cases) { 308s + # Check names attribute 308s + for (useNames in c(TRUE, FALSE)) { 308s + validateIndicesTestMatrix(x, rows, cols, 308s + ftest = rowCounts, fsure = rowCounts_R, 308s + value = 0, na.rm = TRUE, useNames = useNames) 308s + validateIndicesTestMatrix(x, rows, cols, 308s + fcoltest = colCounts, fsure = rowCounts_R, 308s + value = 0, na.rm = TRUE, useNames = useNames) 308s + for (value in c(0, NA_integer_)) { 308s + validateIndicesTestMatrix(x, rows, cols, 308s + ftest = rowCounts, fsure = rowCounts_R, 308s + value = value, useNames = useNames) 308s + validateIndicesTestMatrix(x, rows, cols, 308s + fcoltest = colCounts, fsure = rowCounts_R, 308s + value = value, useNames = useNames) 308s + } 308s + } 308s + } 308s + } 308s + } 309s > 309s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 309s > x[2:3, 3:4] <- NA_character_ 309s > # Test with and without dimnames on x 309s > for (setDimnames in c(TRUE, FALSE)) { 309s + if (setDimnames) dimnames(x) <- dimnames 309s + else dimnames(x) <- NULL 309s + 309s + count <- 0L 309s + for (rows in index_cases) { 309s + for (cols in index_cases) { 309s + count <- count + 1L 309s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 309s + useNames <- c(TRUE, FALSE) 309s + useNames <- useNames[count %% length(useNames) + 1] 309s + 309s + validateIndicesTestMatrix(x, rows, cols, 309s + ftest = rowCounts, fsure = rowCounts_R, 309s + value = "g", na.rm = TRUE, useNames = useNames) 309s + validateIndicesTestMatrix(x, rows, cols, 309s + fcoltest = colCounts, fsure = rowCounts_R, 309s + value = "g", na.rm = TRUE, useNames = useNames) 309s + for (value in c("g", NA_character_)) { 309s + validateIndicesTestMatrix(x, rows, cols, 309s + ftest = rowCounts, fsure = rowCounts_R, 309s + value = value, useNames = useNames) 309s + validateIndicesTestMatrix(x, rows, cols, 309s + fcoltest = colCounts, fsure = rowCounts_R, 309s + value = value, useNames = useNames) 309s + } 309s + } 309s + } 309s + } 310s > 310s 310s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 310s Copyright (C) 2025 The R Foundation for Statistical Computing 310s Platform: powerpc64le-unknown-linux-gnu 310s 310s R is free software and comes with ABSOLUTELY NO WARRANTY. 310s You are welcome to redistribute it under certain conditions. 310s Type 'license()' or 'licence()' for distribution details. 310s 310s R is a collaborative project with many contributors. 310s Type 'contributors()' for more information and 310s 'citation()' on how to cite R or R packages in publications. 310s 310s Type 'demo()' for some demos, 'help()' for on-line help, or 310s 'help.start()' for an HTML browser interface to help. 310s Type 'q()' to quit R. 310s 310s > library("matrixStats") 310s > 310s > rowCummins_R <- function(x, ..., useNames = TRUE) { 310s + suppressWarnings({ 310s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 310s + }) 310s + 310s + # Preserve dimnames attribute? 310s + dim(y) <- dim(x) 310s + dimnames(y) <- if (useNames) dimnames(x) else NULL 310s + y 310s + } 310s > 310s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 310s + mode <- storage.mode(x) 310s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 310s + storage.mode(x) <- "numeric" 310s + suppressWarnings({ 310s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 310s + }) 310s + 310s + # Preserve dimnames attribute? 310s + dim(y) <- dim(x) 310s + dimnames(y) <- if (useNames) dimnames(x) else NULL 310s + 310s + y 310s + } 310s > 310s > 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > # With and without some NAs 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > for (mode in c("logical", "integer", "double")) { 310s + for (add_na in c(FALSE, TRUE)) { 310s + cat("add_na = ", add_na, "\n", sep = "") 310s + 310s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 310s + diag(x) <- 0 310s + if (add_na) { 310s + x[3:7, c(2, 4)] <- NA_real_ 310s + } 310s + cat("mode: ", mode, "\n", sep = "") 310s + storage.mode(x) <- mode 310s + str(x) 310s + 310s + # To check dimnames attribute 310s + dimnames <- list(letters[1:10], LETTERS[1:5]) 310s + 310s + # Test with and without dimnames on x 310s + for (setDimnames in c(TRUE, FALSE)) { 310s + if (setDimnames) dimnames(x) <- dimnames 310s + else dimnames(x) <- NULL 310s + # Check names attribute 310s + for (useNames in c(TRUE, FALSE)) { 310s + # Row/column ranges 310s + r0 <- rowCummins_R(x, useNames = useNames) 310s + r1 <- rowCummins(x, useNames = useNames) 310s + r2 <- t(colCummins(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + 310s + r0 <- rowCummaxs_R(x, useNames = useNames) 310s + r1 <- rowCummaxs(x, useNames = useNames) 310s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + } # for (useNames ...) 310s + } # for (setDimnames ...) 310s + } # for (add_na ...) 310s + } # for (mode ...) 310s add_na = FALSE 310s mode: logical 310s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 310s add_na = TRUE 310s mode: logical 310s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 310s add_na = FALSE 310s mode: integer 310s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 310s add_na = TRUE 310s mode: integer 310s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 310s add_na = FALSE 310s mode: double 310s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 310s add_na = TRUE 310s mode: double 310s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 310s > 310s > 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > # All NAs 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > for (mode in c("logical", "integer", "double")) { 310s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 310s + cat("mode: ", mode, "\n", sep = "") 310s + storage.mode(x) <- mode 310s + str(x) 310s + 310s + # Test with and without dimnames on x 310s + for (setDimnames in c(TRUE, FALSE)) { 310s + if (setDimnames) dimnames(x) <- dimnames 310s + else dimnames(x) <- NULL 310s + # Check names attribute 310s + for (useNames in c(TRUE, FALSE)) { 310s + r0 <- rowCummins_R(x, useNames = useNames) 310s + r1 <- rowCummins(x, useNames = useNames) 310s + r2 <- t(colCummins(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + 310s + r0 <- rowCummaxs_R(x, useNames = useNames) 310s + r1 <- rowCummaxs(x, useNames = useNames) 310s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + } # for (useNames ...) 310s + } # for (setDimnames ...) 310s + } # for (mode ...) 310s mode: logical 310s logi [1:10, 1:5] NA NA NA NA NA NA ... 310s mode: integer 310s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 310s mode: double 310s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 310s > 310s > 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > # A 1x1 matrix 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > for (mode in c("logical", "integer", "double")) { 310s + x <- matrix(0, nrow = 1L, ncol = 1L) 310s + cat("mode: ", mode, "\n", sep = "") 310s + storage.mode(x) <- mode 310s + str(x) 310s + 310s + # To check dimnames attribute 310s + dimnames <- list("a", "A") 310s + 310s + # Test with and without dimnames on x 310s + for (setDimnames in c(TRUE, FALSE)) { 310s + if (setDimnames) dimnames(x) <- dimnames 310s + else dimnames(x) <- NULL 310s + # Check names attribute 310s + for (useNames in c(TRUE, FALSE)) { 310s + r0 <- rowCummins_R(x, useNames = useNames) 310s + r1 <- rowCummins(x, useNames = useNames) 310s + r2 <- t(colCummins(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + 310s + r0 <- rowCummaxs_R(x, useNames = useNames) 310s + r1 <- rowCummaxs(x, useNames = useNames) 310s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + } # for (useNames ...) 310s + } # for (setDimnames ...) 310s + } # for (mode ...) 310s mode: logical 310s logi [1, 1] FALSE 310s mode: integer 310s int [1, 1] 0 310s mode: double 310s num [1, 1] 0 310s > 310s > 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > # Corner cases 310s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 310s > for (mode in c("logical", "integer", "double")) { 310s + cat("mode: ", mode, "\n", sep = "") 310s + value <- 0 310s + storage.mode(value) <- mode 310s + value0 <- if (mode == "logical") 0L else value 310s + 310s + # A 0x0 matrix 310s + x <- matrix(value, nrow = 0L, ncol = 0L) 310s + str(x) 310s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 310s + r1 <- rowCummins(x) 310s + r2 <- t(colCummins(t(x))) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + 310s + # A 0xK matrix 310s + x <- matrix(value, nrow = 0L, ncol = 5L) 310s + str(x) 310s + colnames <- LETTERS[1:5] 310s + # Test with and without dimnames on x 310s + for (setDimnames in c(TRUE, FALSE)) { 310s + if (setDimnames) colnames(x) <- colnames 310s + else dimnames(x) <- NULL 310s + # Check names attribute 310s + for (useNames in c(TRUE, FALSE)) { 310s + r0 <- rowCummins_R(x, useNames = useNames) 310s + r1 <- rowCummins(x, useNames = useNames) 310s + r2 <- t(colCummins(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + r0 <- rowCummaxs_R(x, useNames = useNames) 310s + r1 <- rowCummaxs(x, useNames = useNames) 310s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + } # for (useNames ...) 310s + } # for (setDimnames ...) 310s + 310s + # A Nx0 matrix 310s + x <- matrix(value, nrow = 5L, ncol = 0L) 310s + str(x) 310s + rownames <- LETTERS[1:5] 310s + # Test with and without dimnames on x 310s + for (setDimnames in c(TRUE, FALSE)) { 310s + if (setDimnames) rownames(x) <- rownames 310s + else dimnames(x) <- NULL 310s + # Check names attribute 310s + for (useNames in c(TRUE, FALSE)) { 310s + r0 <- rowCummins_R(x, useNames = useNames) 310s + r1 <- rowCummins(x, useNames = useNames) 310s + r2 <- t(colCummins(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 310s + stopifnot(all.equal(r2, r0)) 310s + 310s + r0 <- rowCummaxs_R(x, useNames = useNames) 310s + r1 <- rowCummaxs(x, useNames = useNames) 310s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 310s + stopifnot(all.equal(r1, r2)) 310s + stopifnot(all.equal(r1, r0)) 311s + stopifnot(all.equal(r2, r0)) 311s + } # for (useNames ...) 311s + } # for (setDimnames ...) 311s + } # for (mode ...) 311s mode: logical 311s logi[0 , 0 ] 311s logi[0 , 1:5] 311s logi[1:5, 0 ] 311s mode: integer 311s int[0 , 0 ] 311s int[0 , 1:5] 311s int[1:5, 0 ] 311s mode: double 311s num[0 , 0 ] 311s num[0 , 1:5] 311s num[1:5, 0 ] 311s > 311s 311s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 311s Copyright (C) 2025 The R Foundation for Statistical Computing 311s Platform: powerpc64le-unknown-linux-gnu 311s 311s R is free software and comes with ABSOLUTELY NO WARRANTY. 311s You are welcome to redistribute it under certain conditions. 311s Type 'license()' or 'licence()' for distribution details. 311s 311s R is a collaborative project with many contributors. 311s Type 'contributors()' for more information and 311s 'citation()' on how to cite R or R packages in publications. 311s 311s Type 'demo()' for some demos, 'help()' for on-line help, or 311s 'help.start()' for an HTML browser interface to help. 311s Type 'q()' to quit R. 311s 311s > library("matrixStats") 311s > 311s > rowCummins_R <- function(x, ..., useNames = TRUE) { 311s + suppressWarnings({ 311s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 311s + }) 311s + 311s + # Preserve dimnames attribute? 311s + dim(y) <- dim(x) 311s + dimnames(y) <- if (useNames) dimnames(x) else NULL 311s + 311s + y 311s + } 311s > 311s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 311s + mode <- storage.mode(x) 311s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 311s + storage.mode(x) <- "numeric" 311s + suppressWarnings({ 311s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 311s + }) 311s + 311s + # Preserve dimnames attribute? 311s + dim(y) <- dim(x) 311s + dimnames(y) <- if (useNames) dimnames(x) else NULL 311s + 311s + storage.mode(y) <- mode 311s + y 311s + } 311s > 311s > 311s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 311s > # Subsetted tests 311s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 311s > source("utils/validateIndicesFramework.R") 311s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 311s > storage.mode(x) <- "integer" 311s > 311s > # To check dimnames attribute 311s > dimnames <- list(letters[1:6], LETTERS[1:6]) 311s > 311s > # Test with and without dimnames on x 311s > for (setDimnames in c(TRUE, FALSE)) { 311s + if (setDimnames) dimnames(x) <- dimnames 311s + else dimnames(x) <- NULL 311s + for (rows in index_cases) { 311s + for (cols in index_cases) { 311s + # Check names attribute 311s + for (useNames in c(TRUE, FALSE)) { 311s + validateIndicesTestMatrix(x, rows, cols, 311s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 311s + validateIndicesTestMatrix(x, rows, cols, 311s + ftest = function(x, rows, cols, ..., useNames) { 311s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 311s + }, fsure = rowCummins_R, useNames = useNames) 311s + 311s + validateIndicesTestMatrix(x, rows, cols, 311s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 311s + validateIndicesTestMatrix(x, rows, cols, 311s + ftest = function(x, rows, cols, ..., useNames) { 311s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 311s + }, fsure = rowCummaxs_R, useNames = useNames) 311s + } 311s + } 311s + } 311s + } 313s > 313s 313s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 313s Copyright (C) 2025 The R Foundation for Statistical Computing 313s Platform: powerpc64le-unknown-linux-gnu 313s 313s R is free software and comes with ABSOLUTELY NO WARRANTY. 313s You are welcome to redistribute it under certain conditions. 313s Type 'license()' or 'licence()' for distribution details. 313s 313s R is a collaborative project with many contributors. 313s Type 'contributors()' for more information and 313s 'citation()' on how to cite R or R packages in publications. 313s 313s Type 'demo()' for some demos, 'help()' for on-line help, or 313s 'help.start()' for an HTML browser interface to help. 313s Type 'q()' to quit R. 313s 313s > library("matrixStats") 313s > 313s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 313s + suppressWarnings({ 313s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 313s + }) 313s + 313s + # Preserve dimnames attribute? 313s + dim(y) <- dim(x) 313s + dimnames(y) <- if (useNames) dimnames(x) else NULL 313s + 313s + y 313s + } 313s > 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # With and without some NAs 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > for (mode in c("logical", "integer", "double")) { 313s + for (add_na in c(FALSE, TRUE)) { 313s + cat("add_na = ", add_na, "\n", sep = "") 313s + 313s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 313s + if (add_na) { 313s + x[3:7, c(2, 4)] <- NA_real_ 313s + } 313s + cat("mode: ", mode, "\n", sep = "") 313s + storage.mode(x) <- mode 313s + str(x) 313s + 313s + # To check dimnames attribute 313s + dimnames <- list(letters[1:10], LETTERS[1:5]) 313s + 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) dimnames(x) <- dimnames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + # Row/column ranges 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(colCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + } # for (add_na ...) 313s + } # for (mode ...) 313s add_na = FALSE 313s mode: logical 313s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 313s add_na = TRUE 313s mode: logical 313s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 313s add_na = FALSE 313s mode: integer 313s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 313s add_na = TRUE 313s mode: integer 313s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 313s add_na = FALSE 313s mode: double 313s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 313s add_na = TRUE 313s mode: double 313s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 313s > 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # All NAs 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > for (mode in c("logical", "integer", "double")) { 313s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 313s + cat("mode: ", mode, "\n", sep = "") 313s + storage.mode(x) <- mode 313s + str(x) 313s + 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) dimnames(x) <- dimnames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + # Row/column ranges 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(colCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + } # for (mode ...) 313s mode: logical 313s logi [1:10, 1:5] NA NA NA NA NA NA ... 313s mode: integer 313s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 313s mode: double 313s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 313s > 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # A 1x1 matrix 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > for (mode in c("logical", "integer", "double")) { 313s + x <- matrix(0, nrow = 1L, ncol = 1L) 313s + cat("mode: ", mode, "\n", sep = "") 313s + storage.mode(x) <- mode 313s + str(x) 313s + 313s + dimnames <- list("a", "A") 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) dimnames(x) <- dimnames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + # Row/column ranges 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(colCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + } 313s mode: logical 313s logi [1, 1] FALSE 313s mode: integer 313s int [1, 1] 0 313s mode: double 313s num [1, 1] 0 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > for (mode in c("logical", "integer", "double")) { 313s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 313s + x[1, 2] <- 0 313s + x[2, 2] <- 1 313s + x[3, 1] <- 0 313s + storage.mode(x) <- mode 313s + cat("mode: ", mode, "\n", sep = "") 313s + str(x) 313s + 313s + dimnames <- list(letters[1:3], LETTERS[1:2]) 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) dimnames(x) <- dimnames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + # Row/column ranges 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(colCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + } 313s mode: logical 313s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 313s mode: integer 313s int [1:3, 1:2] NA NA 0 0 1 NA 313s mode: double 313s num [1:3, 1:2] NA NA 0 0 1 NA 313s > 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # Corner cases 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > for (mode in c("logical", "integer", "double")) { 313s + cat("mode: ", mode, "\n", sep = "") 313s + value <- 0 313s + storage.mode(value) <- mode 313s + if (mode == "logical") value2 <- 0L 313s + 313s + # A 0x0 matrix 313s + x <- matrix(value, nrow = 0L, ncol = 0L) 313s + str(x) 313s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 313s + r1 <- rowCumprods(x) 313s + r2 <- t(colCumprods(t(x))) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + 313s + # A 0xK matrix 313s + x <- matrix(value, nrow = 0L, ncol = 5L) 313s + str(x) 313s + colnames <- LETTERS[1:5] 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) colnames(x) <- colnames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + 313s + # A Nx0 matrix 313s + x <- matrix(value, nrow = 5L, ncol = 0L) 313s + str(x) 313s + rownames <- LETTERS[1:5] 313s + # Test with and without dimnames on x 313s + for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) rownames(x) <- rownames 313s + else dimnames(x) <- NULL 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + r0 <- rowCumprods_R(x, useNames = useNames) 313s + r1 <- rowCumprods(x, useNames = useNames) 313s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 313s + stopifnot(all.equal(r1, r2)) 313s + stopifnot(all.equal(r1, r0)) 313s + stopifnot(all.equal(r2, r0)) 313s + } # for (useNames ...) 313s + } # for (setDimnames ...) 313s + } # for (mode ...) 313s mode: logical 313s logi[0 , 0 ] 313s logi[0 , 1:5] 313s logi[1:5, 0 ] 313s mode: integer 313s int[0 , 0 ] 313s int[0 , 1:5] 313s int[1:5, 0 ] 313s mode: double 313s num[0 , 0 ] 313s num[0 , 1:5] 313s num[1:5, 0 ] 313s > 313s 313s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 313s Copyright (C) 2025 The R Foundation for Statistical Computing 313s Platform: powerpc64le-unknown-linux-gnu 313s 313s R is free software and comes with ABSOLUTELY NO WARRANTY. 313s You are welcome to redistribute it under certain conditions. 313s Type 'license()' or 'licence()' for distribution details. 313s 313s R is a collaborative project with many contributors. 313s Type 'contributors()' for more information and 313s 'citation()' on how to cite R or R packages in publications. 313s 313s Type 'demo()' for some demos, 'help()' for on-line help, or 313s 'help.start()' for an HTML browser interface to help. 313s Type 'q()' to quit R. 313s 313s > library("matrixStats") 313s > 313s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 313s + suppressWarnings({ 313s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 313s + }) 313s + 313s + # Preserve dimnames attribute? 313s + dim(y) <- dim(x) 313s + dimnames(y) <- if (useNames) dimnames(x) else NULL 313s + 313s + y 313s + } 313s > 313s > 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > # Subsetted tests 313s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 313s > source("utils/validateIndicesFramework.R") 313s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 313s > storage.mode(x) <- "integer" 313s > 313s > # To check dimnames attribute 313s > dimnames <- list(letters[1:6], LETTERS[1:6]) 313s > 313s > # Test with and without dimnames on x 313s > for (setDimnames in c(TRUE, FALSE)) { 313s + if (setDimnames) dimnames(x) <- dimnames 313s + else dimnames(x) <- NULL 313s + for (rows in index_cases) { 313s + for (cols in index_cases) { 313s + # Check names attribute 313s + for (useNames in c(TRUE, FALSE)) { 313s + validateIndicesTestMatrix(x, rows, cols, 313s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 313s + validateIndicesTestMatrix(x, rows, cols, 313s + ftest = function(x, rows, cols, ..., useNames) { 313s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 313s + }, fsure = rowCumprods_R, useNames = useNames) 313s + } 313s + } 313s + } 313s + } 314s > 314s 314s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 314s Copyright (C) 2025 The R Foundation for Statistical Computing 314s Platform: powerpc64le-unknown-linux-gnu 314s 314s R is free software and comes with ABSOLUTELY NO WARRANTY. 314s You are welcome to redistribute it under certain conditions. 314s Type 'license()' or 'licence()' for distribution details. 314s 314s R is a collaborative project with many contributors. 314s Type 'contributors()' for more information and 314s 'citation()' on how to cite R or R packages in publications. 314s 314s Type 'demo()' for some demos, 'help()' for on-line help, or 314s 'help.start()' for an HTML browser interface to help. 314s Type 'q()' to quit R. 314s 314s > library("matrixStats") 314s > 314s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 314s + suppressWarnings({ 314s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 314s + }) 314s + 314s + # Preserve dimnames attribute? 314s + dim(y) <- dim(x) 314s + dimnames(y) <- if (useNames) dimnames(x) else NULL 314s + 314s + y 314s + } 314s > 314s > 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > # With and without some NAs 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 314s > for (mode in c("logical", "integer", "double")) { 314s + for (add_na in c(FALSE, TRUE)) { 314s + cat("add_na = ", add_na, "\n", sep = "") 314s + 314s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 314s + if (add_na) { 314s + x[3:7, c(2, 4)] <- NA_real_ 314s + } 314s + cat("mode: ", mode, "\n", sep = "") 314s + storage.mode(x) <- mode 314s + str(x) 314s + 314s + # Test with and without dimnames on x 314s + for (setDimnames in c(TRUE, FALSE)) { 314s + if (setDimnames) dimnames(x) <- dimnames 314s + else dimnames(x) <- NULL 314s + # Check names attribute 314s + for (useNames in c(TRUE, FALSE)) { 314s + # Row/column ranges 314s + r0 <- rowCumsums_R(x, useNames = useNames) 314s + r1 <- rowCumsums(x, useNames = useNames) 314s + r2 <- t(colCumsums(t(x), useNames = useNames)) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + } # for (useNames ...) 314s + } # for (setDimnames ...) 314s + } # for (add_na ...) 314s + } 314s add_na = FALSE 314s mode: logical 314s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 314s add_na = TRUE 314s mode: logical 314s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 314s add_na = FALSE 314s mode: integer 314s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 314s add_na = TRUE 314s mode: integer 314s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 314s add_na = FALSE 314s mode: double 314s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 314s add_na = TRUE 314s mode: double 314s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 314s > 314s > 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > # All NAs 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > for (mode in c("logical", "integer", "double")) { 314s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 314s + cat("mode: ", mode, "\n", sep = "") 314s + storage.mode(x) <- mode 314s + str(x) 314s + 314s + # Test with and without dimnames on x 314s + for (setDimnames in c(TRUE, FALSE)) { 314s + if (setDimnames) dimnames(x) <- dimnames 314s + else dimnames(x) <- NULL 314s + # Check names attribute 314s + for (useNames in c(TRUE, FALSE)) { 314s + # Row/column ranges 314s + r0 <- rowCumsums_R(x, useNames = useNames) 314s + r1 <- rowCumsums(x, useNames = useNames) 314s + r2 <- t(colCumsums(t(x), useNames = useNames)) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + } # for (useNames ...) 314s + } # for (setDimnames ...) 314s + } # for (mode ...) 314s mode: logical 314s logi [1:10, 1:5] NA NA NA NA NA NA ... 314s mode: integer 314s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 314s mode: double 314s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 314s > 314s > 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > # A 1x1 matrix 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > dimnames <- list("a", "A") # to check dimnames attribute 314s > for (mode in c("logical", "integer", "double")) { 314s + x <- matrix(0, nrow = 1L, ncol = 1L) 314s + cat("mode: ", mode, "\n", sep = "") 314s + storage.mode(x) <- mode 314s + str(x) 314s + 314s + r0 <- rowCumsums_R(x) 314s + r1 <- rowCumsums(x) 314s + r2 <- t(colCumsums(t(x))) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + 314s + # Check dimnames attribute 314s + dimnames(x) <- dimnames 314s + # r0 <- rowCumsums_R(x) 314s + # > r0 314s + # a 314s + # [1,] 0 314s + r1 <- rowCumsums(x, useNames = TRUE) 314s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 314s + stopifnot(identical(dimnames(r1), dimnames)) 314s + stopifnot(identical(dimnames(r2), dimnames)) 314s + dimnames(x) <- NULL 314s + } 314s mode: logical 314s logi [1, 1] FALSE 314s mode: integer 314s int [1, 1] 0 314s mode: double 314s num [1, 1] 0 314s > 314s > 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > # Corner cases 314s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314s > names <- LETTERS[1:5] # to check dimnames attribute 314s > for (mode in c("logical", "integer", "double")) { 314s + cat("mode: ", mode, "\n", sep = "") 314s + value <- 0 314s + storage.mode(value) <- mode 314s + value2 <- value 314s + if (mode == "logical") value2 <- 0L 314s + 314s + # A 0x0 matrix 314s + x <- matrix(value, nrow = 0L, ncol = 0L) 314s + str(x) 314s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 314s + r1 <- rowCumsums(x) 314s + r2 <- t(colCumsums(t(x))) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + 314s + # A 0xK matrix 314s + x <- matrix(value, nrow = 0L, ncol = 5L) 314s + str(x) 314s + colnames <- LETTERS[1:5] 314s + # Test with and without dimnames on x 314s + for (setDimnames in c(TRUE, FALSE)) { 314s + if (setDimnames) colnames(x) <- colnames 314s + else dimnames(x) <- NULL 314s + # Check names attribute 314s + for (useNames in c(TRUE, FALSE)) { 314s + r0 <- rowCumsums_R(x, useNames = useNames) 314s + r1 <- rowCumsums(x, useNames = useNames) 314s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + } # for (useNames ...) 314s + } # for (setDimnames ...) 314s + 314s + # A Nx0 matrix 314s + x <- matrix(value, nrow = 5L, ncol = 0L) 314s + str(x) 314s + rownames <- LETTERS[1:5] 314s + # Test with and without dimnames on x 314s + for (setDimnames in c(TRUE, FALSE)) { 314s + if (setDimnames) rownames(x) <- rownames 314s + else dimnames(x) <- NULL 314s + # Check names attribute 314s + for (useNames in c(TRUE, FALSE)) { 314s + r0 <- rowCumsums_R(x, useNames = useNames) 314s + r1 <- rowCumsums(x, useNames = useNames) 314s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 314s + stopifnot(all.equal(r1, r2)) 314s + stopifnot(all.equal(r1, r0)) 314s + stopifnot(all.equal(r2, r0)) 314s + } # for (useNames ...) 314s + } # for (setDimnames ...) 314s + } # for (mode ...) 314s mode: logical 314s logi[0 , 0 ] 314s logi[0 , 1:5] 314s logi[1:5, 0 ] 314s mode: integer 314s int[0 , 0 ] 314s int[0 , 1:5] 314s int[1:5, 0 ] 314s mode: double 314s num[0 , 0 ] 314s num[0 , 1:5] 314s num[1:5, 0 ] 314s > 315s 315s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 315s Copyright (C) 2025 The R Foundation for Statistical Computing 315s Platform: powerpc64le-unknown-linux-gnu 315s 315s R is free software and comes with ABSOLUTELY NO WARRANTY. 315s You are welcome to redistribute it under certain conditions. 315s Type 'license()' or 'licence()' for distribution details. 315s 315s R is a collaborative project with many contributors. 315s Type 'contributors()' for more information and 315s 'citation()' on how to cite R or R packages in publications. 315s 315s Type 'demo()' for some demos, 'help()' for on-line help, or 315s 'help.start()' for an HTML browser interface to help. 315s Type 'q()' to quit R. 315s 315s > library("matrixStats") 315s > 315s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 315s + suppressWarnings({ 315s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 315s + }) 315s + 315s + # Preserve dimnames attribute? 315s + dim(y) <- dim(x) 315s + dimnames(y) <- if (useNames) dimnames(x) else NULL 315s + 315s + y 315s + } 315s > 315s > 315s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 315s > # Subsetted tests 315s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 315s > source("utils/validateIndicesFramework.R") 315s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 315s > storage.mode(x) <- "integer" 315s > 315s > # To check dimnames attribute 315s > dimnames <- list(letters[1:6], LETTERS[1:6]) 315s > 315s > # Test with and without dimnames on x 315s > for (setDimnames in c(TRUE, FALSE)) { 315s + if (setDimnames) dimnames(x) <- dimnames 315s + else dimnames(x) <- NULL 315s + for (rows in index_cases) { 315s + for (cols in index_cases) { 315s + # Check names attribute 315s + for (useNames in c(TRUE, FALSE)) { 315s + validateIndicesTestMatrix(x, rows, cols, 315s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 315s + validateIndicesTestMatrix(x, rows, cols, 315s + ftest = function(x, rows, cols, ..., useNames) { 315s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 315s + }, fsure = rowCumsums_R, useNames = useNames) 315s + } 315s + } 315s + } 315s + } 316s > 316s 316s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 316s Copyright (C) 2025 The R Foundation for Statistical Computing 316s Platform: powerpc64le-unknown-linux-gnu 316s 316s R is free software and comes with ABSOLUTELY NO WARRANTY. 316s You are welcome to redistribute it under certain conditions. 316s Type 'license()' or 'licence()' for distribution details. 316s 316s R is a collaborative project with many contributors. 316s Type 'contributors()' for more information and 316s 'citation()' on how to cite R or R packages in publications. 316s 316s Type 'demo()' for some demos, 'help()' for on-line help, or 316s 'help.start()' for an HTML browser interface to help. 316s Type 'q()' to quit R. 316s 316s > library("matrixStats") 316s > 316s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 316s + ncol2 <- ncol(x) - lag * differences 316s + if (ncol2 <= 0) { 316s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 316s + # Preserve names attribute 316s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 316s + return(y) 316s + } 316s + suppressWarnings({ 316s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 316s + }) 316s + y <- t(y) 316s + 316s + # Preserve dimnames attribute 316s + dim(y) <- c(nrow(x), ncol2) 316s + if (useNames && !is.null(dimnames(x))) { 316s + colnames <- colnames(x) 316s + if (!is.null(colnames)) { 316s + len <- length(colnames) 316s + colnames <- colnames[(len - ncol2 + 1):len] 316s + } 316s + dimnames(y) <- list(rownames(x), colnames) 316s + } 316s + else dimnames(y) <- NULL 316s + 316s + y 316s + } 316s > 316s > 316s > set.seed(0x42) 316s > 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > # With and without some NAs 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > for (mode in c("integer", "double")) { 316s + cat("mode: ", mode, "\n", sep = "") 316s + 316s + for (add_na in c(FALSE, TRUE)) { 316s + cat("add_na = ", add_na, "\n", sep = "") 316s + 316s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 316s + if (add_na) { 316s + x[3:7, c(2, 4)] <- NA_real_ 316s + } 316s + storage.mode(x) <- mode 316s + str(x) 316s + 316s + dimnames <- list(letters[1:10], LETTERS[1:8]) 316s + 316s + # Test with and without dimnames on x 316s + for (setDimnames in c(TRUE, FALSE)) { 316s + if (setDimnames) dimnames(x) <- dimnames 316s + else dimnames(x) <- NULL 316s + # Check dimnames attribute 316s + for (useNames in c(TRUE, FALSE)) { 316s + for (lag in 1:4) { 316s + for (differences in 1:3) { 316s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 316s + mode, lag, differences)) 316s + # Row/column ranges 316s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 316s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 316s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 316s + stopifnot(all.equal(r1, r0)) 316s + stopifnot(all.equal(r2, r0)) 316s + stopifnot(all.equal(r1, r2)) 316s + } 316s + } 316s + } # for (useNames ...) 316s + } # for (setDimnames ...) 316s + } # for (add_na ...) 316s + } # for (mode ...) 316s mode: integer 316s add_na = FALSE 316s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s add_na = TRUE 316s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: integer, lag = 1, differences = 1 316s mode: integer, lag = 1, differences = 2 316s mode: integer, lag = 1, differences = 3 316s mode: integer, lag = 2, differences = 1 316s mode: integer, lag = 2, differences = 2 316s mode: integer, lag = 2, differences = 3 316s mode: integer, lag = 3, differences = 1 316s mode: integer, lag = 3, differences = 2 316s mode: integer, lag = 3, differences = 3 316s mode: integer, lag = 4, differences = 1 316s mode: integer, lag = 4, differences = 2 316s mode: integer, lag = 4, differences = 3 316s mode: double 316s add_na = FALSE 316s num [1:10, 1:8] 36.1 15.1 27.1 63.1 62.1 58.1 28.1 19.1 41.1 3.1 ... 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s add_na = TRUE 316s num [1:10, 1:8] 67.1 80.1 45.1 8.1 39.1 66.1 27.1 71.1 47.1 46.1 ... 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s mode: double, lag = 1, differences = 1 316s mode: double, lag = 1, differences = 2 316s mode: double, lag = 1, differences = 3 316s mode: double, lag = 2, differences = 1 316s mode: double, lag = 2, differences = 2 316s mode: double, lag = 2, differences = 3 316s mode: double, lag = 3, differences = 1 316s mode: double, lag = 3, differences = 2 316s mode: double, lag = 3, differences = 3 316s mode: double, lag = 4, differences = 1 316s mode: double, lag = 4, differences = 2 316s mode: double, lag = 4, differences = 3 316s > 316s > 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > # All NAs 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > for (mode in c("integer", "double")) { 316s + cat("mode: ", mode, "\n", sep = "") 316s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 316s + storage.mode(x) <- mode 316s + str(x) 316s + 316s + dimnames <- list(letters[1:10], LETTERS[1:5]) 316s + 316s + # Test with and without dimnames on x 316s + for (setDimnames in c(TRUE, FALSE)) { 316s + if (setDimnames) dimnames(x) <- dimnames 316s + else dimnames(x) <- NULL 316s + # Check dimnames attribute 316s + for (useNames in c(TRUE, FALSE)) { 316s + r0 <- rowDiffs_R(x, useNames = useNames) 316s + r1 <- rowDiffs(x, useNames = useNames) 316s + r2 <- t(colDiffs(t(x), useNames = useNames)) 316s + stopifnot(all.equal(r1, r0)) 316s + stopifnot(all.equal(r2, r0)) 316s + stopifnot(all.equal(r1, r2)) 316s + } # for (useNames ...) 316s + } # for (setDimnames ...) 316s + } # for (mode ...) 316s mode: integer 316s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 316s mode: double 316s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 316s > 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > # A 1x1 matrix 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > x <- matrix(0, nrow = 1L, ncol = 1L) 316s > dimnames <- list("a", "A") 316s > # Test with and without dimnames on x 316s > for (setDimnames in c(TRUE, FALSE)) { 316s + if (setDimnames) dimnames(x) <- dimnames 316s + else dimnames(x) <- NULL 316s + # Check dimnames attribute 316s + for (useNames in c(TRUE, FALSE)) { 316s + r0 <- rowDiffs_R(x, useNames = useNames) 316s + r1 <- rowDiffs(x, useNames = useNames) 316s + r2 <- t(colDiffs(t(x), useNames = useNames)) 316s + stopifnot(all.equal(r1, r0)) 316s + stopifnot(all.equal(r2, r0)) 316s + stopifnot(all.equal(r1, r2)) 316s + } # for (useNames ...) 316s + } # for (setDimnames ...) 316s > 316s 316s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 316s Copyright (C) 2025 The R Foundation for Statistical Computing 316s Platform: powerpc64le-unknown-linux-gnu 316s 316s R is free software and comes with ABSOLUTELY NO WARRANTY. 316s You are welcome to redistribute it under certain conditions. 316s Type 'license()' or 'licence()' for distribution details. 316s 316s R is a collaborative project with many contributors. 316s Type 'contributors()' for more information and 316s 'citation()' on how to cite R or R packages in publications. 316s 316s Type 'demo()' for some demos, 'help()' for on-line help, or 316s 'help.start()' for an HTML browser interface to help. 316s Type 'q()' to quit R. 316s 316s > library("matrixStats") 316s > 316s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 316s + ncol2 <- ncol(x) - lag * differences 316s + if (ncol2 <= 0) { 316s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 316s + # Preserve names attribute 316s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 316s + return(y) 316s + } 316s + suppressWarnings({ 316s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 316s + }) 316s + y <- t(y) 316s + 316s + # Preserve dimnames attribute 316s + dim(y) <- c(nrow(x), ncol2) 316s + if (useNames && !is.null(dimnames(x))) { 316s + colnames <- colnames(x) 316s + if (!is.null(colnames)) { 316s + len <- length(colnames) 316s + colnames <- colnames[(len - ncol2 + 1):len] 316s + } 316s + dimnames(y) <- list(rownames(x), colnames) 316s + } 316s + else dimnames(y) <- NULL 316s + 316s + y 316s + } 316s > 316s > 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > # Subsetted tests 316s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 316s > source("utils/validateIndicesFramework.R") 316s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 316s > storage.mode(x) <- "integer" 316s > 316s > # To check dimnames attribute 316s > dimnames <- list(letters[1:6], LETTERS[1:6]) 316s > 316s > # Test with and without dimnames on x 316s > for (setDimnames in c(TRUE, FALSE)) { 316s + if (setDimnames) dimnames(x) <- dimnames 316s + else dimnames(x) <- NULL 316s + 316s + count <- 0L 316s + for (rows in index_cases) { 316s + for (cols in index_cases) { 316s + count <- count + 1L 316s + for (lag in 1:2) { 316s + for (differences in 1:3) { 316s + # Check dimnames attribute 316s + useNames <- c(TRUE, FALSE) 316s + useNames <- useNames[count %% length(useNames) + 1] 316s + validateIndicesTestMatrix(x, rows, cols, 316s + ftest = rowDiffs, fsure = rowDiffs_R, 316s + lag = lag, differences = differences, useNames = useNames) 316s + validateIndicesTestMatrix(x, rows, cols, 316s + ftest = function(x, rows, cols, ..., useNames) { 316s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 316s + }, fsure = rowDiffs_R, 316s + lag = lag, differences = differences, useNames = useNames) 316s + } 316s + } 316s + } 316s + } 316s + } 319s > 319s 319s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 319s Copyright (C) 2025 The R Foundation for Statistical Computing 319s Platform: powerpc64le-unknown-linux-gnu 319s 319s R is free software and comes with ABSOLUTELY NO WARRANTY. 319s You are welcome to redistribute it under certain conditions. 319s Type 'license()' or 'licence()' for distribution details. 319s 319s R is a collaborative project with many contributors. 319s Type 'contributors()' for more information and 319s 'citation()' on how to cite R or R packages in publications. 319s 319s Type 'demo()' for some demos, 'help()' for on-line help, or 319s 'help.start()' for an HTML browser interface to help. 319s Type 'q()' to quit R. 319s 319s > library("matrixStats") 319s > 319s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 319s + quantile_na <- function(x, ..., na.rm = FALSE) { 319s + if (!na.rm && anyMissing(x)) 319s + return(c(NA_real_, NA_real_)) 319s + quantile(x, ..., na.rm = na.rm) 319s + } 319s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 319s + probs = c(0.25, 0.75), na.rm = na.rm) 319s + rownames(q) <- NULL # Not needed anymore 319s + 319s + # Preserve names attribute 319s + dim(q) <- c(2L, nrow(x)) 319s + colnames(q) <- if (useNames) rownames(x) else NULL 319s + 319s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 319s + } 319s > 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > # Test with multiple quantiles 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > for (mode in c("integer", "double")) { 319s + cat("mode: ", mode, "\n", sep = "") 319s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 319s + storage.mode(x) <- mode 319s + str(x) 319s + 319s + # To check names attribute 319s + dimnames <- list(letters[1:10], LETTERS[1:10]) 319s + 319s + for (add_na in c(FALSE, TRUE)) { 319s + if (add_na) { 319s + x[3:5, 6:9] <- NA 319s + } 319s + # Test with and without dimnames on x 319s + for (setDimnames in c(TRUE, FALSE)) { 319s + if (setDimnames) dimnames(x) <- dimnames 319s + else dimnames(x) <- NULL 319s + for (na.rm in c(FALSE, TRUE)) { 319s + # Check names attribute 319s + for (useNames in c(TRUE, FALSE)) { 319s + probs <- c(0, 0.5, 1) 319s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 319s + print(q0) 319s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 319s + print(q1) 319s + stopifnot(all.equal(q1, q0)) 319s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 319s + stopifnot(all.equal(q2, q0)) 319s + 319s + q <- iqr(x[3, ], na.rm = na.rm) 319s + print(q) 319s + } # for (useNames ...) 319s + } # for (na.rm ...) 319s + } # for (setDimnames ...) 319s + } # for (add_na ...) 319s + } # for (mode ...) 319s mode: integer 319s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s a b c d e f g h i j 319s 45 45 NA NA NA 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s a b c d e f g h i j 319s 45 45 25 25 25 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s mode: double 319s num [1:10, 1:10] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 45 45 45 45 45 45 45 45 45 319s [1] 45 319s a b c d e f g h i j 319s 45 45 NA NA NA 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s a b c d e f g h i j 319s 45 45 25 25 25 45 45 45 45 45 319s a b c d e f g h i j 319s 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] 45 45 NA NA NA 45 45 45 45 45 319s [1] NA 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 45 45 25 25 25 45 45 45 45 45 319s [1] 25 319s > 319s > 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > # Test corner cases 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > for (mode in c("integer", "double")) { 319s + cat("mode: ", mode, "\n", sep = "") 319s + # Empty vectors 319s + x <- integer(0L) 319s + storage.mode(x) <- mode 319s + str(x) 319s + q <- iqr(x) 319s + print(q) 319s + stopifnot(identical(q, NA_real_)) 319s + 319s + # Scalar 319s + x <- 1L 319s + storage.mode(x) <- mode 319s + str(x) 319s + q <- iqr(x) 319s + str(q) 319s + stopifnot(identical(q, 0)) 319s + } 319s mode: integer 319s int(0) 319s [1] NA 319s int 1 319s num 0 319s mode: double 319s num(0) 319s [1] NA 319s num 1 319s num 0 319s > 319s > 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > # Single row matrices 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > x <- matrix(1, nrow = 1L, ncol = 2L) 319s > dimnames <- list("a", LETTERS[1:2]) 319s > # Test with and without dimnames on x 319s > for (setDimnames in c(TRUE, FALSE)) { 319s + if (setDimnames) dimnames(x) <- dimnames 319s + else dimnames(x) <- NULL 319s + # Check names attribute 319s + for (useNames in c(TRUE, FALSE)) { 319s + q0 <- rowIQRs_R(x, useNames = useNames) 319s + q1 <- rowIQRs(x, useNames = useNames) 319s + q2 <- colIQRs(t(x), useNames = useNames) 319s + stopifnot(all.equal(q0, q1)) 319s + stopifnot(all.equal(q0, q2)) 319s + } 319s + } 319s > 319s > x <- matrix(1, nrow = 2L, ncol = 1L) 319s > q <- colIQRs(x) 319s > stopifnot(identical(q, 0)) 319s > 319s 319s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 319s Copyright (C) 2025 The R Foundation for Statistical Computing 319s Platform: powerpc64le-unknown-linux-gnu 319s 319s R is free software and comes with ABSOLUTELY NO WARRANTY. 319s You are welcome to redistribute it under certain conditions. 319s Type 'license()' or 'licence()' for distribution details. 319s 319s R is a collaborative project with many contributors. 319s Type 'contributors()' for more information and 319s 'citation()' on how to cite R or R packages in publications. 319s 319s Type 'demo()' for some demos, 'help()' for on-line help, or 319s 'help.start()' for an HTML browser interface to help. 319s Type 'q()' to quit R. 319s 319s > library("matrixStats") 319s > 319s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 319s + quantile_na <- function(x, ..., na.rm = FALSE) { 319s + if (!na.rm && anyMissing(x)) 319s + return(c(NA_real_, NA_real_)) 319s + quantile(x, ..., na.rm = na.rm) 319s + } 319s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 319s + probs = c(0.25, 0.75), na.rm = na.rm) 319s + rownames(q) <- NULL # Not needed anymore 319s + 319s + # Preserve names attribute 319s + dim(q) <- c(2L, nrow(x)) 319s + colnames(q) <- if (useNames) rownames(x) else NULL 319s + 319s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 319s + } 319s > 319s > 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > # Subsetted tests 319s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 319s > source("utils/validateIndicesFramework.R") 319s > x <- runif(6, min = -6, max = 6) 319s > for (idxs in index_cases) { 319s + for (na.rm in c(TRUE, FALSE)) { 319s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 319s + dim(x) <- c(1L, length(x)) 319s + rowIQRs_R(x, na.rm = na.rm) 319s + }, na.rm = na.rm) 319s + } 319s + } 319s > 319s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 319s > 319s > # To check names attribute 319s > dimnames <- list(letters[1:6], LETTERS[1:6]) 319s > 319s > # Test with and without dimnames on x 319s > for (setDimnames in c(TRUE, FALSE)) { 319s + if (setDimnames) dimnames(x) <- dimnames 319s + else dimnames(x) <- NULL 319s + 319s + count <- 0L 319s + for (rows in index_cases) { 319s + for (cols in index_cases) { 319s + count <- count + 1L 319s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 319s + useNames <- c(TRUE, FALSE) 319s + useNames <- useNames[count %% length(useNames) + 1] 319s + 319s + validateIndicesTestMatrix(x, rows, cols, 319s + ftest = rowIQRs, fsure = rowIQRs_R, 319s + na.rm = na.rm, useNames = useNames) 319s + validateIndicesTestMatrix(x, rows, cols, 319s + fcoltest = colIQRs, fsure = rowIQRs_R, 319s + na.rm = na.rm, useNames = useNames) 319s + } 319s + } 319s + } 321s > 321s 321s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 321s Copyright (C) 2025 The R Foundation for Statistical Computing 321s Platform: powerpc64le-unknown-linux-gnu 321s 321s R is free software and comes with ABSOLUTELY NO WARRANTY. 321s You are welcome to redistribute it under certain conditions. 321s Type 'license()' or 'licence()' for distribution details. 321s 321s R is a collaborative project with many contributors. 321s Type 'contributors()' for more information and 321s 'citation()' on how to cite R or R packages in publications. 321s 321s Type 'demo()' for some demos, 'help()' for on-line help, or 321s 'help.start()' for an HTML browser interface to help. 321s Type 'q()' to quit R. 321s 321s > # Test inspired by the harmonic mean example in R-help 321s > # thread '[R] Beyond double-precision?' on May 9, 2009. 321s > 321s > library("matrixStats") 321s > library("stats") 321s > 321s > logSumExp0 <- function(lx) { 321s + idx_max <- which.max(lx) 321s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 321s + } 321s > 321s > n <- 200L 321s > set.seed(1) 321s > 321s > for (mode in c("integer", "double")) { 321s + cat("mode: ", mode, "\n", sep = "") 321s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 321s + storage.mode(x) <- mode 321s + str(x) 321s + 321s + # The logarithm of the harmonic mean by rows 321s + y_h <- log(1 / rowMeans(1 / x)) 321s + str(y_h) 321s + 321s + lx_neg <- -log(x) 321s + 321s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 321s + stopifnot(all.equal(y0, y_h)) 321s + 321s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 321s + stopifnot(all.equal(y1, y0)) 321s + 321s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 321s + stopifnot(all.equal(y2, y0)) 321s + 321s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 321s + stopifnot(all.equal(y3, y0)) 321s + 321s + 321s + # The logarithm of the harmonic mean by columns 321s + y_h <- log(1 / colMeans(1 / x)) 321s + str(y_h) 321s + 321s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 321s + stopifnot(all.equal(y0, y_h)) 321s + 321s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 321s + stopifnot(all.equal(y1, y0)) 321s + 321s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 321s + stopifnot(all.equal(y2, y0)) 321s + 321s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 321s + stopifnot(all.equal(y3, y0)) 321s + 321s + # Testing names 321s + rownames(lx_neg) <- seq_len(nrow(x)) 321s + colnames(lx_neg) <- seq_len(ncol(x)) 321s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 321s + stopifnot(identical(names(y2), rownames(lx_neg))) 321s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 321s + stopifnot(identical(names(y3), rownames(lx_neg))) 321s + } # for (mode ...) 321s mode: integer 321s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 321s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 321s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 321s mode: double 321s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 321s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 321s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 321s > 321s > 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > # Corner cases 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > ## Zero-size matrices 321s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s numeric(0) 321s > stopifnot(length(y) == nrow(lx)) 321s > 321s > y <- colLogSumExps(lx) 321s > print(y) 321s numeric(0) 321s > stopifnot(length(y) == ncol(lx)) 321s > 321s > ## Zero-height matrices 321s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s numeric(0) 321s > stopifnot(length(y) == nrow(lx)) 321s > 321s > y <- colLogSumExps(lx) 321s > print(y) 321s [1] -Inf -Inf -Inf -Inf -Inf 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(all(y == -Inf)) 321s > 321s > ## Zero-width matrices 321s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 321s > y <- colLogSumExps(lx) 321s > print(y) 321s numeric(0) 321s > stopifnot(length(y) == ncol(lx)) 321s > 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s [1] -Inf -Inf -Inf -Inf -Inf 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(y == -Inf)) 321s > 321s > 321s > ## Matrices with one element 321s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s [1] 1 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(y == lx)) 321s > 321s > y <- colLogSumExps(lx) 321s > print(y) 321s [1] 1 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(all(y == lx)) 321s > 321s > ## All missing values 321s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 321s > y <- rowLogSumExps(lx, na.rm = TRUE) 321s > print(y) 321s [1] -Inf 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(identical(y, -Inf)) 321s > 321s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 321s > y <- colLogSumExps(lx, na.rm = TRUE) 321s > print(y) 321s [1] -Inf 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(identical(y, -Inf)) 321s > 321s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 321s > y <- rowLogSumExps(lx, na.rm = TRUE) 321s > print(y) 321s [1] -Inf -Inf 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(y == -Inf)) 321s > 321s > y <- rowLogSumExps(lx, na.rm = FALSE) 321s > print(y) 321s [1] NA NA 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(is.na(y) & !is.nan(y))) 321s > 321s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 321s > y <- colLogSumExps(lx, na.rm = TRUE) 321s > print(y) 321s [1] -Inf -Inf 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(all(y == -Inf)) 321s > 321s > y <- colLogSumExps(lx, na.rm = FALSE) 321s > print(y) 321s [1] NA NA 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(all(is.na(y) & !is.nan(y))) 321s > 321s > ## +Inf values 321s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 321s > y <- colLogSumExps(lx, na.rm = TRUE) 321s > print(y) 321s [1] Inf Inf 321s > stopifnot(length(y) == ncol(lx)) 321s > stopifnot(all(y == +Inf)) 321s > 321s > ## multiple -Inf values 321s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s [1] -Inf -Inf 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(y == -Inf)) 321s > 321s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 321s > y <- rowLogSumExps(lx) 321s > print(y) 321s [1] 5 5 321s > stopifnot(length(y) == nrow(lx)) 321s > stopifnot(all(y == 5)) 321s > 321s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 321s > ## (This would core dump on Windows) 321s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 321s > y <- colLogSumExps(x) 321s > str(y) 321s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 321s > 321s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 321s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 321s > ## used) 321s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 321s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 321s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 321s > stopifnot(names(y) == c("c", "b", "a")) 321s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 321s > stopifnot(names(y) == "B") 321s > 321s > 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > # Check names attributes 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > 321s > ## Create isFALSE() if running on an old version of R 321s > if (!exists("isFALSE", mode="function")) { 321s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 321s + } 321s > 321s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 321s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 321s + log(sum(exp(rx), ...)) 321s + }, ...) 321s + if (isFALSE(useNames)) names(res) <- NULL 321s + res 321s + } 321s > 321s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 321s > 321s > # To check names attribute 321s > dimnames <- list(letters[1:6], LETTERS[1:6]) 321s > 321s > # Test with and without dimnames on x 321s > for (setDimnames in c(TRUE, FALSE)) { 321s + if (setDimnames) dimnames(x) <- dimnames 321s + else dimnames(x) <- NULL 321s + for (useNames in c(TRUE, FALSE)) { 321s + y0 <- rowLogSumExps_R(x, useNames = useNames) 321s + y1 <- rowLogSumExps(x, useNames = useNames) 321s + y2 <- colLogSumExps(t(x), useNames = useNames) 321s + stopifnot(all.equal(y1, y0)) 321s + stopifnot(all.equal(y2, y0)) 321s + } 321s + } 321s > 321s 321s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 321s Copyright (C) 2025 The R Foundation for Statistical Computing 321s Platform: powerpc64le-unknown-linux-gnu 321s 321s R is free software and comes with ABSOLUTELY NO WARRANTY. 321s You are welcome to redistribute it under certain conditions. 321s Type 'license()' or 'licence()' for distribution details. 321s 321s R is a collaborative project with many contributors. 321s Type 'contributors()' for more information and 321s 'citation()' on how to cite R or R packages in publications. 321s 321s Type 'demo()' for some demos, 'help()' for on-line help, or 321s 'help.start()' for an HTML browser interface to help. 321s Type 'q()' to quit R. 321s 321s > library("matrixStats") 321s > 321s > ## Create isFALSE() if running on an old version of R 321s > if (!exists("isFALSE", mode="function")) { 321s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 321s + } 321s > 321s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 321s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 321s + log(sum(exp(rx), ...)) 321s + }, ...) 321s + if (isFALSE(useNames)) names(res) <- NULL 321s + res 321s + } 321s > 321s > 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > # Subsetted tests 321s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321s > source("utils/validateIndicesFramework.R") 321s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 321s > 321s > # To check names attribute 321s > dimnames <- list(letters[1:6], LETTERS[1:6]) 321s > 321s > # Test with and without dimnames on x 321s > for (setDimnames in c(TRUE, FALSE)) { 321s + if (setDimnames) dimnames(x) <- dimnames 321s + else dimnames(x) <- NULL 321s + for (rows in index_cases) { 321s + for (cols in index_cases) { 321s + for (na.rm in c(TRUE, FALSE)) { 321s + for (useNames in c(TRUE, FALSE)) { 321s + validateIndicesTestMatrix(x, rows, cols, 321s + ftest = rowLogSumExps, 321s + fsure = rowLogSumExps_R, 321s + na.rm = na.rm, useNames = useNames) 321s + validateIndicesTestMatrix(x, rows, cols, 321s + fcoltest = colLogSumExps, 321s + fsure = rowLogSumExps_R, 321s + na.rm = na.rm, useNames = useNames) 321s + } 321s + } 321s + } 321s + } 321s + } 322s > 322s 322s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 322s Copyright (C) 2025 The R Foundation for Statistical Computing 322s Platform: powerpc64le-unknown-linux-gnu 322s 322s R is free software and comes with ABSOLUTELY NO WARRANTY. 322s You are welcome to redistribute it under certain conditions. 322s Type 'license()' or 'licence()' for distribution details. 322s 322s R is a collaborative project with many contributors. 322s Type 'contributors()' for more information and 322s 'citation()' on how to cite R or R packages in publications. 322s 322s Type 'demo()' for some demos, 'help()' for on-line help, or 322s 'help.start()' for an HTML browser interface to help. 322s Type 'q()' to quit R. 322s 322s > library("matrixStats") 322s > 322s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 322s > options(matrixStats.center.onUse = "ignore") 322s > 322s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 322s + suppressWarnings({ 322s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 322s + }) 322s + if (!useNames) names(res) <- NULL 322s + res 322s + } 322s > 322s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 322s + suppressWarnings({ 322s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 322s + }) 322s + if (!useNames) names(res) <- NULL 322s + res 322s + } 322s > 322s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 322s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 322s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 322s + } 322s > 322s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 322s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 322s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 322s + } 322s > 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # A 3x3 matrix (no ties) 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > for (mode in c("integer", "double")) { 322s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 322s + cat("mode: ", mode, "\n", sep = "") 322s + storage.mode(x) <- mode 322s + str(x) 322s + 322s + # To check name attribute 322s + dimnames <- list(letters[1:3], LETTERS[1:3]) 322s + 322s + # Test with and without dimnames on x 322s + for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("rowMads():\n") 322s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 322s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 322s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 322s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 322s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 322s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r1b, r1)) 322s + stopifnot(all.equal(r1c, r1)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r2b, r2)) 322s + 322s + cat("colMads():\n") 322s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 322s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 322s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 322s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 322s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 322s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r1b, r1)) 322s + stopifnot(all.equal(r1c, r1)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r2b, r2)) 322s + } 322s + } 322s + } 322s mode: integer 322s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s mode: double 322s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # Ties: a 4x4 matrix 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > for (mode in c("integer", "double")) { 322s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 322s + cat("mode: ", mode, "\n", sep = "") 322s + storage.mode(x) <- mode 322s + str(x) 322s + tx <- t(x) 322s + 322s + # To check name attribute 322s + dimnames <- list(letters[1:4], LETTERS[1:4]) 322s + 322s + # Test with and without dimnames on x 322s + for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("rowMads():\n") 322s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 322s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + 322s + cat("colMads():\n") 322s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 322s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + } 322s + } 322s + } 322s mode: integer 322s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s mode: double 322s num [1:4, 1:4] 1.1 2.1 3.1 4.1 2.1 3.1 4.1 5.1 3.1 4.1 ... 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s > tx <- NULL 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # No ties: a 3x3 matrix with an NA value 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > for (mode in c("integer", "double")) { 322s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 322s + x[2, 2] <- NA_real_ 322s + 322s + cat("mode: ", mode, "\n", sep = "") 322s + storage.mode(x) <- mode 322s + str(x) 322s + tx <- t(x) 322s + 322s + # To check name attribute 322s + dimnames <- list(letters[1:3], LETTERS[1:3]) 322s + 322s + # Test with and without dimnames on x 322s + for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("rowMads():\n") 322s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 322s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + 322s + cat("colMads():\n") 322s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 322s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 322s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + } 322s + } 322s + } 322s mode: integer 322s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s mode: double 322s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s rowMads(): 322s colMads(): 322s > tx <- NULL 322s > 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # With and without some NAs 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > for (add_na in c(FALSE, TRUE)) { 322s + cat("add_na = ", add_na, "\n", sep = "") 322s + 322s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 322s + if (add_na) { 322s + x[3:7, c(2, 4)] <- NA_real_ 322s + } 322s + 322s + # To check name attribute 322s + dimnames <- list(letters[1:10], LETTERS[1:5]) 322s + 322s + # Test with and without dimnames on x 322s + for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Row/column ranges 322s + for (na.rm in c(FALSE, TRUE)) { 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("na.rm = ", na.rm, "\n", sep = "") 322s + cat("rowMads():\n") 322s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 322s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 322s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 322s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 322s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r2, r1)) 322s + stopifnot(all.equal(r3, r0)) 322s + stopifnot(all.equal(r3, r1)) 322s + stopifnot(all.equal(r3, r2)) 322s + 322s + cat("colMads():\n") 322s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 322s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 322s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 322s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 322s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r2, r1)) 322s + stopifnot(all.equal(r3, r0)) 322s + stopifnot(all.equal(r3, r1)) 322s + stopifnot(all.equal(r3, r2)) 322s + } 322s + } 322s + } 322s + tx <- NULL 322s + } # for (add_na ...) 322s add_na = FALSE 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s add_na = TRUE 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = FALSE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s na.rm = TRUE 322s rowMads(): 322s colMads(): 322s > 322s > 322s > 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # All NAs 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 322s > # Test with and without dimnames on x 322s > for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Row/column ranges 322s + for (na.rm in c(FALSE, TRUE)) { 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("na.rm = ", na.rm, "\n", sep = "") 322s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 322s + if (na.rm) r0[is.na(r0)] <- NaN 322s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 322s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r1, r2)) 322s + } 322s + } 322s + } 322s na.rm = FALSE 322s na.rm = FALSE 322s na.rm = TRUE 322s na.rm = TRUE 322s na.rm = FALSE 322s na.rm = FALSE 322s na.rm = TRUE 322s na.rm = TRUE 322s > tx <- NULL 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # A 1x1 matrix 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > x <- matrix(0, nrow = 1L, ncol = 1L) 322s > dimnames <- list("a", "A") 322s > # Test with and without dimnames on x 322s > for (setDimnames in c(TRUE, FALSE)) { 322s + if (setDimnames) dimnames(x) <- dimnames 322s + else dimnames(x) <- NULL 322s + tx <- t(x) 322s + # Row/column ranges 322s + for (na.rm in c(FALSE, TRUE)) { 322s + # Check names attribute 322s + for (useNames in c(TRUE, FALSE)) { 322s + cat("na.rm = ", na.rm, "\n", sep = "") 322s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 322s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 322s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + stopifnot(all.equal(r1, r2)) 322s + } 322s + } 322s + } 322s na.rm = FALSE 322s na.rm = FALSE 322s na.rm = TRUE 322s na.rm = TRUE 322s na.rm = FALSE 322s na.rm = FALSE 322s na.rm = TRUE 322s na.rm = TRUE 322s > 322s > 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > # A 0x0 matrix 322s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 322s > x <- matrix(double(0), nrow = 0, ncol = 0) 322s > tx <- t(x) 322s > for (na.rm in c(FALSE, TRUE)) { 322s + cat("na.rm = ", na.rm, "\n", sep = "") 322s + r0 <- rowMads_R(x, na.rm = na.rm) 322s + r1 <- rowMads(x, na.rm = na.rm) 322s + r2 <- colMads(tx, na.rm = na.rm) 322s + stopifnot(all.equal(r1, r2)) 322s + stopifnot(all.equal(r1, r0)) 322s + stopifnot(all.equal(r2, r0)) 322s + } 322s na.rm = FALSE 322s na.rm = TRUE 322s > 323s 323s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 323s Copyright (C) 2025 The R Foundation for Statistical Computing 323s Platform: powerpc64le-unknown-linux-gnu 323s 323s R is free software and comes with ABSOLUTELY NO WARRANTY. 323s You are welcome to redistribute it under certain conditions. 323s Type 'license()' or 'licence()' for distribution details. 323s 323s R is a collaborative project with many contributors. 323s Type 'contributors()' for more information and 323s 'citation()' on how to cite R or R packages in publications. 323s 323s Type 'demo()' for some demos, 'help()' for on-line help, or 323s 'help.start()' for an HTML browser interface to help. 323s Type 'q()' to quit R. 323s 323s > library("matrixStats") 323s > 323s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 323s > options(matrixStats.center.onUse = "ignore") 323s > 323s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 323s + suppressWarnings({ 323s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 323s + }) 323s + if (!useNames) names(res) <- NULL 323s + res 323s + } 323s > 323s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 323s + suppressWarnings({ 323s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 323s + }) 323s + if (!useNames) names(res) <- NULL 323s + res 323s + } 323s > 323s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 323s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 323s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 323s + } 323s > 323s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 323s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 323s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 323s + } 323s > 323s > 323s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 323s > # Subsetted tests 323s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 323s > source("utils/validateIndicesFramework.R") 323s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 323s > storage.mode(x) <- "integer" 323s > 323s > # To check names attribute 323s > dimnames <- list(letters[1:6], LETTERS[1:6]) 323s > 323s > # Test with and without dimnames on x 323s > for (setDimnames in c(TRUE, FALSE)) { 323s + if (setDimnames) dimnames(x) <- dimnames 323s + else dimnames(x) <- NULL 323s + 323s + count <- 0L 323s + for (rows in index_cases) { 323s + for (cols in index_cases) { 323s + count <- count + 1L 323s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 323s + useNames <- c(TRUE, FALSE) 323s + useNames <- useNames[count %% length(useNames) + 1] 323s + 323s + validateIndicesTestMatrix(x, rows, cols, 323s + ftest = rowMads, fsure = rowMads_R, 323s + na.rm = na.rm, useNames = useNames) 323s + validateIndicesTestMatrix(x, rows, cols, 323s + ftest = rowMads_center, fsure = rowMads_R, 323s + na.rm = na.rm, useNames = useNames) 323s + 323s + validateIndicesTestMatrix(x, rows, cols, 323s + fcoltest = colMads, fsure = rowMads_R, 323s + na.rm = na.rm, useNames = useNames) 323s + validateIndicesTestMatrix(x, rows, cols, 323s + fcoltest = colMads_center, fsure = rowMads_R, 323s + na.rm = na.rm, useNames = useNames) 323s + } 323s + } 323s + } 324s > 324s 324s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 324s Copyright (C) 2025 The R Foundation for Statistical Computing 324s Platform: powerpc64le-unknown-linux-gnu 324s 324s R is free software and comes with ABSOLUTELY NO WARRANTY. 324s You are welcome to redistribute it under certain conditions. 324s Type 'license()' or 'licence()' for distribution details. 324s 324s R is a collaborative project with many contributors. 324s Type 'contributors()' for more information and 324s 'citation()' on how to cite R or R packages in publications. 324s 324s Type 'demo()' for some demos, 'help()' for on-line help, or 324s 'help.start()' for an HTML browser interface to help. 324s Type 'q()' to quit R. 324s 324s > library("matrixStats") 324s > 324s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 324s + res <- rowMeans(x, na.rm = na.rm) 324s + if (!useNames) names(res) <- NULL 324s + res 324s + } 324s > 324s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 324s + res <- colMeans(x, na.rm = na.rm) 324s + if (!useNames) names(res) <- NULL 324s + res 324s + } 324s > 324s > for (mode in c("integer", "logical", "double")) { 324s + x <- matrix(-4:4, nrow = 3, ncol = 3) 324s + storage.mode(x) <- mode 324s + if (mode == "double") x <- x + 0.1 324s + 324s + # To check names attribute 324s + dimnames <- list(letters[1:3], LETTERS[1:3]) 324s + 324s + # Test with and without dimnames on x 324s + for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s + } 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: Single-element matrix 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: Single-element matrix:\n") 324s Special case: Single-element matrix: 324s > for (mode in c("integer", "logical", "double")) { 324s + x <- matrix(1, nrow = 1, ncol = 1) 324s + storage.mode(x) <- mode 324s + 324s + # To check names attribute 324s + dimnames <- list("a", "A") 324s + 324s + # Test with and without dimnames on x 324s + for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: Empty matrix 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: Empty matrix:\n") 324s Special case: Empty matrix: 324s > for (mode in c("integer", "logical", "double")) { 324s + x <- matrix(integer(0), nrow = 0, ncol = 0) 324s + storage.mode(x) <- mode 324s + 324s + y0 <- rowMeans(x, na.rm = FALSE) 324s + y1 <- rowMeans2(x, na.rm = FALSE) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans(x, na.rm = FALSE) 324s + y1 <- colMeans2(x, na.rm = FALSE) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: All NAs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: All NAs:\n") 324s Special case: All NAs: 324s > for (mode in c("integer", "logical", "double")) { 324s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 324s + storage.mode(x) <- mode 324s + 324s + # To check names attribute 324s + dimnames <- list(letters[1:3], LETTERS[1:3]) 324s + 324s + # Test with and without dimnames on x 324s + for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: All NaNs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: All NaNs:\n") 324s Special case: All NaNs: 324s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: All Infs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: All Infs:\n") 324s Special case: All Infs: 324s > x <- matrix(Inf, nrow = 3, ncol = 3) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: All -Infs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: All -Infs:\n") 324s Special case: All -Infs: 324s > x <- matrix(-Inf, nrow = 3, ncol = 3) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: Infs and -Infs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: Infs and -Infs:\n") 324s Special case: Infs and -Infs: 324s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 324s > 324s > # To check names attribute 324s > dimnames <- list(letters[1:4], LETTERS[1:4]) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: NaNs and NAs 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: NaNs and NAs:\n") 324s Special case: NaNs and NAs: 324s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + str(y0) 324s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + str(y1) 324s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s Named num [1:4] NaN NA NaN NA 324s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 324s Named num [1:4] NaN NA NaN NA 324s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 324s num [1:4] NaN NA NaN NA 324s num [1:4] NaN NA NaN NA 324s num [1:4] NaN NA NaN NA 324s num [1:4] NaN NA NaN NA 324s num [1:4] NaN NA NaN NA 324s num [1:4] NaN NA NaN NA 324s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 324s > ## returned here (as one would expect). NaN might very well be returned, 324s > ## when both NA and NaN are involved. This is an accepted feature in R, 324s > ## which is documented in help("is.nan"). See also 324s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 324s > ## Thus, we cannot guarantee that y1 is identical to y0. 324s > 324s > 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Special case: Integer overflow with ties 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > cat("Special case: Integer overflow with ties:\n") 324s Special case: Integer overflow with ties: 324s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + # Check names attribute 324s + for (useNames in c(TRUE, FALSE)) { 324s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + 324s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 324s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 324s + stopifnot(all.equal(y1, y0)) 324s + } 324s + } 324s > 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Consistency checks 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > set.seed(1) 324s > 324s > cat("Consistency checks:\n") 324s Consistency checks: 324s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 324s > for (kk in seq_len(n_sims)) { 324s + cat("Random test #", kk, "\n", sep = "") 324s + 324s + # Simulate data in a matrix of any shape 324s + dim <- sample(50:200, size = 2) 324s + n <- prod(dim) 324s + x <- rnorm(n, sd = 100) 324s + dim(x) <- dim 324s + 324s + # Add NAs? 324s + if ((kk %% 4) %in% c(3, 0)) { 324s + cat("Adding NAs\n") 324s + nna <- sample(n, size = 1) 324s + na_values <- c(NA_real_, NaN) 324s + t <- sample(na_values, size = nna, replace = TRUE) 324s + x[sample(length(x), size = nna)] <- t 324s + } 324s + 324s + # Mode? 324s + modes <- "double" 324s + if ((kk %% 4) %in% c(2, 0)) { 324s + modes <- c("integer", "logical") 324s + } 324s + 324s + for (mode in modes) { 324s + if (mode != "double") { 324s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 324s + storage.mode(x) <- mode 324s + } 324s + 324s + na.rm <- sample(c(TRUE, FALSE), size = 1) 324s + 324s + # rowMeans2(): 324s + y0 <- rowMeans(x, na.rm = na.rm) 324s + y1 <- rowMeans2(x, na.rm = na.rm) 324s + stopifnot(all.equal(y1, y0)) 324s + y2 <- colMeans2(t(x), na.rm = na.rm) 324s + stopifnot(all.equal(y2, y0)) 324s + 324s + # colMeans2(): 324s + y0 <- colMeans(x, na.rm = na.rm) 324s + y1 <- colMeans2(x, na.rm = na.rm) 324s + stopifnot(all.equal(y1, y0)) 324s + y2 <- rowMeans2(t(x), na.rm = na.rm) 324s + stopifnot(all.equal(y2, y0)) 324s + } 324s + } # for (kk ...) 324s Random test #1 324s Random test #2 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #3 324s Adding NAs 324s Random test #4 324s Adding NAs 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #5 324s Random test #6 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #7 324s Adding NAs 324s Random test #8 324s Adding NAs 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #9 324s Random test #10 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #11 324s Adding NAs 324s Random test #12 324s Adding NAs 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #13 324s Random test #14 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #15 324s Adding NAs 324s Random test #16 324s Adding NAs 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #17 324s Random test #18 324s Coercing from double to integer 324s Coercing from integer to logical 324s Random test #19 324s Adding NAs 324s Random test #20 324s Adding NAs 324s Coercing from double to integer 324s Coercing from integer to logical 324s > 324s 324s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 324s Copyright (C) 2025 The R Foundation for Statistical Computing 324s Platform: powerpc64le-unknown-linux-gnu 324s 324s R is free software and comes with ABSOLUTELY NO WARRANTY. 324s You are welcome to redistribute it under certain conditions. 324s Type 'license()' or 'licence()' for distribution details. 324s 324s R is a collaborative project with many contributors. 324s Type 'contributors()' for more information and 324s 'citation()' on how to cite R or R packages in publications. 324s 324s Type 'demo()' for some demos, 'help()' for on-line help, or 324s 'help.start()' for an HTML browser interface to help. 324s Type 'q()' to quit R. 324s 324s > library("matrixStats") 324s > 324s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 324s + res <- rowMeans(x, na.rm = na.rm) 324s + if (!useNames) names(res) <- NULL 324s + res 324s + } 324s > 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > # Subsetted tests 324s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 324s > source("utils/validateIndicesFramework.R") 324s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 324s > storage.mode(x) <- "integer" 324s > 324s > # To check names attribute 324s > dimnames <- list(letters[1:6], LETTERS[1:6]) 324s > 324s > # Test with and without dimnames on x 324s > for (setDimnames in c(TRUE, FALSE)) { 324s + if (setDimnames) dimnames(x) <- dimnames 324s + else dimnames(x) <- NULL 324s + 324s + count <- 0L 324s + for (rows in index_cases) { 324s + for (cols in index_cases) { 324s + count <- count + 1L 324s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 324s + useNames <- c(TRUE, FALSE) 324s + useNames <- useNames[count %% length(useNames) + 1] 324s + 324s + validateIndicesTestMatrix(x, rows, cols, 324s + ftest = rowMeans2, fsure = rowMeans_R, 324s + na.rm = na.rm, useNames = useNames) 324s + validateIndicesTestMatrix(x, rows, cols, 324s + fcoltest = colMeans2, fsure = rowMeans_R, 324s + na.rm = na.rm, useNames = useNames) 324s + } 324s + } 324s + } 324s > 324s 324s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 324s Copyright (C) 2025 The R Foundation for Statistical Computing 324s Platform: powerpc64le-unknown-linux-gnu 324s 324s R is free software and comes with ABSOLUTELY NO WARRANTY. 324s You are welcome to redistribute it under certain conditions. 324s Type 'license()' or 'licence()' for distribution details. 324s 324s R is a collaborative project with many contributors. 324s Type 'contributors()' for more information and 324s 'citation()' on how to cite R or R packages in publications. 324s 324s Type 'demo()' for some demos, 'help()' for on-line help, or 324s 'help.start()' for an HTML browser interface to help. 324s Type 'q()' to quit R. 324s 325s > library("matrixStats") 325s > 325s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 325s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 325s + if (!useNames) names(res) <- NULL 325s + res 325s + } 325s > 325s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 325s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 325s + if (!useNames) names(res) <- NULL 325s + res 325s + } 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Non-ties 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Non-ties:\n") 325s Special case: Non-ties: 325s > for (mode in c("integer", "double")) { 325s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 325s + storage.mode(x) <- mode 325s + 325s + # To check names attribute 325s + dimnames <- list(letters[1:3], LETTERS[1:3]) 325s + 325s + # Test with and without dimnames on x 325s + for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Ties 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Ties:\n") 325s Special case: Ties: 325s > for (mode in c("integer", "double")) { 325s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 325s + storage.mode(x) <- mode 325s + 325s + # To check names attribute 325s + dimnames <- list(letters[1:4], LETTERS[1:4]) 325s + 325s + # Test with and without dimnames on x 325s + for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Single-element matrix 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Single-element matrix:\n") 325s Special case: Single-element matrix: 325s > for (mode in c("integer", "double")) { 325s + x <- matrix(1, nrow = 1, ncol = 1) 325s + storage.mode(x) <- mode 325s + 325s + # To check names attribute 325s + dimnames <- list("a", "A") 325s + 325s + # Test with and without dimnames on x 325s + for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Empty matrix 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Empty matrix:\n") 325s Special case: Empty matrix: 325s > for (mode in c("integer", "double")) { 325s + x <- matrix(integer(0), nrow = 0, ncol = 0) 325s + storage.mode(x) <- mode 325s + 325s + y0 <- rowMedians_R(x, na.rm = FALSE) 325s + y1 <- rowMedians(x, na.rm = FALSE) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE) 325s + y1 <- colMedians(x, na.rm = FALSE) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: All NAs 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: All NAs:\n") 325s Special case: All NAs: 325s > for (mode in c("integer", "double")) { 325s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 325s + storage.mode(x) <- mode 325s + 325s + # To check names attribute 325s + dimnames <- list(letters[1:3], LETTERS[1:3]) 325s + 325s + # Test with and without dimnames on x 325s + for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: All NaNs 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: All NaNs:\n") 325s Special case: All NaNs: 325s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: All Infs 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: All Infs:\n") 325s Special case: All Infs: 325s > x <- matrix(Inf, nrow = 3, ncol = 3) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: All -Infs 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: All -Infs:\n") 325s Special case: All -Infs: 325s > x <- matrix(-Inf, nrow = 3, ncol = 3) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Infs and -Infs 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Infs and -Infs:\n") 325s Special case: Infs and -Infs: 325s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 325s > 325s > # To check names attribute 325s > dimnames <- list(letters[1:4], LETTERS[1:4]) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Special case: Integer overflow with ties 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > cat("Special case: Integer overflow with ties:\n") 325s Special case: Integer overflow with ties: 325s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + # Check names attribute 325s + for (useNames in c(TRUE, FALSE)) { 325s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + 325s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 325s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 325s + stopifnot(all.equal(y1, y0)) 325s + } 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Consistency checks 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > set.seed(1) 325s > 325s > cat("Consistency checks:\n") 325s Consistency checks: 325s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 325s > for (kk in seq_len(n_sims)) { 325s + cat("Random test #", kk, "\n", sep = "") 325s + 325s + # Simulate data in a matrix of any shape 325s + dim <- sample(50:200, size = 2) 325s + n <- prod(dim) 325s + x <- rnorm(n, sd = 100) 325s + dim(x) <- dim 325s + 325s + # Add NAs? 325s + if ((kk %% 4) %in% c(3, 0)) { 325s + cat("Adding NAs\n") 325s + nna <- sample(n, size = 1) 325s + na_values <- c(NA_real_, NaN) 325s + t <- sample(na_values, size = nna, replace = TRUE) 325s + x[sample(length(x), size = nna)] <- t 325s + } 325s + 325s + # Integer or double? 325s + if ((kk %% 4) %in% c(2, 0)) { 325s + cat("Coercing to integers\n") 325s + storage.mode(x) <- "integer" 325s + } 325s + 325s + na.rm <- sample(c(TRUE, FALSE), size = 1) 325s + 325s + # rowMedians(): 325s + y0 <- rowMedians_R(x, na.rm = na.rm) 325s + y1 <- rowMedians(x, na.rm = na.rm) 325s + stopifnot(all.equal(y1, y0)) 325s + y2 <- colMedians(t(x), na.rm = na.rm) 325s + stopifnot(all.equal(y2, y0)) 325s + 325s + # colMedians(): 325s + y0 <- colMedians_R(x, na.rm = na.rm) 325s + y1 <- colMedians(x, na.rm = na.rm) 325s + stopifnot(all.equal(y1, y0)) 325s + y2 <- rowMedians(t(x), na.rm = na.rm) 325s + stopifnot(all.equal(y2, y0)) 325s + } # for (kk ...) 325s Random test #1 325s Random test #2 325s Coercing to integers 325s Random test #3 325s Adding NAs 325s Random test #4 325s Adding NAs 325s Coercing to integers 325s Random test #5 325s Random test #6 325s Coercing to integers 325s Random test #7 325s Adding NAs 325s Random test #8 325s Adding NAs 325s Coercing to integers 325s Random test #9 325s Random test #10 325s Coercing to integers 325s Random test #11 325s Adding NAs 325s Random test #12 325s Adding NAs 325s Coercing to integers 325s Random test #13 325s Random test #14 325s Coercing to integers 325s Random test #15 325s Adding NAs 325s Random test #16 325s Adding NAs 325s Coercing to integers 325s Random test #17 325s Random test #18 325s Coercing to integers 325s Random test #19 325s Adding NAs 325s Random test #20 325s Adding NAs 325s Coercing to integers 325s > 325s 325s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 325s Copyright (C) 2025 The R Foundation for Statistical Computing 325s Platform: powerpc64le-unknown-linux-gnu 325s 325s R is free software and comes with ABSOLUTELY NO WARRANTY. 325s You are welcome to redistribute it under certain conditions. 325s Type 'license()' or 'licence()' for distribution details. 325s 325s R is a collaborative project with many contributors. 325s Type 'contributors()' for more information and 325s 'citation()' on how to cite R or R packages in publications. 325s 325s Type 'demo()' for some demos, 'help()' for on-line help, or 325s 'help.start()' for an HTML browser interface to help. 325s Type 'q()' to quit R. 325s 325s > library("matrixStats") 325s > 325s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 325s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 325s + if (!useNames) names(res) <- NULL 325s + res 325s + } 325s > 325s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 325s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 325s + if (!useNames) names(res) <- NULL 325s + res 325s + } 325s > 325s > 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > # Subsetted tests 325s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325s > source("utils/validateIndicesFramework.R") 325s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 325s > storage.mode(x) <- "integer" 325s > 325s > # To check names attribute 325s > dimnames <- list(letters[1:6], LETTERS[1:6]) 325s > 325s > # Test with and without dimnames on x 325s > for (setDimnames in c(TRUE, FALSE)) { 325s + if (setDimnames) dimnames(x) <- dimnames 325s + else dimnames(x) <- NULL 325s + 325s + count <- 0L 325s + for (rows in index_cases) { 325s + for (cols in index_cases) { 325s + count <- count + 1L 325s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 325s + useNames <- c(TRUE, FALSE) 325s + useNames <- useNames[count %% length(useNames) + 1] 325s + 325s + validateIndicesTestMatrix(x, rows, cols, 325s + ftest = rowMedians, fsure = rowMedians_R, 325s + na.rm = na.rm, useNames = useNames) 325s + validateIndicesTestMatrix(x, rows, cols, 325s + fcoltest = colMedians, fsure = rowMedians_R, 325s + na.rm = na.rm, useNames = useNames) 325s + } 325s + } 325s + } 326s > 326s 326s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 326s Copyright (C) 2025 The R Foundation for Statistical Computing 326s Platform: powerpc64le-unknown-linux-gnu 326s 326s R is free software and comes with ABSOLUTELY NO WARRANTY. 326s You are welcome to redistribute it under certain conditions. 326s Type 'license()' or 'licence()' for distribution details. 326s 326s R is a collaborative project with many contributors. 326s Type 'contributors()' for more information and 326s 'citation()' on how to cite R or R packages in publications. 326s 326s Type 'demo()' for some demos, 'help()' for on-line help, or 326s 'help.start()' for an HTML browser interface to help. 326s Type 'q()' to quit R. 326s 326s > library("matrixStats") 326s > library("stats") 326s > 326s > asWhich <- function(probs, max) { 326s + idx <- as.integer(round(probs * max)) 326s + if (idx < 1L) { 326s + idx <- 1L 326s + } else if (idx > max) { 326s + idx <- max 326s + } 326s + idx 326s + } # asWhich() 326s > 326s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 326s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 326s + 326s + # Remove Attributes 326s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 326s + ans 326s + } # rowOrderStats_R() 326s > 326s > 326s > set.seed(1) 326s > 326s > 326s > # Simulate data in a matrix of any shape 326s > nrow <- 60L 326s > ncol <- 30L 326s > x <- rnorm(nrow * ncol) 326s > dim(x) <- c(nrow, ncol) 326s > probs <- 0.3 326s > which <- asWhich(probs, max = ncol) 326s > 326s > y0 <- rowOrderStats_R(x, probs = probs) 326s > y1 <- rowOrderStats(x, which = which) 326s > stopifnot(all.equal(y1, y0)) 326s > y2 <- colOrderStats(t(x), which = which) 326s > stopifnot(all.equal(y2, y0)) 326s > 326s > 326s > 326s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 326s > # Consistency checks 326s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 326s > for (mode in c("integer", "double")) { 326s + cat("Consistency checks without NAs:\n") 326s + for (kk in 1:3) { 326s + cat("Random test #", kk, "\n", sep = "") 326s + 326s + # Simulate data in a matrix of any shape 326s + nrow <- sample(20L, size = 1L) 326s + ncol <- sample(20L, size = 1L) 326s + x <- rnorm(nrow * ncol) 326s + dim(x) <- c(nrow, ncol) 326s + 326s + cat("mode: ", mode, "\n", sep = "") 326s + storage.mode(x) <- mode 326s + str(x) 326s + 326s + probs <- runif(1) 326s + which <- asWhich(probs, max = ncol) 326s + 326s + y0 <- rowOrderStats_R(x, probs = probs) 326s + y1 <- rowOrderStats(x, which = which) 326s + stopifnot(all.equal(y1, y0)) 326s + y2 <- colOrderStats(t(x), which = which) 326s + stopifnot(all.equal(y2, y0)) 326s + } # for (kk in ...) 326s + } # for (mode ...) 326s Consistency checks without NAs: 326s Random test #1 326s mode: integer 326s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 326s Random test #2 326s mode: integer 326s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 326s Random test #3 326s mode: integer 326s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 326s Consistency checks without NAs: 326s Random test #1 326s mode: double 326s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 326s Random test #2 326s mode: double 326s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 326s Random test #3 326s mode: double 326s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 326s > 326s > 326s > # Check names attribute 326s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 326s > 326s > probs <- runif(1) 326s > which <- asWhich(probs, max = ncol(x)) 326s > 326s > dimnames <- list(letters[1:3], LETTERS[1:3]) 326s > 326s > # Test with and without dimnames on x 326s > for (setDimnames in c(TRUE, FALSE)) { 326s + if (setDimnames) dimnames(x) <- dimnames 326s + else dimnames(x) <- NULL 326s + # Check names attribute 326s + for (useNames in c(TRUE, FALSE)) { 326s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 326s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 326s + stopifnot(all.equal(y1, y0)) 326s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 326s + stopifnot(all.equal(y2, y0)) 326s + } 326s + } 326s > 326s 326s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 326s Copyright (C) 2025 The R Foundation for Statistical Computing 326s Platform: powerpc64le-unknown-linux-gnu 326s 326s R is free software and comes with ABSOLUTELY NO WARRANTY. 326s You are welcome to redistribute it under certain conditions. 326s Type 'license()' or 'licence()' for distribution details. 326s 326s R is a collaborative project with many contributors. 326s Type 'contributors()' for more information and 326s 'citation()' on how to cite R or R packages in publications. 326s 326s Type 'demo()' for some demos, 'help()' for on-line help, or 326s 'help.start()' for an HTML browser interface to help. 326s Type 'q()' to quit R. 326s 326s > library("matrixStats") 326s > 326s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 326s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 326s + 326s + # Remove Attributes 326s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 326s + ans 326s + } # rowOrderStats_R() 326s > 326s > 326s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 326s > # Subsetted tests 326s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 326s > source("utils/validateIndicesFramework.R") 326s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 326s > storage.mode(x) <- "integer" 326s > 326s > # To check names attribute 326s > dimnames <- list(letters[1:6], LETTERS[1:6]) 326s > 326s > probs <- 0.3 326s > # Test with and without dimnames on x 326s > for (setDimnames in c(TRUE, FALSE)) { 326s + if (setDimnames) dimnames(x) <- dimnames 326s + else dimnames(x) <- NULL 326s + for (rows in index_cases) { 326s + for (cols in index_cases) { 326s + # Check names attribute 326s + for (useNames in c(TRUE, FALSE)) { 326s + if (is.null(cols)) which <- round(probs * ncol(x)) 326s + else { 326s + xxrows <- rows 326s + suppressWarnings({ 326s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 326s + if (identical(xx, "error")) which <- 0L 326s + else which <- round(probs * ncol(xx)) 326s + }) 326s + } 326s + if (which == 0L) next 326s + 326s + validateIndicesTestMatrix(x, rows, cols, 326s + ftest = rowOrderStats, fsure = rowOrderStats_R, 326s + which = which, probs = probs, useNames = useNames) 326s + validateIndicesTestMatrix(x, rows, cols, 326s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 326s + which = which, probs = probs, useNames = useNames) 326s + } 326s + } 326s + } 326s + } 327s > 327s 327s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 327s Copyright (C) 2025 The R Foundation for Statistical Computing 327s Platform: powerpc64le-unknown-linux-gnu 327s 327s R is free software and comes with ABSOLUTELY NO WARRANTY. 327s You are welcome to redistribute it under certain conditions. 327s Type 'license()' or 'licence()' for distribution details. 327s 327s R is a collaborative project with many contributors. 327s Type 'contributors()' for more information and 327s 'citation()' on how to cite R or R packages in publications. 327s 327s Type 'demo()' for some demos, 'help()' for on-line help, or 327s 'help.start()' for an HTML browser interface to help. 327s Type 'q()' to quit R. 327s 327s > library("matrixStats") 327s > 327s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 327s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 327s + if (!useNames) names(res) <- NULL 327s + res 327s + } 327s > 327s > all.equal.na <- function(target, current, ...) { 327s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 327s + current[is.nan(current)] <- NA_real_ 327s + target[is.nan(target)] <- NA_real_ 327s + all.equal(target, current, ...) 327s + } 327s > 327s > for (mode in c("integer", "double")) { 327s + # Missing values 327s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 327s + cat("mode: ", mode, "\n", sep = "") 327s + storage.mode(x) <- mode 327s + str(x) 327s + 327s + # To check names attribute 327s + dimnames <- list(letters[1:4], LETTERS[1:2]) 327s + 327s + # Test with and without dimnames on x 327s + for (setDimnames in c(TRUE, FALSE)) { 327s + if (setDimnames) dimnames(x) <- dimnames 327s + else dimnames(x) <- NULL 327s + # Check names attribute 327s + for (useNames in c(TRUE, FALSE)) { 327s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 327s + print(y0) 327s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 327s + print(y1) 327s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 327s + print(y2) 327s + stopifnot(all.equal(y1, y0)) 327s + stopifnot(all.equal(y2, y1)) 327s + 327s + # Missing values 327s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 327s + print(y0) 327s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 327s + print(y1) 327s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 327s + print(y2) 327s + stopifnot(all.equal(y1, y0)) 327s + stopifnot(all.equal(y2, y1)) 327s + 327s + # "Empty" rows 327s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 327s + print(y0) 327s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 327s + print(y1) 327s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 327s + print(y2) 327s + stopifnot(all.equal.na(y1, y0)) 327s + stopifnot(all.equal(y2, y1)) 327s + stopifnot(length(y1) == 0L) 327s + 327s + # Using product() 327s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 327s + print(y1) 327s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 327s + print(y2) 327s + stopifnot(all.equal(y2, y1)) 327s + } 327s + } 327s + } # for (mode ...) 327s mode: integer 327s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 NA NA 0 327s a b c d 327s 1 NA NA 0 327s a b c d 327s 1 NA NA 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s a b c d 327s 1 NA NA 0 327s a b c d 327s 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s mode: double 327s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 0 1 0 327s a b c d 327s 1 NA NaN 0 327s a b c d 327s 1 NA NaN 0 327s a b c d 327s 1 NA NaN 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s a b c d 327s 1 NA NA 0 327s a b c d 327s 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 0 1 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s [1] 1 NA NaN 0 327s numeric(0) 327s numeric(0) 327s numeric(0) 327s [1] 1 NA NA 0 327s [1] 1 NA NA 0 327s > 327s > 327s > # Bug report 2012-06-25 327s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 327s > y0 <- rowProds_R(x) 327s > print(y0) 327s [1] 1 0 1 0 327s > y1 <- rowProds(x) 327s > print(y1) 327s [1] 1 0 1 0 327s > y2 <- colProds(t(x)) 327s > print(y2) 327s [1] 1 0 1 0 327s > stopifnot(all.equal.na(y1, y0)) 327s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 327s > stopifnot(all.equal.na(y2, y1)) 327s > # Check names attribute 327s > dimnames(x) <- dimnames 327s > y0 <- rowProds_R(x, useNames = TRUE) 327s > print(y0) 327s a b c d 327s 1 0 1 0 327s > y1 <- rowProds(x, useNames = TRUE) 327s > print(y1) 327s a b c d 327s 1 0 1 0 327s > y2 <- colProds(t(x), useNames = TRUE) 327s > print(y2) 327s a b c d 327s 1 0 1 0 327s > stopifnot(all.equal.na(y1, y0)) 327s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 327s > stopifnot(all.equal.na(y2, y1)) 327s > 327s > # Bug report 2014-03-25 ("all rows contains a zero") 327s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 327s > # To check names attribute 327s > dimnames <- list(letters[1:2], LETTERS[1:2]) 327s > y0 <- rowProds_R(x) 327s > print(y0) 327s [1] 0 0 327s > y1 <- rowProds(x) 327s > print(y1) 327s [1] 0 0 327s > y2 <- colProds(t(x)) 327s > print(y2) 327s [1] 0 0 327s > stopifnot(all.equal.na(y1, y0)) 327s > stopifnot(all.equal.na(y1, c(0, 0))) 327s > stopifnot(all.equal.na(y2, y1)) 327s > # Check names attribute 327s > dimnames(x) <- dimnames 327s > y0 <- rowProds_R(x, useNames = TRUE) 327s > print(y0) 327s a b 327s 0 0 327s > y1 <- rowProds(x, useNames = TRUE) 327s > print(y1) 327s a b 327s 0 0 327s > y2 <- colProds(t(x), useNames = TRUE) 327s > print(y2) 327s a b 327s 0 0 327s > stopifnot(all.equal.na(y1, y0)) 327s > stopifnot(all.equal.na(y2, y1)) 327s > 327s 327s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 327s Copyright (C) 2025 The R Foundation for Statistical Computing 327s Platform: powerpc64le-unknown-linux-gnu 327s 327s R is free software and comes with ABSOLUTELY NO WARRANTY. 327s You are welcome to redistribute it under certain conditions. 327s Type 'license()' or 'licence()' for distribution details. 327s 327s R is a collaborative project with many contributors. 327s Type 'contributors()' for more information and 327s 'citation()' on how to cite R or R packages in publications. 327s 327s Type 'demo()' for some demos, 'help()' for on-line help, or 327s 'help.start()' for an HTML browser interface to help. 327s Type 'q()' to quit R. 327s 327s > library("matrixStats") 327s > 327s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 327s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 327s + if (!useNames) names(res) <- NULL 327s + res 327s + } 327s > 327s > 327s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 327s > # Subsetted tests 327s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 327s > source("utils/validateIndicesFramework.R") 327s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 327s > storage.mode(x) <- "integer" 327s > 327s > # To check names attribute 327s > dimnames <- list(letters[1:6], LETTERS[1:6]) 327s > 327s > # Test with and without dimnames on x 327s > for (setDimnames in c(TRUE, FALSE)) { 327s + if (setDimnames) dimnames(x) <- dimnames 327s + else dimnames(x) <- NULL 327s + for (rows in index_cases) { 327s + for (cols in index_cases) { 327s + for (na.rm in c(TRUE, FALSE)) { 327s + for (useNames in c(TRUE, FALSE)) { 327s + validateIndicesTestMatrix(x, rows, cols, 327s + ftest = rowProds, fsure = rowProds_R, 327s + method = "expSumLog", 327s + FUN = product, na.rm = na.rm, useNames = useNames) 327s + validateIndicesTestMatrix(x, rows, cols, 327s + fcoltest = colProds, fsure = rowProds_R, 327s + method = "expSumLog", 327s + FUN = product, na.rm = na.rm, useNames = useNames) 327s + } 327s + } 327s + } 327s + } 327s + } 328s > 329s 329s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 329s Copyright (C) 2025 The R Foundation for Statistical Computing 329s Platform: powerpc64le-unknown-linux-gnu 329s 329s R is free software and comes with ABSOLUTELY NO WARRANTY. 329s You are welcome to redistribute it under certain conditions. 329s Type 'license()' or 'licence()' for distribution details. 329s 329s R is a collaborative project with many contributors. 329s Type 'contributors()' for more information and 329s 'citation()' on how to cite R or R packages in publications. 329s 329s Type 'demo()' for some demos, 'help()' for on-line help, or 329s 'help.start()' for an HTML browser interface to help. 329s Type 'q()' to quit R. 329s 329s > library("matrixStats") 329s > 329s > ## Create isFALSE() if running on an old version of R 329s > if (!exists("isFALSE", mode="function")) { 329s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 329s + } 329s > 329s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = TRUE) { 329s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 329s + if (!na.rm && any(is.na(x))) { 329s + na_value <- NA_real_ 329s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 329s + rep(na_value, times = length(probs)) 329s + } else { 329s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 329s + } 329s + }, probs = probs, na.rm = na.rm) 329s + 329s + if (!is.null(dim(q))) q <- t(q) 329s + else dim(q) <- c(nrow(x), length(probs)) 329s + 329s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 329s + rownames(q) <- rownames(x) 329s + if (isFALSE(useNames)) dimnames(q) <- NULL 329s + 329s + if (drop) q <- drop(q) 329s + q 329s + } 329s > 329s > 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > # Test with multiple quantiles 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > for (mode in c("logical", "integer", "double")) { 329s + cat("mode: ", mode, "\n", sep = "") 329s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 329s + storage.mode(x) <- mode 329s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 329s + str(x) 329s + 329s + probs <- c(0, 0.5, 1) 329s + # Test with and without dimnames on x 329s + for (setDimnames in c(TRUE, FALSE)) { 329s + if (setDimnames) dimnames(x) <- dimnames 329s + else dimnames(x) <- NULL 329s + # Check names attribute 329s + for (useNames in c(TRUE, FALSE)) { 329s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 329s + print(q0) 329s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 329s + print(q1) 329s + stopifnot(all.equal(q1, q0)) 329s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 329s + stopifnot(all.equal(q2, q0)) 329s + } 329s + } 329s + } # for (mode ...) 329s mode: logical 329s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 329s 0% 50% 100% 329s a 1 1 1 329s b 1 1 1 329s c 1 1 1 329s d 1 1 1 329s e 1 1 1 329s f 1 1 1 329s g 1 1 1 329s h 1 1 1 329s 0% 50% 100% 329s a 1 1 1 329s b 1 1 1 329s c 1 1 1 329s d 1 1 1 329s e 1 1 1 329s f 1 1 1 329s g 1 1 1 329s h 1 1 1 329s [,1] [,2] [,3] 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s [,1] [,2] [,3] 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s 0% 50% 100% 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s 0% 50% 100% 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s [,1] [,2] [,3] 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s [,1] [,2] [,3] 329s [1,] 1 1 1 329s [2,] 1 1 1 329s [3,] 1 1 1 329s [4,] 1 1 1 329s [5,] 1 1 1 329s [6,] 1 1 1 329s [7,] 1 1 1 329s [8,] 1 1 1 329s mode: integer 329s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 329s 0% 50% 100% 329s a 1 17 33 329s b 2 18 34 329s c 3 19 35 329s d 4 20 36 329s e 5 21 37 329s f 6 22 38 329s g 7 23 39 329s h 8 24 40 329s 0% 50% 100% 329s a 1 17 33 329s b 2 18 34 329s c 3 19 35 329s d 4 20 36 329s e 5 21 37 329s f 6 22 38 329s g 7 23 39 329s h 8 24 40 329s [,1] [,2] [,3] 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s [,1] [,2] [,3] 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s 0% 50% 100% 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s 0% 50% 100% 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s [,1] [,2] [,3] 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s [,1] [,2] [,3] 329s [1,] 1 17 33 329s [2,] 2 18 34 329s [3,] 3 19 35 329s [4,] 4 20 36 329s [5,] 5 21 37 329s [6,] 6 22 38 329s [7,] 7 23 39 329s [8,] 8 24 40 329s mode: double 329s num [1:8, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 329s 0% 50% 100% 329s a 1.1 17.1 33.1 329s b 2.1 18.1 34.1 329s c 3.1 19.1 35.1 329s d 4.1 20.1 36.1 329s e 5.1 21.1 37.1 329s f 6.1 22.1 38.1 329s g 7.1 23.1 39.1 329s h 8.1 24.1 40.1 329s 0% 50% 100% 329s a 1.1 17.1 33.1 329s b 2.1 18.1 34.1 329s c 3.1 19.1 35.1 329s d 4.1 20.1 36.1 329s e 5.1 21.1 37.1 329s f 6.1 22.1 38.1 329s g 7.1 23.1 39.1 329s h 8.1 24.1 40.1 329s [,1] [,2] [,3] 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s [,1] [,2] [,3] 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s 0% 50% 100% 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s 0% 50% 100% 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s [,1] [,2] [,3] 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s [,1] [,2] [,3] 329s [1,] 1.1 17.1 33.1 329s [2,] 2.1 18.1 34.1 329s [3,] 3.1 19.1 35.1 329s [4,] 4.1 20.1 36.1 329s [5,] 5.1 21.1 37.1 329s [6,] 6.1 22.1 38.1 329s [7,] 7.1 23.1 39.1 329s [8,] 8.1 24.1 40.1 329s > 329s > 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > # Test with a single quantile 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > for (mode in c("logical", "integer", "double")) { 329s + cat("mode: ", mode, "\n", sep = "") 329s + x <- matrix(1:40, nrow = 8, ncol = 5) 329s + storage.mode(x) <- mode 329s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 329s + str(x) 329s + 329s + probs <- c(0.5) 329s + # Test with and without dimnames on x 329s + for (setDimnames in c(TRUE, FALSE)) { 329s + if (setDimnames) dimnames(x) <- dimnames 329s + else dimnames(x) <- NULL 329s + # Check names attribute 329s + for (useNames in c(TRUE, FALSE)) { 329s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 329s + print(q0) 329s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 329s + print(q1) 329s + stopifnot(all.equal(q1, q0)) 329s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 329s + stopifnot(all.equal(q2, q0)) 329s + } 329s + } 329s + } # for (mode ...) 329s mode: logical 329s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 329s a b c d e f g h 329s 1 1 1 1 1 1 1 1 329s a b c d e f g h 329s 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s [1] 1 1 1 1 1 1 1 1 329s mode: integer 329s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 329s a b c d e f g h 329s 17 18 19 20 21 22 23 24 329s a b c d e f g h 329s 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s mode: double 329s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 329s a b c d e f g h 329s 17 18 19 20 21 22 23 24 329s a b c d e f g h 329s 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s [1] 17 18 19 20 21 22 23 24 329s > 329s > 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > # Consistency checks 329s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 329s > set.seed(1) 329s > 329s > probs <- seq(from = 0, to = 1, by = 0.25) 329s > 329s > cat("Consistency checks:\n") 329s Consistency checks: 329s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 329s > for (kk in seq_len(n_sims)) { 329s + cat("Random test #", kk, "\n", sep = "") 329s + 329s + # Simulate data in a matrix of any shape 329s + dim <- sample(20:60, size = 2L) 329s + n <- prod(dim) 329s + x <- rnorm(n, sd = 100) 329s + dim(x) <- dim 329s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 329s + 329s + # Add NAs? 329s + has_na <- ((kk %% 2) == 0L) 329s + if (has_na) { 329s + cat("Adding NAs\n") 329s + nna <- sample(n, size = 1) 329s + na_values <- c(NA_real_, NaN) 329s + t <- sample(na_values, size = nna, replace = TRUE) 329s + x[sample(length(x), size = nna)] <- t 329s + } 329s + 329s + # Logical, integer, or double? 329s + mode <- "numeric" 329s + if ((kk %% 6) %in% 1:2) { 329s + cat("Coercing to logical\n") 329s + mode <- "logical" 329s + } else if ((kk %% 6) %in% 3:4) { 329s + cat("Coercing to integers\n") 329s + mode <- "integer" 329s + } 329s + storage.mode(x) <- mode 329s + 329s + str(x) 329s + 329s + # rowQuantiles(): 329s + for (type in 1:9) { 329s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 329s + # Test with and without dimnames on x 329s + for (setDimnames in c(TRUE, FALSE)) { 329s + if (setDimnames) dimnames(x) <- dimnames 329s + else dimnames(x) <- NULL 329s + # Check names attribute 329s + for (useNames in c(TRUE, FALSE)) { 329s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 329s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 329s + stopifnot(all.equal(q1, q0)) 329s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 329s + stopifnot(all.equal(q2, q0)) 329s + } 329s + } 329s + } 329s + } # for (kk ...) 329s Random test #1 329s Coercing to logical 329s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 329s type=1, has_na=FALSE: 329s type=2, has_na=FALSE: 329s type=3, has_na=FALSE: 329s type=4, has_na=FALSE: 329s type=5, has_na=FALSE: 329s type=6, has_na=FALSE: 329s type=7, has_na=FALSE: 329s type=8, has_na=FALSE: 329s type=9, has_na=FALSE: 329s Random test #2 329s Adding NAs 329s Coercing to logical 329s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 329s type=1, has_na=TRUE: 329s type=2, has_na=TRUE: 329s type=3, has_na=TRUE: 329s type=4, has_na=TRUE: 329s type=5, has_na=TRUE: 329s type=6, has_na=TRUE: 330s type=7, has_na=TRUE: 330s type=8, has_na=TRUE: 330s type=9, has_na=TRUE: 330s Random test #3 330s Coercing to integers 330s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 330s type=1, has_na=FALSE: 330s type=2, has_na=FALSE: 330s type=3, has_na=FALSE: 330s type=4, has_na=FALSE: 330s type=5, has_na=FALSE: 330s type=6, has_na=FALSE: 330s type=7, has_na=FALSE: 330s type=8, has_na=FALSE: 330s type=9, has_na=FALSE: 330s Random test #4 330s Adding NAs 330s Coercing to integers 330s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 330s type=1, has_na=TRUE: 330s type=2, has_na=TRUE: 330s type=3, has_na=TRUE: 330s type=4, has_na=TRUE: 330s type=5, has_na=TRUE: 330s type=6, has_na=TRUE: 331s type=7, has_na=TRUE: 331s type=8, has_na=TRUE: 331s type=9, has_na=TRUE: 331s Random test #5 331s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 331s type=1, has_na=FALSE: 331s type=2, has_na=FALSE: 331s type=3, has_na=FALSE: 331s type=4, has_na=FALSE: 331s type=5, has_na=FALSE: 331s type=6, has_na=FALSE: 331s type=7, has_na=FALSE: 331s type=8, has_na=FALSE: 331s type=9, has_na=FALSE: 331s Random test #6 331s Adding NAs 331s num [1:46, 1:22] 197 -107 15 148 -110 ... 331s type=1, has_na=TRUE: 331s type=2, has_na=TRUE: 331s type=3, has_na=TRUE: 331s type=4, has_na=TRUE: 331s type=5, has_na=TRUE: 332s type=6, has_na=TRUE: 332s type=7, has_na=TRUE: 332s type=8, has_na=TRUE: 332s type=9, has_na=TRUE: 332s Random test #7 332s Coercing to logical 332s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 332s type=1, has_na=FALSE: 332s type=2, has_na=FALSE: 332s type=3, has_na=FALSE: 332s type=4, has_na=FALSE: 332s type=5, has_na=FALSE: 332s type=6, has_na=FALSE: 332s type=7, has_na=FALSE: 332s type=8, has_na=FALSE: 332s type=9, has_na=FALSE: 332s Random test #8 332s Adding NAs 332s Coercing to logical 332s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 332s type=1, has_na=TRUE: 332s type=2, has_na=TRUE: 332s type=3, has_na=TRUE: 332s type=4, has_na=TRUE: 332s type=5, has_na=TRUE: 332s type=6, has_na=TRUE: 332s type=7, has_na=TRUE: 332s type=8, has_na=TRUE: 332s type=9, has_na=TRUE: 332s Random test #9 332s Coercing to integers 332s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 332s type=1, has_na=FALSE: 332s type=2, has_na=FALSE: 333s type=3, has_na=FALSE: 333s type=4, has_na=FALSE: 333s type=5, has_na=FALSE: 333s type=6, has_na=FALSE: 333s type=7, has_na=FALSE: 333s type=8, has_na=FALSE: 333s type=9, has_na=FALSE: 333s Random test #10 333s Adding NAs 333s Coercing to integers 333s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 333s type=1, has_na=TRUE: 333s type=2, has_na=TRUE: 333s type=3, has_na=TRUE: 333s type=4, has_na=TRUE: 333s type=5, has_na=TRUE: 333s type=6, has_na=TRUE: 333s type=7, has_na=TRUE: 333s type=8, has_na=TRUE: 333s type=9, has_na=TRUE: 334s Random test #11 334s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 334s type=1, has_na=FALSE: 334s type=2, has_na=FALSE: 334s type=3, has_na=FALSE: 334s type=4, has_na=FALSE: 334s type=5, has_na=FALSE: 334s type=6, has_na=FALSE: 334s type=7, has_na=FALSE: 334s type=8, has_na=FALSE: 334s type=9, has_na=FALSE: 334s Random test #12 334s Adding NAs 334s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 334s type=1, has_na=TRUE: 334s type=2, has_na=TRUE: 334s type=3, has_na=TRUE: 334s type=4, has_na=TRUE: 334s type=5, has_na=TRUE: 335s type=6, has_na=TRUE: 335s type=7, has_na=TRUE: 335s type=8, has_na=TRUE: 335s type=9, has_na=TRUE: 335s Random test #13 335s Coercing to logical 335s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 335s type=1, has_na=FALSE: 335s type=2, has_na=FALSE: 335s type=3, has_na=FALSE: 335s type=4, has_na=FALSE: 335s type=5, has_na=FALSE: 335s type=6, has_na=FALSE: 335s type=7, has_na=FALSE: 335s type=8, has_na=FALSE: 335s type=9, has_na=FALSE: 335s Random test #14 335s Adding NAs 335s Coercing to logical 335s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 335s type=1, has_na=TRUE: 335s type=2, has_na=TRUE: 335s type=3, has_na=TRUE: 336s type=4, has_na=TRUE: 336s type=5, has_na=TRUE: 336s type=6, has_na=TRUE: 336s type=7, has_na=TRUE: 336s type=8, has_na=TRUE: 336s type=9, has_na=TRUE: 336s Random test #15 336s Coercing to integers 336s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 336s type=1, has_na=FALSE: 336s type=2, has_na=FALSE: 336s type=3, has_na=FALSE: 336s type=4, has_na=FALSE: 336s type=5, has_na=FALSE: 336s type=6, has_na=FALSE: 336s type=7, has_na=FALSE: 336s type=8, has_na=FALSE: 336s type=9, has_na=FALSE: 336s Random test #16 336s Adding NAs 336s Coercing to integers 336s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 336s type=1, has_na=TRUE: 336s type=2, has_na=TRUE: 336s type=3, has_na=TRUE: 336s type=4, has_na=TRUE: 336s type=5, has_na=TRUE: 336s type=6, has_na=TRUE: 336s type=7, has_na=TRUE: 336s type=8, has_na=TRUE: 336s type=9, has_na=TRUE: 336s Random test #17 336s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 336s type=1, has_na=FALSE: 337s type=2, has_na=FALSE: 337s type=3, has_na=FALSE: 337s type=4, has_na=FALSE: 337s type=5, has_na=FALSE: 337s type=6, has_na=FALSE: 337s type=7, has_na=FALSE: 337s type=8, has_na=FALSE: 337s type=9, has_na=FALSE: 337s Random test #18 337s Adding NAs 337s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 337s type=1, has_na=TRUE: 337s type=2, has_na=TRUE: 337s type=3, has_na=TRUE: 337s type=4, has_na=TRUE: 337s type=5, has_na=TRUE: 337s type=6, has_na=TRUE: 337s type=7, has_na=TRUE: 337s type=8, has_na=TRUE: 338s type=9, has_na=TRUE: 338s Random test #19 338s Coercing to logical 338s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 338s type=1, has_na=FALSE: 338s type=2, has_na=FALSE: 338s type=3, has_na=FALSE: 338s type=4, has_na=FALSE: 338s type=5, has_na=FALSE: 338s type=6, has_na=FALSE: 338s type=7, has_na=FALSE: 338s type=8, has_na=FALSE: 338s type=9, has_na=FALSE: 338s Random test #20 338s Adding NAs 338s Coercing to logical 338s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 338s type=1, has_na=TRUE: 338s type=2, has_na=TRUE: 338s type=3, has_na=TRUE: 338s type=4, has_na=TRUE: 338s type=5, has_na=TRUE: 338s type=6, has_na=TRUE: 338s type=7, has_na=TRUE: 338s type=8, has_na=TRUE: 338s type=9, has_na=TRUE: 338s Random test #21 338s Coercing to integers 338s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 338s type=1, has_na=FALSE: 339s type=2, has_na=FALSE: 339s type=3, has_na=FALSE: 339s type=4, has_na=FALSE: 339s type=5, has_na=FALSE: 339s type=6, has_na=FALSE: 339s type=7, has_na=FALSE: 339s type=8, has_na=FALSE: 339s type=9, has_na=FALSE: 339s Random test #22 339s Adding NAs 339s Coercing to integers 339s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 339s type=1, has_na=TRUE: 339s type=2, has_na=TRUE: 339s type=3, has_na=TRUE: 339s type=4, has_na=TRUE: 339s type=5, has_na=TRUE: 339s type=6, has_na=TRUE: 340s type=7, has_na=TRUE: 340s type=8, has_na=TRUE: 340s type=9, has_na=TRUE: 340s Random test #23 340s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 340s type=1, has_na=FALSE: 340s type=2, has_na=FALSE: 340s type=3, has_na=FALSE: 340s type=4, has_na=FALSE: 340s type=5, has_na=FALSE: 340s type=6, has_na=FALSE: 340s type=7, has_na=FALSE: 340s type=8, has_na=FALSE: 340s type=9, has_na=FALSE: 340s Random test #24 340s Adding NAs 340s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 340s type=1, has_na=TRUE: 340s type=2, has_na=TRUE: 340s type=3, has_na=TRUE: 340s type=4, has_na=TRUE: 340s type=5, has_na=TRUE: 340s type=6, has_na=TRUE: 340s type=7, has_na=TRUE: 340s type=8, has_na=TRUE: 341s type=9, has_na=TRUE: 341s > 341s > 341s > 341s > for (mode in c("logical", "integer", "double")) { 341s + naValue <- NA_real_ 341s + storage.mode(naValue) <- mode 341s + 341s + someValue <- 1 341s + storage.mode(someValue) <- mode 341s + 341s + for (type in 1:9) { 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + # All NA 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 341s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + # Test with and without dimnames on x 341s + for (setDimnames in c(TRUE, FALSE)) { 341s + if (setDimnames) dimnames(x) <- dimnames 341s + else dimnames(x) <- NULL 341s + # Check names attribute 341s + for (useNames in c(TRUE, FALSE)) { 341s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 341s + 341s + qr <- rowQuantiles(x, type = type, useNames = useNames) 341s + stopifnot(identical(qr, qr0)) 341s + 341s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 341s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 341s + 341s + stopifnot(identical(qc, qr)) 341s + } 341s + } 341s + 341s + 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + # Empty matrices 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + probs <- c(0, 0.25, 0.75, 1) 341s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 341s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 341s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 341s + 341s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 341s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 341s + 341s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 341s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 341s + 341s + 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + # Single column matrices 341s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s + probs <- c(0, 0.25, 0.75, 1) 341s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 341s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + print(qr) 341s + 341s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 341s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 341s + print(qc) 341s + 341s + stopifnot(identical(qc, qr)) 341s + } 341s + } 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s 0% 25% 75% 100% 341s a 1 1 1 1 341s b 1 1 1 1 341s > 341s 341s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 341s Copyright (C) 2025 The R Foundation for Statistical Computing 341s Platform: powerpc64le-unknown-linux-gnu 341s 341s R is free software and comes with ABSOLUTELY NO WARRANTY. 341s You are welcome to redistribute it under certain conditions. 341s Type 'license()' or 'licence()' for distribution details. 341s 341s R is a collaborative project with many contributors. 341s Type 'contributors()' for more information and 341s 'citation()' on how to cite R or R packages in publications. 341s 341s Type 'demo()' for some demos, 'help()' for on-line help, or 341s 'help.start()' for an HTML browser interface to help. 341s Type 'q()' to quit R. 341s 341s > library("matrixStats") 341s > 341s > ## Create isFALSE() if running on an old version of R 341s > if (!exists("isFALSE", mode="function")) { 341s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 341s + } 341s > 341s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = TRUE) { 341s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 341s + if (!na.rm && any(is.na(x))) { 341s + na_value <- NA_real_ 341s + storage.mode(na_value) <- storage.mode(x) 341s + rep(na_value, times = length(probs)) 341s + 341s + } else { 341s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 341s + } 341s + }, probs = probs, na.rm = na.rm) 341s + 341s + if (!is.null(dim(q))) q <- t(q) 341s + else dim(q) <- c(nrow(x), length(probs)) 341s + 341s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 341s + rownames(q) <- rownames(x) 341s + if (isFALSE(useNames)) dimnames(q) <- NULL 341s + 341s + if (drop) q <- drop(q) 341s + q 341s + } 341s > 341s > 341s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s > # Subsetted tests 341s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 341s > source("utils/validateIndicesFramework.R") 341s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 341s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 341s > probs <- c(0, 0.25, 0.75, 1) 341s > # Test with and without dimnames on x 341s > for (setDimnames in c(TRUE, FALSE)) { 341s + if (setDimnames) dimnames(x) <- dimnames 341s + else dimnames(x) <- NULL 341s + 341s + count <- 0L 341s + for (rows in index_cases) { 341s + for (cols in index_cases) { 341s + count <- count + 1L 341s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 341s + useNames <- c(TRUE, FALSE) 341s + useNames <- useNames[count %% length(useNames) + 1] 341s + 341s + validateIndicesTestMatrix(x, rows, cols, 341s + ftest = rowQuantiles, fsure = rowQuantiles_R, 341s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 341s + validateIndicesTestMatrix(x, rows, cols, 341s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 341s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 341s + } 341s + } 341s + } 342s > 342s > 342s 342s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 342s Copyright (C) 2025 The R Foundation for Statistical Computing 342s Platform: powerpc64le-unknown-linux-gnu 342s 342s R is free software and comes with ABSOLUTELY NO WARRANTY. 342s You are welcome to redistribute it under certain conditions. 342s Type 'license()' or 'licence()' for distribution details. 342s 342s R is a collaborative project with many contributors. 342s Type 'contributors()' for more information and 342s 'citation()' on how to cite R or R packages in publications. 342s 342s Type 'demo()' for some demos, 'help()' for on-line help, or 342s 'help.start()' for an HTML browser interface to help. 342s Type 'q()' to quit R. 342s 342s > library("matrixStats") 342s > 342s > rowMins_R <- function(x, ..., useNames = TRUE) { 342s + suppressWarnings({ 342s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 342s + }) 342s + if (!useNames) names(res) <- NULL 342s + res 342s + } # rowMins_R() 342s > 342s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 342s + suppressWarnings({ 342s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 342s + }) 342s + if (!useNames) names(res) <- NULL 342s + res 342s + } # rowMaxs_R() 342s > 342s > rowRanges_R <- function(x, ..., useNames = TRUE) { 342s + suppressWarnings({ 342s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 342s + }) 342s + 342s + # Preserve rownames attribute 342s + dim <- c(dim(x)[1], 2L) 342s + if (!isTRUE(all.equal(dim(ans), dim))) { 342s + dim(ans) <- dim 342s + rownames <- rownames(x) 342s + if (!is.null(dimnames)) rownames(ans) <- rownames 342s + } 342s + if (!useNames) dimnames(ans) <- NULL 342s + ans 342s + } # rowRanges_R() 342s > 342s > 342s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 342s > # With and without some NAs 342s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 342s > for (mode in c("integer", "double")) { 342s + cat("mode: ", mode, "\n", sep = "") 342s + 342s + for (add_na in c(FALSE, TRUE)) { 342s + cat("add_na = ", add_na, "\n", sep = "") 342s + 342s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 342s + if (add_na) { 342s + x[3:7, c(2, 4)] <- NA_real_ 342s + } 342s + storage.mode(x) <- mode 342s + str(x) 342s + 342s + # To check names attribute 342s + dimnames <- list(letters[1:10], LETTERS[1:5]) 342s + 342s + # Test with and without dimnames on x 342s + for (setDimnames in c(TRUE, FALSE)) { 342s + if (setDimnames) dimnames(x) <- dimnames 342s + else dimnames(x) <- NULL 342s + # Row/column extremes 342s + for (na.rm in c(FALSE, TRUE)) { 342s + # Check names attribute 342s + for (useNames in c(TRUE, FALSE)) { 342s + cat("na.rm = ", na.rm, "\n", sep = "") 342s + 342s + # Ranges 342s + cat("range:\n") 342s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 342s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 342s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 342s + stopifnot(all.equal(r1, r2)) 342s + stopifnot(all.equal(r1, r0)) 342s + 342s + # Min 342s + cat("min:\n") 342s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 342s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 342s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 342s + stopifnot(all.equal(m1, m2)) 342s + stopifnot(all.equal(m1, m0)) 342s + 342s + # Max 342s + cat("max:\n") 342s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 342s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 342s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 342s + stopifnot(all.equal(m1, m2)) 342s + stopifnot(all.equal(m1, m0)) 342s + } 342s + } 342s + } 342s + } # for (add_na ...) 342s + } # for (mode ...) 343s mode: integer 343s add_na = FALSE 343s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s add_na = TRUE 343s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s mode: double 343s add_na = FALSE 343s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s add_na = TRUE 343s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = FALSE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s na.rm = TRUE 343s range: 343s min: 343s max: 343s > 343s > 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > # All NAs 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > for (mode in c("integer", "double")) { 343s + cat("mode: ", mode, "\n", sep = "") 343s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 343s + storage.mode(x) <- mode 343s + str(x) 343s + 343s + # Test with and without dimnames on x 343s + for (setDimnames in c(TRUE, FALSE)) { 343s + if (setDimnames) dimnames(x) <- dimnames 343s + else dimnames(x) <- NULL 343s + for (na.rm in c(FALSE, TRUE)) { 343s + # Check names attribute 343s + for (useNames in c(TRUE, FALSE)) { 343s + cat("na.rm = ", na.rm, "\n", sep = "") 343s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 343s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 343s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 343s + stopifnot(all.equal(r1, r2)) 343s + stopifnot(all.equal(r1, r0)) 343s + } 343s + } 343s + } 343s + } # for (mode ...) 343s mode: integer 343s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 343s na.rm = FALSE 343s na.rm = FALSE 343s na.rm = TRUE 343s na.rm = TRUE 343s na.rm = FALSE 343s na.rm = FALSE 343s na.rm = TRUE 343s na.rm = TRUE 343s mode: double 343s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 343s na.rm = FALSE 343s na.rm = FALSE 343s na.rm = TRUE 343s na.rm = TRUE 343s na.rm = FALSE 343s na.rm = FALSE 343s na.rm = TRUE 343s na.rm = TRUE 343s > 343s > 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > # Special cases 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > # Nx0 matrix 343s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 343s > r0 <- rowRanges_R(x) 343s > #r1 <- rowRanges(x) 343s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 343s > #stopifnot(all.equal(r1, r_truth)) 343s > 343s > # 0xN matrix 343s > x <- t(x) 343s > #r1 <- colRanges(x) 343s > #stopifnot(all.equal(r1, r_truth)) 343s > 343s > # Nx1 matrix 343s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 343s > # To check names attribute 343s > dimnames <- list(letters[1:5], "A") 343s > r1 <- rowRanges(x) 343s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 343s > stopifnot(all.equal(r1, r_truth)) 343s > # Check names attribute 343s > dimnames(x) <- dimnames 343s > r0 <- rowRanges_R(x, useNames = TRUE) 343s > r1 <- rowRanges(x, useNames = TRUE) 343s > stopifnot(all.equal(r1, r0)) 343s > dimnames(x) <- NULL 343s > 343s > # 1xN matrix 343s > x <- t(x) 343s > r1 <- colRanges(x) 343s > stopifnot(all.equal(r1, r_truth)) 343s > # Check names attribute 343s > dimnames(x) <- list("a", LETTERS[1:5]) 343s > r1 <- colRanges(x, useNames = TRUE) 343s > stopifnot(identical(rownames(r1), colnames(x))) 343s > 343s > 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 343s > 343s > na_list <- list( 343s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 343s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 343s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 343s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 343s + ) 343s > 343s > na <- na_list[["real"]] 343s > na[2, 2] <- NA 343s > na_list[["real + NA cell"]] <- na 343s > 343s > na <- na_list[["real"]] 343s > na[2, ] <- NA 343s > na_list[["real + NA row"]] <- na 343s > 343s > na <- na_list[["real"]] 343s > na[2, ] <- NaN 343s > na_list[["real + NaN row"]] <- na 343s > 343s > na <- na_list[["real"]] 343s > na[2, 2] <- Inf 343s > na_list[["real + Inf cell"]] <- na 343s > 343s > na <- na_list[["real"]] 343s > na[2, ] <- Inf 343s > na_list[["real + Inf row"]] <- na 343s > 343s > na <- na_list[["real"]] 343s > na[2, 2] <- NaN 343s > na_list[["real + NaN cell"]] <- na 343s > 343s > na <- na_list[["real w/ NA"]] 343s > na[2, 2] <- NaN 343s > na_list[["real w/ NA + NaN cell"]] <- na 343s > 343s > na <- na_list[["real w/ NA"]] 343s > na[2, ] <- NaN 343s > na_list[["real w/ NA + NaN row"]] <- na 343s > 343s > # To check names attribute 343s > dimnames <- list(letters[1:4], LETTERS[1:3]) 343s > 343s > # Test with and without dimnames on x 343s > for (setDimnames in c(TRUE, FALSE)) { 343s + if (setDimnames) dimnames(x) <- dimnames 343s + else dimnames(x) <- NULL 343s + for (na.rm in c(FALSE, TRUE)) { 343s + for (name in names(na_list)) { 343s + # Check names attribute 343s + for (useNames in c(TRUE, FALSE)) { 343s + na <- na_list[[name]] 343s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 343s + print(na) 343s + 343s + cat(" min:\n") 343s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 343s + str(y0) 343s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 343s + str(y1) 343s + stopifnot(all.equal(y1, y0)) 343s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 343s + str(y1c) 343s + stopifnot(all.equal(y1c, y1)) 343s + 343s + cat(" max:\n") 343s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 343s + str(y0) 343s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 343s + str(y1) 343s + stopifnot(all.equal(y1, y0)) 343s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 343s + str(y1c) 343s + stopifnot(all.equal(y1c, y1)) 343s + 343s + cat(" range:\n") 343s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 343s + str(y0) 343s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 343s + str(y1) 343s + stopifnot(all.equal(y1, y0)) 343s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 343s + str(y1c) 343s + stopifnot(all.equal(y1c, y1)) 343s + } 343s + } # for (name ...) 343s + } # for (na.rm ...) 343s + } 343s integer (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer w/ NA (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s max: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s range: 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s integer w/ NA (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s max: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s range: 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real + NA cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + Inf cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s max: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s range: 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s real w/ NA + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s max: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s range: 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s integer (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer w/ NA (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s integer w/ NA (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real + NA cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NA cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NA row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NA row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s integer (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer w/ NA (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s max: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s range: 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s integer w/ NA (integer) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s max: 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s int [1:4] NA NA NA NA 343s range: 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s int [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real + NA cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NA row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s num [1:4] 1 NA 3 4 343s max: 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s num [1:4] 9 NA 11 12 343s range: 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 343s real + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + Inf cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s num [1:4] 1 NaN 3 4 343s max: 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s num [1:4] 9 NaN 11 12 343s range: 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 343s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s max: 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s num [1:4] NA NA NA NA 343s range: 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s num [1:4, 1:2] NA NA NA NA NA NA NA NA 343s real w/ NA + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s max: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s range: 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s real w/ NA + NaN row (double) w/ na.rm = FALSE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s max: 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s num [1:4] NA NaN NA NA 343s range: 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 343s integer (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s int [1:4] 1 2 3 4 343s max: 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s int [1:4] 9 10 11 12 343s range: 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s int [1:4, 1:2] 1 2 3 4 9 10 11 12 343s integer w/ NA (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s integer w/ NA (integer) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 6 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NA NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real + NA cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NA cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NA 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NA row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NA row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NA NA NA 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] NaN NaN NaN 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s num [1:4] 9 -Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 Inf 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s num [1:4, 1:2] 1 2 3 4 9 ... 343s real + Inf row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + Inf row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] Inf Inf Inf 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s num [1:4] 1 Inf 3 4 343s max: 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s num [1:4] 9 Inf 11 12 343s range: 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s num [1:4, 1:2] 1 Inf 3 4 9 ... 343s real + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] 1 5 9 343s [2,] 2 NaN 10 343s [3,] 3 7 11 343s [4,] 4 8 12 343s min: 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s num [1:4] 1 2 3 4 343s max: 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s num [1:4] 9 10 11 12 343s range: 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s num [1:4, 1:2] 1 2 3 4 9 10 11 12 343s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NA NaN NA 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s real w/ NA + NaN row (double) w/ na.rm = TRUE: 343s [,1] [,2] [,3] 343s [1,] NA NA NA 343s [2,] NaN NaN NaN 343s [3,] NA NA NA 343s [4,] NA NA NA 343s min: 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s num [1:4] Inf Inf Inf Inf 343s max: 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s num [1:4] -Inf -Inf -Inf -Inf 343s range: 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 343s > 343s 343s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 343s Copyright (C) 2025 The R Foundation for Statistical Computing 343s Platform: powerpc64le-unknown-linux-gnu 343s 343s R is free software and comes with ABSOLUTELY NO WARRANTY. 343s You are welcome to redistribute it under certain conditions. 343s Type 'license()' or 'licence()' for distribution details. 343s 343s R is a collaborative project with many contributors. 343s Type 'contributors()' for more information and 343s 'citation()' on how to cite R or R packages in publications. 343s 343s Type 'demo()' for some demos, 'help()' for on-line help, or 343s 'help.start()' for an HTML browser interface to help. 343s Type 'q()' to quit R. 343s 343s > library("matrixStats") 343s > 343s > rowMins_R <- function(x, ..., useNames = TRUE) { 343s + suppressWarnings({ 343s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 343s + }) 343s + if (!useNames) names(res) <- NULL 343s + res 343s + } # rowMins_R() 343s > 343s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 343s + suppressWarnings({ 343s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 343s + }) 343s + if (!useNames) names(res) <- NULL 343s + res 343s + } # rowMaxs_R() 343s > 343s > rowRanges_R <- function(x, ..., useNames = TRUE) { 343s + suppressWarnings({ 343s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 343s + }) 343s + 343s + # Preserve rownames attribute 343s + dim <- c(dim(x)[1], 2L) 343s + if (!isTRUE(all.equal(dim(ans), dim))) { 343s + dim(ans) <- dim 343s + rownames <- rownames(x) 343s + if (!is.null(dimnames)) rownames(ans) <- rownames 343s + } 343s + if (!useNames) dimnames(ans) <- NULL 343s + ans 343s + } # rowRanges_R() 343s > 343s > 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > # Subsetted tests 343s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 343s > source("utils/validateIndicesFramework.R") 343s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 343s > storage.mode(x) <- "integer" 343s > 343s > # To check rownames/names attributes 343s > dimnames <- list(letters[1:6], LETTERS[1:6]) 343s > 343s > # Test with and without dimnames on x 343s > for (setDimnames in c(TRUE, FALSE)) { 343s + if (setDimnames) dimnames(x) <- dimnames 343s + else dimnames(x) <- NULL 343s + 343s + count <- 0L 343s + for (rows in index_cases) { 343s + for (cols in index_cases) { 343s + count <- count + 1L 343s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 343s + useNames <- c(TRUE, FALSE) 343s + useNames <- useNames[count %% length(useNames) + 1] 343s + 343s + validateIndicesTestMatrix(x, rows, cols, 343s + ftest = rowRanges, fsure = rowRanges_R, 343s + na.rm = na.rm, useNames = useNames) 343s + validateIndicesTestMatrix(x, rows, cols, 343s + ftest = rowMins, fsure = rowMins_R, 343s + na.rm = na.rm, useNames = useNames) 343s + validateIndicesTestMatrix(x, rows, cols, 343s + ftest = rowMaxs, fsure = rowMaxs_R, 343s + na.rm = na.rm, useNames = useNames) 343s + 343s + validateIndicesTestMatrix(x, rows, cols, 343s + fcoltest = colRanges, fsure = rowRanges_R, 343s + na.rm = na.rm, useNames = useNames) 343s + validateIndicesTestMatrix(x, rows, cols, 343s + fcoltest = colMins, fsure = rowMins_R, 343s + na.rm = na.rm, useNames = useNames) 343s + validateIndicesTestMatrix(x, rows, cols, 343s + fcoltest = colMaxs, fsure = rowMaxs_R, 343s + na.rm = na.rm, useNames = useNames) 343s + } 343s + } 343s + } 344s > 345s 345s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 345s Copyright (C) 2025 The R Foundation for Statistical Computing 345s Platform: powerpc64le-unknown-linux-gnu 345s 345s R is free software and comes with ABSOLUTELY NO WARRANTY. 345s You are welcome to redistribute it under certain conditions. 345s Type 'license()' or 'licence()' for distribution details. 345s 345s R is a collaborative project with many contributors. 345s Type 'contributors()' for more information and 345s 'citation()' on how to cite R or R packages in publications. 345s 345s Type 'demo()' for some demos, 'help()' for on-line help, or 345s 'help.start()' for an HTML browser interface to help. 345s Type 'q()' to quit R. 345s 345s > library("matrixStats") 345s > 345s > dense_rank <- function(x) match(x, table = sort(unique(x))) 345s > 345s > rowRanks_R <- function(x, ties.method, ..., useNames = TRUE) { 345s + if (ties.method == "dense") { 345s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 345s + } else { 345s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 345s + } 345s + 345s + # Preserve dimnames attribute? 345s + dim(res) <- dim(x) 345s + dimnames(res) <- if (useNames) dimnames(x) else NULL 345s + 345s + res 345s + } 345s > 345s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 345s + if (ties.method == "dense") { 345s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 345s + } else { 345s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 345s + } 345s + 345s + # Preserve dimnames attribute? 345s + tx <- t(x) 345s + dim(res) <- dim(tx) 345s + dimnames(res) <- if (useNames) dimnames(tx) else NULL 345s + 345s + if (preserveShape) res <- t(res) 345s + res 345s + } 345s > 345s > set.seed(1) 345s > 345s > cat("Consistency checks:\n") 345s Consistency checks: 345s > xs <- vector("list", length = 4L) 345s > for (kk in 1:4) { 345s + 345s + # Simulate data in a matrix of any shape 345s + dim <- sample(40:80, size = 2L) 345s + n <- prod(dim) 345s + x <- rnorm(n, sd = 10) 345s + dim(x) <- dim 345s + 345s + # Add NAs? 345s + if ((kk %% 4) %in% c(3, 0)) { 345s + cat("Adding NAs\n") 345s + nna <- sample(n, size = 1L) 345s + x[sample(length(x), size = nna)] <- NA_real_ 345s + } 345s + 345s + # Integer or double? 345s + if ((kk %% 4) %in% c(2, 0)) { 345s + cat("Coercing to integers\n") 345s + storage.mode(x) <- "integer" 345s + } 345s + 345s + xs[[kk]] <- x 345s + } # for (kk ...) 345s Coercing to integers 345s Adding NAs 345s Adding NAs 345s Coercing to integers 345s > str(xs) 345s List of 4 345s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 345s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 345s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 345s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 345s > 345s > for (kk in 1:4) { 345s + cat("Random test #", kk, "\n", sep = "") 345s + x <- xs[[kk]] 345s + tx <- t(x) 345s + 345s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 345s + cat(sprintf("ties.method = %s\n", ties)) 345s + # rowRanks(): 345s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 345s + y2 <- rowRanks_R(x, ties.method = ties) 345s + stopifnot(identical(y1, y2)) 345s + 345s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 345s + stopifnot(identical(y1, y3)) 345s + 345s + # colRanks(): 345s + y1 <- matrixStats::colRanks(x, ties.method = ties) 345s + y2 <- colRanks_R(x, ties.method = ties) 345s + stopifnot(identical(y1, y2)) 345s + 345s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 345s + stopifnot(identical(y1, y3)) 345s + } 345s + } # for (kk ...) 345s Random test #1 345s ties.method = max 345s ties.method = min 345s ties.method = average 345s ties.method = first 345s ties.method = last 345s ties.method = dense 345s Random test #2 345s ties.method = max 345s ties.method = min 345s ties.method = average 345s ties.method = first 345s ties.method = last 345s ties.method = dense 345s Random test #3 345s ties.method = max 345s ties.method = min 345s ties.method = average 345s ties.method = first 345s ties.method = last 345s ties.method = dense 345s Random test #4 345s ties.method = max 345s ties.method = min 345s ties.method = average 345s ties.method = first 345s ties.method = last 345s ties.method = dense 345s > 345s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 345s > 345s > cat("Consistency checks for random:\n") 345s Consistency checks for random: 345s > tolerance <- 0.1 345s > nsamples <- 10000 345s > for (kk in 1:4) { 345s + cat("Random test #", kk, "\n", sep = "") 345s + x <- xs[[kk]] 345s + tx <- t(x) 345s + 345s + for (ties in c("random")) { 345s + cat(sprintf("ties.method = %s\n", ties)) 345s + 345s + ## rowRanks(): 345s + y0 <- rowRanks_R(x, ties.method = ties) 345s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 345s + 345s + ## Assert symmetric rank differences 345s + d <- y1 - y0 345s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 345s + 345s + ## Assert within [min, max] 345s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 345s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 345s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 345s + ## Assert near average 345s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 345s + y1mean <- Reduce(`+`, y1list) / nsamples 345s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 345s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 345s + 345s + ## colRanks(): 345s + y0 <- colRanks_R(x, ties.method = ties) 345s + y1 <- matrixStats::colRanks(x, ties.method = ties) 345s + 345s + ## Assert symmetric rank differences 345s + d <- y1 - y0 345s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 345s + 345s + ## Assert within [min, max] 345s + y2min <- matrixStats::colRanks(x, ties.method = "min") 345s + y2max <- matrixStats::colRanks(x, ties.method = "max") 345s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 345s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 345s + y1mean <- Reduce(`+`, y1list) / nsamples 345s + ## Assert near average 345s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 345s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 345s + } 345s + } # for (kk ...) 345s Random test #1 345s ties.method = random 348s Random test #2 348s ties.method = random 351s Random test #3 351s ties.method = random 351s Random test #4 351s ties.method = random 352s > 352s > 352s > ## Exception handling 352s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 352s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 352s > stopifnot(inherits(y, "try-error")) 352s > 352s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 352s > stopifnot(inherits(y, "try-error")) 352s > 352s > dimnames <- list(letters[1:3], LETTERS[1:4]) 352s > for (mode in c("integer", "double")){ 352s + storage.mode(x) <- mode 352s + # Test with and without dimnames on x 352s + for (setDimnames in c(TRUE, FALSE)) { 352s + if (setDimnames) dimnames(x) <- dimnames 352s + else dimnames(x) <- NULL 352s + # Check names attribute 352s + for (useNames in c(TRUE, FALSE)) { 352s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 352s + cat(sprintf("ties.method = %s\n", ties)) 352s + # rowRanks(): 352s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 352s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 352s + stopifnot(identical(y1, y2)) 352s + 352s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 352s + stopifnot(identical(y1, y3)) 352s + 352s + # colRanks(): 352s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 352s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 352s + stopifnot(identical(y1, y2)) 352s + 352s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 352s + stopifnot(identical(y1, y3)) 352s + 352s + # Check preserveShape 352s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 352s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 352s + stopifnot(identical(y1, y2)) 352s + } 352s + } 352s + } 352s + } 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s ties.method = max 352s ties.method = min 352s ties.method = average 352s ties.method = first 352s ties.method = last 352s ties.method = dense 352s ties.method = random 352s > 352s 352s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 352s Copyright (C) 2025 The R Foundation for Statistical Computing 352s Platform: powerpc64le-unknown-linux-gnu 352s 352s R is free software and comes with ABSOLUTELY NO WARRANTY. 352s You are welcome to redistribute it under certain conditions. 352s Type 'license()' or 'licence()' for distribution details. 352s 352s R is a collaborative project with many contributors. 352s Type 'contributors()' for more information and 352s 'citation()' on how to cite R or R packages in publications. 352s 352s Type 'demo()' for some demos, 'help()' for on-line help, or 352s 'help.start()' for an HTML browser interface to help. 352s Type 'q()' to quit R. 352s 352s > library("matrixStats") 352s > 352s > rowRanks_R <- function(x, ties.method = "average", ..., useNames = TRUE) { 352s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 352s + ties.method = ties.method)) 352s + 352s + # Preserve dimnames attribute? 352s + dim(ans) <- dim(x) 352s + dimnames(ans) <- if (useNames) dimnames(x) else NULL 352s + 352s + ans 352s + } 352s > 352s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 352s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 352s + 352s + # Preserve dimnames attribute? 352s + tx <- t(x) 352s + dim(ans) <- dim(tx) 352s + dimnames(ans) <- if (useNames) dimnames(tx) else NULL 352s + 352s + if (preserveShape) ans <- t(ans) 352s + ans 352s + } 352s > 352s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 352s > # Subsetted tests 352s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 352s > source("utils/validateIndicesFramework.R") 352s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 352s > storage.mode(x) <- "integer" 352s > 352s > # To check dimnames attribute 352s > dimnames <- list(letters[1:6], LETTERS[1:6]) 352s > 352s > colRanks_R_t <- function(x, rows, cols, ..., useNames = TRUE) { 352s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 352s + } 352s > 352s > # Test with and without dimnames on x 352s > for (setDimnames in c(TRUE, FALSE)) { 352s + if (setDimnames) dimnames(x) <- dimnames 352s + else dimnames(x) <- NULL 352s + 352s + count <- 0L 352s + for (rows in index_cases) { 352s + for (cols in index_cases) { 352s + count <- count + 1L 352s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 352s + useNames <- c(TRUE, FALSE) 352s + useNames <- useNames[count %% length(useNames) + 1] 352s + 352s + validateIndicesTestMatrix(x, rows, cols, 352s + ftest = rowRanks, fsure = rowRanks_R, 352s + ties.method = "average", useNames = useNames) 352s + 352s + validateIndicesTestMatrix(x, rows, cols, 352s + ftest = colRanks_R_t, fsure = rowRanks_R, 352s + ties.method = "average", useNames = useNames) 352s + 352s + for (perserveShape in c(TRUE, FALSE)) { 352s + validateIndicesTestMatrix(x, rows, cols, 352s + ftest = colRanks, fsure = colRanks_R, 352s + ties.method = "average", perserveShape = perserveShape, 352s + useNames = useNames) 352s + } 352s + } 352s + } 352s + } 354s > 354s 354s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 354s Copyright (C) 2025 The R Foundation for Statistical Computing 354s Platform: powerpc64le-unknown-linux-gnu 354s 354s R is free software and comes with ABSOLUTELY NO WARRANTY. 354s You are welcome to redistribute it under certain conditions. 354s Type 'license()' or 'licence()' for distribution details. 354s 354s R is a collaborative project with many contributors. 354s Type 'contributors()' for more information and 354s 'citation()' on how to cite R or R packages in publications. 354s 354s Type 'demo()' for some demos, 'help()' for on-line help, or 354s 'help.start()' for an HTML browser interface to help. 354s Type 'q()' to quit R. 354s 354s > library("matrixStats") 354s > 354s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 354s > options(matrixStats.center.onUse = "ignore") 354s > 354s > ## Create isFALSE() if running on an old version of R 354s > if (!exists("isFALSE", mode="function")) { 354s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 354s + } 354s > 354s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 354s + suppressWarnings({ 354s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 354s + }) 354s + stopifnot(!any(is.infinite(sigma))) 354s + 354s + # Keep naming support consistency same as rowSds() 354s + if (is.null(center) || ncol(x) <= 1L) { 354s + if (isFALSE(useNames)) names(sigma) <- NULL 354s + } 354s + else if (isFALSE(useNames)) names(sigma) <- NULL 354s + sigma 354s + } 354s > 354s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 354s + suppressWarnings({ 354s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 354s + }) 354s + stopifnot(!any(is.infinite(sigma))) 354s + 354s + # Keep naming support consistency same as colSds() 354s + if (is.null(center) || nrow(x) <= 1L) { 354s + if (isFALSE(useNames)) names(sigma) <- NULL 354s + } 354s + if (isFALSE(useNames)) names(sigma) <- NULL 354s + sigma 354s + } 354s > 354s > 354s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 354s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 354s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 354s + stopifnot(!any(is.infinite(sigma))) 354s + sigma 354s + } 354s > 354s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 354s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 354s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 354s + stopifnot(!any(is.infinite(sigma))) 354s + sigma 354s + } 354s > 354s > 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > # With and without some NAs 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > for (mode in c("integer", "double")) { 354s + for (add_na in c(FALSE, TRUE)) { 354s + cat("add_na = ", add_na, "\n", sep = "") 354s + 354s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 354s + if (add_na) { 354s + x[3:7, c(2, 4)] <- NA_real_ 354s + } 354s + cat("mode: ", mode, "\n", sep = "") 354s + storage.mode(x) <- mode 354s + str(x) 354s + 354s + # To check names attribute 354s + dimnames <- list(letters[1:10], LETTERS[1:5]) 354s + 354s + # Test with and without dimnames on x 354s + for (setDimnames in c(TRUE, FALSE)) { 354s + if (setDimnames) dimnames(x) <- dimnames 354s + else dimnames(x) <- NULL 354s + # Row/column ranges 354s + for (na.rm in c(FALSE, TRUE)) { 354s + # Check names attribute 354s + for (useNames in c(TRUE, FALSE)) { 354s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 354s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 354s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 354s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 354s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 354s + stopifnot(all.equal(r1, r2)) 354s + stopifnot(all.equal(r1, r0)) 354s + stopifnot(all.equal(r2, r0)) 354s + stopifnot(all.equal(r1b, r2b)) 354s + stopifnot( 354s + !any(is.infinite(r1)), 354s + !any(is.infinite(r2)), 354s + !any(is.infinite(r1b)), 354s + !any(is.infinite(r2b)) 354s + ) 354s + } 354s + } 354s + } 354s + } # for (add_na ...) 354s + } 354s add_na = FALSE 354s mode: integer 354s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 354s add_na = TRUE 354s mode: integer 354s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 354s add_na = FALSE 354s mode: double 354s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 354s add_na = TRUE 354s mode: double 354s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 354s > 354s > 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > # All NAs 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > for (mode in c("integer", "double")) { 354s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 354s + cat("mode: ", mode, "\n", sep = "") 354s + storage.mode(x) <- mode 354s + str(x) 354s + 354s + # Test with and without dimnames on x 354s + for (setDimnames in c(TRUE, FALSE)) { 354s + if (setDimnames) dimnames(x) <- dimnames 354s + else dimnames(x) <- NULL 354s + # Row/column ranges 354s + for (na.rm in c(FALSE, TRUE)) { 354s + # Check names attribute 354s + for (useNames in c(TRUE, FALSE)) { 354s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 354s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 354s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 354s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 354s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 354s + stopifnot(all.equal(r1, r2)) 354s + stopifnot(all.equal(r1, r0)) 354s + stopifnot(all.equal(r2, r0)) 354s + stopifnot(all.equal(r1b, r2b)) 354s + stopifnot( 354s + !any(is.infinite(r1)), 354s + !any(is.infinite(r2)), 354s + !any(is.infinite(r1b)), 354s + !any(is.infinite(r2b)) 354s + ) 354s + } 354s + } 354s + } 354s + } 354s mode: integer 354s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 354s mode: double 354s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 354s > 354s > 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > # A 1x1 matrix 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > x <- matrix(0, nrow = 1L, ncol = 1L) 354s > dimnames <- list("a", "A") 354s > for (na.rm in c(FALSE, TRUE)) { 354s + cat("na.rm = ", na.rm, "\n", sep = "") 354s + 354s + # Test with and without dimnames on x 354s + for (setDimnames in c(TRUE, FALSE)) { 354s + if (setDimnames) dimnames(x) <- dimnames 354s + else dimnames(x) <- NULL 354s + # Row/column ranges 354s + for (na.rm in c(FALSE, TRUE)) { 354s + # Check names attribute 354s + for (useNames in c(TRUE, FALSE)) { 354s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 354s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 354s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 354s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 354s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 354s + stopifnot(all.equal(r1, r2)) 354s + stopifnot(all.equal(r1, r0)) 354s + stopifnot(all.equal(r2, r0)) 354s + stopifnot(all.equal(r1b, r2b)) 354s + stopifnot( 354s + !any(is.infinite(r1)), 354s + !any(is.infinite(r2)), 354s + !any(is.infinite(r1b)), 354s + !any(is.infinite(r2b)) 354s + ) 354s + } 354s + } 354s + } 354s + } 354s na.rm = FALSE 354s na.rm = TRUE 354s > 354s 354s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 354s Copyright (C) 2025 The R Foundation for Statistical Computing 354s Platform: powerpc64le-unknown-linux-gnu 354s 354s R is free software and comes with ABSOLUTELY NO WARRANTY. 354s You are welcome to redistribute it under certain conditions. 354s Type 'license()' or 'licence()' for distribution details. 354s 354s R is a collaborative project with many contributors. 354s Type 'contributors()' for more information and 354s 'citation()' on how to cite R or R packages in publications. 354s 354s Type 'demo()' for some demos, 'help()' for on-line help, or 354s 'help.start()' for an HTML browser interface to help. 354s Type 'q()' to quit R. 354s 354s > library("matrixStats") 354s > 354s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 354s > options(matrixStats.center.onUse = "ignore") 354s > 354s > ## Create isFALSE() if running on an old version of R 354s > if (!exists("isFALSE", mode="function")) { 354s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 354s + } 354s > 354s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 354s + suppressWarnings({ 354s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 354s + }) 354s + stopifnot(!any(is.infinite(sigma))) 354s + 354s + # Keep naming support consistency same as rowSds() 354s + if (is.null(center) || ncol(x) <= 1L) { 354s + if (isFALSE(useNames)) names(sigma) <- NULL 354s + } 354s + else if (isFALSE(useNames)) names(sigma) <- NULL 354s + sigma 354s + } 354s > 354s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 354s + suppressWarnings({ 354s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 354s + }) 354s + stopifnot(!any(is.infinite(sigma))) 354s + 354s + # Keep naming support consistency same as colSds() 354s + if (is.null(center) || nrow(x) <= 1L) { 354s + if (isFALSE(useNames)) names(sigma) <- NULL 354s + } 354s + else if (isFALSE(useNames)) names(sigma) <- NULL 354s + sigma 354s + } 354s > 354s > 354s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 354s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 354s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 354s + stopifnot(!any(is.infinite(sigma))) 354s + sigma 354s + } 354s > 354s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 354s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 354s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 354s + stopifnot(!any(is.infinite(sigma))) 354s + sigma 354s + } 354s > 354s > 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > # Subsetted tests 354s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354s > source("utils/validateIndicesFramework.R") 354s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 354s > storage.mode(x) <- "integer" 354s > 354s > # To check names attribute 354s > dimnames <- list(letters[1:6], LETTERS[1:6]) 354s > 354s > # Test with and without dimnames on x 354s > for (setDimnames in c(TRUE, FALSE)) { 354s + if (setDimnames) dimnames(x) <- dimnames 354s + else dimnames(x) <- NULL 354s + 354s + count <- 0L 354s + for (rows in index_cases) { 354s + for (cols in index_cases) { 354s + count <- count + 1L 354s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 354s + useNames <- c(TRUE, FALSE) 354s + useNames <- useNames[count %% length(useNames) + 1] 354s + 354s + validateIndicesTestMatrix(x, rows, cols, 354s + ftest = rowSds, fsure = rowSds_R, 354s + na.rm = na.rm, useNames = useNames) 354s + validateIndicesTestMatrix(x, rows, cols, 354s + ftest = rowSds_center, fsure = rowSds_R, 354s + na.rm = na.rm, center = TRUE, useNames = useNames) 354s + 354s + validateIndicesTestMatrix(x, rows, cols, 354s + fcoltest = colSds, fsure = rowSds_R, 354s + na.rm = na.rm, useNames = useNames) 354s + validateIndicesTestMatrix(x, rows, cols, 354s + fcoltest = colSds_center, fsure = rowSds_R, 354s + na.rm = na.rm, center = TRUE, useNames = useNames) 354s + } 354s + } 354s + } 355s > 355s 355s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 355s Copyright (C) 2025 The R Foundation for Statistical Computing 355s Platform: powerpc64le-unknown-linux-gnu 355s 355s R is free software and comes with ABSOLUTELY NO WARRANTY. 355s You are welcome to redistribute it under certain conditions. 355s Type 'license()' or 'licence()' for distribution details. 355s 355s R is a collaborative project with many contributors. 355s Type 'contributors()' for more information and 355s 'citation()' on how to cite R or R packages in publications. 355s 355s Type 'demo()' for some demos, 'help()' for on-line help, or 355s 'help.start()' for an HTML browser interface to help. 355s Type 'q()' to quit R. 355s 355s > library("matrixStats") 355s > 355s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 355s + ## FIXME: sum() may overflow for integers, whereas 355s + ## base::rowSums() doesn't. What should rowSums2() do? 355s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 355s + res <- rowSums(x, na.rm = na.rm) 355s + if (!useNames) names(res) <- NULL 355s + res 355s + } 355s > 355s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 355s + ## FIXME: sum() may overflow for integers, whereas 355s + ## base::colSums() doesn't. What should colSums2() do? 355s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 355s + res <- colSums(x, na.rm = na.rm) 355s + if (!useNames) names(res) <- NULL 355s + res 355s + } 355s > 355s > for (mode in c("integer", "logical", "double")) { 355s + x <- matrix(-4:4, nrow = 3, ncol = 3) 355s + storage.mode(x) <- mode 355s + if (mode == "double") x <- x + 0.1 355s + 355s + # To check names attribute 355s + dimnames <- list(letters[1:3], LETTERS[1:3]) 355s + 355s + # Test with and without dimnames on x 355s + for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s + } 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: Single-element matrix 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: Single-element matrix:\n") 355s Special case: Single-element matrix: 355s > for (mode in c("integer", "logical", "double")) { 355s + x <- matrix(1, nrow = 1, ncol = 1) 355s + storage.mode(x) <- mode 355s + 355s + # To check names attribute 355s + dimnames <- list("a", "A") 355s + 355s + # Test with and without dimnames on x 355s + for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: Empty matrix 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: Empty matrix:\n") 355s Special case: Empty matrix: 355s > for (mode in c("integer", "logical", "double")) { 355s + x <- matrix(integer(0), nrow = 0, ncol = 0) 355s + storage.mode(x) <- mode 355s + 355s + y0 <- rowSums2_R(x, na.rm = FALSE) 355s + y1 <- rowSums2(x, na.rm = FALSE) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE) 355s + y1 <- colSums2(x, na.rm = FALSE) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: All NAs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: All NAs:\n") 355s Special case: All NAs: 355s > for (mode in c("integer", "logical", "double")) { 355s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 355s + storage.mode(x) <- mode 355s + 355s + # To check names attribute 355s + dimnames <- list(letters[1:3], LETTERS[1:3]) 355s + 355s + # Test with and without dimnames on x 355s + for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: All NaNs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: All NaNs:\n") 355s Special case: All NaNs: 355s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 355s > 355s > # Test with and without dimnames on x 355s > for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: All Infs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: All Infs:\n") 355s Special case: All Infs: 355s > x <- matrix(Inf, nrow = 3, ncol = 3) 355s > 355s > # Test with and without dimnames on x 355s > for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: All -Infs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: All -Infs:\n") 355s Special case: All -Infs: 355s > x <- matrix(-Inf, nrow = 3, ncol = 3) 355s > 355s > # Test with and without dimnames on x 355s > for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: Infs and -Infs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: Infs and -Infs:\n") 355s Special case: Infs and -Infs: 355s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 355s > 355s > # To check names attribute 355s > dimnames <- list(letters[1:4], LETTERS[1:4]) 355s > 355s > # Test with and without dimnames on x 355s > for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: NaNs and NAs 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: Infs and -Infs:\n") 355s Special case: Infs and -Infs: 355s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 355s > 355s > y0 <- rowSums(x, na.rm = FALSE) 355s > str(y0) 355s num [1:4] NaN NA NaN NA 355s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 355s > y1 <- rowSums2(x, na.rm = FALSE) 355s > str(y0) 355s num [1:4] NaN NA NaN NA 355s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 355s > stopifnot(all.equal(y1, y0)) 355s > 355s > y0 <- colSums(x, na.rm = FALSE) 355s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 355s > y1 <- colSums2(x, na.rm = FALSE) 355s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 355s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 355s > ## returned here (as one would expect). NaN might very well be returned, 355s > ## when both NA and NaN are involved. This is an accepted feature in R, 355s > ## which is documented in help("is.nan"). See also 355s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 355s > ## Thus, we cannot guarantee that y1 is identical to y0. 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Special case: Integer overflow with ties 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > cat("Special case: Integer overflow with ties:\n") 355s Special case: Integer overflow with ties: 355s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 355s > 355s > # Test with and without dimnames on x 355s > for (setDimnames in c(TRUE, FALSE)) { 355s + if (setDimnames) dimnames(x) <- dimnames 355s + else dimnames(x) <- NULL 355s + # Check names attribute 355s + for (useNames in c(TRUE, FALSE)) { 355s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + 355s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 355s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 355s + stopifnot(all.equal(y1, y0)) 355s + } 355s + } 355s > 355s > 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > # Consistency checks 355s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355s > set.seed(1) 355s > 355s > cat("Consistency checks:\n") 355s Consistency checks: 355s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 355s > for (kk in seq_len(n_sims)) { 355s + cat("Random test #", kk, "\n", sep = "") 355s + 355s + # Simulate data in a matrix of any shape 355s + dim <- sample(50:200, size = 2) 355s + n <- prod(dim) 355s + x <- rnorm(n, sd = 100) 355s + dim(x) <- dim 355s + 355s + # Add NAs? 355s + if ((kk %% 4) %in% c(3, 0)) { 355s + cat("Adding NAs\n") 355s + nna <- sample(n, size = 1) 355s + na_values <- c(NA_real_, NaN) 355s + t <- sample(na_values, size = nna, replace = TRUE) 355s + x[sample(length(x), size = nna)] <- t 355s + } 355s + 355s + # Mode? 355s + modes <- "double" 355s + if ((kk %% 4) %in% c(2, 0)) { 355s + modes <- c("integer", "logical") 355s + } 355s + 355s + for (mode in modes) { 355s + if (mode != "double") { 355s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 355s + storage.mode(x) <- mode 355s + } 355s + 355s + na.rm <- sample(c(TRUE, FALSE), size = 1) 355s + 355s + # rowSums2(): 355s + y0 <- rowSums2_R(x, na.rm = na.rm) 355s + y1 <- rowSums2(x, na.rm = na.rm) 355s + stopifnot(all.equal(y1, y0)) 355s + y2 <- colSums2(t(x), na.rm = na.rm) 355s + stopifnot(all.equal(y2, y0)) 355s + 355s + # colSums2(): 355s + y0 <- colSums2_R(x, na.rm = na.rm) 355s + y1 <- colSums2(x, na.rm = na.rm) 355s + stopifnot(all.equal(y1, y0)) 355s + y2 <- rowSums2(t(x), na.rm = na.rm) 355s + stopifnot(all.equal(y2, y0)) 355s + } 355s + } # for (kk ...) 355s Random test #1 355s Random test #2 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #3 355s Adding NAs 355s Random test #4 355s Adding NAs 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #5 355s Random test #6 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #7 355s Adding NAs 355s Random test #8 355s Adding NAs 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #9 355s Random test #10 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #11 355s Adding NAs 355s Random test #12 355s Adding NAs 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #13 355s Random test #14 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #15 355s Adding NAs 355s Random test #16 355s Adding NAs 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #17 355s Random test #18 355s Coercing from double to integer 355s Coercing from integer to logical 355s Random test #19 355s Adding NAs 355s Random test #20 355s Adding NAs 355s Coercing from double to integer 355s Coercing from integer to logical 355s > 355s 355s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 355s Copyright (C) 2025 The R Foundation for Statistical Computing 355s Platform: powerpc64le-unknown-linux-gnu 355s 355s R is free software and comes with ABSOLUTELY NO WARRANTY. 355s You are welcome to redistribute it under certain conditions. 355s Type 'license()' or 'licence()' for distribution details. 355s 355s R is a collaborative project with many contributors. 355s Type 'contributors()' for more information and 355s 'citation()' on how to cite R or R packages in publications. 355s 355s Type 'demo()' for some demos, 'help()' for on-line help, or 355s 'help.start()' for an HTML browser interface to help. 355s Type 'q()' to quit R. 355s 356s > library("matrixStats") 356s > 356s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 356s + ## FIXME: sum() may overflow for integers, whereas 356s + ## base::rowSums() doesn't. What should rowSums2() do? 356s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 356s + res <- rowSums(x, na.rm = na.rm) 356s + if (!useNames) names(res) <- NULL 356s + res 356s + } 356s > 356s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 356s + ## FIXME: sum() may overflow for integers, whereas 356s + ## base::colSums() doesn't. What should colSums2() do? 356s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 356s + res <- colSums(x, na.rm = na.rm) 356s + if (!useNames) names(res) <- NULL 356s + res 356s + } 356s > 356s > 356s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 356s > # Subsetted tests 356s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 356s > source("utils/validateIndicesFramework.R") 356s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 356s > storage.mode(x) <- "integer" 356s > 356s > # To check names attribute 356s > dimnames <- list(letters[1:6], LETTERS[1:6]) 356s > 356s > # Test with and without dimnames on x 356s > for (setDimnames in c(TRUE, FALSE)) { 356s + if (setDimnames) dimnames(x) <- dimnames 356s + else dimnames(x) <- NULL 356s + for (rows in index_cases) { 356s + for (cols in index_cases) { 356s + for (na.rm in c(TRUE, FALSE)) { 356s + for (useNames in c(TRUE, FALSE)) { 356s + validateIndicesTestMatrix(x, rows, cols, 356s + ftest = rowSums2, fsure = rowSums2_R, 356s + na.rm = na.rm, useNames = useNames) 356s + validateIndicesTestMatrix(x, rows, cols, 356s + fcoltest = colSums2, fsure = rowSums2_R, 356s + na.rm = na.rm, useNames = useNames) 356s + } 356s + } 356s + } 356s + } 356s + } 356s > 356s 356s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 356s Copyright (C) 2025 The R Foundation for Statistical Computing 356s Platform: powerpc64le-unknown-linux-gnu 356s 356s R is free software and comes with ABSOLUTELY NO WARRANTY. 356s You are welcome to redistribute it under certain conditions. 356s Type 'license()' or 'licence()' for distribution details. 356s 356s R is a collaborative project with many contributors. 356s Type 'contributors()' for more information and 356s 'citation()' on how to cite R or R packages in publications. 356s 356s Type 'demo()' for some demos, 'help()' for on-line help, or 356s 'help.start()' for an HTML browser interface to help. 356s Type 'q()' to quit R. 356s 356s > library("matrixStats") 356s > 356s > nrow <- 6L 356s > ncol <- 5L 356s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 356s > 356s > # To check names attribute 356s > dimnames <- list(letters[1:6], LETTERS[1:5]) 356s > 356s > modes <- c("integer", "logical", "raw") 356s > for (mode in modes) { 356s + cat(sprintf("Mode: %s...\n", mode)) 356s + 356s + x <- data 356s + if (mode == "logical") x <- x - 2L 356s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 356s + storage.mode(x) <- mode 356s + print(x) 356s + 356s + unique_values <- unique(as.vector(x)) 356s + nbr_of_unique_values <- length(unique_values) 356s + 356s + y <- rowTabulates(x) 356s + print(y) 356s + stopifnot( 356s + identical(dim(y), c(nrow, nbr_of_unique_values)), 356s + all(y >= 0) 356s + ) 356s + if (mode != "raw") { 356s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 356s + stopifnot(all(y == y0)) 356s + } 356s + # Check names attribute 356s + dimnames(x) <- dimnames 356s + y1 <- rowTabulates(x, useNames = FALSE) 356s + stopifnot(all.equal(y1, y)) 356s + y <- rowTabulates(x, useNames = TRUE) 356s + stopifnot(identical(rownames(y), rownames(x))) 356s + dimnames(x) <- NULL 356s + 356s + y <- colTabulates(x) 356s + print(y) 356s + stopifnot( 356s + identical(dim(y), c(ncol, nbr_of_unique_values)), 356s + all(y >= 0) 356s + ) 356s + if (mode != "raw") { 356s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 356s + stopifnot(all(y == y0)) 356s + } 356s + # Check names attribute 356s + dimnames(x) <- dimnames 356s + y1 <- colTabulates(x, useNames = FALSE) 356s + stopifnot(all.equal(y1, y)) 356s + y <- colTabulates(x, useNames = TRUE) 356s + stopifnot(identical(rownames(y), colnames(x))) 356s + dimnames(x) <- NULL 356s + 356s + # Count only certain values 356s + if (mode == "integer") { 356s + subset <- c(0:2, NA_integer_) 356s + } else if (mode == "logical") { 356s + subset <- c(TRUE, FALSE, NA) 356s + } else { 356s + subset <- c(0:2) 356s + } 356s + y <- rowTabulates(x, values = subset) 356s + print(y) 356s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 356s + # Check names attribute 356s + dimnames(x) <- dimnames 356s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 356s + stopifnot(all.equal(y1, y)) 356s + y <- rowTabulates(x, values = subset, useNames = TRUE) 356s + stopifnot(identical(rownames(y), rownames(x))) 356s + dimnames(x) <- NULL 356s + 356s + y <- colTabulates(x, values = subset) 356s + print(y) 356s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 356s + # Check names attribute 356s + dimnames(x) <- dimnames 356s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 357s + stopifnot(all.equal(y1, y)) 357s + y <- colTabulates(x, values = subset, useNames = TRUE) 357s + stopifnot(identical(rownames(y), colnames(x))) 357s + dimnames(x) <- NULL 357s + 357s + # Raw 357s + if (mode %in% c("integer", "raw")) { 357s + subset <- c(0:2) 357s + 357s + y <- rowTabulates(x, values = as.raw(subset)) 357s + print(y) 357s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 357s + # Check names attribute 357s + dimnames(x) <- dimnames 357s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 357s + stopifnot(all.equal(y1, y)) 357s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 357s + stopifnot(identical(rownames(y3), rownames(x))) 357s + dimnames(x) <- NULL 357s + 357s + y2 <- colTabulates(t(x), values = as.raw(subset)) 357s + print(y2) 357s + stopifnot( 357s + identical(dim(y2), c(nrow, length(subset))), 357s + identical(y2, y) 357s + ) 357s + # Check names attribute 357s + dimnames(x) <- dimnames 357s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 357s + stopifnot(all.equal(y1, y)) 357s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 357s + stopifnot(identical(rownames(y), colnames(t(x)))) 357s + dimnames(x) <- NULL 357s + } 357s + 357s + cat(sprintf("Mode: %s...done\n", mode)) 357s + } # for (mode ...) 357s Mode: integer... 357s [,1] [,2] [,3] [,4] [,5] 357s [1,] 0 NA 2 3 4 357s [2,] NA 2 3 4 0 357s [3,] 2 3 4 0 1 357s [4,] 3 4 0 1 2 357s [5,] NA 0 1 2 3 357s [6,] 0 1 2 3 4 357s 0 1 2 3 4 357s [1,] 1 0 1 1 1 1 357s [2,] 1 0 1 1 1 1 357s [3,] 1 1 1 1 1 0 357s [4,] 1 1 1 1 1 0 357s [5,] 1 1 1 1 0 1 357s [6,] 1 1 1 1 1 0 357s 0 1 2 3 4 357s [1,] 2 0 1 1 0 2 357s [2,] 1 1 1 1 1 1 357s [3,] 1 1 2 1 1 0 357s [4,] 1 1 1 2 1 0 357s [5,] 1 1 1 1 2 0 357s 0 1 2 357s [1,] 1 0 1 1 357s [2,] 1 0 1 1 357s [3,] 1 1 1 0 357s [4,] 1 1 1 0 357s [5,] 1 1 1 1 357s [6,] 1 1 1 0 357s 0 1 2 357s [1,] 2 0 1 2 357s [2,] 1 1 1 1 357s [3,] 1 1 2 0 357s [4,] 1 1 1 0 357s [5,] 1 1 1 0 357s 0x0 0x1 0x2 357s [1,] 1 0 1 357s [2,] 1 0 1 357s [3,] 1 1 1 357s [4,] 1 1 1 357s [5,] 1 1 1 357s [6,] 1 1 1 357s 0x0 0x1 0x2 357s [1,] 1 0 1 357s [2,] 1 0 1 357s [3,] 1 1 1 357s [4,] 1 1 1 357s [5,] 1 1 1 357s [6,] 1 1 1 357s Mode: integer...done 357s Mode: logical... 357s [,1] [,2] [,3] [,4] [,5] 357s [1,] TRUE NA FALSE TRUE TRUE 357s [2,] NA FALSE TRUE TRUE TRUE 357s [3,] FALSE TRUE TRUE TRUE TRUE 357s [4,] TRUE TRUE TRUE TRUE FALSE 357s [5,] NA TRUE TRUE FALSE TRUE 357s [6,] TRUE TRUE FALSE TRUE TRUE 357s FALSE TRUE 357s [1,] 1 3 1 357s [2,] 1 3 1 357s [3,] 1 4 0 357s [4,] 1 4 0 357s [5,] 1 3 1 357s [6,] 1 4 0 357s FALSE TRUE 357s [1,] 1 3 2 357s [2,] 1 4 1 357s [3,] 2 4 0 357s [4,] 1 5 0 357s [5,] 1 5 0 357s TRUE FALSE 357s [1,] 3 1 1 357s [2,] 3 1 1 357s [3,] 4 1 0 357s [4,] 4 1 0 357s [5,] 3 1 1 357s [6,] 4 1 0 357s TRUE FALSE 357s [1,] 3 1 2 357s [2,] 4 1 1 357s [3,] 4 2 0 357s [4,] 5 1 0 357s [5,] 5 1 0 357s Mode: logical...done 357s Mode: raw... 357s [,1] [,2] [,3] [,4] [,5] 357s [1,] 00 01 02 03 04 357s [2,] 01 02 03 04 00 357s [3,] 02 03 04 00 01 357s [4,] 03 04 00 01 02 357s [5,] 04 00 01 02 03 357s [6,] 00 01 02 03 04 357s 0x0 0x1 0x2 0x3 0x4 357s [1,] 1 1 1 1 1 357s [2,] 1 1 1 1 1 357s [3,] 1 1 1 1 1 357s [4,] 1 1 1 1 1 357s [5,] 1 1 1 1 1 357s [6,] 1 1 1 1 1 357s 0x0 0x1 0x2 0x3 0x4 357s [1,] 2 1 1 1 1 357s [2,] 1 2 1 1 1 357s [3,] 1 1 2 1 1 357s [4,] 1 1 1 2 1 357s [5,] 1 1 1 1 2 357s 0 1 2 357s [1,] 1 1 1 357s [2,] 1 1 1 357s [3,] 1 1 1 357s [4,] 1 1 1 357s [5,] 1 1 1 357s [6,] 1 1 1 357s 0 1 2 357s [1,] 2 1 1 357s [2,] 1 2 1 357s [3,] 1 1 2 357s [4,] 1 1 1 357s [5,] 1 1 1 357s 0x0 0x1 0x2 357s [1,] 1 1 1 357s [2,] 1 1 1 357s [3,] 1 1 1 357s [4,] 1 1 1 357s [5,] 1 1 1 357s [6,] 1 1 1 357s 0x0 0x1 0x2 357s [1,] 1 1 1 357s [2,] 1 1 1 357s [3,] 1 1 1 357s [4,] 1 1 1 357s [5,] 1 1 1 357s [6,] 1 1 1 357s Mode: raw...done 357s > 357s 357s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 357s Copyright (C) 2025 The R Foundation for Statistical Computing 357s Platform: powerpc64le-unknown-linux-gnu 357s 357s R is free software and comes with ABSOLUTELY NO WARRANTY. 357s You are welcome to redistribute it under certain conditions. 357s Type 'license()' or 'licence()' for distribution details. 357s 357s R is a collaborative project with many contributors. 357s Type 'contributors()' for more information and 357s 'citation()' on how to cite R or R packages in publications. 357s 357s Type 'demo()' for some demos, 'help()' for on-line help, or 357s 'help.start()' for an HTML browser interface to help. 357s Type 'q()' to quit R. 357s 357s > library("matrixStats") 357s > 357s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 357s > # Subsetted tests 357s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 357s > source("utils/validateIndicesFramework.R") 357s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 357s > storage.mode(x) <- "integer" 357s > 357s > # To check names attribute 357s > dimnames <- list(letters[1:6], LETTERS[1:6]) 357s > 357s > # Test with and without dimnames on x 357s > for (setDimnames in c(TRUE, FALSE)) { 357s + if (setDimnames) dimnames(x) <- dimnames 357s + else dimnames(x) <- NULL 357s + 357s + count <- 0L 357s + for (rows in index_cases) { 357s + for (cols in index_cases) { 357s + count <- count + 1L 357s + useNames <- c(TRUE, FALSE) 357s + useNames <- useNames[count %% length(useNames) + 1] 357s + 357s + validateIndicesTestMatrix(x, rows, cols, 357s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 357s + validateIndicesTestMatrix(x, rows, cols, 357s + ftest = rowTabulates, fsure = rowTabulates, 357s + values = 1:3, useNames = useNames) 357s + 357s + validateIndicesTestMatrix(x, rows, cols, 357s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 357s + validateIndicesTestMatrix(x, rows, cols, 357s + ftest = colTabulates, fsure = colTabulates, 357s + values = 1:3, useNames = useNames) 357s + } 357s + } 357s + } 358s > 358s 358s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 358s Copyright (C) 2025 The R Foundation for Statistical Computing 358s Platform: powerpc64le-unknown-linux-gnu 358s 358s R is free software and comes with ABSOLUTELY NO WARRANTY. 358s You are welcome to redistribute it under certain conditions. 358s Type 'license()' or 'licence()' for distribution details. 358s 358s R is a collaborative project with many contributors. 358s Type 'contributors()' for more information and 358s 'citation()' on how to cite R or R packages in publications. 358s 358s Type 'demo()' for some demos, 'help()' for on-line help, or 358s 'help.start()' for an HTML browser interface to help. 358s Type 'q()' to quit R. 358s 358s > library("matrixStats") 358s > 358s > fcns <- list( 358s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 358s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 358s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 358s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 358s + ) 358s > 358s > for (fcn in names(fcns)) { 358s + cat(sprintf("%s()...\n", fcn)) 358s + row_fcn <- fcns[[fcn]][[1L]] 358s + col_fcn <- fcns[[fcn]][[2L]] 358s + 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + # With and without some NAs 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + for (mode in c("integer", "double")) { 358s + for (add_na in c(FALSE, TRUE)) { 358s + cat("add_na = ", add_na, "\n", sep = "") 358s + 358s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 358s + if (add_na) { 358s + x[3:7, c(2, 4)] <- NA_real_ 358s + } 358s + cat("mode: ", mode, "\n", sep = "") 358s + storage.mode(x) <- mode 358s + str(x) 358s + 358s + # To check names attribute 358s + dimnames <- list(letters[1:10], LETTERS[1:5]) 358s + 358s + # Test with and without dimnames on x 358s + for (setDimnames in c(TRUE, FALSE)) { 358s + if (setDimnames) dimnames(x) <- dimnames 358s + else dimnames(x) <- NULL 358s + # Row/column ranges 358s + for (na.rm in c(FALSE, TRUE)) { 358s + # Check names attribute 358s + for (useNames in c(TRUE, FALSE)) { 358s + cat("na.rm = ", na.rm, "\n", sep = "") 358s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 358s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 358s + stopifnot(all.equal(r1, r2)) 358s + } 358s + } 358s + } 358s + } # for (add_na ...) 358s + } 358s + 358s + 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + # All NAs 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + for (mode in c("integer", "double")) { 358s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 358s + cat("mode: ", mode, "\n", sep = "") 358s + storage.mode(x) <- mode 358s + str(x) 358s + 358s + # Test with and without dimnames on x 358s + for (setDimnames in c(TRUE, FALSE)) { 358s + if (setDimnames) dimnames(x) <- dimnames 358s + else dimnames(x) <- NULL 358s + # Row/column ranges 358s + for (na.rm in c(FALSE, TRUE)) { 358s + # Check names attribute 358s + for (useNames in c(TRUE, FALSE)) { 358s + cat("na.rm = ", na.rm, "\n", sep = "") 358s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 358s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 358s + stopifnot(all.equal(r1, r2)) 358s + } 358s + } 358s + } 358s + } 358s + 358s + 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + # A 1x1 matrix 358s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 358s + x <- matrix(0, nrow = 1L, ncol = 1L) 358s + dimnames <- list("a", "A") 358s + # Test with and without dimnames on x 358s + for (setDimnames in c(TRUE, FALSE)) { 358s + if (setDimnames) dimnames(x) <- dimnames 358s + else dimnames(x) <- NULL 358s + # Row/column ranges 358s + for (na.rm in c(FALSE, TRUE)) { 358s + # Check names attribute 358s + for (useNames in c(TRUE, FALSE)) { 358s + cat("na.rm = ", na.rm, "\n", sep = "") 358s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 358s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 358s + stopifnot(all.equal(r1, r2)) 358s + } 358s + } 358s + } 358s + 358s + cat(sprintf("%s()...DONE\n", fcn)) 358s + } # for (fcn ...) 358s rowVarDiffs()... 358s add_na = FALSE 358s mode: integer 358s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 358s na.rm = FALSE 358s na.rm = FALSE 358s na.rm = TRUE 358s na.rm = TRUE 358s na.rm = FALSE 358s na.rm = FALSE 358s na.rm = TRUE 358s na.rm = TRUE 358s add_na = TRUE 358s mode: integer 358s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 358s na.rm = FALSE 358s na.rm = FALSE 358s na.rm = TRUE 358s na.rm = TRUE 358s na.rm = FALSE 358s na.rm = FALSE 358s na.rm = TRUE 358s na.rm = TRUE 358s add_na = FALSE 358s mode: double 358s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 358s na.rm = FALSE 358s na.rm = FALSE 358s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: integer 359s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: double 359s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s rowVarDiffs()...DONE 359s rowSdDiffs()... 359s add_na = FALSE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = FALSE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: integer 359s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: double 359s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s rowSdDiffs()...DONE 359s rowMadDiffs()... 359s add_na = FALSE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = FALSE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: integer 359s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: double 359s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s rowMadDiffs()...DONE 359s rowIQRDiffs()... 359s add_na = FALSE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: integer 359s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = FALSE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s add_na = TRUE 359s mode: double 359s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: integer 359s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s mode: double 359s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s na.rm = FALSE 359s na.rm = FALSE 359s na.rm = TRUE 359s na.rm = TRUE 359s rowIQRDiffs()...DONE 359s > 359s 359s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 359s Copyright (C) 2025 The R Foundation for Statistical Computing 359s Platform: powerpc64le-unknown-linux-gnu 359s 359s R is free software and comes with ABSOLUTELY NO WARRANTY. 359s You are welcome to redistribute it under certain conditions. 359s Type 'license()' or 'licence()' for distribution details. 359s 359s R is a collaborative project with many contributors. 359s Type 'contributors()' for more information and 359s 'citation()' on how to cite R or R packages in publications. 359s 359s Type 'demo()' for some demos, 'help()' for on-line help, or 359s 'help.start()' for an HTML browser interface to help. 359s Type 'q()' to quit R. 359s 359s > library("matrixStats") 359s > 359s > fcns <- list( 359s + madDiff = c(rowMadDiffs, colMadDiffs), 359s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 359s + ) 359s > 359s > 359s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 359s > # Subsetted tests 359s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 359s > source("utils/validateIndicesFramework.R") 359s > # To check names attribute 359s > dimnames <- list(letters[1:6], LETTERS[1:6]) 359s > trim <- runif(1, min = 0, max = 0.5) 359s > for (fcn in names(fcns)) { 359s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 359s + row_fcn <- fcns[[fcn]][[1L]] 359s + col_fcn <- fcns[[fcn]][[2L]] 359s + 359s + for (mode in c("numeric", "integer")) { 359s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 359s + storage.mode(x) <- mode 359s + if (mode == "numeric") x[1:2, 3:4] <- Inf 359s + 359s + # Test with and without dimnames on x 359s + for (setDimnames in c(TRUE, FALSE)) { 359s + if (setDimnames) dimnames(x) <- dimnames 359s + else dimnames(x) <- NULL 359s + 359s + count <- 0L 359s + for (diff in 1:2) { 359s + for (rows in index_cases) { 359s + for (cols in index_cases) { 359s + count <- count + 1L 359s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 359s + useNames <- c(TRUE, FALSE) 359s + useNames <- useNames[count %% length(useNames) + 1] 359s + validateIndicesTestMatrix(x, rows, cols, 359s + ftest = row_fcn, fsure = row_fcn, 359s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 359s + validateIndicesTestMatrix(x, rows, cols, 359s + fcoltest = col_fcn, fsure = row_fcn, 359s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 359s + } 359s + } 359s + } 359s + } 359s + } 359s + cat(sprintf("%s()...DONE\n", fcn)) 359s + } 359s subsetted tests on madDiff()... 361s madDiff()...DONE 361s subsetted tests on iqrDiff()... 364s iqrDiff()...DONE 364s > 364s 364s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 364s Copyright (C) 2025 The R Foundation for Statistical Computing 364s Platform: powerpc64le-unknown-linux-gnu 364s 364s R is free software and comes with ABSOLUTELY NO WARRANTY. 364s You are welcome to redistribute it under certain conditions. 364s Type 'license()' or 'licence()' for distribution details. 364s 364s R is a collaborative project with many contributors. 364s Type 'contributors()' for more information and 364s 'citation()' on how to cite R or R packages in publications. 364s 364s Type 'demo()' for some demos, 'help()' for on-line help, or 364s 'help.start()' for an HTML browser interface to help. 364s Type 'q()' to quit R. 364s 364s > library("matrixStats") 364s > 364s > fcns <- list( 364s + varDiff = c(rowVarDiffs, colVarDiffs), 364s + sdDiff = c(rowSdDiffs, colSdDiffs) 364s + ) 364s > 364s > 364s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 364s > # Subsetted tests 364s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 364s > source("utils/validateIndicesFramework.R") 364s > # To check names attribute 364s > dimnames <- list(letters[1:6], LETTERS[1:6]) 364s > trim <- runif(1, min = 0, max = 0.5) 364s > for (fcn in names(fcns)) { 364s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 364s + row_fcn <- fcns[[fcn]][[1L]] 364s + col_fcn <- fcns[[fcn]][[2L]] 364s + 364s + for (mode in c("numeric", "integer")) { 364s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 364s + storage.mode(x) <- mode 364s + if (mode == "numeric") x[1:2, 3:4] <- Inf 364s + 364s + # Test with and without dimnames on x 364s + for (setDimnames in c(TRUE, FALSE)) { 364s + if (setDimnames) dimnames(x) <- dimnames 364s + else dimnames(x) <- NULL 364s + 364s + count <- 0L 364s + for (diff in 1:2) { 364s + for (rows in index_cases) { 364s + for (cols in index_cases) { 364s + count <- count + 1L 364s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 364s + useNames <- c(TRUE, FALSE) 364s + useNames <- useNames[count %% length(useNames) + 1] 364s + 364s + validateIndicesTestMatrix(x, rows, cols, 364s + ftest = row_fcn, fsure = row_fcn, 364s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 364s + validateIndicesTestMatrix(x, rows, cols, 364s + fcoltest = col_fcn, fsure = row_fcn, 364s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 364s + } 364s + } 364s + } 364s + } 364s + } 364s + cat(sprintf("%s()...DONE\n", fcn)) 364s + } 364s subsetted tests on varDiff()... 366s varDiff()...DONE 366s subsetted tests on sdDiff()... 368s sdDiff()...DONE 368s > 368s 368s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 368s Copyright (C) 2025 The R Foundation for Statistical Computing 368s Platform: powerpc64le-unknown-linux-gnu 368s 368s R is free software and comes with ABSOLUTELY NO WARRANTY. 368s You are welcome to redistribute it under certain conditions. 368s Type 'license()' or 'licence()' for distribution details. 368s 368s R is a collaborative project with many contributors. 368s Type 'contributors()' for more information and 368s 'citation()' on how to cite R or R packages in publications. 368s 368s Type 'demo()' for some demos, 'help()' for on-line help, or 368s 'help.start()' for an HTML browser interface to help. 368s Type 'q()' to quit R. 368s 368s > library("matrixStats") 368s > 368s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 368s > options(matrixStats.center.onUse = "ignore") 368s > options(matrixStats.vars.formula.freq = Inf) 368s > 368s > ## Create isFALSE() if running on an old version of R 368s > if (!exists("isFALSE", mode="function")) { 368s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 368s + } 368s > 368s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 368s + suppressWarnings({ 368s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 368s + }) 368s + stopifnot(!any(is.infinite(res))) 368s + 368s + # Keep naming support consistency same as rowVars() 368s + if (is.null(center) || ncol(x) <= 1L) { 368s + if (isFALSE(useNames)) names(res) <- NULL 368s + } 368s + else if (isFALSE(useNames)) names(res) <- NULL 368s + res 368s + } 368s > 368s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 368s + suppressWarnings({ 368s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 368s + }) 368s + stopifnot(!any(is.infinite(res))) 368s + 368s + # Keep naming support consistency same as colVars() 368s + if (is.null(center) || ncol(x) <= 1L) { 368s + if (isFALSE(useNames)) names(res) <- NULL 368s + } 368s + else if (isFALSE(useNames)) names(res) <- NULL 368s + res 368s + } 368s > 368s > 368s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 368s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 368s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 368s + stopifnot(!any(is.infinite(res))) 368s + res 368s + } 368s > 368s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 368s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 368s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 368s + stopifnot(!any(is.infinite(res))) 368s + res 368s + } 368s > 368s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 368s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 368s + x[is.infinite(center), ] <- NaN 368s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 368s + stopifnot(!any(is.infinite(res))) 368s + res 368s + } 368s > 368s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 368s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 368s + x[, is.infinite(center)] <- NaN 368s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 368s + stopifnot(!any(is.infinite(res))) 368s + res 368s + } 368s > 368s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 368s > # With and without some NAs or Infs 368s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 368s > for (mode in c("integer", "double")) { 368s + if (mode == "integer") { 368s + specials <- c(0L, NA_integer_) 368s + delta <- 0L 368s + } else { 368s + specials <- c(0, NA_real_, Inf) 368s + delta <- 0.1 368s + } 368s + 368s + for (special in specials) { 368s + cat("special = ", special, "\n", sep = "") 368s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 368s + x[3:7, c(2, 4)] <- special 368s + cat("mode: ", mode, "\n", sep = "") 368s + str(x) 368s + stopifnot(storage.mode(x) == mode) 368s + 368s + # To check names attribute 368s + dimnames <- list(letters[1:10], LETTERS[1:5]) 368s + 368s + # Test with and without dimnames on x 368s + for (setDimnames in c(TRUE, FALSE)) { 368s + if (setDimnames) dimnames(x) <- dimnames 368s + else dimnames(x) <- NULL 368s + # Row/column variance 368s + for (na.rm in c(FALSE, TRUE)) { 368s + # Check names attribute 368s + for (useNames in c(TRUE, FALSE)) { 368s + cat("na.rm = ", na.rm, "\n", sep = "") 368s + center <- rowMeans(x, na.rm = na.rm) 368s + 368s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 368s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 368s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 368s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 368s + 368s + tx <- t(x) 368s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 368s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 368s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 368s + tx <- NULL 368s + 368s + stopifnot(all.equal(r1, r2)) 368s + stopifnot(all.equal(r1, r0)) 368s + stopifnot(all.equal(r1b, r1c)) 368s + stopifnot(all.equal(r2, r0)) 368s + stopifnot(all.equal(r2b, r2c)) 368s + 368s + center <- colMeans(x, na.rm = na.rm) 368s + 368s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 368s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 368s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 368s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 368s + stopifnot(all.equal(r3b, r3)) 368s + stopifnot(all.equal(r3c, r3)) 368s + stopifnot(all.equal(r3d, r3)) 368s + 368s + stopifnot( 368s + !any(is.infinite(r0)), 368s + !any(is.infinite(r1)), 368s + !any(is.infinite(r2)), 368s + !any(is.infinite(r3)), 368s + !any(is.infinite(r1b)), 368s + !any(is.infinite(r1c)), 368s + !any(is.infinite(r2b)), 368s + !any(is.infinite(r2c)), 368s + !any(is.infinite(r3b)), 368s + !any(is.infinite(r3c)), 368s + !any(is.infinite(r3d)) 368s + ) 368s + } 368s + } 368s + } 368s + } # for (special ...) 368s + } 368s special = 0 368s mode: integer 368s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s special = NA 368s mode: integer 368s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s special = 0 368s mode: double 368s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s special = NA 368s mode: double 368s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s special = Inf 368s mode: double 368s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s na.rm = FALSE 368s na.rm = FALSE 368s na.rm = TRUE 368s na.rm = TRUE 368s > 368s > 368s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 368s > # All NAs 368s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 368s > for (mode in c("integer", "double")) { 368s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 368s + cat("mode: ", mode, "\n", sep = "") 368s + storage.mode(x) <- mode 368s + str(x) 368s + 368s + # Test with and without dimnames on x 368s + for (setDimnames in c(TRUE, FALSE)) { 368s + if (setDimnames) dimnames(x) <- dimnames 368s + else dimnames(x) <- NULL 368s + # Row/column variance 368s + for (na.rm in c(FALSE, TRUE)) { 368s + # Check names attribute 368s + for (useNames in c(TRUE, FALSE)) { 368s + cat("na.rm = ", na.rm, "\n", sep = "") 368s + 368s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 368s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 368s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 368s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 368s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 368s + stopifnot(all.equal(r1, r2)) 368s + stopifnot(all.equal(r1, r0)) 368s + stopifnot(all.equal(r2, r0)) 368s + stopifnot(all.equal(r1b, r2b)) 368s + stopifnot( 368s + !any(is.infinite(r0)), 368s + !any(is.infinite(r1)), 368s + !any(is.infinite(r2)), 368s + !any(is.infinite(r1b)), 368s + !any(is.infinite(r2b)) 368s + ) 368s + } 368s + } 368s + } 368s + } 369s mode: integer 369s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s mode: double 369s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s > 369s > 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > # A 1x1 matrix 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > x <- matrix(0, nrow = 1L, ncol = 1L) 369s > dimnames <- list("a", "A") 369s > # Test with and without dimnames on x 369s > for (setDimnames in c(TRUE, FALSE)) { 369s + if (setDimnames) dimnames(x) <- dimnames 369s + else dimnames(x) <- NULL 369s + # Row/column variance 369s + for (na.rm in c(FALSE, TRUE)) { 369s + # Check names attribute 369s + for (useNames in c(TRUE, FALSE)) { 369s + cat("na.rm = ", na.rm, "\n", sep = "") 369s + 369s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 369s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 369s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 369s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 369s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 369s + stopifnot(all.equal(r1, r2)) 369s + stopifnot(all.equal(r1, r0)) 369s + stopifnot(all.equal(r2, r0)) 369s + stopifnot(all.equal(r1b, r2b)) 369s + stopifnot( 369s + !any(is.infinite(r0)), 369s + !any(is.infinite(r1)), 369s + !any(is.infinite(r2)), 369s + !any(is.infinite(r1b)), 369s + !any(is.infinite(r2b)) 369s + ) 369s + } 369s + } 369s + } 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s na.rm = FALSE 369s na.rm = FALSE 369s na.rm = TRUE 369s na.rm = TRUE 369s > 369s > 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > # center and .dim 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 369s > a <- array(m, dim = c(3, 2, 2)) 369s > stopifnot(prod(dim(a)) == prod(dim(m))) 369s > 369s > y0 <- rowVars(m, dim. = dim(m)) 369s > print(y0) 369s [1] 15 15 15 369s > y1 <- rowVars(a, dim. = dim(m)) 369s > print(y1) 369s [1] 15 15 15 369s > stopifnot(identical(y1, y0)) 369s > stopifnot( 369s + !any(is.infinite(y0)), 369s + !any(is.infinite(y1)) 369s + ) 369s > 369s > mu <- rowMeans(m) 369s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 369s > print(y0) 369s [1] 15 15 15 369s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 369s > print(y1) 369s [1] 15 15 15 369s > stopifnot(identical(y1, y0)) 369s > stopifnot( 369s + !any(is.infinite(y0)), 369s + !any(is.infinite(y1)) 369s + ) 369s > 369s > 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > # Corner cases 369s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 369s > x[1,1] <- NA_real_ 369s > x[1,2] <- Inf 369s > 369s > center <- colMeans2(x, na.rm = TRUE) 369s > y <- colVars(x, center = center, na.rm = TRUE) 369s > stopifnot(!any(is.infinite(y))) 369s > 369s > x <- t(x) 369s > center <- rowMeans2(x, na.rm = TRUE) 369s > y <- rowVars(x, center = center, na.rm = TRUE) 369s > stopifnot(!any(is.infinite(y))) 369s > 369s 369s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 369s Copyright (C) 2025 The R Foundation for Statistical Computing 369s Platform: powerpc64le-unknown-linux-gnu 369s 369s R is free software and comes with ABSOLUTELY NO WARRANTY. 369s You are welcome to redistribute it under certain conditions. 369s Type 'license()' or 'licence()' for distribution details. 369s 369s R is a collaborative project with many contributors. 369s Type 'contributors()' for more information and 369s 'citation()' on how to cite R or R packages in publications. 369s 369s Type 'demo()' for some demos, 'help()' for on-line help, or 369s 'help.start()' for an HTML browser interface to help. 369s Type 'q()' to quit R. 369s 369s > library("matrixStats") 369s > 369s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 369s > options(matrixStats.center.onUse = "ignore") 369s > 369s > ## Create isFALSE() if running on an old version of R 369s > if (!exists("isFALSE", mode="function")) { 369s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 369s + } 369s > 369s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 369s + suppressWarnings({ 369s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 369s + }) 369s + stopifnot(!any(is.infinite(res))) 369s + 369s + # Keep naming support consistency same as rowVars() 369s + if (is.null(center) || ncol(x) <= 1L) { 369s + if (isFALSE(useNames)) names(res) <- NULL 369s + } 369s + else if (isFALSE(useNames)) names(res) <- NULL 369s + res 369s + } 369s > 369s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 369s + suppressWarnings({ 369s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 369s + }) 369s + stopifnot(!any(is.infinite(res))) 369s + 369s + # Keep naming support consistency same as colVars() 369s + if (is.null(center) || nrow(x) <= 1L) { 369s + if (isFALSE(useNames)) names(res) <- NULL 369s + } 369s + else if (isFALSE(useNames)) names(res) <- NULL 369s + res 369s + } 369s > 369s > 369s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 369s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 369s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 369s + stopifnot(!any(is.infinite(res))) 369s + res 369s + } 369s > 369s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 369s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 369s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 369s + stopifnot(!any(is.infinite(res))) 369s + res 369s + } 369s > 369s > 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > # Subsetted tests 369s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369s > source("utils/validateIndicesFramework.R") 369s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 369s > storage.mode(x) <- "integer" 369s > 369s > # To check names attribute 369s > dimnames <- list(letters[1:6], LETTERS[1:6]) 369s > 369s > # Test with and without dimnames on x 369s > for (setDimnames in c(TRUE, FALSE)) { 369s + if (setDimnames) dimnames(x) <- dimnames 369s + else dimnames(x) <- NULL 369s + 369s + count <- 0L 369s + for (rows in index_cases) { 369s + for (cols in index_cases) { 369s + count <- count + 1L 369s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 369s + useNames <- c(TRUE, FALSE) 369s + useNames <- useNames[count %% length(useNames) + 1] 369s + 369s + validateIndicesTestMatrix(x, rows, cols, 369s + ftest = rowVars, fsure = rowVars_R, 369s + na.rm = na.rm, useNames = useNames) 369s + validateIndicesTestMatrix(x, rows, cols, 369s + ftest = rowVars_center, fsure = rowVars_R, 369s + na.rm = na.rm, center = TRUE, useNames = useNames) 369s + 369s + validateIndicesTestMatrix(x, rows, cols, 369s + fcoltest = colVars, fsure = rowVars_R, 369s + na.rm = na.rm, useNames = useNames) 369s + validateIndicesTestMatrix(x, rows, cols, 369s + fcoltest = colVars_center, fsure = rowVars_R, 369s + na.rm = na.rm, center = TRUE, useNames = useNames) 369s + } 369s + } 369s + } 369s > 370s 370s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 370s Copyright (C) 2025 The R Foundation for Statistical Computing 370s Platform: powerpc64le-unknown-linux-gnu 370s 370s R is free software and comes with ABSOLUTELY NO WARRANTY. 370s You are welcome to redistribute it under certain conditions. 370s Type 'license()' or 'licence()' for distribution details. 370s 370s R is a collaborative project with many contributors. 370s Type 'contributors()' for more information and 370s 'citation()' on how to cite R or R packages in publications. 370s 370s Type 'demo()' for some demos, 'help()' for on-line help, or 370s 'help.start()' for an HTML browser interface to help. 370s Type 'q()' to quit R. 370s 370s > library("matrixStats") 370s > 370s > ## Create isFALSE() if running on an old version of R 370s > if (!exists("isFALSE", mode="function")) { 370s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 370s + } 370s > 370s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 370s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 370s + 370s + # Keep naming support consistency same as rowWeightedMeans() 370s + idxs <- which(is.na(w) | w != 0) 370s + nw <- length(idxs) 370s + if (na.rm) na.rm <- anyMissing(x) 370s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 370s + if (!useNames) names(res) <- NULL 370s + } 370s + else if (isFALSE(useNames)) names(res) <- NULL 370s + 370s + res 370s + } 370s > 370s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 370s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 370s + 370s + # Keep naming support consistency same as colWeightedMeans() 370s + idxs <- which(is.na(w) | w != 0) 370s + nw <- length(idxs) 370s + if (!is.null(w) && nw == 0L) { 370s + if (!useNames) names(res) <- NULL 370s + } 370s + else if (isFALSE(useNames)) names(res) <- NULL 370s + 370s + res 370s + } 370s > 370s > set.seed(1) 370s > 370s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 370s > print(x) 370s [,1] [,2] [,3] [,4] 370s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 370s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 370s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 370s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 370s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 370s > 370s > # To check names attribute 370s > dimnames <- list(letters[1:5], LETTERS[1:4]) 370s > 370s > # Non-weighted row averages 370s > x_est0 <- rowMeans(x) 370s > x_est1 <- rowWeightedMeans(x) 370s > print(x_est1) 370s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x)) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Check names attribute 370s > dimnames(x) <- dimnames 370s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 370s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > x_est0 <- rowMeans(x) 370s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 370s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > dimnames(x) <- NULL 370s > 370s > 370s > # Weighted row averages (uniform weights) 370s > w <- rep(2.5, times = ncol(x)) 370s > x_est0 <- rowMeans(x) 370s > x_est1 <- rowWeightedMeans(x, w = w) 370s > print(x_est1) 370s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), w = w) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # Weighted row averages (excluding some columns) 370s > w <- c(1, 1, 0, 1) 370s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 370s > x_est1 <- rowWeightedMeans(x, w = w) 370s > print(x_est1) 370s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), w = w) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # Weighted row averages (excluding some columns) 370s > w <- c(0, 1, 0, 0) 370s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 370s > x_est1 <- rowWeightedMeans(x, w = w) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), w = w) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # Weighted row averages (all zero weights) 370s > w <- c(0, 0, 0, 0) 370s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 370s > x_est1 <- rowWeightedMeans(x, w = w) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), w = w) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # Weighted averages by rows and columns 370s > w <- 1:4 370s > x_est1 <- rowWeightedMeans(x, w = w) 370s > print(x_est1) 370s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 370s > x_est2 <- colWeightedMeans(t(x), w = w) 370s > stopifnot(all.equal(x_est2, x_est1)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > x[sample(length(x), size = 0.3 * length(x))] <- NA 370s > print(x) 370s [,1] [,2] [,3] [,4] 370s [1,] -0.6264538 NA 1.5117812 -0.04493361 370s [2,] 0.1836433 NA NA -0.01619026 370s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 370s [4,] 1.5952808 NA -2.2146999 0.82122120 370s [5,] 0.3295078 NA NA 0.59390132 370s > 370s > # Non-weighted row averages with missing values 370s > x_est0 <- rowMeans(x, na.rm = TRUE) 370s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 370s > print(x_est1) 370s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Check names attribute 370s > dimnames(x) <- dimnames 370s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 370s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > x_est0 <- rowMeans(x, na.rm = TRUE) 370s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 370s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > dimnames(x) <- NULL 370s > 370s > 370s > # Weighted row averages with missing values 370s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 370s > print(x_est0) 370s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 370s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 370s > print(x_est1) 370s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 370s > stopifnot(all.equal(x_est1, x_est0)) 370s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 370s > stopifnot(all.equal(x_est2, x_est0)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # Weighted averages by rows and columns 370s > w <- 1:4 370s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 370s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 370s > stopifnot(all.equal(x_est2, x_est1)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > 370s > # w contains missing value 370s > w[1] <- NA_integer_ 370s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 370s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 370s > stopifnot(all.equal(x_est2, x_est1)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 370s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 370s > stopifnot(all.equal(x_est2, x_est1)) 370s > # Test with and without dimnames on x 370s > for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + # Check names attribute 370s + for (useNames in c(TRUE, FALSE)) { 370s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 370s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 370s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 370s + stopifnot(all.equal(x_est1, x_est0)) 370s + } 370s + } 370s > 370s 370s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 370s Copyright (C) 2025 The R Foundation for Statistical Computing 370s Platform: powerpc64le-unknown-linux-gnu 370s 370s R is free software and comes with ABSOLUTELY NO WARRANTY. 370s You are welcome to redistribute it under certain conditions. 370s Type 'license()' or 'licence()' for distribution details. 370s 370s R is a collaborative project with many contributors. 370s Type 'contributors()' for more information and 370s 'citation()' on how to cite R or R packages in publications. 370s 370s Type 'demo()' for some demos, 'help()' for on-line help, or 370s 'help.start()' for an HTML browser interface to help. 370s Type 'q()' to quit R. 370s 370s > library("matrixStats") 370s > 370s > ## Create isFALSE() if running on an old version of R 370s > if (!exists("isFALSE", mode="function")) { 370s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 370s + } 370s > 370s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 370s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 370s + 370s + # Keep naming support consistency same as rowWeightedMeans() 370s + idxs <- which(is.na(w) | w != 0) 370s + nw <- length(idxs) 370s + if (na.rm) na.rm <- anyMissing(x) 370s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 370s + if (!useNames) names(res) <- NULL 370s + } 370s + else if (isFALSE(useNames)) names(res) <- NULL 370s + 370s + res 370s + } 370s > 370s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 370s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 370s + 370s + # Keep naming support consistency same as colWeightedMeans() 370s + idxs <- which(is.na(w) | w != 0) 370s + nw <- length(idxs) 370s + if (!is.null(w) && nw == 0L) { 370s + if (!useNames) names(res) <- NULL 370s + } 370s + else if (isFALSE(useNames)) names(res) <- NULL 370s + 370s + res 370s + } 370s > 370s > 370s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 370s > # Subsetted tests 370s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 370s > source("utils/validateIndicesFramework.R") 370s > # To check names attribute 370s > dimnames <- list(letters[1:6], LETTERS[1:6]) 370s > for (mode in c("numeric", "integer", "logical")) { 370s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 370s + w <- runif(6, min = 0, max = 6) 370s + storage.mode(x) <- mode 370s + storage.mode(w) <- if (mode == "logical") "integer" else mode 370s + if (mode == "numeric") w[1] <- Inf 370s + 370s + # Test with and without dimnames on x 370s + for (setDimnames in c(TRUE, FALSE)) { 370s + if (setDimnames) dimnames(x) <- dimnames 370s + else dimnames(x) <- NULL 370s + 370s + count <- 0L 370s + for (rows in index_cases) { 370s + for (cols in index_cases) { 370s + count <- count + 1L 370s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 370s + useNames <- c(TRUE, FALSE) 370s + useNames <- useNames[count %% length(useNames) + 1] 370s + 370s + validateIndicesTestMatrix_w(x, w, rows, cols, 370s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 370s + na.rm = na.rm, useNames = useNames) 370s + validateIndicesTestMatrix_w(x, w, rows, cols, 370s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 370s + na.rm = na.rm, useNames = useNames) 370s + } 370s + } 370s + } 370s + } 371s > 371s 371s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 371s Copyright (C) 2025 The R Foundation for Statistical Computing 371s Platform: powerpc64le-unknown-linux-gnu 371s 371s R is free software and comes with ABSOLUTELY NO WARRANTY. 371s You are welcome to redistribute it under certain conditions. 371s Type 'license()' or 'licence()' for distribution details. 371s 371s R is a collaborative project with many contributors. 371s Type 'contributors()' for more information and 371s 'citation()' on how to cite R or R packages in publications. 371s 371s Type 'demo()' for some demos, 'help()' for on-line help, or 371s 'help.start()' for an HTML browser interface to help. 371s Type 'q()' to quit R. 371s 371s > library("matrixStats") 371s > 371s > ## Create isFALSE() if running on an old version of R 371s > if (!exists("isFALSE", mode="function")) { 371s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 371s + } 371s > 371s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 371s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 371s + 371s + # Keep naming support consistency same as rowWeightedMedians() 371s + if (!is.null(w)) { 371s + if (isFALSE(useNames)) names(res) <- NULL 371s + } 371s + else if (!useNames) names(res) <- NULL 371s + 371s + res 371s + } 371s > 371s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 371s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 371s + 371s + # Keep naming support consistency same as colWeightedMedians() 371s + if (!is.null(w)) { 371s + if (isFALSE(useNames)) names(res) <- NULL 371s + } 371s + else if (!useNames) names(res) <- NULL 371s + 371s + res 371s + } 371s > 371s > set.seed(1) 371s > 371s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 371s > print(x) 371s [,1] [,2] [,3] [,4] 371s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 371s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 371s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 371s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 371s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 371s > 371s > # To check names attribute 371s > dimnames <- list(letters[1:5], LETTERS[1:4]) 371s > 371s > # Non-weighted row medians 371s > x_est0 <- rowMedians(x) 371s > x_est1 <- rowWeightedMedians(x) 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x)) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowMedians(x, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 371s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + stopifnot(all.equal(x_est2, x_est0)) 371s + } 371s + } 371s > 371s > 371s > # Weighted row medians (uniform weights) 371s > w <- rep(2.5, times = ncol(x)) 371s > x_est0 <- rowMedians(x) 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > 371s > # Weighted row medians (excluding some columns) 371s > w <- c(1, 1, 0, 1) 371s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > # Weighted row medians (excluding some columns) 371s > w <- c(0, 1, 0, 0) 371s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > # Weighted row medians (all zero weights) 371s > w <- c(0, 0, 0, 0) 371s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > # Weighted medians by rows and columns 371s > w <- 1:4 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est1)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > 371s > # Weighted row medians with missing values 371s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 371s > print(x_est0) 371s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 371s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 371s > print(x_est1) 371s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 371s > stopifnot(all.equal(x_est1, x_est0)) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(all.equal(x_est2, x_est0)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > # Weighted medians by rows and columns 371s > w <- 1:4 371s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 371s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 371s > stopifnot(all.equal(x_est2, x_est1)) 371s > # Test with and without dimnames on x 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s > 371s > # Inf weight 371s > x <- matrix(1:2, nrow = 1, ncol = 2) 371s > w <- c(7, Inf) 371s > x_est1 <- rowWeightedMedians(x, w = w) 371s > x_est2 <- colWeightedMedians(t(x), w = w) 371s > stopifnot(identical(2, x_est1)) 371s > stopifnot(identical(2, x_est2)) 371s > # Test with and without dimnames on x 371s > dimnames <- list("a", LETTERS[1:2]) 371s > for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + # Check names attribute 371s + for (useNames in c(TRUE, FALSE)) { 371s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 371s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 371s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 371s + stopifnot(all.equal(x_est1, x_est0)) 371s + } 371s + } 371s > 371s 371s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 371s Copyright (C) 2025 The R Foundation for Statistical Computing 371s Platform: powerpc64le-unknown-linux-gnu 371s 371s R is free software and comes with ABSOLUTELY NO WARRANTY. 371s You are welcome to redistribute it under certain conditions. 371s Type 'license()' or 'licence()' for distribution details. 371s 371s R is a collaborative project with many contributors. 371s Type 'contributors()' for more information and 371s 'citation()' on how to cite R or R packages in publications. 371s 371s Type 'demo()' for some demos, 'help()' for on-line help, or 371s 'help.start()' for an HTML browser interface to help. 371s Type 'q()' to quit R. 371s 371s > library("matrixStats") 371s > 371s > ## Create isFALSE() if running on an old version of R 371s > if (!exists("isFALSE", mode="function")) { 371s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 371s + } 371s > 371s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 371s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 371s + 371s + # Keep naming support consistency same as rowWeightedMedians() 371s + if (!is.null(w)) { 371s + if (isFALSE(useNames)) names(res) <- NULL 371s + } 371s + else if (!useNames) names(res) <- NULL 371s + 371s + res 371s + } 371s > 371s > 371s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 371s > # Subsetted tests 371s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 371s > source("utils/validateIndicesFramework.R") 371s > # To check names attribute 371s > dimnames <- list(letters[1:6], LETTERS[1:6]) 371s > for (mode in c("numeric", "integer", "logical")) { 371s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 371s + w <- runif(6, min = 0, max = 6) 371s + storage.mode(x) <- mode 371s + storage.mode(w) <- if (mode == "logical") "integer" else mode 371s + if (mode == "numeric") w[1] <- Inf 371s + 371s + # Test with and without dimnames on x 371s + for (setDimnames in c(TRUE, FALSE)) { 371s + if (setDimnames) dimnames(x) <- dimnames 371s + else dimnames(x) <- NULL 371s + 371s + count <- 0L 371s + for (rows in index_cases) { 371s + for (cols in index_cases) { 371s + count <- count + 1L 371s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 371s + useNames <- c(TRUE, FALSE) 371s + useNames <- useNames[count %% length(useNames) + 1] 371s + 371s + validateIndicesTestMatrix_w(x, w, rows, cols, 371s + ftest = rowWeightedMedians, 371s + fsure = rowWeightedMedians_R, 371s + na.rm = na.rm, useNames = useNames) 371s + validateIndicesTestMatrix_w(x, w, rows, cols, 371s + fcoltest = colWeightedMedians, 371s + fsure = rowWeightedMedians_R, 371s + na.rm = na.rm, useNames = useNames) 371s + } 372s + } 372s + } 372s + } 373s > 373s 373s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 373s Copyright (C) 2025 The R Foundation for Statistical Computing 373s Platform: powerpc64le-unknown-linux-gnu 373s 373s R is free software and comes with ABSOLUTELY NO WARRANTY. 373s You are welcome to redistribute it under certain conditions. 373s Type 'license()' or 'licence()' for distribution details. 373s 373s R is a collaborative project with many contributors. 373s Type 'contributors()' for more information and 373s 'citation()' on how to cite R or R packages in publications. 373s 373s Type 'demo()' for some demos, 'help()' for on-line help, or 373s 'help.start()' for an HTML browser interface to help. 373s Type 'q()' to quit R. 373s 373s > library("matrixStats") 373s > 373s > set.seed(1) 373s > 373s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 373s > print(x) 373s [,1] [,2] [,3] [,4] 373s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 373s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 373s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 373s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 373s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 373s > 373s > # To check names attribute 373s > dimnames <- list(letters[1:5], LETTERS[1:4]) 373s > 373s > # Weighted row variances (uniform weights - all w = 1) 373s > # Non-weighted row variances 373s > x_est0 <- rowVars(x) 373s > w <- rep(1, times = ncol(x)) 373s > x_est1 <- rowWeightedVars(x, w = w) 373s > print(x_est1) 373s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowVars(x, useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row variances (uniform weights - all w = 3) 373s > x3 <- cbind(x, x, x) 373s > x_est0 <- rowVars(x3) 373s > w <- rep(3, times = ncol(x)) 373s > x_est1 <- rowWeightedVars(x, w = w) 373s > print(x_est1) 373s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x3 <- cbind(x, x, x) 373s > x_est0 <- rowVars(x3, useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row variances (excluding some columns) 373s > w <- c(1, 1, 0, 1) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 373s > x_est1 <- rowWeightedVars(x, w = w) 373s > print(x_est1) 373s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row variances (excluding some columns) 373s > w <- c(0, 1, 0, 0) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 373s > x_est1 <- rowWeightedVars(x, w = w) 373s > #stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est1)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row variances (all zero weights) 373s > w <- c(0, 0, 0, 0) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 373s > x_est1 <- rowWeightedVars(x, w = w) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > # Weighted variances by rows and columns 373s > w <- 1:4 373s > # Test with and without dimnames on x 373s > for (setDimnames in c(TRUE, FALSE)) { 373s + if (setDimnames) dimnames(x) <- dimnames 373s + else dimnames(x) <- NULL 373s + # Check names attribute 373s + for (useNames in c(TRUE, FALSE)) { 373s + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 373s + print(x_est1) 373s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 373s + stopifnot(all.equal(x_est2, x_est1)) 373s + } 373s + } 373s a b c d e 373s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 373s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 373s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 373s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 373s > 373s > 373s > x[sample(length(x), size = 0.3 * length(x))] <- NA 373s > print(x) 373s [,1] [,2] [,3] [,4] 373s [1,] -0.6264538 NA 1.5117812 -0.04493361 373s [2,] 0.1836433 NA NA -0.01619026 373s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 373s [4,] 1.5952808 NA -2.2146999 0.82122120 373s [5,] 0.3295078 NA NA 0.59390132 373s > 373s > # Non-weighted row variances with missing values 373s > x_est0 <- rowVars(x, na.rm = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 373s > print(x_est1) 373s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 373s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 373s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 373s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row variances with missing values 373s > # Test with and without dimnames on x 373s > for (setDimnames in c(TRUE, FALSE)) { 373s + if (setDimnames) dimnames(x) <- dimnames 373s + else dimnames(x) <- NULL 373s + # Check names attribute 373s + for (useNames in c(TRUE, FALSE)) { 373s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 373s + print(x_est1) 373s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 373s + stopifnot(all.equal(x_est2, x_est1)) 373s + } 373s + } 373s a b c d e 373s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s > 373s > 373s > # Weighted variances by rows and columns 373s > w <- 1:4 373s > # Test with and without dimnames on x 373s > for (setDimnames in c(TRUE, FALSE)) { 373s + if (setDimnames) dimnames(x) <- dimnames 373s + else dimnames(x) <- NULL 373s + # Check names attribute 373s + for (useNames in c(TRUE, FALSE)) { 373s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 373s + print(x_est1) 373s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 373s + stopifnot(all.equal(x_est2, x_est1)) 373s + } 373s + } 373s a b c d e 373s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 373s > 373s > 373s > # Weighted row standard deviation (excluding some columns) 373s > w <- c(1, 1, 0, 1) 373s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 373s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 373s > x_est1 <- rowWeightedSds(x, w = w) 373s > print(x_est1) 373s [1] NA NA 0.9734868 NA NA 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 373s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 373s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 373s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s > 373s > # Weighted row MADs (excluding some columns) 373s > w <- c(1, 1, 0, 1) 373s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 373s > x_est1 <- rowWeightedMads(x, w = w) 373s > print(x_est1) 373s [1] NA NA 0.3046914 NA NA 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > x_est2 <- colWeightedMads(t(x), w = w) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > # Check names attribute 373s > dimnames(x) <- dimnames 373s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 373s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 373s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 373s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 373s > stopifnot(all.equal(x_est1, x_est0)) 373s > stopifnot(all.equal(x_est2, x_est0)) 373s > dimnames(x) <- NULL 373s > 373s 373s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 373s Copyright (C) 2025 The R Foundation for Statistical Computing 373s Platform: powerpc64le-unknown-linux-gnu 373s 373s R is free software and comes with ABSOLUTELY NO WARRANTY. 373s You are welcome to redistribute it under certain conditions. 373s Type 'license()' or 'licence()' for distribution details. 373s 373s R is a collaborative project with many contributors. 373s Type 'contributors()' for more information and 373s 'citation()' on how to cite R or R packages in publications. 373s 373s Type 'demo()' for some demos, 'help()' for on-line help, or 373s 'help.start()' for an HTML browser interface to help. 373s Type 'q()' to quit R. 373s 373s > library("matrixStats") 373s > 373s > fcns <- list( 373s + weightedVar = c(rowWeightedVars, colWeightedVars), 373s + weightedSd = c(rowWeightedSds, colWeightedSds), 373s + weightedMad = c(rowWeightedMads, colWeightedMads) 373s + ) 373s > 373s > 373s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 373s > # Subsetted tests 373s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 373s > source("utils/validateIndicesFramework.R") 373s > # To check names attribute 373s > dimnames <- list(letters[1:6], LETTERS[1:6]) 373s > for (fcn in names(fcns)) { 373s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 373s + row_fcn <- fcns[[fcn]][[1]] 373s + col_fcn <- fcns[[fcn]][[2]] 373s + 373s + for (mode in c("numeric", "integer")) { 373s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 373s + w <- runif(6, min = 0, max = 6) 373s + storage.mode(x) <- mode 373s + storage.mode(w) <- mode 373s + if (mode == "numeric") w[1] <- Inf 373s + 373s + # Test with and without dimnames on x 373s + for (setDimnames in c(TRUE, FALSE)) { 373s + if (setDimnames) dimnames(x) <- dimnames 373s + else dimnames(x) <- NULL 373s + 373s + count <- 0L 373s + for (rows in index_cases) { 373s + for (cols in index_cases) { 373s + count <- count + 1L 373s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 373s + useNames <- c(TRUE, FALSE) 373s + useNames <- useNames[count %% length(useNames) + 1] 373s + 373s + validateIndicesTestMatrix_w(x, w, rows, cols, 373s + ftest = row_fcn, fsure = row_fcn, 373s + na.rm = na.rm, useNames = useNames) 373s + validateIndicesTestMatrix_w(x, w, rows, cols, 373s + fcoltest = col_fcn, fsure = row_fcn, 373s + na.rm = na.rm, useNames = useNames) 373s + } 373s + } 373s + } 373s + } 373s + cat(sprintf("%s()...DONE\n", fcn)) 373s + } 373s subsetted tests on matrix weightedVar()... 374s weightedVar()...DONE 374s subsetted tests on matrix weightedSd()... 375s weightedSd()...DONE 375s subsetted tests on matrix weightedMad()... 375s weightedMad()...DONE 375s > 375s 375s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 375s Copyright (C) 2025 The R Foundation for Statistical Computing 375s Platform: powerpc64le-unknown-linux-gnu 375s 375s R is free software and comes with ABSOLUTELY NO WARRANTY. 375s You are welcome to redistribute it under certain conditions. 375s Type 'license()' or 'licence()' for distribution details. 375s 375s R is a collaborative project with many contributors. 375s Type 'contributors()' for more information and 375s 'citation()' on how to cite R or R packages in publications. 375s 375s Type 'demo()' for some demos, 'help()' for on-line help, or 375s 'help.start()' for an HTML browser interface to help. 375s Type 'q()' to quit R. 375s 375s > library("matrixStats") 375s > 375s > signTabulate0 <- function(x, ...) { 375s + nneg <- sum(x < 0, na.rm = TRUE) 375s + nzero <- sum(x == 0, na.rm = TRUE) 375s + npos <- sum(x > 0, na.rm = TRUE) 375s + nna <- sum(is.na(x)) 375s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 375s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 375s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 375s + res <- as.double(res) 375s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 375s + if (is.integer(x)) res <- res[1:4] 375s + res 375s + } # signTabulate0() 375s > 375s > 375s > # Simulate data 375s > set.seed(0xBEEF) 375s > n <- 100L 376s > x <- runif(n) 376s > x[sample(n, size = 0.1 * n)] <- 0 376s > x[sample(n, size = 0.1 * n)] <- NA_real_ 376s > x[sample(n, size = 0.1 * n)] <- -Inf 376s > x[sample(n, size = 0.1 * n)] <- +Inf 376s > 376s > # Doubles 376s > message("Doubles:") 376s > counts0 <- signTabulate0(x) 376s Doubles: 376s > print(counts0) 376s -1 0 +1 NA -Inf +Inf 376s 9 7 77 7 9 10 376s > counts1 <- signTabulate(x) 376s > print(counts1) 376s -1 0 +1 NA -Inf +Inf 376s 9 7 77 7 9 10 376s > stopifnot(identical(counts1, counts0)) 376s > 376s > # Integers 376s > message("Integers:") 376s > x <- suppressWarnings(as.integer(x)) 376s > counts0 <- signTabulate0(x) 376s > print(counts0) 376s -1 0 +1 NA 376s 0 74 0 26 376s > counts1 <- signTabulate(x) 376s > print(counts1) 376s -1 0 +1 NA 376s 0 74 0 26 376s > stopifnot(identical(counts1, counts0)) 376s > 376s Integers: 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: powerpc64le-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > 376s > signTabulate0 <- function(x, ...) { 376s + nneg <- sum(x < 0, na.rm = TRUE) 376s + nzero <- sum(x == 0, na.rm = TRUE) 376s + npos <- sum(x > 0, na.rm = TRUE) 376s + nna <- sum(is.na(x)) 376s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 376s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 376s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 376s + res <- as.double(res) 376s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 376s + if (is.integer(x)) res <- res[1:4] 376s + res 376s + } # signTabulate0() 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Subsetted tests 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > source("utils/validateIndicesFramework.R") 376s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 376s > x[2:3, 4:5] <- +Inf 376s > x[4:5, 1:2] <- -Inf 376s > for (idxs in index_cases) { 376s + validateIndicesTestVector(x, idxs, 376s + ftest = signTabulate, fsure = signTabulate0) 376s + } 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: powerpc64le-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > options(warn = 1) 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Consistency checks 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > set.seed(1) 376s > 376s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 376s + if (is.null(idxs)) { 376s + sum(x, na.rm = na.rm) 376s + } else { 376s + sum(x[idxs], na.rm = na.rm) 376s + } 376s + } # sum2_R() 376s > 376s > 376s > cat("Consistency checks:\n") 376s Consistency checks: 376s > for (kk in 1:20) { 376s + cat("Random test #", kk, "\n", sep = "") 376s + 376s + # Simulate data in a matrix of any shape 376s + n <- sample(1e3, size = 1L) 376s + x <- rnorm(n, sd = 100) 376s + 376s + # Add NAs? 376s + if ((kk %% 4) %in% c(3, 0)) { 376s + cat("Adding NAs\n") 376s + nna <- sample(n, size = 1L) 376s + na_values <- c(NA_real_, NaN) 376s + t <- sample(na_values, size = nna, replace = TRUE) 376s + x[sample(length(x), size = nna)] <- t 376s + } 376s + 376s + # Integer or double? 376s + if ((kk %% 4) %in% c(2, 0)) { 376s + cat("Coercing to integers\n") 376s + storage.mode(x) <- "integer" 376s + } 376s + 376s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 376s + 376s + # Sum over all 376s + y0 <- sum2_R(x, na.rm = na.rm) 376s + y1 <- sum2(x, na.rm = na.rm) 376s + stopifnot(all.equal(y1, y0)) 376s + 376s + # Sum over subset 376s + nidxs <- sample(n, size = 1L) 376s + idxs <- sample(n, size = nidxs) 376s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 376s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 376s + stopifnot(all.equal(y1, y0)) 376s + 376s + if (storage.mode(x) == "integer") { 376s + storage.mode(x) <- "logical" 376s + 376s + y0 <- sum2_R(x, na.rm = na.rm) 376s + y1 <- sum2(x, na.rm = na.rm) 376s + stopifnot(all.equal(y1, y0)) 376s + 376s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 376s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 376s + stopifnot(all.equal(y1, y0)) 376s + } 376s + } # for (kk ...) 376s Random test #1 376s Random test #2 376s Coercing to integers 376s Random test #3 376s Adding NAs 376s Random test #4 376s Adding NAs 376s Coercing to integers 376s Random test #5 376s Random test #6 376s Coercing to integers 376s Random test #7 376s Adding NAs 376s Random test #8 376s Adding NAs 376s Coercing to integers 376s Random test #9 376s Random test #10 376s Coercing to integers 376s Random test #11 376s Adding NAs 376s Random test #12 376s Adding NAs 376s Coercing to integers 376s Random test #13 376s Random test #14 376s Coercing to integers 376s Random test #15 376s Adding NAs 376s Random test #16 376s Adding NAs 376s Coercing to integers 376s Random test #17 376s Random test #18 376s Coercing to integers 376s Random test #19 376s Adding NAs 376s Random test #20 376s Adding NAs 376s Coercing to integers 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # All missing values 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > for (n in 0:2) { 376s + for (na.rm in c(FALSE, TRUE)) { 376s + x <- rep(NA_real_, times = n) 376s + y0 <- sum(x, na.rm = na.rm) 376s + y <- sum2(x, na.rm = na.rm) 376s + stopifnot(all.equal(y, y0)) 376s + 376s + x <- rep(NA_integer_, times = n) 376s + y0 <- sum(x, na.rm = na.rm) 376s + y <- sum2(x, na.rm = na.rm) 376s + stopifnot(all.equal(y, y0)) 376s + 376s + x <- rep(NA, times = n) 376s + y0 <- sum(x, na.rm = na.rm) 376s + y <- sum2(x, na.rm = na.rm) 376s + stopifnot(all.equal(y, y0)) 376s + } 376s + } 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Special cases 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > for (na.rm in c(FALSE, TRUE)) { 376s + # Summing over zero elements (integers) 376s + x <- integer(0) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot(identical(s1, s2)) 376s + 376s + x <- 1:10 376s + idxs <- integer(0) 376s + s1 <- sum(x[idxs], na.rm = na.rm) 376s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 376s + stopifnot(identical(s1, s2)) 376s + 376s + # Summing over NA_integer_:s 376s + x <- rep(NA_integer_, times = 10L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot(identical(s1, s2)) 376s + 376s + x <- rep(NA_integer_, times = 10L) 376s + idxs <- 1:5 376s + s1 <- sum(x[idxs], na.rm = na.rm) 376s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 376s + stopifnot(identical(s1, s2)) 376s + 376s + 376s + # Summing over zero elements (doubles) 376s + x <- double(0) 376s + s1 <- sum(x) 376s + s2 <- sum2(x) 376s + stopifnot( 376s + identical(s1, 0), 376s + identical(s1, s2) 376s + ) 376s + 376s + x <- as.double(1:10) 376s + idxs <- integer(0) 376s + s1 <- sum(x[idxs]) 376s + s2 <- sum2(x, idxs = idxs) 376s + stopifnot( 376s + identical(s1, 0), 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over NA_real_:s 376s + x <- rep(NA_real_, times = 10L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot( 376s + !na.rm || s1 == 0, 376s + identical(s1, s2) 376s + ) 376s + 376s + x <- rep(NA_real_, times = 10L) 376s + idxs <- 1:5 376s + s1 <- sum(x[idxs], na.rm = na.rm) 376s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 376s + stopifnot( 376s + !na.rm || s1 == 0, 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over -Inf:s 376s + x <- rep(-Inf, times = 3L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot( 376s + is.infinite(s1) && s1 < 0, 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over +Inf:s 376s + x <- rep(+Inf, times = 3L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot(identical(s1, s2)) 376s + stopifnot( 376s + is.infinite(s1) && s1 > 0, 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over mix of -Inf:s and +Inf:s 376s + x <- rep(c(-Inf, +Inf), times = 3L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot( 376s + is.nan(s1), 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over mix of -Inf:s and +Inf:s and numerics 376s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + stopifnot( 376s + is.nan(s1), 376s + identical(s1, s2) 376s + ) 376s + 376s + # Summing over mix of NaN, NA, +Inf, and numerics 376s + x <- c(NaN, NA, +Inf, 3.14) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + if (na.rm) { 376s + stopifnot( 376s + is.infinite(s1) && s1 > 0, 376s + identical(s2, s1) 376s + ) 376s + } else { 376s + stopifnot(is.na(s1), is.na(s2)) 376s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 376s + ## returned here (as one would expect). NaN might very well be returned, 376s + ## when both NA and NaN are involved. This is an accepted feature in R, 376s + ## which is documented in help("is.nan"). See also 376s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 376s + ## Thus, we cannot guarantee that s1 is identical to s0. 376s + } 376s + 376s + # Summing over mix of NaN, NA, +Inf, and numerics 376s + x <- c(NA, NaN, +Inf, 3.14) 376s + s1 <- sum(x, na.rm = na.rm) 376s + s2 <- sum2(x, na.rm = na.rm) 376s + if (na.rm) { 376s + stopifnot( 376s + is.infinite(s1) && s1 > 0, 376s + identical(s2, s1) 376s + ) 376s + } else { 376s + stopifnot(is.na(s1), is.na(s2)) 376s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 376s + ## returned here (as one would expect). NaN might very well be returned, 376s + ## when both NA and NaN are involved. This is an accepted feature in R, 376s + ## which is documented in help("is.nan"). See also 376s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 376s + ## Thus, we cannot guarantee that s1 is identical to s0. 376s + } 376s + } 376s Warning in sum2(x[1:2]) : 376s Integer overflow. Use sum2(..., mode = "double") to avoid this. 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Summing of large integers 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 376s > 376s > # Total gives integer overflow 376s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 376s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 376s > stopifnot( 376s + identical(s2, NA_integer_) 376s + ) 376s Warning in sum2(x, mode = "integer") : 376s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 376s > 376s > ## Assert above warning 376s > res <- tryCatch({ 376s + s2 <- sum2(x[1:2]) 376s + }, warning = identity) 376s > stopifnot(inherits(res, "warning")) 376s > 376s > 376s > # Total gives integer overflow (coerce to numeric) 376s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 376s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 376s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 376s > stopifnot( 376s + identical(s1, 2147483648), 376s + identical(s1, s2), 376s + identical(s1, s3) 376s + ) 376s > 376s > # Cumulative sum would give integer overflow but not the total 376s > s1 <- sum(x) # 1L 376s > s2 <- sum2(x) # 1L 376s > stopifnot( 376s + identical(s1, 1L), 376s + identical(s1, s2) 376s + ) 376s > 376s > # Input is double but coercing result to integer 376s > x <- c(1, 2, 3.1) 376s > s1 <- sum2(x) 376s > s2 <- sum2(x, mode = "integer") 376s > stopifnot( 376s + identical(as.integer(s1), s2) 376s + ) 376s > 376s > ## Assert above warning 376s > res <- tryCatch({ 376s + s2 <- sum2(x, mode = "integer") 376s + }, warning = identity) 376s > stopifnot(inherits(res, "warning")) 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Summing of large doubles 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > ## Double overflow 376s > x <- rep(.Machine$double.xmax, times = 2L) 376s > y0 <- sum(x) 376s > print(y0) 376s [1] Inf 376s > y <- sum2(x) 376s > print(y) 376s [1] Inf 376s > stopifnot( 376s + is.infinite(y) && y > 0, 376s + identical(y, y0) 376s + ) 376s > 376s > x <- rep(-.Machine$double.xmax, times = 2L) 376s > y0 <- sum(x) 376s > print(y0) 376s [1] -Inf 376s > y <- sum2(x) 376s > print(y) 376s [1] -Inf 376s > stopifnot( 376s + is.infinite(y) && y < 0, 376s + identical(y, y0) 376s + ) 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Argument 'idxs' 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > x <- 1:10 376s > idxs_list <- list( 376s + integer = 1:5, 376s + double = as.double(1:5), 376s + logical = (x <= 5) 376s + ) 376s > 376s > for (idxs in idxs_list) { 376s + cat("idxs:\n") 376s + str(idxs) 376s + s1 <- sum(x[idxs], na.rm = TRUE) 376s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 376s + stopifnot(identical(s1, s2)) 376s + } 376s idxs: 376s int [1:5] 1 2 3 4 5 376s idxs: 376s num [1:5] 1 2 3 4 5 376s idxs: 376s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: powerpc64le-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Subsetted tests 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > source("utils/validateIndicesFramework.R") 376s > x <- runif(6, min = -6, max = 6) 376s > storage.mode(x) <- "integer" 376s > for (idxs in index_cases) { 376s + validateIndicesTestVector(x, idxs, 376s + ftest = sum2, fsure = sum, 376s + na.rm = FALSE) 376s + validateIndicesTestVector(x, idxs, 376s + ftest = sum2, fsure = sum, 376s + na.rm = TRUE) 376s + } 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: powerpc64le-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > 376s > set.seed(1) 376s > x <- rnorm(1e4) 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Variance estimators 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > sigma2_a <- var(x) 376s > cat(sprintf("var(x) = %g\n", sigma2_a)) 376s var(x) = 1.02487 376s > 376s > sigma2_b <- varDiff(x) 376s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 376s varDiff(x) = 1.01224 376s > 376s > d <- abs(sigma2_b - sigma2_a) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 0.0126268 376s > stopifnot(d < 0.02) 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Standard deviation estimators 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > sigma_a <- sd(x) 376s > cat(sprintf("sd(x) = %g\n", sigma_a)) 376s sd(x) = 1.01236 376s > 376s > sigma_b <- sdDiff(x) 376s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 376s sdDiff(x) = 1.0061 376s > 376s > d <- abs(sigma_b - sigma_a) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 0.00625567 376s > stopifnot(d < 0.01) 376s > 376s > # Sanity checks 376s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 376s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 376s > 376s > 376s > sigma_a2 <- mad(x) 376s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 376s mad(x) = 0.998376 376s > 376s > sigma_b2 <- madDiff(x) 376s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 376s madDiff(x) = 1.02513 376s > 376s > d <- abs(sigma_b2 - sigma_a2) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 0.0267497 376s > stopifnot(d < 0.05) 376s > 376s > 376s > sigma_a3 <- IQR(x) 376s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 376s IQR(x) = 1.35105 376s > 376s > sigma_b3 <- iqrDiff(x) 376s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 376s iqrDiff(x) = 1.37797 376s > 376s > d <- abs(sigma_b3 - sigma_a3) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 0.0269152 376s > stopifnot(d < 0.05) 376s > 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Trimmed estimators 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > y <- x 376s > outliers <- sample(length(x), size = 0.1 * length(x)) 376s > y[outliers] <- 100 * y[outliers] 376s > 376s > sigma_ao <- sd(y[-outliers]) 376s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 376s sd(y) = 1.01166 376s > 376s > sigma_bo <- sdDiff(y[-outliers]) 376s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 376s sdDiff(y) = 1.00743 376s > 376s > d <- abs(sigma_b - sigma_a) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 0.00625567 376s > stopifnot(d < 0.01) 376s > 376s > sigma_bot <- sdDiff(y, trim = 0.05) 376s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 376s sdDiff(y, trim = 0.05) = 7.74327 376s > 376s > d <- abs(sigma_bot - sigma_a) 376s > cat(sprintf("Absolute difference = %g\n", d)) 376s Absolute difference = 6.73091 376s > #stopifnot(d < 1e-3) 376s > 376s > sigma_cot <- madDiff(y, trim = 0.05) 376s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 376s madDiff(y, trim = 0.05) = 1.15278 376s > 376s > sigma_dot <- iqrDiff(y, trim = 0.05) 376s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 376s iqrDiff(y, trim = 0.05) = 1.55762 376s > 376s > 376s > fcns <- list( 376s + varDiff = varDiff, 376s + sdDiff = sdDiff, 376s + madDiff = madDiff, 376s + iqrDiff = iqrDiff 376s + ) 376s > 376s > for (name in names(fcns)) { 376s + cat(sprintf("%s()...\n", name)) 376s + fcn <- fcns[[name]] 376s + 376s + for (mode in c("integer", "double")) { 376s + cat("mode: ", mode, "", sep = "") 376s + for (n in 0:3) { 376s + x <- runif(n, min = -5, max = 5) 376s + storage.mode(x) <- mode 376s + str(x) 376s + 376s + y <- fcn(x) 376s + yt <- fcn(x, trim = 0.1) 376s + str(list("non-trimmed" = y, trimmed = yt)) 376s + } # for (mode ...) 376s + } 376s + 376s + cat(sprintf("%s()...DONE\n", name)) 376s + } # for (name ...) 376s varDiff()... 376s mode: integer int(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int -4 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:2] 3 2 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:3] 1 4 -1 376s List of 2 376s $ non-trimmed: num 16 376s $ trimmed : num 16 376s mode: double num(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num -0.794 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:2] 0.897 -3.728 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:3] 2.07 -1.13 1.94 376s List of 2 376s $ non-trimmed: num 9.83 376s $ trimmed : num 9.83 376s varDiff()...DONE 376s sdDiff()... 376s mode: integer int(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int 2 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:2] -4 1 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:3] -2 1 -1 376s List of 2 376s $ non-trimmed: num 2.5 376s $ trimmed : num 2.5 376s mode: double num(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num -3.78 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:2] -2.04 2.38 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:3] 1.42 -2.14 1.14 376s List of 2 376s $ non-trimmed: num 3.42 376s $ trimmed : num 3.42 376s sdDiff()...DONE 376s madDiff()... 376s mode: integer int(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int -1 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:2] -1 4 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int [1:3] -1 0 -3 376s List of 2 376s $ non-trimmed: num 2.1 376s $ trimmed : num 2.1 376s mode: double num(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num -1.13 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:2] -1.7 -1.21 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num [1:3] -2.39 -0.464 3.086 376s List of 2 376s $ non-trimmed: num 0.851 376s $ trimmed : num 0.851 376s madDiff()...DONE 376s iqrDiff()... 376s mode: integer int(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s int 3 376s List of 2 376s $ non-trimmed: num 0 376s $ trimmed : num 0 376s int [1:2] -3 4 376s List of 2 376s $ non-trimmed: num 0 376s $ trimmed : num 0 376s int [1:3] 0 -2 -2 376s List of 2 376s $ non-trimmed: num 0.707 376s $ trimmed : num 0.707 376s mode: double num(0) 376s List of 2 376s $ non-trimmed: num NA 376s $ trimmed : num NA 376s num -4.46 376s List of 2 376s $ non-trimmed: num 0 376s $ trimmed : num 0 376s num [1:2] 3.67 1.02 376s List of 2 376s $ non-trimmed: num 0 376s $ trimmed : num 0 376s num [1:3] -0.537 -2.733 2.857 376s List of 2 376s $ non-trimmed: num 2.75 376s $ trimmed : num 2.75 376s iqrDiff()...DONE 376s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: powerpc64le-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > fcns <- list( 377s + varDiff = varDiff, 377s + sdDiff = sdDiff, 377s + madDiff = madDiff, 377s + iqrDiff = iqrDiff 377s + ) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Subsetted tests 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > source("utils/validateIndicesFramework.R") 377s > for (name in names(fcns)) { 377s + cat(sprintf("subsetted tests on %s()...\n", name)) 377s + fcn <- fcns[[name]] 377s + 377s + for (mode in c("numeric", "integer")) { 377s + x <- runif(6, min = -6, max = 6) 377s + storage.mode(x) <- mode 377s + trim <- runif(1, min = 0, max = 0.5) 377s + if (mode == "numeric") x[1] <- Inf 377s + 377s + for (diff in 1:2) { 377s + for (idxs in index_cases) { 377s + validateIndicesTestVector(x, idxs, 377s + ftest = fcn, fsure = fcn, 377s + na.rm = TRUE, diff = diff, trim = trim) 377s + validateIndicesTestVector(x, idxs, 377s + ftest = fcn, fsure = fcn, 377s + na.rm = FALSE, diff = diff, trim = trim) 377s + } 377s + } 377s + } 377s + cat(sprintf("%s()...DONE\n", name)) 377s + } 377s subsetted tests on varDiff()... 377s varDiff()...DONE 377s subsetted tests on sdDiff()... 377s sdDiff()...DONE 377s subsetted tests on madDiff()... 377s madDiff()...DONE 377s subsetted tests on iqrDiff()... 377s iqrDiff()...DONE 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: powerpc64le-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > for (mode in c("logical", "integer", "double")) { 377s + cat("mode: ", mode, "", sep = "") 377s + n <- 2L 377s + x <- runif(n, min = -5, max = 5) 377s + if (mode == "logical") { 377s + x <- x > 0 377s + } 377s + storage.mode(x) <- mode 377s + str(x) 377s + 377s + cat("All weights are 1\n") 377s + w <- rep(1, times = n) 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + 377s + cat("First weight is 5\n") 377s + # Pull the mean towards zero 377s + w[1] <- 5 377s + str(w) 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + 377s + cat("All weights are 0\n") 377s + # All weights set to zero 377s + w <- rep(0, times = n) 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + 377s + cat("First weight is 8.5\n") 377s + # Put even more weight on the zero 377s + w[1] <- 8.5 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + 377s + cat("First weight is Inf\n") 377s + # All weight on the first value 377s + w[1] <- Inf 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + 377s + cat("Last weight is Inf\n") 377s + # All weight on the last value 377s + w[1] <- 1 377s + w[n] <- Inf 377s + m0 <- weighted.mean(x, w) 377s + m1 <- weightedMean(x, w) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(identical(m1, m0)) 377s + } # for (mode ...) 377s mode: logical logi [1:2] FALSE TRUE 377s All weights are 1 377s List of 2 377s $ m0: num 0.5 377s $ m1: num 0.5 377s First weight is 5 377s num [1:2] 5 1 377s List of 2 377s $ m0: num 0.167 377s $ m1: num 0.167 377s All weights are 0 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s First weight is 8.5 377s List of 2 377s $ m0: num 0 377s $ m1: num 0 377s First weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s Last weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s mode: integer int [1:2] -1 0 377s All weights are 1 377s List of 2 377s $ m0: num -0.5 377s $ m1: num -0.5 377s First weight is 5 377s num [1:2] 5 1 377s List of 2 377s $ m0: num -0.833 377s $ m1: num -0.833 377s All weights are 0 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s First weight is 8.5 377s List of 2 377s $ m0: num -1 377s $ m1: num -1 377s First weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s Last weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s mode: double num [1:2] 2.86 -2.73 377s All weights are 1 377s List of 2 377s $ m0: num 0.066 377s $ m1: num 0.066 377s First weight is 5 377s num [1:2] 5 1 377s List of 2 377s $ m0: num 1.93 377s $ m1: num 1.93 377s All weights are 0 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s First weight is 8.5 377s List of 2 377s $ m0: num 2.86 377s $ m1: num 2.86 377s First weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s Last weight is Inf 377s List of 2 377s $ m0: num NaN 377s $ m1: num NaN 377s > 377s > 377s > message("*** Testing for missing values") 377s > # NA tests 377s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 377s *** Testing for missing values 377s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 377s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 377s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 377s > ## is because 'x' is dropped and therefore that first element 377s > ## is skipped in the computation. It basically does 377s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 377s > ## without looking at 'w'. 377s > for (x in xs) { 377s + for (mode in c("logical", "integer", "double")) { 377s + storage.mode(x) <- mode 377s + for (w in ws) { 377s + for (na.rm in c(FALSE, TRUE)) { 377s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 377s + str(list(x = x, w = w)) 377s + m0 <- weighted.mean(x, w, na.rm = na.rm) 377s + m1 <- weightedMean(x, w, na.rm = na.rm) 377s + str(list(m0 = m0, m1 = m1)) 377s + stopifnot(all.equal(m1, m0)) 377s + } 377s + } 377s + } 377s + } 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] TRUE TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] 1 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] 1 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: logical, na.rm = FALSE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: logical, na.rm = TRUE 377s List of 2 377s $ x: logi [1:3] NA TRUE TRUE 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: integer, na.rm = FALSE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: integer, na.rm = TRUE 377s List of 2 377s $ x: int [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] NA 1 1 377s List of 2 377s $ m0: num 1 377s $ m1: num 1 377s mode: double, na.rm = FALSE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s mode: double, na.rm = TRUE 377s List of 2 377s $ x: num [1:3] NA 1 1 377s $ w: num [1:3] 1 NA 1 377s List of 2 377s $ m0: num NA 377s $ m1: num NA 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: powerpc64le-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Subsetted tests 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > source("utils/validateIndicesFramework.R") 377s > for (mode in c("numeric", "integer")) { 377s + x <- runif(6, min = -6, max = 6) 377s + w <- runif(6, min = 0, max = 6) 377s + storage.mode(x) <- mode 377s + storage.mode(w) <- mode 377s + if (mode == "numeric") w[1] <- Inf 377s + 377s + for (idxs in index_cases) { 377s + validateIndicesTestVector_w(x, w, idxs, 377s + ftest = weightedMean, fsure = weighted.mean, 377s + na.rm = TRUE, refine = TRUE) 377s + validateIndicesTestVector_w(x, w, idxs, 377s + ftest = weightedMean, fsure = weighted.mean, 377s + na.rm = FALSE, refine = TRUE) 377s + } 377s + } 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: powerpc64le-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 378s > library("matrixStats") 378s > 378s > x <- 1:5 378s > y <- weightedMedian(x) 378s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 378s > print(y) 378s [1] 3 378s > 378s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 378s > print(y) 378s [1] NA 378s > stopifnot(is.na(y)) 378s > 378s > x <- 1:10 378s > n <- length(x) 378s > 378s > y1 <- median(x) # 5.5 378s > y2 <- weightedMedian(x) # 5.5 378s > stopifnot(all.equal(y1, y2)) 378s > 378s > 378s > w <- rep(1, times = n) 378s > y1 <- weightedMedian(x, w) # 5.5 (default) 378s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 378s > y2b <- weightedMedian(x, ties = "min") # 5 378s > y2c <- weightedMedian(x, ties = "max") # 6 378s > stopifnot(all.equal(y2a, y1)) 378s > 378s > y3 <- weightedMedian(x, w) # 5.5 (default) 378s > 378s > 378s > # Pull the median towards zero 378s > w[1] <- 5 378s > y1 <- weightedMedian(x, w) # 3.5 378s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 378s > y2 <- median(y) # 3.5 378s > stopifnot(all.equal(y1, y2)) 378s > 378s > # Put even more weight on the zero 378s > w[1] <- 8.5 378s > y <- weightedMedian(x, w) # 2 378s > 378s > # All weight on the first value 378s > w[1] <- Inf 378s > y <- weightedMedian(x, w) # 1 378s > 378s > # All weight on the last value 378s > w[1] <- 1 378s > w[n] <- Inf 378s > y <- weightedMedian(x, w) # 10 378s > 378s > # All weights set to zero 378s > w <- rep(0, times = n) 378s > y <- weightedMedian(x, w) # NA 378s > 378s > x <- 1:4 378s > w <- rep(1, times = 4) 378s > for (mode in c("integer", "double")) { 378s + storage.mode(x) <- mode 378s + for (ties in c("weighted", "mean", "min", "max")) { 378s + cat(sprintf("ties = %s\n", ties)) 378s + y <- weightedMedian(x, w, ties = ties) 378s + } 378s + } 378s ties = weighted 378s ties = mean 378s ties = min 378s ties = max 378s ties = weighted 378s ties = mean 378s ties = min 378s ties = max 378s > 378s > set.seed(0x42) 378s > 378s > y <- weightedMedian(x = double(0L)) 378s > print(y) 378s [1] NA 378s > stopifnot(length(y) == 1L) 378s > stopifnot(is.na(y)) 378s > 378s > y <- weightedMedian(x = x[1]) 378s > print(y) 378s [1] 1 378s > stopifnot(length(y) == 1L) 378s > stopifnot(all.equal(y, x[1])) 378s > 378s > 378s > n <- 1e3 378s > x <- runif(n) 378s > w <- runif(n, min = 0, max = 1) 378s > for (mode in c("integer", "double")) { 378s + storage.mode(x) <- mode 378s + for (ties in c("weighted", "mean", "min", "max")) { 378s + y <- weightedMedian(x, w, ties = ties) 378s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 378s + } 378s + } 378s mode = integer, ties = weighted, result = 0 378s mode = integer, ties = mean, result = 0 378s mode = integer, ties = min, result = 0 378s mode = integer, ties = max, result = 0 378s mode = double, ties = weighted, result = 0 378s mode = double, ties = mean, result = 0 378s mode = double, ties = min, result = 0 378s mode = double, ties = max, result = 0 378s > 378s > 378s > # A large vector 378s > n <- 1e5 378s > x <- runif(n) 378s > w <- runif(n, min = 0, max = 1) 378s > y <- weightedMedian(x, w) 378s > 378s > y <- weightedMedian(x, w, ties = "min") 378s > 378s > 378s > # Single Number 378s > xs <- c(1, NA_integer_) 378s > ws <- c(1, NA_integer_) 378s > for (x in xs) { 378s + for (w in ws) { 378s + y <- weightedMedian(x = x, w = w) 378s + if (is.na(w)) z <- NA_real_ 378s + else z <- x[1] 378s + stopifnot(all.equal(y, z)) 378s + } 378s + } 378s > 378s > ## Logical 378s > x1 <- c(TRUE, FALSE, TRUE) 378s > w0 <- c(0, 0, 0) 378s > stopifnot(!is.finite(weightedMedian(x1, w0)), 378s + !is.infinite(weightedMedian(x1, w0))) 378s > 378s > w1 <- c(1, 1, 1) 378s > stopifnot(weightedMedian(x1, w1) == 1) 378s > 378s > w2 <- c(1, 2, 3) 378s > stopifnot(weightedMedian(x1, w2) == 1) 378s > 378s > ### NA 378s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 378s + c(1, 2, 3))), 378s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 378s + c(1, 2, 3), 378s + na.rm = TRUE), 378s + weightedMedian(c(TRUE, FALSE), 378s + c(1, 2)))) 378s > ### Identical to as.integer() 378s > x <- rcauchy(100) 378s > w <- abs(rcauchy(100)) 378s > stopifnot(all.equal(weightedMedian(x > 0, w), 378s + weightedMedian(as.integer(x > 0), w))) 378s > 378s > 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: powerpc64le-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 378s > 378s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 378s > # Subsetted tests 378s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 378s > source("utils/validateIndicesFramework.R") 378s > for (mode in c("numeric", "integer")) { 378s + x <- runif(6, min = -6, max = 6) 378s + w <- runif(6, min = 0, max = 6) 378s + storage.mode(x) <- mode 378s + storage.mode(w) <- mode 378s + if (mode == "numeric") w[1] <- Inf 378s + 378s + for (idxs in index_cases) { 378s + validateIndicesTestVector_w(x, w, idxs, 378s + ftest = weightedMedian, 378s + fsure = weightedMedian, 378s + na.rm = TRUE) 378s + validateIndicesTestVector_w(x, w, idxs, 378s + ftest = weightedMedian, 378s + fsure = weightedMedian, 378s + na.rm = FALSE) 378s + 378s + for (ties in c("weighted", "mean", "min", "max")) { 378s + validateIndicesTestVector_w(x, w, idxs, 378s + ftest = weightedMedian, 378s + fsure = weightedMedian, 378s + na.rm = TRUE, ties = ties) 378s + validateIndicesTestVector_w(x, w, idxs, 378s + ftest = weightedMedian, 378s + fsure = weightedMedian, 378s + na.rm = FALSE, ties = ties) 378s + } 378s + } 378s + } 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: powerpc64le-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 378s > 378s > weightedVar_R <- function(x, w) { 378s + mu <- weighted.mean(x, w = w) 378s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 378s + } 378s > 378s > 378s > n <- 10 378s > x <- as.double(1:n) 378s > 378s > message("*** weightedVar() ...") 378s *** weightedVar() ... 378s - Zero elements 378s > 378s > message("- Zero elements") 378s > m0 <- var(integer(0)) 378s > m1 <- weightedVar(integer(0), w = integer(0)) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0:- One elements 378s num NA 378s $ m1: int NA 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- One elements") 378s > m0 <- var(1) 378s > m1 <- weightedVar(1) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num NA 378s $ - Uniform weights (all w = 1) 378s m1: num NA 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- Uniform weights (all w = 1)") 378s > m0 <- var(x) 378s > w <- rep(1, times = n) 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num 9.17 378s $ m1:- Uniform weights (all w = 3) 378s num 9.17 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- Uniform weights (all w = 3)") 378s > m0 <- var(rep(x, each = 3)) 378s > w <- rep(3, times = n) 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num 8.53 378s $ m1:- Uniform weights on the first five elements 378s num 8.53 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- Uniform weights on the first five elements") 378s > idxs <- 1:5 378s - Uniform weights on every second elements 378s > m0 <- var(x[1:5]) 378s > w <- rep(0, times = n) 378s > w[idxs] <- 1 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num 2.5 378s $ m1: num 2.5 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- Uniform weights on every second elements") 378s > idxs <- seq(from = 1, to = n, by = 2) 378s > m0 <- var(x[idxs]) 378s > w <- rep(0, times = n) 378s > - All weights are zero 378s w[idxs] <- 1 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num 10 378s $ m1: num 10 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > 378s > message("- All weights are zero") 378s > idxs <- integer(0L) 378s > m0 <- var(x[idxs]) 378s > w <- rep(0, times = n) 378s > w[idxs] <- 1 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num NA 378s $ m1:- Infinite weight on first element 378s - Missing-value weight on first element 378s num NA 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > message("- Infinite weight on first element") 378s > idxs <- 1L 378s > m0 <- var(x[idxs]) 378s > w <- rep(0, times = n) 378s > w[idxs] <- Inf 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num NA 378s $ m1: num NA 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > message("- Missing-value weight on first element") 378s > idxs <- 1L 378s > w <- rep(1, times = n) 378s > w[idxs] <- NA_real_ 378s > m1 <- weightedVar(x, w = w) 378s > str(list(m1 = m1)) 378s List of 1 378s $ m1: num NA 378s > stopifnot(identical(m1, NA_real_)) 378s > 378s > 378s > message("- Frequency weights") 378s > 378s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 378s > y <- c(2, 2, 4, 5, 5, 5) 378s > x <- unique(y) 378s > w <- table(y) 378s - Frequency weights 378s > stopifnot(names(w) == x) 378s > 378s > m0 <- weightedVar(x, w = w) 378s > m1 <- var(y) 378s > stopifnot(all.equal(m1, m0)) 378s > m2 <- weightedVar(x, w = w) 378s > str(list(m0 = m0, m1 = m1, m2 = m2)) 378s List of 3 378s $ m0: num 2.17 378s $ m1: num 2.17 378s $ m2: num 2.17 378s > stopifnot(all.equal(m2, m0)) 378s > 378s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 378s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 378s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 378s > 378s > m0 <- weightedVar(large, w = years) 378s > m1 <- weightedVar(large, w = years) 378s > str(list(m0 = m0, m1 = m1)) 378s List of 2 378s $ m0: num 899 378s $ m1: num 899 378s > stopifnot(all.equal(m1, m0)) 378s > 378s > message("*** weightedVar() ... DONE") 378s *** weightedVar() ... DONE 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: powerpc64le-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 378s > 378s > fcns <- list( 378s + weightedVar = weightedVar, 378s + weightedSd = weightedSd, 378s + weightedMad = weightedMad 378s + ) 378s > 378s > for (name in names(fcns)) { 378s + cat(sprintf("%s()...\n", name)) 378s + fcn <- fcns[[name]] 378s + 378s + for (mode in c("integer", "double")) { 378s + cat("mode: ", mode, "\n", sep = "") 378s + n <- 15L 378s + x <- runif(n, min = -5, max = 5) 378s + storage.mode(x) <- mode 378s + str(x) 378s + 378s + for (add_na in c(FALSE, TRUE)) { 378s + cat("add_na: ", add_na, "\n", sep = "") 378s + if (add_na) { 378s + x[c(5, 7)] <- NA 378s + } 378s + str(x) 378s + 378s + for (na.rm in c(FALSE, TRUE)) { 378s + cat("na.rm: ", na.rm, "\n", sep = "") 378s + 378s + cat("Weights are not specified (all are 1)\n") 378s + m1 <- fcn(x, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("All weights are 1\n") 378s + w <- rep(1, times = n) 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("First weight is 5\n") 378s + # Pull the mean towards zero 378s + w[1] <- 5 378s + str(w) 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("All weights are 0\n") 378s + # All weights set to zero 378s + w <- rep(0, times = n) 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("First weight is 8.5\n") 378s + # Put even more weight on the zero 378s + w[1] <- 8.5 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("First weight is Inf\n") 378s + # All weight on the first value 378s + w[1] <- Inf 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("Last weight is Inf\n") 378s + # All weight on the last value 378s + w[1] <- 1 378s + w[n] <- Inf 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + 378s + cat("Last weight is NA\n") 378s + # All weight on the last value 378s + w[1] <- 1 378s + w[n] <- NA_real_ 378s + m1 <- fcn(x, w, na.rm = na.rm) 378s + str(list(m1 = m1)) 378s + } # for (na.rm ...) 378s + } # for (add_na ...) 378s + } # for (mode ...) 378s + 378s + cat(sprintf("%s()...DONE\n", name)) 378s + } # for (name ...) 378s weightedVar()... 378s mode: integer 378s int [1:15] 4 -3 2 -3 1 -4 4 3 -3 3 ... 378s add_na: FALSE 378s int [1:15] 4 -3 2 -3 1 -4 4 3 -3 3 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 8.27 378s All weights are 1 378s List of 1 378s $ m1: num 8.27 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 8.54 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int NA 378s First weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 8.27 378s All weights are 1 378s List of 1 378s $ m1: num 8.27 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 8.54 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int NA 378s First weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s add_na: TRUE 378s int [1:15] 4 -3 2 -3 NA -4 NA 3 -3 3 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: int NA 378s All weights are 1 378s List of 1 378s $ m1: int NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: int NA 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int NA 378s First weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 8.53 378s All weights are 1 378s List of 1 378s $ m1: num 8.53 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 9.11 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int NA 378s First weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is Inf 378s List of 1 378s $ m1: int NA 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s mode: double 378s num [1:15] 1.22 -2.28 -1.58 2.21 -1.26 ... 378s add_na: FALSE 378s num [1:15] 1.22 -2.28 -1.58 2.21 -1.26 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 4.53 378s All weights are 1 378s List of 1 378s $ m1: num 4.53 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 3.62 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 4.53 378s All weights are 1 378s List of 1 378s $ m1: num 4.53 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 3.62 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s add_na: TRUE 378s num [1:15] 1.22 -2.28 -1.58 2.21 NA ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num NA 378s All weights are 1 378s List of 1 378s $ m1: num NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num NA 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 3.92 378s All weights are 1 378s List of 1 378s $ m1: num 3.92 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.97 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s weightedVar()...DONE 378s weightedSd()... 378s mode: integer 378s int [1:15] 0 -2 -4 -3 -4 1 3 -2 1 -3 ... 378s add_na: FALSE 378s int [1:15] 0 -2 -4 -3 -4 1 3 -2 1 -3 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.56 378s All weights are 1 378s List of 1 378s $ m1: num 2.56 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.29 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.56 378s All weights are 1 378s List of 1 378s $ m1: num 2.56 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.29 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s add_na: TRUE 378s int [1:15] 0 -2 -4 -3 NA 1 NA -2 1 -3 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num NA 378s All weights are 1 378s List of 1 378s $ m1: num NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num NA 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.36 378s All weights are 1 378s List of 1 378s $ m1: num 2.36 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.08 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s mode: double 378s num [1:15] -2.973 3.3 -4.637 -2.594 -0.513 ... 378s add_na: FALSE 378s num [1:15] -2.973 3.3 -4.637 -2.594 -0.513 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.7 378s All weights are 1 378s List of 1 378s $ m1: num 2.7 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.49 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.7 378s All weights are 1 378s List of 1 378s $ m1: num 2.7 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.49 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s add_na: TRUE 378s num [1:15] -2.97 3.3 -4.64 -2.59 NA ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num NA 378s All weights are 1 378s List of 1 378s $ m1: num NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num NA 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.77 378s All weights are 1 378s List of 1 378s $ m1: num 2.77 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.54 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num NA 378s First weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is Inf 378s List of 1 378s $ m1: num NA 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s weightedSd()...DONE 378s weightedMad()... 378s mode: integer 378s int [1:15] 3 -2 1 -4 4 0 0 0 1 -4 ... 378s add_na: FALSE 378s int [1:15] 3 -2 1 -4 4 0 0 0 1 -4 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.97 378s All weights are 1 378s List of 1 378s $ m1: num 2.97 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.97 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int 0 378s First weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.97 378s All weights are 1 378s List of 1 378s $ m1: num 2.97 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.97 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int 0 378s First weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s add_na: TRUE 378s int [1:15] 3 -2 1 -4 NA 0 NA 0 1 -4 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num NA 378s All weights are 1 378s List of 1 378s $ m1: int NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: int NA 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int 0 378s First weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.97 378s All weights are 1 378s List of 1 378s $ m1: num 2.97 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.97 378s All weights are 0 378s List of 1 378s $ m1: int NA 378s First weight is 8.5 378s List of 1 378s $ m1: int 0 378s First weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is Inf 378s List of 1 378s $ m1: int 0 378s Last weight is NA 378s List of 1 378s $ m1: int NA 378s mode: double 378s num [1:15] 0.943 -4.928 -0.436 -0.515 -1.053 ... 378s add_na: FALSE 378s num [1:15] 0.943 -4.928 -0.436 -0.515 -1.053 ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.84 378s All weights are 1 378s List of 1 378s $ m1: num 2.84 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.08 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num 0 378s First weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 2.84 378s All weights are 1 378s List of 1 378s $ m1: num 2.84 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.08 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num 0 378s First weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s add_na: TRUE 378s num [1:15] 0.943 -4.928 -0.436 -0.515 NA ... 378s na.rm: FALSE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num NA 378s All weights are 1 378s List of 1 378s $ m1: num NA 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num NA 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num 0 378s First weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s na.rm: TRUE 378s Weights are not specified (all are 1) 378s List of 1 378s $ m1: num 3.23 378s All weights are 1 378s List of 1 378s $ m1: num 3.23 378s First weight is 5 378s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 378s List of 1 378s $ m1: num 2.12 378s All weights are 0 378s List of 1 378s $ m1: num NA 378s First weight is 8.5 378s List of 1 378s $ m1: num 0 378s First weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is Inf 378s List of 1 378s $ m1: num 0 378s Last weight is NA 378s List of 1 378s $ m1: num NA 378s weightedMad()...DONE 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: powerpc64le-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 379s > library("matrixStats") 379s > 379s > fcns <- list( 379s + weightedVar = weightedVar, 379s + weightedSd = weightedSd, 379s + weightedMad = weightedMad 379s + ) 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Subsetted tests 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > source("utils/validateIndicesFramework.R") 379s > for (name in names(fcns)) { 379s + cat(sprintf("subsetted tests on %s()...\n", name)) 379s + fcn <- fcns[[name]] 379s + 379s + for (mode in c("numeric", "integer")) { 379s + x <- runif(6, min = -6, max = 6) 379s + w <- runif(6, min = 0, max = 6) 379s + storage.mode(x) <- mode 379s + storage.mode(w) <- mode 379s + if (mode == "numeric") w[1] <- Inf 379s + 379s + for (idxs in index_cases) { 379s + validateIndicesTestVector_w(x, w, idxs, 379s + ftest = fcn, fsure = fcn, 379s + na.rm = TRUE) 379s + validateIndicesTestVector_w(x, w, idxs, 379s + ftest = fcn, fsure = fcn, 379s + na.rm = FALSE) 379s + } 379s + } 379s + cat(sprintf("%s()...DONE\n", name)) 379s + } 379s subsetted tests on weightedVar()... 379s weightedVar()...DONE 379s subsetted tests on weightedSd()... 379s weightedSd()...DONE 379s subsetted tests on weightedMad()... 379s weightedMad()...DONE 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: powerpc64le-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 379s > library("matrixStats") 379s > 379s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 379s + if (na.rm) { 379s + xnok <- is.na(x) 379s + ynok <- is.na(y) 379s + anok <- xnok & ynok 379s + unit <- switch(OP, 379s + "+" = 0, 379s + "-" = NA_real_, 379s + "*" = 1, 379s + "/" = NA_real_, 379s + stop("Unknown 'OP' operator: ", OP) 379s + ) 379s + x[xnok] <- unit 379s + y[ynok] <- unit 379s + } 379s + 379s + ans <- switch(OP, 379s + "+" = x + y, 379s + "-" = x - y, 379s + "*" = x * y, 379s + "/" = x / y, 379s + stop("Unknown 'OP' operator: ", OP) 379s + ) 379s + 379s + if (na.rm) { 379s + ans[anok] <- NA_real_ 379s + } 379s + 379s + ans 379s + } # x_OP_y_R() 379s > 379s > 379s > 379s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 379s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 379s + } 379s > 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # No missing values 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > x <- matrix(1:16, nrow = 4, ncol = 4) 379s > y <- 1:nrow(x) 379s > storage.mode(y) <- storage.mode(x) 379s > 379s > for (OP in c("+", "-", "*", "/")) { 379s + for (na.rm in c(FALSE, TRUE)) { 379s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 379s + 379s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 379s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 379s + str(a1) 379s + stopifnot(all.equal(a1, a0)) 379s + 379s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 379s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 379s + str(b1) 379s + stopifnot(all.equal(b1, b0)) 379s + } 379s + } 379s OP = '+', na.rm = FALSE 379s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 379s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 379s OP = '+', na.rm = TRUE 379s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 379s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 379s OP = '-', na.rm = FALSE 379s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 379s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 379s OP = '-', na.rm = TRUE 379s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 379s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 379s OP = '*', na.rm = FALSE 379s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 379s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 379s OP = '*', na.rm = TRUE 379s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 379s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 379s OP = '/', na.rm = FALSE 379s num [1:4, 1:4] 1 1 1 1 5 ... 379s num [1:4, 1:4] 1 2 3 4 2.5 ... 379s OP = '/', na.rm = TRUE 379s num [1:4, 1:4] 1 1 1 1 5 ... 379s num [1:4, 1:4] 1 2 3 4 2.5 ... 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Missing values in x, y, or both. 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > for (which in c("x", "y", "both")) { 379s + x <- matrix(1:16, nrow = 4, ncol = 4) 379s + y <- 1:nrow(x) 379s + storage.mode(y) <- storage.mode(x) 379s + 379s + if (which == "x") { 379s + x[3:6] <- NA_real_ 379s + } else if (which == "y") { 379s + y[c(1, 3)] <- NA_real_ 379s + } else if (which == "both") { 379s + x[3:6] <- NA_real_ 379s + y[c(1, 3)] <- NA_real_ 379s + } 379s + 379s + for (OP in c("+", "-", "*", "/")) { 379s + for (na.rm in c(FALSE, TRUE)) { 379s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 379s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 379s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 379s + str(a1) 379s + stopifnot(all.equal(a1, a0)) 379s + 379s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 379s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 379s + str(b1) 379s + stopifnot(all.equal(b1, b0)) 379s + } 379s + } 379s + } 379s OP = '+', na.rm = FALSE 379s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 379s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 379s OP = '+', na.rm = TRUE 379s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 379s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 379s OP = '-', na.rm = FALSE 379s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 379s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 379s OP = '-', na.rm = TRUE 379s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 379s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 379s OP = '*', na.rm = FALSE 379s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 379s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 379s OP = '*', na.rm = TRUE 379s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 379s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 379s OP = '/', na.rm = FALSE 379s num [1:4, 1:4] 1 1 NA NA NA ... 379s num [1:4, 1:4] 1 2 NA NA NA ... 379s OP = '/', na.rm = TRUE 379s num [1:4, 1:4] 1 1 NA NA NA ... 379s num [1:4, 1:4] 1 2 NA NA NA ... 379s OP = '+', na.rm = FALSE 379s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 379s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 379s OP = '+', na.rm = TRUE 379s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 379s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 379s OP = '-', na.rm = FALSE 379s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 379s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 379s OP = '-', na.rm = TRUE 379s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 379s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 379s OP = '*', na.rm = FALSE 379s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 379s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 379s OP = '*', na.rm = TRUE 379s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 379s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 379s OP = '/', na.rm = FALSE 379s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 379s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 379s OP = '/', na.rm = TRUE 379s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 379s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 379s OP = '+', na.rm = FALSE 379s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 379s OP = '+', na.rm = TRUE 379s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 379s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 379s OP = '-', na.rm = FALSE 379s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 379s OP = '-', na.rm = TRUE 379s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 379s OP = '*', na.rm = FALSE 379s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 379s OP = '*', na.rm = TRUE 379s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 379s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 379s OP = '/', na.rm = FALSE 379s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 379s OP = '/', na.rm = TRUE 379s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 379s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 379s > 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Length differences 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > x <- matrix(1:8, nrow = 2, ncol = 4) 379s > y <- 1:ncol(x) 379s > storage.mode(y) <- storage.mode(x) 379s > 379s > for (OP in c("+", "-", "*", "/")) { 379s + for (na.rm in c(FALSE, TRUE)) { 379s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 379s + 379s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 379s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 379s + str(a1) 379s + stopifnot(all.equal(a1, a0)) 379s + 379s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 379s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 379s + str(b1) 379s + stopifnot(all.equal(b1, b0)) 379s + } 379s + } 379s OP = '+', na.rm = FALSE 379s int [1:2, 1:4] 2 4 6 8 6 8 10 12 379s int [1:2, 1:4] 2 3 5 6 8 9 11 12 379s OP = '+', na.rm = TRUE 379s int [1:2, 1:4] 2 4 6 8 6 8 10 12 379s int [1:2, 1:4] 2 3 5 6 8 9 11 12 379s OP = '-', na.rm = FALSE 379s int [1:2, 1:4] 0 0 0 0 4 4 4 4 379s int [1:2, 1:4] 0 1 1 2 2 3 3 4 379s OP = '-', na.rm = TRUE 379s int [1:2, 1:4] 0 0 0 0 4 4 4 4 379s int [1:2, 1:4] 0 1 1 2 2 3 3 4 379s OP = '*', na.rm = FALSE 379s int [1:2, 1:4] 1 4 9 16 5 12 21 32 379s int [1:2, 1:4] 1 2 6 8 15 18 28 32 379s OP = '*', na.rm = TRUE 379s int [1:2, 1:4] 1 4 9 16 5 12 21 32 379s int [1:2, 1:4] 1 2 6 8 15 18 28 32 379s OP = '/', na.rm = FALSE 379s num [1:2, 1:4] 1 1 1 1 5 ... 379s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 379s OP = '/', na.rm = TRUE 379s num [1:2, 1:4] 1 1 1 1 5 ... 379s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # All missing values 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > xs <- list( 379s + A = matrix(1:2, nrow = 2, ncol = 2), 379s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 379s + ) 379s > ys <- list( 379s + A = 1L, 379s + B = NA_integer_ 379s + ) 379s > 379s > for (x in xs) { 379s + for (y in ys) { 379s + for (mode in c("logical", "integer", "double")) { 379s + storage.mode(x) <- mode 379s + storage.mode(y) <- mode 379s + str(list(x = x, y = y)) 379s + 379s + for (OP in c("+", "-", "*", "/")) { 379s + for (na.rm in c(FALSE, TRUE)) { 379s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 379s + suppressWarnings({ 379s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 379s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 379s + }) 379s + str(z) 379s + stopifnot(all.equal(z, z0)) 379s + } 379s + } 379s + } # for (mode ...) 379s + } # for (y ...) 379s + } # for (x ...) 379s List of 2 379s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 379s $ y: logi TRUE 379s mode = 'logical', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] 2 2 2 2 379s mode = 'logical', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 2 2 2 2 379s mode = 'logical', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] 0 0 0 0 379s mode = 'logical', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] 0 0 0 0 379s mode = 'logical', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s List of 2 379s $ x: int [1:2, 1:2] 1 1 1 1 379s $ y: int 1 379s mode = 'integer', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] 2 2 2 2 379s mode = 'integer', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 2 2 2 2 379s mode = 'integer', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] 0 0 0 0 379s mode = 'integer', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] 0 0 0 0 379s mode = 'integer', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s List of 2 379s $ x: num [1:2, 1:2] 1 1 1 1 379s $ y: num 1 379s mode = 'double', OP = '+', na.rm = FALSE 379s num [1:2, 1:2] 2 2 2 2 379s mode = 'double', OP = '+', na.rm = TRUE 379s num [1:2, 1:2] 2 2 2 2 379s mode = 'double', OP = '-', na.rm = FALSE 379s num [1:2, 1:2] 0 0 0 0 379s mode = 'double', OP = '-', na.rm = TRUE 379s num [1:2, 1:2] 0 0 0 0 379s mode = 'double', OP = '*', na.rm = FALSE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '*', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s List of 2 379s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 379s $ y: logi NA 379s mode = 'logical', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: int [1:2, 1:2] 1 1 1 1 379s $ y: int NA 379s mode = 'integer', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: num [1:2, 1:2] 1 1 1 1 379s $ y: num NA 379s mode = 'double', OP = '+', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '+', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '-', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '-', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: logi [1:2, 1:2] NA NA NA NA 379s $ y: logi TRUE 379s mode = 'logical', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'logical', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: int [1:2, 1:2] NA NA NA NA 379s $ y: int 1 379s mode = 'integer', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] 1 1 1 1 379s mode = 'integer', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: num [1:2, 1:2] NA NA NA NA 379s $ y: num 1 379s mode = 'double', OP = '+', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '+', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '-', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '-', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = TRUE 379s num [1:2, 1:2] 1 1 1 1 379s mode = 'double', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: logi [1:2, 1:2] NA NA NA NA 379s $ y: logi NA 379s mode = 'logical', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'logical', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: int [1:2, 1:2] NA NA NA NA 379s $ y: int NA 379s mode = 'integer', OP = '+', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '+', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '-', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '-', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = FALSE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '*', na.rm = TRUE 379s int [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'integer', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s List of 2 379s $ x: num [1:2, 1:2] NA NA NA NA 379s $ y: num NA 379s mode = 'double', OP = '+', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '+', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '-', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '-', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '*', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '/', na.rm = FALSE 379s num [1:2, 1:2] NA NA NA NA 379s mode = 'double', OP = '/', na.rm = TRUE 379s num [1:2, 1:2] NA NA NA NA 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: powerpc64le-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 379s > library("matrixStats") 379s > 379s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 379s + if (na.rm) { 379s + xnok <- is.na(x) 379s + ynok <- is.na(y) 379s + anok <- xnok & ynok 379s + unit <- switch(OP, 379s + "+" = 0, 379s + "-" = NA_real_, 379s + "*" = 1, 379s + "/" = NA_real_, 379s + stop("Unknown 'OP' operator: ", OP) 379s + ) 379s + x[xnok] <- unit 379s + y[ynok] <- unit 379s + } 379s + 379s + ans <- switch(OP, 379s + "+" = x + y, 379s + "-" = x - y, 379s + "*" = x * y, 379s + "/" = x / y, 379s + stop("Unknown 'OP' operator: ", OP) 379s + ) 379s + 379s + if (na.rm) { 379s + ans[anok] <- NA_real_ 379s + } 379s + 379s + ans 379s + } # x_OP_y_R() 379s > 379s > 379s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 379s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 379s + } 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Subsetted tests 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > source("utils/validateIndicesFramework.R") 379s > for (OP in c("+", "-", "*", "/")) { 379s + for (mode in c("numeric", "integer", "logical")) { 379s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 379s + y <- runif(6, min = 0, max = 6) 379s + storage.mode(x) <- mode 379s + storage.mode(y) <- mode 379s + if (mode == "numeric") y[1] <- Inf 379s + 379s + for (xrows in index_cases) { 379s + for (xcols in index_cases) { 379s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 379s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 379s + 379s + for (yidxs in list(xrows, xcols)) { 379s + for (na.rm in c(TRUE, FALSE)) { 379s + 379s + suppressWarnings({ 379s + actual <- tryCatch( 379s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 379s + na.rm = na.rm), 379s + error = function(c) "error" 379s + ) 379s + 379s + expect <- tryCatch( 379s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 379s + na.rm = na.rm), 379s + error = function(c) "error" 379s + ) 379s + }) 379s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 379s + 379s + suppressWarnings({ 379s + actual <- tryCatch( 379s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 379s + na.rm = na.rm), 379s + error = function(c) "error" 379s + ) 379s + 379s + expect <- tryCatch( 379s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 379s + na.rm = na.rm), 379s + error = function(c) "error" 379s + ) 379s + }) 379s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 379s + } 379s + } 379s + } 379s + } 379s + } 379s + } 383s > 383s 383s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 383s Copyright (C) 2025 The R Foundation for Statistical Computing 383s Platform: powerpc64le-unknown-linux-gnu 383s 383s R is free software and comes with ABSOLUTELY NO WARRANTY. 383s You are welcome to redistribute it under certain conditions. 383s Type 'license()' or 'licence()' for distribution details. 383s 383s R is a collaborative project with many contributors. 383s Type 'contributors()' for more information and 383s 'citation()' on how to cite R or R packages in publications. 383s 383s Type 'demo()' for some demos, 'help()' for on-line help, or 383s 'help.start()' for an HTML browser interface to help. 383s Type 'q()' to quit R. 383s 384s > ## These tests need to be last of all tests, otherwise 384s > ## covr::package_coverage() gives an error. 384s > cat("1. Loading package\n") 384s 1. Loading package 384s > loadNamespace("matrixStats") 384s 384s > stopifnot("matrixStats" %in% loadedNamespaces()) 384s > 384s > cat("2. Unloading package\n") 384s 2. Unloading package 384s > unloadNamespace("matrixStats") 384s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 384s > 384s > if (FALSE) { 384s + ## 'covr' gives "Error in library("matrixStats") : 384s + ## there is no package called 'matrixStats'" here, cf. 384s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 384s + 384s + cat("3. Attaching package\n") 384s + library("matrixStats") 384s + stopifnot("package:matrixStats" %in% search()) 384s + 384s + cat("4. Detaching package\n") 384s + detach("package:matrixStats") 384s + stopifnot(!"package:matrixStats" %in% search()) 384s + stopifnot("matrixStats" %in% loadedNamespaces()) 384s + 384s + cat("5. Unloading package\n") 384s + unloadNamespace("matrixStats") 384s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 384s + 384s + cat("6. Attaching package (again)\n") 384s + library("matrixStats") 384s + stopifnot("package:matrixStats" %in% search()) 384s + 384s + cat("7. Detaching package (again)\n") 384s + detach("package:matrixStats") 384s + stopifnot(!"package:matrixStats" %in% search()) 384s + stopifnot("matrixStats" %in% loadedNamespaces()) 384s + } 384s > 384s > cat("7. DONE\n") 384s 7. DONE 384s > 384s autopkgtest [23:33:25]: test run-unit-test: -----------------------] 384s autopkgtest [23:33:25]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 384s run-unit-test PASS 385s autopkgtest [23:33:26]: test pkg-r-autopkgtest: preparing testbed 404s Creating nova instance adt-resolute-ppc64el-r-cran-matrixstats-20260209-232701-juju-7f2275-prod-proposed-migration-environment-2-6a8a0b78-1aab-4015-b68b-a6d0dc16e5b9 from image adt/ubuntu-resolute-ppc64el-server-20260209.img (UUID f7f31435-4cd1-4090-aa55-59cfefa097ca)... 525s autopkgtest [23:35:46]: testbed dpkg architecture: ppc64el 525s autopkgtest [23:35:46]: testbed apt version: 3.1.15 526s autopkgtest [23:35:47]: @@@@@@@@@@@@@@@@@@@@ test bed setup 526s autopkgtest [23:35:47]: testbed release detected to be: resolute 526s autopkgtest [23:35:47]: updating testbed package index (apt update) 527s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 527s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 527s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 527s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 527s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 527s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 527s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 530s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main ppc64el Packages [246 kB] 530s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/universe ppc64el Packages [1534 kB] 535s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse ppc64el Packages [19.4 kB] 535s Fetched 3774 kB in 9s (439 kB/s) 536s Reading package lists... 537s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 537s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 537s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 537s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 538s Reading package lists... 538s Reading package lists... 538s Building dependency tree... 538s Reading state information... 538s Calculating upgrade... 538s The following packages will be upgraded: 538s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 538s libip6tc2 libxtables12 wget 538s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 538s Need to get 3125 kB of archives. 538s After this operation, 78.8 kB of additional disk space will be used. 538s Get:1 http://ftpmaster.internal/ubuntu resolute/main ppc64el iptables ppc64el 1.8.11-2ubuntu3 [464 kB] 538s Get:2 http://ftpmaster.internal/ubuntu resolute/main ppc64el libip4tc2 ppc64el 1.8.11-2ubuntu3 [27.8 kB] 538s Get:3 http://ftpmaster.internal/ubuntu resolute/main ppc64el libip6tc2 ppc64el 1.8.11-2ubuntu3 [28.2 kB] 538s Get:4 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxtables12 ppc64el 1.8.11-2ubuntu3 [41.2 kB] 538s Get:5 http://ftpmaster.internal/ubuntu resolute/main ppc64el iproute2 ppc64el 6.18.0-1ubuntu1 [1458 kB] 545s Get:6 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcryptsetup12 ppc64el 2:2.8.0-1ubuntu3 [404 kB] 545s Get:7 http://ftpmaster.internal/ubuntu resolute/main ppc64el wget ppc64el 1.25.0-2ubuntu4 [401 kB] 545s Get:8 http://ftpmaster.internal/ubuntu resolute/main ppc64el cryptsetup-bin ppc64el 2:2.8.0-1ubuntu3 [250 kB] 545s Get:9 http://ftpmaster.internal/ubuntu resolute/main ppc64el dracut-install ppc64el 109-11ubuntu1 [51.3 kB] 545s dpkg-preconfigure: unable to re-open stdin: No such file or directory 545s Fetched 3125 kB in 7s (464 kB/s) 545s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 122003 files and directories currently installed.) 545s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_ppc64el.deb ... 545s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 545s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_ppc64el.deb ... 545s Unpacking libip4tc2:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 546s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_ppc64el.deb ... 546s Unpacking libip6tc2:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 546s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_ppc64el.deb ... 546s Unpacking libxtables12:ppc64el (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 546s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_ppc64el.deb ... 546s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 546s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_ppc64el.deb ... 546s Unpacking libcryptsetup12:ppc64el (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 546s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_ppc64el.deb ... 546s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 546s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_ppc64el.deb ... 546s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 546s Preparing to unpack .../8-dracut-install_109-11ubuntu1_ppc64el.deb ... 546s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 546s Setting up libip4tc2:ppc64el (1.8.11-2ubuntu3) ... 546s Setting up wget (1.25.0-2ubuntu4) ... 546s Setting up libip6tc2:ppc64el (1.8.11-2ubuntu3) ... 546s Setting up libxtables12:ppc64el (1.8.11-2ubuntu3) ... 546s Setting up dracut-install (109-11ubuntu1) ... 546s Setting up libcryptsetup12:ppc64el (2:2.8.0-1ubuntu3) ... 546s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 546s Setting up iptables (1.8.11-2ubuntu3) ... 546s Setting up iproute2 (6.18.0-1ubuntu1) ... 547s Processing triggers for man-db (2.13.1-1build1) ... 548s Processing triggers for install-info (7.2-5) ... 548s Processing triggers for libc-bin (2.42-2ubuntu4) ... 548s autopkgtest [23:36:09]: upgrading testbed (apt dist-upgrade and autopurge) 548s Reading package lists... 548s Building dependency tree... 548s Reading state information... 549s Calculating upgrade... 549s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 549s Reading package lists... 549s Building dependency tree... 549s Reading state information... 549s Solving dependencies... 549s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 551s Reading package lists... 552s Building dependency tree... 552s Reading state information... 552s Solving dependencies... 552s The following NEW packages will be installed: 552s build-essential cpp cpp-15 cpp-15-powerpc64le-linux-gnu 552s cpp-powerpc64le-linux-gnu dctrl-tools fontconfig fontconfig-config 552s fonts-dejavu-core fonts-dejavu-mono fonts-glyphicons-halflings fonts-mathjax 552s g++ g++-15 g++-15-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu gcc gcc-15 552s gcc-15-powerpc64le-linux-gnu gcc-powerpc64le-linux-gnu gfortran gfortran-15 552s gfortran-15-powerpc64le-linux-gnu gfortran-powerpc64le-linux-gnu 552s icu-devtools libasan8 libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev 552s libcairo2 libcc1-0 libcrypt-dev libdatrie1 libdeflate-dev libdeflate0 552s libfontconfig1 libgcc-15-dev libgfortran-15-dev libgfortran5 libgomp1 552s libgraphite2-3 libharfbuzz0b libice6 libicu-dev libisl23 libitm1 libjbig0 552s libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev 552s libjs-bootstrap libjs-highlight.js libjs-jquery libjs-jquery-datatables 552s libjs-mathjax liblapack-dev liblapack3 liblerc4 liblsan0 liblzma-dev libmpc3 552s libncurses-dev libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 552s libpaper-utils libpaper2 libpcre2-16-0 libpcre2-32-0 libpcre2-dev 552s libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev libquadmath0 552s libreadline-dev libsharpyuv0 libsm6 libstdc++-15-dev libtcl8.6 libthai-data 552s libthai0 libtiff6 libtirpc-dev libtk8.6 libtsan2 libubsan1 libwebp7 552s libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 libzstd-dev 552s linux-libc-dev node-normalize.css pkg-r-autopkgtest pkgconf pkgconf-bin 552s r-base-core r-base-dev r-cran-base64enc r-cran-cli r-cran-commonmark 552s r-cran-evaluate r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable 552s r-cran-highr r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle 552s r-cran-markdown r-cran-matrixstats r-cran-r6 r-cran-rcolorbrewer 552s r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs r-cran-viridislite 552s r-cran-withr r-cran-xfun r-cran-yaml rpcsvc-proto unzip x11-common xdg-utils 552s zip zlib1g-dev 552s 0 upgraded, 137 newly installed, 0 to remove and 0 not upgraded. 552s Need to get 173 MB of archives. 552s After this operation, 564 MB of additional disk space will be used. 552s Get:1 http://ftpmaster.internal/ubuntu resolute/main ppc64el libc-dev-bin ppc64el 2.42-2ubuntu4 [23.9 kB] 552s Get:2 http://ftpmaster.internal/ubuntu resolute/main ppc64el linux-libc-dev ppc64el 6.19.0-3.3 [1832 kB] 555s Get:3 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcrypt-dev ppc64el 1:4.5.1-1 [162 kB] 555s Get:4 http://ftpmaster.internal/ubuntu resolute/main ppc64el rpcsvc-proto ppc64el 1.4.3-1build1 [84.2 kB] 555s Get:5 http://ftpmaster.internal/ubuntu resolute/main ppc64el libc6-dev ppc64el 2.42-2ubuntu4 [2080 kB] 559s Get:6 http://ftpmaster.internal/ubuntu resolute/main ppc64el libisl23 ppc64el 0.27-1build1 [893 kB] 560s Get:7 http://ftpmaster.internal/ubuntu resolute/main ppc64el libmpc3 ppc64el 1.3.1-2 [62.5 kB] 560s Get:8 http://ftpmaster.internal/ubuntu resolute/main ppc64el cpp-15-powerpc64le-linux-gnu ppc64el 15.2.0-12ubuntu1 [11.4 MB] 582s Get:9 http://ftpmaster.internal/ubuntu resolute/main ppc64el cpp-15 ppc64el 15.2.0-12ubuntu1 [1038 B] 582s Get:10 http://ftpmaster.internal/ubuntu resolute/main ppc64el cpp-powerpc64le-linux-gnu ppc64el 4:15.2.0-4ubuntu1 [5746 B] 582s Get:11 http://ftpmaster.internal/ubuntu resolute/main ppc64el cpp ppc64el 4:15.2.0-4ubuntu1 [22.4 kB] 582s Get:12 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcc1-0 ppc64el 15.2.0-12ubuntu1 [49.0 kB] 582s Get:13 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgomp1 ppc64el 15.2.0-12ubuntu1 [169 kB] 582s Get:14 http://ftpmaster.internal/ubuntu resolute/main ppc64el libitm1 ppc64el 15.2.0-12ubuntu1 [32.2 kB] 582s Get:15 http://ftpmaster.internal/ubuntu resolute/main ppc64el libasan8 ppc64el 15.2.0-12ubuntu1 [3006 kB] 592s Get:16 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblsan0 ppc64el 15.2.0-12ubuntu1 [1374 kB] 596s Get:17 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtsan2 ppc64el 15.2.0-12ubuntu1 [2729 kB] 601s Get:18 http://ftpmaster.internal/ubuntu resolute/main ppc64el libubsan1 ppc64el 15.2.0-12ubuntu1 [1231 kB] 603s Get:19 http://ftpmaster.internal/ubuntu resolute/main ppc64el libquadmath0 ppc64el 15.2.0-12ubuntu1 [160 kB] 603s Get:20 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgcc-15-dev ppc64el 15.2.0-12ubuntu1 [1670 kB] 606s Get:21 http://ftpmaster.internal/ubuntu resolute/main ppc64el gcc-15-powerpc64le-linux-gnu ppc64el 15.2.0-12ubuntu1 [22.4 MB] 646s Get:22 http://ftpmaster.internal/ubuntu resolute/main ppc64el gcc-15 ppc64el 15.2.0-12ubuntu1 [530 kB] 647s Get:23 http://ftpmaster.internal/ubuntu resolute/main ppc64el gcc-powerpc64le-linux-gnu ppc64el 4:15.2.0-4ubuntu1 [1220 B] 647s Get:24 http://ftpmaster.internal/ubuntu resolute/main ppc64el gcc ppc64el 4:15.2.0-4ubuntu1 [5032 B] 647s Get:25 http://ftpmaster.internal/ubuntu resolute/main ppc64el libstdc++-15-dev ppc64el 15.2.0-12ubuntu1 [2747 kB] 654s Get:26 http://ftpmaster.internal/ubuntu resolute/main ppc64el g++-15-powerpc64le-linux-gnu ppc64el 15.2.0-12ubuntu1 [13.0 MB] 702s Get:27 http://ftpmaster.internal/ubuntu resolute/main ppc64el g++-15 ppc64el 15.2.0-12ubuntu1 [25.3 kB] 702s Get:28 http://ftpmaster.internal/ubuntu resolute/main ppc64el g++-powerpc64le-linux-gnu ppc64el 4:15.2.0-4ubuntu1 [970 B] 702s Get:29 http://ftpmaster.internal/ubuntu resolute/main ppc64el g++ ppc64el 4:15.2.0-4ubuntu1 [1092 B] 702s Get:30 http://ftpmaster.internal/ubuntu resolute/main ppc64el build-essential ppc64el 12.12ubuntu2 [5256 B] 702s Get:31 http://ftpmaster.internal/ubuntu resolute/main ppc64el dctrl-tools ppc64el 2.24-3build4 [108 kB] 702s Get:32 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-dejavu-mono all 2.37-8build1 [502 kB] 702s Get:33 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-dejavu-core all 2.37-8build1 [834 kB] 704s Get:34 http://ftpmaster.internal/ubuntu resolute/main ppc64el fontconfig-config ppc64el 2.17.1-3ubuntu1 [38.5 kB] 704s Get:35 http://ftpmaster.internal/ubuntu resolute/main ppc64el libfontconfig1 ppc64el 2.17.1-3ubuntu1 [193 kB] 704s Get:36 http://ftpmaster.internal/ubuntu resolute/main ppc64el fontconfig ppc64el 2.17.1-3ubuntu1 [182 kB] 704s Get:37 http://ftpmaster.internal/ubuntu resolute/universe ppc64el fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 704s Get:38 http://ftpmaster.internal/ubuntu resolute/main ppc64el fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 708s Get:39 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgfortran5 ppc64el 15.2.0-12ubuntu1 [620 kB] 709s Get:40 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgfortran-15-dev ppc64el 15.2.0-12ubuntu1 [651 kB] 710s Get:41 http://ftpmaster.internal/ubuntu resolute/main ppc64el gfortran-15-powerpc64le-linux-gnu ppc64el 15.2.0-12ubuntu1 [12.3 MB] 733s Get:42 http://ftpmaster.internal/ubuntu resolute/main ppc64el gfortran-15 ppc64el 15.2.0-12ubuntu1 [18.1 kB] 733s Get:43 http://ftpmaster.internal/ubuntu resolute/main ppc64el gfortran-powerpc64le-linux-gnu ppc64el 4:15.2.0-4ubuntu1 [1020 B] 733s Get:44 http://ftpmaster.internal/ubuntu resolute/main ppc64el gfortran ppc64el 4:15.2.0-4ubuntu1 [1166 B] 733s Get:45 http://ftpmaster.internal/ubuntu resolute/main ppc64el icu-devtools ppc64el 78.2-1ubuntu1 [246 kB] 733s Get:46 http://ftpmaster.internal/ubuntu resolute/main ppc64el libblas3 ppc64el 3.12.1-7ubuntu1 [291 kB] 733s Get:47 http://ftpmaster.internal/ubuntu resolute/main ppc64el libblas-dev ppc64el 3.12.1-7ubuntu1 [306 kB] 733s Get:48 http://ftpmaster.internal/ubuntu resolute/main ppc64el libbz2-dev ppc64el 1.0.8-6build2 [50.0 kB] 733s Get:49 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpixman-1-0 ppc64el 0.46.4-1 [347 kB] 733s Get:50 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxcb-render0 ppc64el 1.17.0-2ubuntu1 [17.4 kB] 733s Get:51 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxcb-shm0 ppc64el 1.17.0-2ubuntu1 [6072 B] 733s Get:52 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxrender1 ppc64el 1:0.9.12-1 [23.0 kB] 733s Get:53 http://ftpmaster.internal/ubuntu resolute/main ppc64el libcairo2 ppc64el 1.18.4-3 [759 kB] 734s Get:54 http://ftpmaster.internal/ubuntu resolute/main ppc64el libdatrie1 ppc64el 0.2.14-1 [22.7 kB] 734s Get:55 http://ftpmaster.internal/ubuntu resolute/main ppc64el libdeflate0 ppc64el 1.23-2build1 [64.1 kB] 734s Get:56 http://ftpmaster.internal/ubuntu resolute/main ppc64el libdeflate-dev ppc64el 1.23-2build1 [71.8 kB] 734s Get:57 http://ftpmaster.internal/ubuntu resolute/main ppc64el libgraphite2-3 ppc64el 1.3.14-11ubuntu1 [85.3 kB] 734s Get:58 http://ftpmaster.internal/ubuntu resolute/main ppc64el libharfbuzz0b ppc64el 12.3.2-1 [663 kB] 735s Get:59 http://ftpmaster.internal/ubuntu resolute/main ppc64el x11-common all 1:7.7+24ubuntu1 [22.4 kB] 735s Get:60 http://ftpmaster.internal/ubuntu resolute/main ppc64el libice6 ppc64el 2:1.1.1-1build1 [51.9 kB] 735s Get:61 http://ftpmaster.internal/ubuntu resolute/main ppc64el libicu-dev ppc64el 78.2-1ubuntu1 [13.3 MB] 758s Get:62 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg-turbo8 ppc64el 2.1.5-4ubuntu3 [214 kB] 758s Get:63 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg-turbo8-dev ppc64el 2.1.5-4ubuntu3 [358 kB] 758s Get:64 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg8 ppc64el 8c-2ubuntu11 [2148 B] 758s Get:65 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg8-dev ppc64el 8c-2ubuntu11 [1484 B] 758s Get:66 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjpeg-dev ppc64el 8c-2ubuntu11 [1486 B] 758s Get:67 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 758s Get:68 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 758s Get:69 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 758s Get:70 http://ftpmaster.internal/ubuntu resolute/universe ppc64el libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 758s Get:71 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblapack3 ppc64el 3.12.1-7ubuntu1 [2960 kB] 768s Get:72 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblapack-dev ppc64el 3.12.1-7ubuntu1 [6357 kB] 782s Get:73 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblerc4 ppc64el 4.0.0+ds-5ubuntu2 [315 kB] 782s Get:74 http://ftpmaster.internal/ubuntu resolute/main ppc64el libncurses-dev ppc64el 6.6+20251231-1 [505 kB] 782s Get:75 http://ftpmaster.internal/ubuntu resolute/main ppc64el libthai-data all 0.1.30-1 [155 kB] 782s Get:76 http://ftpmaster.internal/ubuntu resolute/main ppc64el libthai0 ppc64el 0.1.30-1 [22.5 kB] 782s Get:77 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpango-1.0-0 ppc64el 1.57.0-1 [283 kB] 782s Get:78 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpangoft2-1.0-0 ppc64el 1.57.0-1 [61.2 kB] 782s Get:79 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpangocairo-1.0-0 ppc64el 1.57.0-1 [31.0 kB] 782s Get:80 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpaper2 ppc64el 2.2.5-0.3build1 [18.1 kB] 782s Get:81 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpaper-utils ppc64el 2.2.5-0.3build1 [15.7 kB] 782s Get:82 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpcre2-16-0 ppc64el 10.46-1 [292 kB] 782s Get:83 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpcre2-32-0 ppc64el 10.46-1 [275 kB] 782s Get:84 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpcre2-posix3 ppc64el 10.46-1 [7334 B] 782s Get:85 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpcre2-dev ppc64el 10.46-1 [937 kB] 785s Get:86 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpkgconf3 ppc64el 1.8.1-4build1 [37.9 kB] 785s Get:87 http://ftpmaster.internal/ubuntu resolute/main ppc64el zlib1g-dev ppc64el 1:1.3.dfsg+really1.3.1-1ubuntu2 [903 kB] 787s Get:88 http://ftpmaster.internal/ubuntu resolute/main ppc64el libpng-dev ppc64el 1.6.54-1 [326 kB] 787s Get:89 http://ftpmaster.internal/ubuntu resolute/main ppc64el libreadline-dev ppc64el 8.3-3 [252 kB] 787s Get:90 http://ftpmaster.internal/ubuntu resolute/main ppc64el libsharpyuv0 ppc64el 1.5.0-0.1build1 [24.7 kB] 787s Get:91 http://ftpmaster.internal/ubuntu resolute/main ppc64el libsm6 ppc64el 2:1.2.6-1build1 [18.6 kB] 787s Get:92 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtcl8.6 ppc64el 8.6.17+dfsg-1build1 [1239 kB] 790s Get:93 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjbig0 ppc64el 2.1-6.1ubuntu3 [37.1 kB] 790s Get:94 http://ftpmaster.internal/ubuntu resolute/main ppc64el libwebp7 ppc64el 1.5.0-0.1build1 [330 kB] 790s Get:95 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtiff6 ppc64el 4.7.0-3ubuntu3 [307 kB] 790s Get:96 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxft2 ppc64el 2.3.6-1build2 [61.6 kB] 790s Get:97 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxss1 ppc64el 1:1.2.3-1build4 [7470 B] 790s Get:98 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtk8.6 ppc64el 8.6.17-1 [968 kB] 793s Get:99 http://ftpmaster.internal/ubuntu resolute/main ppc64el libxt6t64 ppc64el 1:1.2.1-1.3 [203 kB] 793s Get:100 http://ftpmaster.internal/ubuntu resolute/main ppc64el libzstd-dev ppc64el 1.5.7+dfsg-3 [528 kB] 794s Get:101 http://ftpmaster.internal/ubuntu resolute/universe ppc64el node-normalize.css all 8.0.1-5.1 [10.4 kB] 794s Get:102 http://ftpmaster.internal/ubuntu resolute/main ppc64el zip ppc64el 3.0-15ubuntu3 [198 kB] 794s Get:103 http://ftpmaster.internal/ubuntu resolute/main ppc64el unzip ppc64el 6.0-29ubuntu1 [200 kB] 794s Get:104 http://ftpmaster.internal/ubuntu resolute/main ppc64el xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 794s Get:105 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-base-core ppc64el 4.5.2-1ubuntu2 [29.3 MB] 876s Get:106 http://ftpmaster.internal/ubuntu resolute/main ppc64el liblzma-dev ppc64el 5.8.2-2 [210 kB] 876s Get:107 http://ftpmaster.internal/ubuntu resolute/main ppc64el pkgconf-bin ppc64el 1.8.1-4build1 [22.7 kB] 876s Get:108 http://ftpmaster.internal/ubuntu resolute/main ppc64el pkgconf ppc64el 1.8.1-4build1 [16.8 kB] 876s Get:109 http://ftpmaster.internal/ubuntu resolute/main ppc64el libtirpc-dev ppc64el 1.3.6+ds-1 [223 kB] 876s Get:110 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-base-dev all 4.5.2-1ubuntu2 [1880 B] 876s Get:111 http://ftpmaster.internal/ubuntu resolute/universe ppc64el pkg-r-autopkgtest all 20250812 [6158 B] 876s Get:112 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-base64enc ppc64el 0.1-3-3build1 [29.3 kB] 876s Get:113 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-cli ppc64el 3.6.4-1 [1411 kB] 878s Get:114 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-commonmark ppc64el 1.9.5-1 [142 kB] 878s Get:115 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-evaluate all 1.0.5-1 [117 kB] 878s Get:116 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-farver ppc64el 2.1.2-1 [1389 kB] 881s Get:117 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-glue ppc64el 1.8.0-1 [165 kB] 881s Get:118 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-rlang ppc64el 1.1.5-3 [1738 kB] 884s Get:119 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 884s Get:120 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 884s Get:121 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-isoband ppc64el 0.2.7-1 [1486 kB] 887s Get:122 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-s7 ppc64el 0.2.0-1 [330 kB] 887s Get:123 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-labeling all 0.4.3-1 [62.1 kB] 887s Get:124 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-r6 all 2.6.1-1 [101 kB] 887s Get:125 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 887s Get:126 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-viridislite all 0.4.3-1 [1088 kB] 889s Get:127 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-scales all 1.4.0-1 [725 kB] 890s Get:128 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-vctrs ppc64el 0.6.5-1 [1399 kB] 893s Get:129 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-withr all 3.0.2+dfsg-1 [214 kB] 893s Get:130 http://ftpmaster.internal/ubuntu resolute-proposed/universe ppc64el r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 904s Get:131 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-xfun ppc64el 0.55+dfsg-1 [589 kB] 905s Get:132 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-highr all 0.11+dfsg-1 [38.5 kB] 905s Get:133 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-yaml ppc64el 2.3.10-1 [123 kB] 905s Get:134 http://ftpmaster.internal/ubuntu resolute/main ppc64el libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 917s Get:135 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-knitr all 1.51+dfsg-1 [847 kB] 918s Get:136 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-markdown all 1.13-1 [162 kB] 918s Get:137 http://ftpmaster.internal/ubuntu resolute/universe ppc64el r-cran-matrixstats ppc64el 1.5.0-1 [578 kB] 920s Preconfiguring packages ... 920s Fetched 173 MB in 6min 8s (470 kB/s) 920s Selecting previously unselected package libc-dev-bin. 920s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 122006 files and directories currently installed.) 920s Preparing to unpack .../000-libc-dev-bin_2.42-2ubuntu4_ppc64el.deb ... 920s Unpacking libc-dev-bin (2.42-2ubuntu4) ... 920s Selecting previously unselected package linux-libc-dev:ppc64el. 920s Preparing to unpack .../001-linux-libc-dev_6.19.0-3.3_ppc64el.deb ... 920s Unpacking linux-libc-dev:ppc64el (6.19.0-3.3) ... 920s Selecting previously unselected package libcrypt-dev:ppc64el. 920s Preparing to unpack .../002-libcrypt-dev_1%3a4.5.1-1_ppc64el.deb ... 920s Unpacking libcrypt-dev:ppc64el (1:4.5.1-1) ... 920s Selecting previously unselected package rpcsvc-proto. 920s Preparing to unpack .../003-rpcsvc-proto_1.4.3-1build1_ppc64el.deb ... 920s Unpacking rpcsvc-proto (1.4.3-1build1) ... 920s Selecting previously unselected package libc6-dev:ppc64el. 920s Preparing to unpack .../004-libc6-dev_2.42-2ubuntu4_ppc64el.deb ... 920s Unpacking libc6-dev:ppc64el (2.42-2ubuntu4) ... 920s Selecting previously unselected package libisl23:ppc64el. 920s Preparing to unpack .../005-libisl23_0.27-1build1_ppc64el.deb ... 920s Unpacking libisl23:ppc64el (0.27-1build1) ... 920s Selecting previously unselected package libmpc3:ppc64el. 920s Preparing to unpack .../006-libmpc3_1.3.1-2_ppc64el.deb ... 920s Unpacking libmpc3:ppc64el (1.3.1-2) ... 920s Selecting previously unselected package cpp-15-powerpc64le-linux-gnu. 920s Preparing to unpack .../007-cpp-15-powerpc64le-linux-gnu_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking cpp-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package cpp-15. 920s Preparing to unpack .../008-cpp-15_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking cpp-15 (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package cpp-powerpc64le-linux-gnu. 920s Preparing to unpack .../009-cpp-powerpc64le-linux-gnu_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 920s Unpacking cpp-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 920s Selecting previously unselected package cpp. 920s Preparing to unpack .../010-cpp_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 920s Unpacking cpp (4:15.2.0-4ubuntu1) ... 920s Selecting previously unselected package libcc1-0:ppc64el. 920s Preparing to unpack .../011-libcc1-0_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libcc1-0:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libgomp1:ppc64el. 920s Preparing to unpack .../012-libgomp1_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libgomp1:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libitm1:ppc64el. 920s Preparing to unpack .../013-libitm1_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libitm1:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libasan8:ppc64el. 920s Preparing to unpack .../014-libasan8_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libasan8:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package liblsan0:ppc64el. 920s Preparing to unpack .../015-liblsan0_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking liblsan0:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libtsan2:ppc64el. 920s Preparing to unpack .../016-libtsan2_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libtsan2:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libubsan1:ppc64el. 920s Preparing to unpack .../017-libubsan1_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libubsan1:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libquadmath0:ppc64el. 920s Preparing to unpack .../018-libquadmath0_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libquadmath0:ppc64el (15.2.0-12ubuntu1) ... 920s Selecting previously unselected package libgcc-15-dev:ppc64el. 920s Preparing to unpack .../019-libgcc-15-dev_15.2.0-12ubuntu1_ppc64el.deb ... 920s Unpacking libgcc-15-dev:ppc64el (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package gcc-15-powerpc64le-linux-gnu. 921s Preparing to unpack .../020-gcc-15-powerpc64le-linux-gnu_15.2.0-12ubuntu1_ppc64el.deb ... 921s Unpacking gcc-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package gcc-15. 921s Preparing to unpack .../021-gcc-15_15.2.0-12ubuntu1_ppc64el.deb ... 921s Unpacking gcc-15 (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package gcc-powerpc64le-linux-gnu. 921s Preparing to unpack .../022-gcc-powerpc64le-linux-gnu_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 921s Unpacking gcc-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 921s Selecting previously unselected package gcc. 921s Preparing to unpack .../023-gcc_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 921s Unpacking gcc (4:15.2.0-4ubuntu1) ... 921s Selecting previously unselected package libstdc++-15-dev:ppc64el. 921s Preparing to unpack .../024-libstdc++-15-dev_15.2.0-12ubuntu1_ppc64el.deb ... 921s Unpacking libstdc++-15-dev:ppc64el (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package g++-15-powerpc64le-linux-gnu. 921s Preparing to unpack .../025-g++-15-powerpc64le-linux-gnu_15.2.0-12ubuntu1_ppc64el.deb ... 921s Unpacking g++-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package g++-15. 921s Preparing to unpack .../026-g++-15_15.2.0-12ubuntu1_ppc64el.deb ... 921s Unpacking g++-15 (15.2.0-12ubuntu1) ... 921s Selecting previously unselected package g++-powerpc64le-linux-gnu. 921s Preparing to unpack .../027-g++-powerpc64le-linux-gnu_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 921s Unpacking g++-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 921s Selecting previously unselected package g++. 921s Preparing to unpack .../028-g++_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 921s Unpacking g++ (4:15.2.0-4ubuntu1) ... 921s Selecting previously unselected package build-essential. 921s Preparing to unpack .../029-build-essential_12.12ubuntu2_ppc64el.deb ... 921s Unpacking build-essential (12.12ubuntu2) ... 921s Selecting previously unselected package dctrl-tools. 921s Preparing to unpack .../030-dctrl-tools_2.24-3build4_ppc64el.deb ... 921s Unpacking dctrl-tools (2.24-3build4) ... 921s Selecting previously unselected package fonts-dejavu-mono. 921s Preparing to unpack .../031-fonts-dejavu-mono_2.37-8build1_all.deb ... 921s Unpacking fonts-dejavu-mono (2.37-8build1) ... 921s Selecting previously unselected package fonts-dejavu-core. 921s Preparing to unpack .../032-fonts-dejavu-core_2.37-8build1_all.deb ... 921s Unpacking fonts-dejavu-core (2.37-8build1) ... 921s Selecting previously unselected package fontconfig-config. 921s Preparing to unpack .../033-fontconfig-config_2.17.1-3ubuntu1_ppc64el.deb ... 922s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 922s Selecting previously unselected package libfontconfig1:ppc64el. 922s Preparing to unpack .../034-libfontconfig1_2.17.1-3ubuntu1_ppc64el.deb ... 922s Unpacking libfontconfig1:ppc64el (2.17.1-3ubuntu1) ... 922s Selecting previously unselected package fontconfig. 922s Preparing to unpack .../035-fontconfig_2.17.1-3ubuntu1_ppc64el.deb ... 922s Unpacking fontconfig (2.17.1-3ubuntu1) ... 922s Selecting previously unselected package fonts-glyphicons-halflings. 922s Preparing to unpack .../036-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 922s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 922s Selecting previously unselected package fonts-mathjax. 922s Preparing to unpack .../037-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 922s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 922s Selecting previously unselected package libgfortran5:ppc64el. 922s Preparing to unpack .../038-libgfortran5_15.2.0-12ubuntu1_ppc64el.deb ... 922s Unpacking libgfortran5:ppc64el (15.2.0-12ubuntu1) ... 922s Selecting previously unselected package libgfortran-15-dev:ppc64el. 922s Preparing to unpack .../039-libgfortran-15-dev_15.2.0-12ubuntu1_ppc64el.deb ... 922s Unpacking libgfortran-15-dev:ppc64el (15.2.0-12ubuntu1) ... 922s Selecting previously unselected package gfortran-15-powerpc64le-linux-gnu. 922s Preparing to unpack .../040-gfortran-15-powerpc64le-linux-gnu_15.2.0-12ubuntu1_ppc64el.deb ... 922s Unpacking gfortran-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 922s Selecting previously unselected package gfortran-15. 922s Preparing to unpack .../041-gfortran-15_15.2.0-12ubuntu1_ppc64el.deb ... 922s Unpacking gfortran-15 (15.2.0-12ubuntu1) ... 922s Selecting previously unselected package gfortran-powerpc64le-linux-gnu. 922s Preparing to unpack .../042-gfortran-powerpc64le-linux-gnu_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 922s Unpacking gfortran-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 922s Selecting previously unselected package gfortran. 922s Preparing to unpack .../043-gfortran_4%3a15.2.0-4ubuntu1_ppc64el.deb ... 922s Unpacking gfortran (4:15.2.0-4ubuntu1) ... 922s Selecting previously unselected package icu-devtools. 922s Preparing to unpack .../044-icu-devtools_78.2-1ubuntu1_ppc64el.deb ... 922s Unpacking icu-devtools (78.2-1ubuntu1) ... 922s Selecting previously unselected package libblas3:ppc64el. 922s Preparing to unpack .../045-libblas3_3.12.1-7ubuntu1_ppc64el.deb ... 922s Unpacking libblas3:ppc64el (3.12.1-7ubuntu1) ... 922s Selecting previously unselected package libblas-dev:ppc64el. 922s Preparing to unpack .../046-libblas-dev_3.12.1-7ubuntu1_ppc64el.deb ... 922s Unpacking libblas-dev:ppc64el (3.12.1-7ubuntu1) ... 922s Selecting previously unselected package libbz2-dev:ppc64el. 922s Preparing to unpack .../047-libbz2-dev_1.0.8-6build2_ppc64el.deb ... 922s Unpacking libbz2-dev:ppc64el (1.0.8-6build2) ... 922s Selecting previously unselected package libpixman-1-0:ppc64el. 922s Preparing to unpack .../048-libpixman-1-0_0.46.4-1_ppc64el.deb ... 922s Unpacking libpixman-1-0:ppc64el (0.46.4-1) ... 922s Selecting previously unselected package libxcb-render0:ppc64el. 922s Preparing to unpack .../049-libxcb-render0_1.17.0-2ubuntu1_ppc64el.deb ... 922s Unpacking libxcb-render0:ppc64el (1.17.0-2ubuntu1) ... 922s Selecting previously unselected package libxcb-shm0:ppc64el. 922s Preparing to unpack .../050-libxcb-shm0_1.17.0-2ubuntu1_ppc64el.deb ... 922s Unpacking libxcb-shm0:ppc64el (1.17.0-2ubuntu1) ... 922s Selecting previously unselected package libxrender1:ppc64el. 922s Preparing to unpack .../051-libxrender1_1%3a0.9.12-1_ppc64el.deb ... 922s Unpacking libxrender1:ppc64el (1:0.9.12-1) ... 922s Selecting previously unselected package libcairo2:ppc64el. 922s Preparing to unpack .../052-libcairo2_1.18.4-3_ppc64el.deb ... 922s Unpacking libcairo2:ppc64el (1.18.4-3) ... 922s Selecting previously unselected package libdatrie1:ppc64el. 922s Preparing to unpack .../053-libdatrie1_0.2.14-1_ppc64el.deb ... 922s Unpacking libdatrie1:ppc64el (0.2.14-1) ... 922s Selecting previously unselected package libdeflate0:ppc64el. 922s Preparing to unpack .../054-libdeflate0_1.23-2build1_ppc64el.deb ... 922s Unpacking libdeflate0:ppc64el (1.23-2build1) ... 922s Selecting previously unselected package libdeflate-dev:ppc64el. 922s Preparing to unpack .../055-libdeflate-dev_1.23-2build1_ppc64el.deb ... 922s Unpacking libdeflate-dev:ppc64el (1.23-2build1) ... 922s Selecting previously unselected package libgraphite2-3:ppc64el. 922s Preparing to unpack .../056-libgraphite2-3_1.3.14-11ubuntu1_ppc64el.deb ... 922s Unpacking libgraphite2-3:ppc64el (1.3.14-11ubuntu1) ... 922s Selecting previously unselected package libharfbuzz0b:ppc64el. 922s Preparing to unpack .../057-libharfbuzz0b_12.3.2-1_ppc64el.deb ... 922s Unpacking libharfbuzz0b:ppc64el (12.3.2-1) ... 922s Selecting previously unselected package x11-common. 922s Preparing to unpack .../058-x11-common_1%3a7.7+24ubuntu1_all.deb ... 922s Unpacking x11-common (1:7.7+24ubuntu1) ... 922s Selecting previously unselected package libice6:ppc64el. 922s Preparing to unpack .../059-libice6_2%3a1.1.1-1build1_ppc64el.deb ... 922s Unpacking libice6:ppc64el (2:1.1.1-1build1) ... 922s Selecting previously unselected package libicu-dev:ppc64el. 922s Preparing to unpack .../060-libicu-dev_78.2-1ubuntu1_ppc64el.deb ... 922s Unpacking libicu-dev:ppc64el (78.2-1ubuntu1) ... 923s Selecting previously unselected package libjpeg-turbo8:ppc64el. 923s Preparing to unpack .../061-libjpeg-turbo8_2.1.5-4ubuntu3_ppc64el.deb ... 923s Unpacking libjpeg-turbo8:ppc64el (2.1.5-4ubuntu3) ... 923s Selecting previously unselected package libjpeg-turbo8-dev:ppc64el. 923s Preparing to unpack .../062-libjpeg-turbo8-dev_2.1.5-4ubuntu3_ppc64el.deb ... 923s Unpacking libjpeg-turbo8-dev:ppc64el (2.1.5-4ubuntu3) ... 923s Selecting previously unselected package libjpeg8:ppc64el. 923s Preparing to unpack .../063-libjpeg8_8c-2ubuntu11_ppc64el.deb ... 923s Unpacking libjpeg8:ppc64el (8c-2ubuntu11) ... 923s Selecting previously unselected package libjpeg8-dev:ppc64el. 923s Preparing to unpack .../064-libjpeg8-dev_8c-2ubuntu11_ppc64el.deb ... 923s Unpacking libjpeg8-dev:ppc64el (8c-2ubuntu11) ... 923s Selecting previously unselected package libjpeg-dev:ppc64el. 923s Preparing to unpack .../065-libjpeg-dev_8c-2ubuntu11_ppc64el.deb ... 923s Unpacking libjpeg-dev:ppc64el (8c-2ubuntu11) ... 923s Selecting previously unselected package libjs-bootstrap. 923s Preparing to unpack .../066-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 923s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 923s Selecting previously unselected package libjs-highlight.js. 923s Preparing to unpack .../067-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 923s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 923s Selecting previously unselected package libjs-jquery. 923s Preparing to unpack .../068-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 923s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 923s Selecting previously unselected package libjs-jquery-datatables. 923s Preparing to unpack .../069-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 923s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 923s Selecting previously unselected package liblapack3:ppc64el. 923s Preparing to unpack .../070-liblapack3_3.12.1-7ubuntu1_ppc64el.deb ... 923s Unpacking liblapack3:ppc64el (3.12.1-7ubuntu1) ... 923s Selecting previously unselected package liblapack-dev:ppc64el. 923s Preparing to unpack .../071-liblapack-dev_3.12.1-7ubuntu1_ppc64el.deb ... 923s Unpacking liblapack-dev:ppc64el (3.12.1-7ubuntu1) ... 923s Selecting previously unselected package liblerc4:ppc64el. 923s Preparing to unpack .../072-liblerc4_4.0.0+ds-5ubuntu2_ppc64el.deb ... 923s Unpacking liblerc4:ppc64el (4.0.0+ds-5ubuntu2) ... 923s Selecting previously unselected package libncurses-dev:ppc64el. 923s Preparing to unpack .../073-libncurses-dev_6.6+20251231-1_ppc64el.deb ... 923s Unpacking libncurses-dev:ppc64el (6.6+20251231-1) ... 923s Selecting previously unselected package libthai-data. 923s Preparing to unpack .../074-libthai-data_0.1.30-1_all.deb ... 923s Unpacking libthai-data (0.1.30-1) ... 923s Selecting previously unselected package libthai0:ppc64el. 923s Preparing to unpack .../075-libthai0_0.1.30-1_ppc64el.deb ... 923s Unpacking libthai0:ppc64el (0.1.30-1) ... 923s Selecting previously unselected package libpango-1.0-0:ppc64el. 923s Preparing to unpack .../076-libpango-1.0-0_1.57.0-1_ppc64el.deb ... 923s Unpacking libpango-1.0-0:ppc64el (1.57.0-1) ... 923s Selecting previously unselected package libpangoft2-1.0-0:ppc64el. 923s Preparing to unpack .../077-libpangoft2-1.0-0_1.57.0-1_ppc64el.deb ... 923s Unpacking libpangoft2-1.0-0:ppc64el (1.57.0-1) ... 923s Selecting previously unselected package libpangocairo-1.0-0:ppc64el. 923s Preparing to unpack .../078-libpangocairo-1.0-0_1.57.0-1_ppc64el.deb ... 923s Unpacking libpangocairo-1.0-0:ppc64el (1.57.0-1) ... 923s Selecting previously unselected package libpaper2:ppc64el. 923s Preparing to unpack .../079-libpaper2_2.2.5-0.3build1_ppc64el.deb ... 923s Unpacking libpaper2:ppc64el (2.2.5-0.3build1) ... 923s Selecting previously unselected package libpaper-utils. 923s Preparing to unpack .../080-libpaper-utils_2.2.5-0.3build1_ppc64el.deb ... 923s Unpacking libpaper-utils (2.2.5-0.3build1) ... 923s Selecting previously unselected package libpcre2-16-0:ppc64el. 923s Preparing to unpack .../081-libpcre2-16-0_10.46-1_ppc64el.deb ... 923s Unpacking libpcre2-16-0:ppc64el (10.46-1) ... 923s Selecting previously unselected package libpcre2-32-0:ppc64el. 923s Preparing to unpack .../082-libpcre2-32-0_10.46-1_ppc64el.deb ... 923s Unpacking libpcre2-32-0:ppc64el (10.46-1) ... 923s Selecting previously unselected package libpcre2-posix3:ppc64el. 923s Preparing to unpack .../083-libpcre2-posix3_10.46-1_ppc64el.deb ... 923s Unpacking libpcre2-posix3:ppc64el (10.46-1) ... 923s Selecting previously unselected package libpcre2-dev:ppc64el. 923s Preparing to unpack .../084-libpcre2-dev_10.46-1_ppc64el.deb ... 923s Unpacking libpcre2-dev:ppc64el (10.46-1) ... 923s Selecting previously unselected package libpkgconf3:ppc64el. 923s Preparing to unpack .../085-libpkgconf3_1.8.1-4build1_ppc64el.deb ... 923s Unpacking libpkgconf3:ppc64el (1.8.1-4build1) ... 923s Selecting previously unselected package zlib1g-dev:ppc64el. 923s Preparing to unpack .../086-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu2_ppc64el.deb ... 923s Unpacking zlib1g-dev:ppc64el (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 923s Selecting previously unselected package libpng-dev:ppc64el. 923s Preparing to unpack .../087-libpng-dev_1.6.54-1_ppc64el.deb ... 923s Unpacking libpng-dev:ppc64el (1.6.54-1) ... 923s Selecting previously unselected package libreadline-dev:ppc64el. 923s Preparing to unpack .../088-libreadline-dev_8.3-3_ppc64el.deb ... 923s Unpacking libreadline-dev:ppc64el (8.3-3) ... 923s Selecting previously unselected package libsharpyuv0:ppc64el. 923s Preparing to unpack .../089-libsharpyuv0_1.5.0-0.1build1_ppc64el.deb ... 923s Unpacking libsharpyuv0:ppc64el (1.5.0-0.1build1) ... 923s Selecting previously unselected package libsm6:ppc64el. 923s Preparing to unpack .../090-libsm6_2%3a1.2.6-1build1_ppc64el.deb ... 923s Unpacking libsm6:ppc64el (2:1.2.6-1build1) ... 923s Selecting previously unselected package libtcl8.6:ppc64el. 923s Preparing to unpack .../091-libtcl8.6_8.6.17+dfsg-1build1_ppc64el.deb ... 923s Unpacking libtcl8.6:ppc64el (8.6.17+dfsg-1build1) ... 924s Selecting previously unselected package libjbig0:ppc64el. 924s Preparing to unpack .../092-libjbig0_2.1-6.1ubuntu3_ppc64el.deb ... 924s Unpacking libjbig0:ppc64el (2.1-6.1ubuntu3) ... 924s Selecting previously unselected package libwebp7:ppc64el. 924s Preparing to unpack .../093-libwebp7_1.5.0-0.1build1_ppc64el.deb ... 924s Unpacking libwebp7:ppc64el (1.5.0-0.1build1) ... 924s Selecting previously unselected package libtiff6:ppc64el. 924s Preparing to unpack .../094-libtiff6_4.7.0-3ubuntu3_ppc64el.deb ... 924s Unpacking libtiff6:ppc64el (4.7.0-3ubuntu3) ... 924s Selecting previously unselected package libxft2:ppc64el. 924s Preparing to unpack .../095-libxft2_2.3.6-1build2_ppc64el.deb ... 924s Unpacking libxft2:ppc64el (2.3.6-1build2) ... 924s Selecting previously unselected package libxss1:ppc64el. 924s Preparing to unpack .../096-libxss1_1%3a1.2.3-1build4_ppc64el.deb ... 924s Unpacking libxss1:ppc64el (1:1.2.3-1build4) ... 924s Selecting previously unselected package libtk8.6:ppc64el. 924s Preparing to unpack .../097-libtk8.6_8.6.17-1_ppc64el.deb ... 924s Unpacking libtk8.6:ppc64el (8.6.17-1) ... 924s Selecting previously unselected package libxt6t64:ppc64el. 924s Preparing to unpack .../098-libxt6t64_1%3a1.2.1-1.3_ppc64el.deb ... 924s Unpacking libxt6t64:ppc64el (1:1.2.1-1.3) ... 924s Selecting previously unselected package libzstd-dev:ppc64el. 924s Preparing to unpack .../099-libzstd-dev_1.5.7+dfsg-3_ppc64el.deb ... 924s Unpacking libzstd-dev:ppc64el (1.5.7+dfsg-3) ... 924s Selecting previously unselected package node-normalize.css. 924s Preparing to unpack .../100-node-normalize.css_8.0.1-5.1_all.deb ... 924s Unpacking node-normalize.css (8.0.1-5.1) ... 924s Selecting previously unselected package zip. 924s Preparing to unpack .../101-zip_3.0-15ubuntu3_ppc64el.deb ... 924s Unpacking zip (3.0-15ubuntu3) ... 924s Selecting previously unselected package unzip. 924s Preparing to unpack .../102-unzip_6.0-29ubuntu1_ppc64el.deb ... 924s Unpacking unzip (6.0-29ubuntu1) ... 924s Selecting previously unselected package xdg-utils. 924s Preparing to unpack .../103-xdg-utils_1.2.1-2ubuntu2_all.deb ... 924s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 924s Selecting previously unselected package r-base-core. 924s Preparing to unpack .../104-r-base-core_4.5.2-1ubuntu2_ppc64el.deb ... 924s Unpacking r-base-core (4.5.2-1ubuntu2) ... 924s Selecting previously unselected package liblzma-dev:ppc64el. 924s Preparing to unpack .../105-liblzma-dev_5.8.2-2_ppc64el.deb ... 924s Unpacking liblzma-dev:ppc64el (5.8.2-2) ... 924s Selecting previously unselected package pkgconf-bin. 924s Preparing to unpack .../106-pkgconf-bin_1.8.1-4build1_ppc64el.deb ... 924s Unpacking pkgconf-bin (1.8.1-4build1) ... 924s Selecting previously unselected package pkgconf:ppc64el. 924s Preparing to unpack .../107-pkgconf_1.8.1-4build1_ppc64el.deb ... 924s Unpacking pkgconf:ppc64el (1.8.1-4build1) ... 924s Selecting previously unselected package libtirpc-dev:ppc64el. 924s Preparing to unpack .../108-libtirpc-dev_1.3.6+ds-1_ppc64el.deb ... 924s Unpacking libtirpc-dev:ppc64el (1.3.6+ds-1) ... 924s Selecting previously unselected package r-base-dev. 924s Preparing to unpack .../109-r-base-dev_4.5.2-1ubuntu2_all.deb ... 924s Unpacking r-base-dev (4.5.2-1ubuntu2) ... 924s Selecting previously unselected package pkg-r-autopkgtest. 924s Preparing to unpack .../110-pkg-r-autopkgtest_20250812_all.deb ... 924s Unpacking pkg-r-autopkgtest (20250812) ... 924s Selecting previously unselected package r-cran-base64enc. 924s Preparing to unpack .../111-r-cran-base64enc_0.1-3-3build1_ppc64el.deb ... 924s Unpacking r-cran-base64enc (0.1-3-3build1) ... 924s Selecting previously unselected package r-cran-cli. 924s Preparing to unpack .../112-r-cran-cli_3.6.4-1_ppc64el.deb ... 924s Unpacking r-cran-cli (3.6.4-1) ... 924s Selecting previously unselected package r-cran-commonmark. 924s Preparing to unpack .../113-r-cran-commonmark_1.9.5-1_ppc64el.deb ... 924s Unpacking r-cran-commonmark (1.9.5-1) ... 924s Selecting previously unselected package r-cran-evaluate. 924s Preparing to unpack .../114-r-cran-evaluate_1.0.5-1_all.deb ... 924s Unpacking r-cran-evaluate (1.0.5-1) ... 924s Selecting previously unselected package r-cran-farver. 924s Preparing to unpack .../115-r-cran-farver_2.1.2-1_ppc64el.deb ... 924s Unpacking r-cran-farver (2.1.2-1) ... 924s Selecting previously unselected package r-cran-glue. 924s Preparing to unpack .../116-r-cran-glue_1.8.0-1_ppc64el.deb ... 924s Unpacking r-cran-glue (1.8.0-1) ... 924s Selecting previously unselected package r-cran-rlang. 924s Preparing to unpack .../117-r-cran-rlang_1.1.5-3_ppc64el.deb ... 924s Unpacking r-cran-rlang (1.1.5-3) ... 925s Selecting previously unselected package r-cran-lifecycle. 925s Preparing to unpack .../118-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 925s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 925s Selecting previously unselected package r-cran-gtable. 925s Preparing to unpack .../119-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 925s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 925s Selecting previously unselected package r-cran-isoband. 925s Preparing to unpack .../120-r-cran-isoband_0.2.7-1_ppc64el.deb ... 925s Unpacking r-cran-isoband (0.2.7-1) ... 925s Selecting previously unselected package r-cran-s7. 925s Preparing to unpack .../121-r-cran-s7_0.2.0-1_ppc64el.deb ... 925s Unpacking r-cran-s7 (0.2.0-1) ... 925s Selecting previously unselected package r-cran-labeling. 925s Preparing to unpack .../122-r-cran-labeling_0.4.3-1_all.deb ... 925s Unpacking r-cran-labeling (0.4.3-1) ... 925s Selecting previously unselected package r-cran-r6. 925s Preparing to unpack .../123-r-cran-r6_2.6.1-1_all.deb ... 925s Unpacking r-cran-r6 (2.6.1-1) ... 925s Selecting previously unselected package r-cran-rcolorbrewer. 925s Preparing to unpack .../124-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 925s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 925s Selecting previously unselected package r-cran-viridislite. 925s Preparing to unpack .../125-r-cran-viridislite_0.4.3-1_all.deb ... 925s Unpacking r-cran-viridislite (0.4.3-1) ... 925s Selecting previously unselected package r-cran-scales. 925s Preparing to unpack .../126-r-cran-scales_1.4.0-1_all.deb ... 925s Unpacking r-cran-scales (1.4.0-1) ... 925s Selecting previously unselected package r-cran-vctrs. 925s Preparing to unpack .../127-r-cran-vctrs_0.6.5-1_ppc64el.deb ... 925s Unpacking r-cran-vctrs (0.6.5-1) ... 925s Selecting previously unselected package r-cran-withr. 925s Preparing to unpack .../128-r-cran-withr_3.0.2+dfsg-1_all.deb ... 925s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 925s Selecting previously unselected package r-cran-ggplot2. 925s Preparing to unpack .../129-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 925s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 925s Selecting previously unselected package r-cran-xfun. 925s Preparing to unpack .../130-r-cran-xfun_0.55+dfsg-1_ppc64el.deb ... 925s Unpacking r-cran-xfun (0.55+dfsg-1) ... 925s Selecting previously unselected package r-cran-highr. 925s Preparing to unpack .../131-r-cran-highr_0.11+dfsg-1_all.deb ... 925s Unpacking r-cran-highr (0.11+dfsg-1) ... 925s Selecting previously unselected package r-cran-yaml. 925s Preparing to unpack .../132-r-cran-yaml_2.3.10-1_ppc64el.deb ... 925s Unpacking r-cran-yaml (2.3.10-1) ... 925s Selecting previously unselected package libjs-mathjax. 925s Preparing to unpack .../133-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 925s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 926s Selecting previously unselected package r-cran-knitr. 926s Preparing to unpack .../134-r-cran-knitr_1.51+dfsg-1_all.deb ... 926s Unpacking r-cran-knitr (1.51+dfsg-1) ... 926s Selecting previously unselected package r-cran-markdown. 926s Preparing to unpack .../135-r-cran-markdown_1.13-1_all.deb ... 926s Unpacking r-cran-markdown (1.13-1) ... 926s Selecting previously unselected package r-cran-matrixstats. 926s Preparing to unpack .../136-r-cran-matrixstats_1.5.0-1_ppc64el.deb ... 926s Unpacking r-cran-matrixstats (1.5.0-1) ... 926s Setting up libgraphite2-3:ppc64el (1.3.14-11ubuntu1) ... 926s Setting up libpixman-1-0:ppc64el (0.46.4-1) ... 926s Setting up libsharpyuv0:ppc64el (1.5.0-0.1build1) ... 926s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 926s Setting up liblerc4:ppc64el (4.0.0+ds-5ubuntu2) ... 926s Setting up libzstd-dev:ppc64el (1.5.7+dfsg-3) ... 926s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 926s Setting up libxrender1:ppc64el (1:0.9.12-1) ... 926s Setting up libdatrie1:ppc64el (0.2.14-1) ... 926s Setting up libxcb-render0:ppc64el (1.17.0-2ubuntu1) ... 926s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 926s Setting up unzip (6.0-29ubuntu1) ... 926s Setting up x11-common (1:7.7+24ubuntu1) ... 926s Setting up libdeflate0:ppc64el (1.23-2build1) ... 926s Setting up linux-libc-dev:ppc64el (6.19.0-3.3) ... 926s Setting up libxcb-shm0:ppc64el (1.17.0-2ubuntu1) ... 926s Setting up libgomp1:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libjbig0:ppc64el (2.1-6.1ubuntu3) ... 926s Setting up libpcre2-16-0:ppc64el (10.46-1) ... 926s Setting up zip (3.0-15ubuntu3) ... 926s Setting up libpcre2-32-0:ppc64el (10.46-1) ... 926s Setting up libblas3:ppc64el (3.12.1-7ubuntu1) ... 926s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/blas/libblas.so.3 to provide /usr/lib/powerpc64le-linux-gnu/libblas.so.3 (libblas.so.3-powerpc64le-linux-gnu) in auto mode 926s Setting up libtirpc-dev:ppc64el (1.3.6+ds-1) ... 926s Setting up libpkgconf3:ppc64el (1.8.1-4build1) ... 926s Setting up rpcsvc-proto (1.4.3-1build1) ... 926s Setting up libquadmath0:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up fonts-dejavu-mono (2.37-8build1) ... 926s Setting up libmpc3:ppc64el (1.3.1-2) ... 926s Setting up libtcl8.6:ppc64el (8.6.17+dfsg-1build1) ... 926s Setting up icu-devtools (78.2-1ubuntu1) ... 926s Setting up fonts-dejavu-core (2.37-8build1) ... 926s Setting up pkgconf-bin (1.8.1-4build1) ... 926s Setting up libjpeg-turbo8:ppc64el (2.1.5-4ubuntu3) ... 926s Setting up libgfortran5:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libwebp7:ppc64el (1.5.0-0.1build1) ... 926s Setting up liblzma-dev:ppc64el (5.8.2-2) ... 926s Setting up libubsan1:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libpcre2-posix3:ppc64el (10.46-1) ... 926s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 926s Setting up libcrypt-dev:ppc64el (1:4.5.1-1) ... 926s Setting up libasan8:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libharfbuzz0b:ppc64el (12.3.2-1) ... 926s Setting up libthai-data (0.1.30-1) ... 926s Setting up libxss1:ppc64el (1:1.2.3-1build4) ... 926s Setting up libpaper2:ppc64el (2.2.5-0.3build1) ... 926s Setting up libtsan2:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 926s Setting up libisl23:ppc64el (0.27-1build1) ... 926s Setting up libc-dev-bin (2.42-2ubuntu4) ... 926s Setting up libdeflate-dev:ppc64el (1.23-2build1) ... 926s Setting up node-normalize.css (8.0.1-5.1) ... 926s Setting up xdg-utils (1.2.1-2ubuntu2) ... 926s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 926s Setting up libcc1-0:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up liblsan0:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libblas-dev:ppc64el (3.12.1-7ubuntu1) ... 926s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/blas/libblas.so to provide /usr/lib/powerpc64le-linux-gnu/libblas.so (libblas.so-powerpc64le-linux-gnu) in auto mode 926s Setting up dctrl-tools (2.24-3build4) ... 926s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 926s Setting up libitm1:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up libjpeg8:ppc64el (8c-2ubuntu11) ... 926s Setting up libice6:ppc64el (2:1.1.1-1build1) ... 926s Setting up liblapack3:ppc64el (3.12.1-7ubuntu1) ... 926s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/powerpc64le-linux-gnu/liblapack.so.3 (liblapack.so.3-powerpc64le-linux-gnu) in auto mode 926s Setting up libgcc-15-dev:ppc64el (15.2.0-12ubuntu1) ... 926s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 927s Setting up libpaper-utils (2.2.5-0.3build1) ... 927s Setting up libgfortran-15-dev:ppc64el (15.2.0-12ubuntu1) ... 927s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 927s Setting up pkgconf:ppc64el (1.8.1-4build1) ... 927s Setting up libthai0:ppc64el (0.1.30-1) ... 927s Setting up cpp-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 927s Setting up liblapack-dev:ppc64el (3.12.1-7ubuntu1) ... 927s update-alternatives: using /usr/lib/powerpc64le-linux-gnu/lapack/liblapack.so to provide /usr/lib/powerpc64le-linux-gnu/liblapack.so (liblapack.so-powerpc64le-linux-gnu) in auto mode 927s Setting up cpp-15 (15.2.0-12ubuntu1) ... 927s Setting up libtiff6:ppc64el (4.7.0-3ubuntu3) ... 927s Setting up libc6-dev:ppc64el (2.42-2ubuntu4) ... 927s Setting up libfontconfig1:ppc64el (2.17.1-3ubuntu1) ... 927s Setting up libsm6:ppc64el (2:1.2.6-1build1) ... 927s Setting up libicu-dev:ppc64el (78.2-1ubuntu1) ... 927s Setting up cpp-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 927s Setting up libbz2-dev:ppc64el (1.0.8-6build2) ... 927s Setting up fontconfig (2.17.1-3ubuntu1) ... 929s Regenerating fonts cache... done. 929s Setting up libjpeg-turbo8-dev:ppc64el (2.1.5-4ubuntu3) ... 929s Setting up libxft2:ppc64el (2.3.6-1build2) ... 929s Setting up libncurses-dev:ppc64el (6.6+20251231-1) ... 929s Setting up libpcre2-dev:ppc64el (10.46-1) ... 929s Setting up gcc-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 929s Setting up libtk8.6:ppc64el (8.6.17-1) ... 929s Setting up libpango-1.0-0:ppc64el (1.57.0-1) ... 929s Setting up libreadline-dev:ppc64el (8.3-3) ... 929s Setting up libcairo2:ppc64el (1.18.4-3) ... 929s Setting up gcc-15 (15.2.0-12ubuntu1) ... 929s Setting up libstdc++-15-dev:ppc64el (15.2.0-12ubuntu1) ... 929s Setting up gcc-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 929s Setting up libxt6t64:ppc64el (1:1.2.1-1.3) ... 929s Setting up gfortran-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 929s Setting up zlib1g-dev:ppc64el (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 929s Setting up cpp (4:15.2.0-4ubuntu1) ... 929s Setting up libpangoft2-1.0-0:ppc64el (1.57.0-1) ... 929s Setting up libjpeg8-dev:ppc64el (8c-2ubuntu11) ... 929s Setting up gfortran-15 (15.2.0-12ubuntu1) ... 929s Setting up libpangocairo-1.0-0:ppc64el (1.57.0-1) ... 929s Setting up g++-15-powerpc64le-linux-gnu (15.2.0-12ubuntu1) ... 929s Setting up libpng-dev:ppc64el (1.6.54-1) ... 929s Setting up libjpeg-dev:ppc64el (8c-2ubuntu11) ... 929s Setting up gcc (4:15.2.0-4ubuntu1) ... 929s Setting up gfortran-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 929s Setting up r-base-core (4.5.2-1ubuntu2) ... 929s Creating config file /etc/R/Renviron with new version 929s Setting up r-cran-labeling (0.4.3-1) ... 929s Setting up r-cran-farver (2.1.2-1) ... 929s Setting up r-cran-viridislite (0.4.3-1) ... 929s Setting up r-cran-commonmark (1.9.5-1) ... 929s Setting up r-cran-r6 (2.6.1-1) ... 929s Setting up g++-15 (15.2.0-12ubuntu1) ... 929s Setting up g++-powerpc64le-linux-gnu (4:15.2.0-4ubuntu1) ... 929s Setting up r-cran-rlang (1.1.5-3) ... 929s Setting up r-cran-matrixstats (1.5.0-1) ... 929s Setting up r-cran-xfun (0.55+dfsg-1) ... 929s Setting up r-cran-withr (3.0.2+dfsg-1) ... 929s Setting up r-cran-base64enc (0.1-3-3build1) ... 929s Setting up r-cran-yaml (2.3.10-1) ... 929s Setting up r-cran-evaluate (1.0.5-1) ... 929s Setting up r-cran-highr (0.11+dfsg-1) ... 929s Setting up r-cran-glue (1.8.0-1) ... 929s Setting up r-cran-cli (3.6.4-1) ... 929s Setting up gfortran (4:15.2.0-4ubuntu1) ... 929s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 929s update-alternatives: warning: skip creation of /usr/share/man/man1/f95.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f95) doesn't exist 929s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 929s update-alternatives: warning: skip creation of /usr/share/man/man1/f77.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f77) doesn't exist 929s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 929s Setting up r-cran-markdown (1.13-1) ... 929s Setting up r-cran-s7 (0.2.0-1) ... 929s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 929s Setting up r-cran-isoband (0.2.7-1) ... 929s Setting up r-cran-scales (1.4.0-1) ... 929s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 929s Setting up r-cran-knitr (1.51+dfsg-1) ... 929s Setting up g++ (4:15.2.0-4ubuntu1) ... 929s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 929s Setting up build-essential (12.12ubuntu2) ... 929s Setting up r-cran-vctrs (0.6.5-1) ... 929s Setting up r-base-dev (4.5.2-1ubuntu2) ... 929s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 929s Setting up pkg-r-autopkgtest (20250812) ... 929s Processing triggers for libc-bin (2.42-2ubuntu4) ... 929s Processing triggers for man-db (2.13.1-1build1) ... 930s Processing triggers for install-info (7.2-5) ... 935s autopkgtest [23:42:36]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 935s autopkgtest [23:42:36]: test pkg-r-autopkgtest: [----------------------- 935s Test: Try to load the R library matrixStats 935s 935s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 935s Copyright (C) 2025 The R Foundation for Statistical Computing 935s Platform: powerpc64le-unknown-linux-gnu 935s 935s R is free software and comes with ABSOLUTELY NO WARRANTY. 935s You are welcome to redistribute it under certain conditions. 935s Type 'license()' or 'licence()' for distribution details. 935s 935s R is a collaborative project with many contributors. 935s Type 'contributors()' for more information and 935s 'citation()' on how to cite R or R packages in publications. 935s 935s Type 'demo()' for some demos, 'help()' for on-line help, or 935s 'help.start()' for an HTML browser interface to help. 935s Type 'q()' to quit R. 935s 935s > library('matrixStats') 935s > 935s autopkgtest [23:42:36]: test pkg-r-autopkgtest: -----------------------] 936s pkg-r-autopkgtest PASS 936s autopkgtest [23:42:37]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 936s autopkgtest [23:42:37]: @@@@@@@@@@@@@@@@@@@@ summary 936s run-unit-test PASS 936s pkg-r-autopkgtest PASS