0s autopkgtest [23:22:31]: starting date and time: 2025-03-15 23:22:31+0000 0s autopkgtest [23:22:31]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [23:22:31]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.raxajrm9/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:glibc --apt-upgrade r-cran-matrixstats --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=glibc/2.41-1ubuntu2 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@lcy02-3.secgroup --name adt-plucky-amd64-r-cran-matrixstats-20250315-221624-juju-7f2275-prod-proposed-migration-environment-2-60d380cd-cf86-4ec4-aecf-599a8c4120c8 --image adt/ubuntu-plucky-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 53s autopkgtest [23:23:24]: testbed dpkg architecture: amd64 53s autopkgtest [23:23:24]: testbed apt version: 2.9.31ubuntu1 53s autopkgtest [23:23:24]: @@@@@@@@@@@@@@@@@@@@ test bed setup 54s autopkgtest [23:23:25]: testbed release detected to be: None 54s autopkgtest [23:23:25]: updating testbed package index (apt update) 54s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 54s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 54s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 54s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 54s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [14.5 kB] 54s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [369 kB] 54s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [44.1 kB] 54s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main i386 Packages [67.4 kB] 54s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 Packages [85.7 kB] 54s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 c-n-f Metadata [1852 B] 54s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/restricted amd64 c-n-f Metadata [116 B] 54s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe i386 Packages [174 kB] 54s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 Packages [342 kB] 54s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 c-n-f Metadata [15.3 kB] 54s Get:15 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse i386 Packages [8544 B] 54s Get:16 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 Packages [16.1 kB] 54s Get:17 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 c-n-f Metadata [628 B] 55s Fetched 1265 kB in 0s (5283 kB/s) 56s Reading package lists... 56s Reading package lists... 56s Building dependency tree... 56s Reading state information... 56s Calculating upgrade... 57s Calculating upgrade... 57s The following package was automatically installed and is no longer required: 57s libnl-genl-3-200 57s Use 'sudo apt autoremove' to remove it. 57s The following NEW packages will be installed: 57s bpftool libdebuginfod-common libdebuginfod1t64 linux-headers-6.14.0-10 57s linux-headers-6.14.0-10-generic linux-image-6.14.0-10-generic 57s linux-modules-6.14.0-10-generic linux-modules-extra-6.14.0-10-generic 57s linux-perf linux-tools-6.14.0-10 linux-tools-6.14.0-10-generic pnp.ids 57s The following packages will be upgraded: 57s apparmor apt apt-utils binutils binutils-common binutils-x86-64-linux-gnu 57s cloud-init cloud-init-base curl dosfstools fwupd gir1.2-girepository-2.0 57s gir1.2-glib-2.0 htop hwdata libapparmor1 libapt-pkg7.0 libaudit-common 57s libaudit1 libbinutils libbrotli1 libcap-ng0 libctf-nobfd0 libctf0 57s libcurl3t64-gnutls libcurl4t64 libestr0 libfwupd3 libgirepository-1.0-1 57s libglib2.0-0t64 libglib2.0-data libgprofng0 libjemalloc2 liblz4-1 liblzma5 57s libmm-glib0 libncurses6 libncursesw6 libnl-3-200 libnl-genl-3-200 57s libnl-route-3-200 libpci3 libpython3-stdlib libpython3.13 57s libpython3.13-minimal libpython3.13-stdlib libselinux1 libsframe1 57s libsqlite3-0 libtinfo6 libxml2 linux-firmware linux-generic 57s linux-headers-generic linux-headers-virtual linux-image-generic 57s linux-image-virtual linux-libc-dev linux-tools-common linux-virtual 57s media-types ncurses-base ncurses-bin ncurses-term pci.ids pciutils 57s pinentry-curses python-apt-common python3 python3-apt python3-cffi-backend 57s python3-dbus python3-gi python3-jinja2 python3-lazr.uri python3-markupsafe 57s python3-minimal python3-systemd python3-yaml python3.13 python3.13-gdbm 57s python3.13-minimal rsync rsyslog strace xz-utils 57s 86 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. 57s Need to get 807 MB of archives. 57s After this operation, 326 MB of additional disk space will be used. 57s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-bin amd64 6.5+20250216-2 [194 kB] 57s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-base all 6.5+20250216-2 [25.9 kB] 57s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-term all 6.5+20250216-2 [276 kB] 57s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 liblz4-1 amd64 1.10.0-4 [66.4 kB] 57s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 liblzma5 amd64 5.6.4-1 [157 kB] 57s Get:6 http://ftpmaster.internal/ubuntu plucky/main amd64 libapt-pkg7.0 amd64 2.9.33 [1138 kB] 57s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 apt amd64 2.9.33 [1439 kB] 57s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 apt-utils amd64 2.9.33 [222 kB] 57s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-minimal amd64 3.13.2-2 [27.7 kB] 57s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 python3 amd64 3.13.2-2 [24.0 kB] 57s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13 amd64 3.13.2-2 [2341 kB] 57s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 media-types all 13.0.0 [29.9 kB] 57s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 libncurses6 amd64 6.5+20250216-2 [126 kB] 57s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 libncursesw6 amd64 6.5+20250216-2 [165 kB] 57s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libtinfo6 amd64 6.5+20250216-2 [119 kB] 57s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libsqlite3-0 amd64 3.46.1-2 [715 kB] 57s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13 amd64 3.13.2-2 [735 kB] 57s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-minimal amd64 3.13.2-2 [2365 kB] 57s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-minimal amd64 3.13.2-2 [883 kB] 58s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-stdlib amd64 3.13.2-2 [2066 kB] 58s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3-stdlib amd64 3.13.2-2 [10.4 kB] 58s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 rsync amd64 3.4.1+ds1-3 [482 kB] 58s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 libdebuginfod-common all 0.192-4 [15.4 kB] 58s Get:24 http://ftpmaster.internal/ubuntu plucky/main amd64 libaudit-common all 1:4.0.2-2ubuntu2 [6628 B] 58s Get:25 http://ftpmaster.internal/ubuntu plucky/main amd64 libcap-ng0 amd64 0.8.5-4build1 [15.6 kB] 58s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 libaudit1 amd64 1:4.0.2-2ubuntu2 [54.0 kB] 58s Get:27 http://ftpmaster.internal/ubuntu plucky/main amd64 libselinux1 amd64 3.7-3ubuntu3 [87.3 kB] 58s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 gir1.2-girepository-2.0 amd64 1.83.4-1 [25.3 kB] 58s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 gir1.2-glib-2.0 amd64 2.84.0-1 [184 kB] 58s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 libglib2.0-0t64 amd64 2.84.0-1 [1669 kB] 58s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 libgirepository-1.0-1 amd64 1.83.4-1 [89.5 kB] 58s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 libapparmor1 amd64 4.1.0~beta5-0ubuntu8 [55.0 kB] 58s Get:33 http://ftpmaster.internal/ubuntu plucky/main amd64 libestr0 amd64 0.1.11-2 [8340 B] 58s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 libglib2.0-data all 2.84.0-1 [53.0 kB] 58s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 libxml2 amd64 2.12.7+dfsg+really2.9.14-0.2ubuntu5 [772 kB] 58s Get:36 http://ftpmaster.internal/ubuntu plucky/main amd64 python-apt-common all 2.9.9build1 [21.3 kB] 58s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-apt amd64 2.9.9build1 [172 kB] 58s Get:38 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-cffi-backend amd64 1.17.1-2build2 [96.6 kB] 58s Get:39 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-dbus amd64 1.3.2-5build5 [102 kB] 58s Get:40 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-gi amd64 3.50.0-4build1 [252 kB] 58s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-yaml amd64 6.0.2-1build2 [144 kB] 58s Get:42 http://ftpmaster.internal/ubuntu plucky/main amd64 rsyslog amd64 8.2412.0-2ubuntu2 [555 kB] 58s Get:43 http://ftpmaster.internal/ubuntu plucky/main amd64 apparmor amd64 4.1.0~beta5-0ubuntu8 [701 kB] 58s Get:44 http://ftpmaster.internal/ubuntu plucky/main amd64 dosfstools amd64 4.2-1.2 [95.0 kB] 58s Get:45 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-genl-3-200 amd64 3.7.0-1 [12.2 kB] 58s Get:46 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-route-3-200 amd64 3.7.0-1 [191 kB] 58s Get:47 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-3-200 amd64 3.7.0-1 [64.9 kB] 58s Get:48 http://ftpmaster.internal/ubuntu plucky/main amd64 pci.ids all 0.0~2025.03.09-1 [285 kB] 58s Get:49 http://ftpmaster.internal/ubuntu plucky/main amd64 pciutils amd64 1:3.13.0-2 [110 kB] 58s Get:50 http://ftpmaster.internal/ubuntu plucky/main amd64 libpci3 amd64 1:3.13.0-2 [39.8 kB] 58s Get:51 http://ftpmaster.internal/ubuntu plucky/main amd64 strace amd64 6.13+ds-1ubuntu1 [622 kB] 58s Get:52 http://ftpmaster.internal/ubuntu plucky/main amd64 xz-utils amd64 5.6.4-1 [278 kB] 58s Get:53 http://ftpmaster.internal/ubuntu plucky/main amd64 libgprofng0 amd64 2.44-3ubuntu1 [886 kB] 58s Get:54 http://ftpmaster.internal/ubuntu plucky/main amd64 libctf0 amd64 2.44-3ubuntu1 [96.5 kB] 58s Get:55 http://ftpmaster.internal/ubuntu plucky/main amd64 libctf-nobfd0 amd64 2.44-3ubuntu1 [98.9 kB] 58s Get:56 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils-x86-64-linux-gnu amd64 2.44-3ubuntu1 [1108 kB] 58s Get:57 http://ftpmaster.internal/ubuntu plucky/main amd64 libbinutils amd64 2.44-3ubuntu1 [585 kB] 58s Get:58 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils amd64 2.44-3ubuntu1 [208 kB] 58s Get:59 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils-common amd64 2.44-3ubuntu1 [215 kB] 58s Get:60 http://ftpmaster.internal/ubuntu plucky/main amd64 libsframe1 amd64 2.44-3ubuntu1 [14.8 kB] 58s Get:61 http://ftpmaster.internal/ubuntu plucky/main amd64 hwdata all 0.393-3 [1562 B] 58s Get:62 http://ftpmaster.internal/ubuntu plucky/main amd64 pnp.ids all 0.393-3 [29.5 kB] 58s Get:63 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-common all 6.14.0-10.10 [295 kB] 58s Get:64 http://ftpmaster.internal/ubuntu plucky/main amd64 bpftool amd64 7.6.0+6.14.0-10.10 [1147 kB] 58s Get:65 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-markupsafe amd64 2.1.5-1build4 [13.4 kB] 58s Get:66 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 58s Get:67 http://ftpmaster.internal/ubuntu plucky/main amd64 cloud-init-base all 25.1-0ubuntu3 [616 kB] 58s Get:68 http://ftpmaster.internal/ubuntu plucky/main amd64 libbrotli1 amd64 1.1.0-2build4 [365 kB] 58s Get:69 http://ftpmaster.internal/ubuntu plucky/main amd64 curl amd64 8.12.1-3ubuntu1 [258 kB] 58s Get:70 http://ftpmaster.internal/ubuntu plucky/main amd64 libcurl4t64 amd64 8.12.1-3ubuntu1 [437 kB] 58s Get:71 http://ftpmaster.internal/ubuntu plucky/main amd64 libcurl3t64-gnutls amd64 8.12.1-3ubuntu1 [432 kB] 58s Get:72 http://ftpmaster.internal/ubuntu plucky/main amd64 fwupd amd64 2.0.6-4 [5408 kB] 58s Get:73 http://ftpmaster.internal/ubuntu plucky/main amd64 libfwupd3 amd64 2.0.6-4 [136 kB] 58s Get:74 http://ftpmaster.internal/ubuntu plucky/main amd64 libmm-glib0 amd64 1.23.4-0ubuntu3 [251 kB] 58s Get:75 http://ftpmaster.internal/ubuntu plucky/main amd64 htop amd64 3.4.0-2 [195 kB] 58s Get:76 http://ftpmaster.internal/ubuntu plucky/main amd64 libdebuginfod1t64 amd64 0.192-4 [21.0 kB] 58s Get:77 http://ftpmaster.internal/ubuntu plucky/main amd64 libjemalloc2 amd64 5.3.0-3 [277 kB] 58s Get:78 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-firmware amd64 20250310.git9e1370d3-0ubuntu1 [571 MB] 68s Get:79 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-modules-6.14.0-10-generic amd64 6.14.0-10.10 [41.2 MB] 69s Get:80 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-6.14.0-10-generic amd64 6.14.0-10.10 [15.3 MB] 69s Get:81 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-modules-extra-6.14.0-10-generic amd64 6.14.0-10.10 [120 MB] 70s Get:82 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-generic amd64 6.14.0-10.10 [1730 B] 70s Get:83 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-generic amd64 6.14.0-10.10 [11.1 kB] 70s Get:84 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-virtual amd64 6.14.0-10.10 [1722 B] 70s Get:85 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-virtual amd64 6.14.0-10.10 [11.1 kB] 70s Get:86 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-virtual amd64 6.14.0-10.10 [1642 B] 70s Get:87 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-6.14.0-10 all 6.14.0-10.10 [14.2 MB] 70s Get:88 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-6.14.0-10-generic amd64 6.14.0-10.10 [3915 kB] 70s Get:89 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-generic amd64 6.14.0-10.10 [11.0 kB] 70s Get:90 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-libc-dev amd64 6.14.0-10.10 [1723 kB] 70s Get:91 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-perf amd64 6.14.0-10.10 [4122 kB] 70s Get:92 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-6.14.0-10 amd64 6.14.0-10.10 [1394 kB] 70s Get:93 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-6.14.0-10-generic amd64 6.14.0-10.10 [830 B] 70s Get:94 http://ftpmaster.internal/ubuntu plucky/main amd64 pinentry-curses amd64 1.3.1-2ubuntu3 [42.3 kB] 70s Get:95 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-lazr.uri all 1.0.6-6 [13.7 kB] 70s Get:96 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-systemd amd64 235-1build6 [43.9 kB] 70s Get:97 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-gdbm amd64 3.13.2-2 [31.9 kB] 71s Get:98 http://ftpmaster.internal/ubuntu plucky/main amd64 cloud-init all 25.1-0ubuntu3 [2100 B] 71s Preconfiguring packages ... 71s Fetched 807 MB in 14s (59.1 MB/s) 71s (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 ... 109138 files and directories currently installed.) 71s Preparing to unpack .../ncurses-bin_6.5+20250216-2_amd64.deb ... 71s Unpacking ncurses-bin (6.5+20250216-2) over (6.5+20250216-1) ... 71s Setting up ncurses-bin (6.5+20250216-2) ... 71s (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 ... 109138 files and directories currently installed.) 71s Preparing to unpack .../ncurses-base_6.5+20250216-2_all.deb ... 71s Unpacking ncurses-base (6.5+20250216-2) over (6.5+20250216-1) ... 71s Setting up ncurses-base (6.5+20250216-2) ... 72s (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 ... 109138 files and directories currently installed.) 72s Preparing to unpack .../ncurses-term_6.5+20250216-2_all.deb ... 72s Unpacking ncurses-term (6.5+20250216-2) over (6.5+20250216-1) ... 72s Preparing to unpack .../liblz4-1_1.10.0-4_amd64.deb ... 72s Unpacking liblz4-1:amd64 (1.10.0-4) over (1.10.0-3) ... 72s Setting up liblz4-1:amd64 (1.10.0-4) ... 72s (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 ... 109138 files and directories currently installed.) 72s Preparing to unpack .../liblzma5_5.6.4-1_amd64.deb ... 72s Unpacking liblzma5:amd64 (5.6.4-1) over (5.6.3-1) ... 72s Setting up liblzma5:amd64 (5.6.4-1) ... 72s (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 ... 109138 files and directories currently installed.) 72s Preparing to unpack .../libapt-pkg7.0_2.9.33_amd64.deb ... 72s Unpacking libapt-pkg7.0:amd64 (2.9.33) over (2.9.31ubuntu1) ... 72s Setting up libapt-pkg7.0:amd64 (2.9.33) ... 72s (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 ... 109138 files and directories currently installed.) 72s Preparing to unpack .../archives/apt_2.9.33_amd64.deb ... 72s Unpacking apt (2.9.33) over (2.9.31ubuntu1) ... 73s Setting up apt (2.9.33) ... 73s (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 ... 109138 files and directories currently installed.) 73s Preparing to unpack .../apt-utils_2.9.33_amd64.deb ... 73s Unpacking apt-utils (2.9.33) over (2.9.31ubuntu1) ... 73s Preparing to unpack .../python3-minimal_3.13.2-2_amd64.deb ... 73s Unpacking python3-minimal (3.13.2-2) over (3.13.2-1) ... 73s Setting up python3-minimal (3.13.2-2) ... 73s (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 ... 109138 files and directories currently installed.) 73s Preparing to unpack .../0-python3_3.13.2-2_amd64.deb ... 74s Unpacking python3 (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../1-libpython3.13_3.13.2-2_amd64.deb ... 74s Unpacking libpython3.13:amd64 (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../2-media-types_13.0.0_all.deb ... 74s Unpacking media-types (13.0.0) over (12.0.0) ... 74s Preparing to unpack .../3-libncurses6_6.5+20250216-2_amd64.deb ... 74s Unpacking libncurses6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 74s Preparing to unpack .../4-libncursesw6_6.5+20250216-2_amd64.deb ... 74s Unpacking libncursesw6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 74s Preparing to unpack .../5-libtinfo6_6.5+20250216-2_amd64.deb ... 74s Unpacking libtinfo6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 74s Setting up libtinfo6:amd64 (6.5+20250216-2) ... 74s (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 ... 109138 files and directories currently installed.) 74s Preparing to unpack .../0-libsqlite3-0_3.46.1-2_amd64.deb ... 74s Unpacking libsqlite3-0:amd64 (3.46.1-2) over (3.46.1-1) ... 74s Preparing to unpack .../1-python3.13_3.13.2-2_amd64.deb ... 74s Unpacking python3.13 (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../2-python3.13-minimal_3.13.2-2_amd64.deb ... 74s Unpacking python3.13-minimal (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../3-libpython3.13-minimal_3.13.2-2_amd64.deb ... 74s Unpacking libpython3.13-minimal:amd64 (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../4-libpython3.13-stdlib_3.13.2-2_amd64.deb ... 74s Unpacking libpython3.13-stdlib:amd64 (3.13.2-2) over (3.13.2-1) ... 74s Preparing to unpack .../5-libpython3-stdlib_3.13.2-2_amd64.deb ... 74s Unpacking libpython3-stdlib:amd64 (3.13.2-2) over (3.13.2-1) ... 75s Preparing to unpack .../6-rsync_3.4.1+ds1-3_amd64.deb ... 75s Unpacking rsync (3.4.1+ds1-3) over (3.4.1-0syncable1) ... 75s Selecting previously unselected package libdebuginfod-common. 75s Preparing to unpack .../7-libdebuginfod-common_0.192-4_all.deb ... 75s Unpacking libdebuginfod-common (0.192-4) ... 75s Preparing to unpack .../8-libaudit-common_1%3a4.0.2-2ubuntu2_all.deb ... 75s Unpacking libaudit-common (1:4.0.2-2ubuntu2) over (1:4.0.2-2ubuntu1) ... 75s Setting up libaudit-common (1:4.0.2-2ubuntu2) ... 75s (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 ... 109147 files and directories currently installed.) 75s Preparing to unpack .../libcap-ng0_0.8.5-4build1_amd64.deb ... 75s Unpacking libcap-ng0:amd64 (0.8.5-4build1) over (0.8.5-4) ... 75s Setting up libcap-ng0:amd64 (0.8.5-4build1) ... 75s (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 ... 109147 files and directories currently installed.) 75s Preparing to unpack .../libaudit1_1%3a4.0.2-2ubuntu2_amd64.deb ... 75s Unpacking libaudit1:amd64 (1:4.0.2-2ubuntu2) over (1:4.0.2-2ubuntu1) ... 75s Setting up libaudit1:amd64 (1:4.0.2-2ubuntu2) ... 75s (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 ... 109147 files and directories currently installed.) 75s Preparing to unpack .../libselinux1_3.7-3ubuntu3_amd64.deb ... 75s Unpacking libselinux1:amd64 (3.7-3ubuntu3) over (3.7-3ubuntu2) ... 75s Setting up libselinux1:amd64 (3.7-3ubuntu3) ... 75s (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 ... 109147 files and directories currently installed.) 75s Preparing to unpack .../00-gir1.2-girepository-2.0_1.83.4-1_amd64.deb ... 75s Unpacking gir1.2-girepository-2.0:amd64 (1.83.4-1) over (1.82.0-4) ... 75s Preparing to unpack .../01-gir1.2-glib-2.0_2.84.0-1_amd64.deb ... 75s Unpacking gir1.2-glib-2.0:amd64 (2.84.0-1) over (2.83.5-1) ... 75s Preparing to unpack .../02-libglib2.0-0t64_2.84.0-1_amd64.deb ... 75s Unpacking libglib2.0-0t64:amd64 (2.84.0-1) over (2.83.5-1) ... 75s Preparing to unpack .../03-libgirepository-1.0-1_1.83.4-1_amd64.deb ... 75s Unpacking libgirepository-1.0-1:amd64 (1.83.4-1) over (1.82.0-4) ... 75s Preparing to unpack .../04-libapparmor1_4.1.0~beta5-0ubuntu8_amd64.deb ... 75s Unpacking libapparmor1:amd64 (4.1.0~beta5-0ubuntu8) over (4.1.0~beta5-0ubuntu6) ... 75s Preparing to unpack .../05-libestr0_0.1.11-2_amd64.deb ... 75s Unpacking libestr0:amd64 (0.1.11-2) over (0.1.11-1build1) ... 75s Preparing to unpack .../06-libglib2.0-data_2.84.0-1_all.deb ... 75s Unpacking libglib2.0-data (2.84.0-1) over (2.83.5-1) ... 75s Preparing to unpack .../07-libxml2_2.12.7+dfsg+really2.9.14-0.2ubuntu5_amd64.deb ... 75s Unpacking libxml2:amd64 (2.12.7+dfsg+really2.9.14-0.2ubuntu5) over (2.12.7+dfsg+really2.9.14-0.2ubuntu4) ... 75s Preparing to unpack .../08-python-apt-common_2.9.9build1_all.deb ... 75s Unpacking python-apt-common (2.9.9build1) over (2.9.9) ... 75s Preparing to unpack .../09-python3-apt_2.9.9build1_amd64.deb ... 76s Unpacking python3-apt (2.9.9build1) over (2.9.9) ... 76s Preparing to unpack .../10-python3-cffi-backend_1.17.1-2build2_amd64.deb ... 76s Unpacking python3-cffi-backend:amd64 (1.17.1-2build2) over (1.17.1-2build1) ... 76s Preparing to unpack .../11-python3-dbus_1.3.2-5build5_amd64.deb ... 76s Unpacking python3-dbus (1.3.2-5build5) over (1.3.2-5build4) ... 76s Preparing to unpack .../12-python3-gi_3.50.0-4build1_amd64.deb ... 76s Unpacking python3-gi (3.50.0-4build1) over (3.50.0-4) ... 76s Preparing to unpack .../13-python3-yaml_6.0.2-1build2_amd64.deb ... 76s Unpacking python3-yaml (6.0.2-1build2) over (6.0.2-1build1) ... 76s Preparing to unpack .../14-rsyslog_8.2412.0-2ubuntu2_amd64.deb ... 76s Unpacking rsyslog (8.2412.0-2ubuntu2) over (8.2412.0-2ubuntu1) ... 76s Preparing to unpack .../15-apparmor_4.1.0~beta5-0ubuntu8_amd64.deb ... 77s Unpacking apparmor (4.1.0~beta5-0ubuntu8) over (4.1.0~beta5-0ubuntu6) ... 77s Preparing to unpack .../16-dosfstools_4.2-1.2_amd64.deb ... 77s Unpacking dosfstools (4.2-1.2) over (4.2-1.1build1) ... 77s Preparing to unpack .../17-libnl-genl-3-200_3.7.0-1_amd64.deb ... 77s Unpacking libnl-genl-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 77s Preparing to unpack .../18-libnl-route-3-200_3.7.0-1_amd64.deb ... 77s Unpacking libnl-route-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 77s Preparing to unpack .../19-libnl-3-200_3.7.0-1_amd64.deb ... 77s Unpacking libnl-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 77s Preparing to unpack .../20-pci.ids_0.0~2025.03.09-1_all.deb ... 77s Unpacking pci.ids (0.0~2025.03.09-1) over (0.0~2025.02.12-1) ... 77s Preparing to unpack .../21-pciutils_1%3a3.13.0-2_amd64.deb ... 77s Unpacking pciutils (1:3.13.0-2) over (1:3.13.0-1) ... 77s Preparing to unpack .../22-libpci3_1%3a3.13.0-2_amd64.deb ... 77s Unpacking libpci3:amd64 (1:3.13.0-2) over (1:3.13.0-1) ... 77s Preparing to unpack .../23-strace_6.13+ds-1ubuntu1_amd64.deb ... 77s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 77s Preparing to unpack .../24-xz-utils_5.6.4-1_amd64.deb ... 77s Unpacking xz-utils (5.6.4-1) over (5.6.3-1) ... 78s Preparing to unpack .../25-libgprofng0_2.44-3ubuntu1_amd64.deb ... 78s Unpacking libgprofng0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../26-libctf0_2.44-3ubuntu1_amd64.deb ... 78s Unpacking libctf0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../27-libctf-nobfd0_2.44-3ubuntu1_amd64.deb ... 78s Unpacking libctf-nobfd0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../28-binutils-x86-64-linux-gnu_2.44-3ubuntu1_amd64.deb ... 78s Unpacking binutils-x86-64-linux-gnu (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../29-libbinutils_2.44-3ubuntu1_amd64.deb ... 78s Unpacking libbinutils:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../30-binutils_2.44-3ubuntu1_amd64.deb ... 78s Unpacking binutils (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../31-binutils-common_2.44-3ubuntu1_amd64.deb ... 78s Unpacking binutils-common:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../32-libsframe1_2.44-3ubuntu1_amd64.deb ... 78s Unpacking libsframe1:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 78s Preparing to unpack .../33-hwdata_0.393-3_all.deb ... 78s Unpacking hwdata (0.393-3) over (0.393-1) ... 78s Selecting previously unselected package pnp.ids. 78s Preparing to unpack .../34-pnp.ids_0.393-3_all.deb ... 78s Unpacking pnp.ids (0.393-3) ... 78s Preparing to unpack .../35-linux-tools-common_6.14.0-10.10_all.deb ... 78s Unpacking linux-tools-common (6.14.0-10.10) over (6.12.0-16.16) ... 78s Selecting previously unselected package bpftool. 78s Preparing to unpack .../36-bpftool_7.6.0+6.14.0-10.10_amd64.deb ... 78s Unpacking bpftool (7.6.0+6.14.0-10.10) ... 78s Preparing to unpack .../37-python3-markupsafe_2.1.5-1build4_amd64.deb ... 78s Unpacking python3-markupsafe (2.1.5-1build4) over (2.1.5-1build3) ... 78s Preparing to unpack .../38-python3-jinja2_3.1.5-2ubuntu1_all.deb ... 78s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 78s Preparing to unpack .../39-cloud-init-base_25.1-0ubuntu3_all.deb ... 79s Unpacking cloud-init-base (25.1-0ubuntu3) over (25.1-0ubuntu2) ... 79s Preparing to unpack .../40-libbrotli1_1.1.0-2build4_amd64.deb ... 79s Unpacking libbrotli1:amd64 (1.1.0-2build4) over (1.1.0-2build3) ... 79s Preparing to unpack .../41-curl_8.12.1-3ubuntu1_amd64.deb ... 79s Unpacking curl (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 79s Preparing to unpack .../42-libcurl4t64_8.12.1-3ubuntu1_amd64.deb ... 79s Unpacking libcurl4t64:amd64 (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 79s Preparing to unpack .../43-libcurl3t64-gnutls_8.12.1-3ubuntu1_amd64.deb ... 79s Unpacking libcurl3t64-gnutls:amd64 (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 79s Preparing to unpack .../44-fwupd_2.0.6-4_amd64.deb ... 79s Unpacking fwupd (2.0.6-4) over (2.0.6-3) ... 79s Preparing to unpack .../45-libfwupd3_2.0.6-4_amd64.deb ... 79s Unpacking libfwupd3:amd64 (2.0.6-4) over (2.0.6-3) ... 79s Preparing to unpack .../46-libmm-glib0_1.23.4-0ubuntu3_amd64.deb ... 79s Unpacking libmm-glib0:amd64 (1.23.4-0ubuntu3) over (1.23.4-0ubuntu2) ... 79s Preparing to unpack .../47-htop_3.4.0-2_amd64.deb ... 79s Unpacking htop (3.4.0-2) over (3.3.0-5) ... 79s Selecting previously unselected package libdebuginfod1t64:amd64. 79s Preparing to unpack .../48-libdebuginfod1t64_0.192-4_amd64.deb ... 79s Unpacking libdebuginfod1t64:amd64 (0.192-4) ... 79s Preparing to unpack .../49-libjemalloc2_5.3.0-3_amd64.deb ... 79s Unpacking libjemalloc2:amd64 (5.3.0-3) over (5.3.0-2build1) ... 79s Preparing to unpack .../50-linux-firmware_20250310.git9e1370d3-0ubuntu1_amd64.deb ... 79s Unpacking linux-firmware (20250310.git9e1370d3-0ubuntu1) over (20250204.git0fd450ee-0ubuntu1) ... 82s Selecting previously unselected package linux-modules-6.14.0-10-generic. 82s Preparing to unpack .../51-linux-modules-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 82s Unpacking linux-modules-6.14.0-10-generic (6.14.0-10.10) ... 83s Selecting previously unselected package linux-image-6.14.0-10-generic. 83s Preparing to unpack .../52-linux-image-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 83s Unpacking linux-image-6.14.0-10-generic (6.14.0-10.10) ... 83s Selecting previously unselected package linux-modules-extra-6.14.0-10-generic. 83s Preparing to unpack .../53-linux-modules-extra-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 83s Unpacking linux-modules-extra-6.14.0-10-generic (6.14.0-10.10) ... 84s Preparing to unpack .../54-linux-generic_6.14.0-10.10_amd64.deb ... 84s Unpacking linux-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 84s Preparing to unpack .../55-linux-image-generic_6.14.0-10.10_amd64.deb ... 84s Unpacking linux-image-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 84s Preparing to unpack .../56-linux-virtual_6.14.0-10.10_amd64.deb ... 84s Unpacking linux-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 84s Preparing to unpack .../57-linux-image-virtual_6.14.0-10.10_amd64.deb ... 84s Unpacking linux-image-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 84s Preparing to unpack .../58-linux-headers-virtual_6.14.0-10.10_amd64.deb ... 84s Unpacking linux-headers-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 84s Selecting previously unselected package linux-headers-6.14.0-10. 84s Preparing to unpack .../59-linux-headers-6.14.0-10_6.14.0-10.10_all.deb ... 84s Unpacking linux-headers-6.14.0-10 (6.14.0-10.10) ... 87s Selecting previously unselected package linux-headers-6.14.0-10-generic. 87s Preparing to unpack .../60-linux-headers-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 87s Unpacking linux-headers-6.14.0-10-generic (6.14.0-10.10) ... 88s Preparing to unpack .../61-linux-headers-generic_6.14.0-10.10_amd64.deb ... 88s Unpacking linux-headers-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 88s Preparing to unpack .../62-linux-libc-dev_6.14.0-10.10_amd64.deb ... 88s Unpacking linux-libc-dev:amd64 (6.14.0-10.10) over (6.12.0-16.16) ... 88s Selecting previously unselected package linux-perf. 88s Preparing to unpack .../63-linux-perf_6.14.0-10.10_amd64.deb ... 88s Unpacking linux-perf (6.14.0-10.10) ... 88s Selecting previously unselected package linux-tools-6.14.0-10. 88s Preparing to unpack .../64-linux-tools-6.14.0-10_6.14.0-10.10_amd64.deb ... 88s Unpacking linux-tools-6.14.0-10 (6.14.0-10.10) ... 88s Selecting previously unselected package linux-tools-6.14.0-10-generic. 88s Preparing to unpack .../65-linux-tools-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 88s Unpacking linux-tools-6.14.0-10-generic (6.14.0-10.10) ... 88s Preparing to unpack .../66-pinentry-curses_1.3.1-2ubuntu3_amd64.deb ... 88s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 88s Preparing to unpack .../67-python3-lazr.uri_1.0.6-6_all.deb ... 89s Unpacking python3-lazr.uri (1.0.6-6) over (1.0.6-5) ... 89s Preparing to unpack .../68-python3-systemd_235-1build6_amd64.deb ... 89s Unpacking python3-systemd (235-1build6) over (235-1build5) ... 89s Preparing to unpack .../69-python3.13-gdbm_3.13.2-2_amd64.deb ... 89s Unpacking python3.13-gdbm (3.13.2-2) over (3.13.2-1) ... 89s Preparing to unpack .../70-cloud-init_25.1-0ubuntu3_all.deb ... 89s Unpacking cloud-init (25.1-0ubuntu3) over (25.1-0ubuntu2) ... 89s Setting up linux-headers-6.14.0-10 (6.14.0-10.10) ... 89s Setting up media-types (13.0.0) ... 89s Installing new version of config file /etc/mime.types ... 89s Setting up linux-headers-6.14.0-10-generic (6.14.0-10.10) ... 89s Setting up libapparmor1:amd64 (4.1.0~beta5-0ubuntu8) ... 89s Setting up pci.ids (0.0~2025.03.09-1) ... 89s Setting up apt-utils (2.9.33) ... 89s Setting up libdebuginfod-common (0.192-4) ... 89s Setting up linux-firmware (20250310.git9e1370d3-0ubuntu1) ... 89s Setting up bpftool (7.6.0+6.14.0-10.10) ... 89s Setting up libestr0:amd64 (0.1.11-2) ... 89s Setting up libbrotli1:amd64 (1.1.0-2build4) ... 89s Setting up libsqlite3-0:amd64 (3.46.1-2) ... 89s Setting up dosfstools (4.2-1.2) ... 89s Setting up rsyslog (8.2412.0-2ubuntu2) ... 89s info: The user `syslog' is already a member of `adm'. 90s Setting up binutils-common:amd64 (2.44-3ubuntu1) ... 90s Setting up libcurl3t64-gnutls:amd64 (8.12.1-3ubuntu1) ... 90s Setting up linux-libc-dev:amd64 (6.14.0-10.10) ... 90s Setting up libctf-nobfd0:amd64 (2.44-3ubuntu1) ... 90s Setting up linux-headers-generic (6.14.0-10.10) ... 90s Setting up libjemalloc2:amd64 (5.3.0-3) ... 90s Setting up libsframe1:amd64 (2.44-3ubuntu1) ... 90s Setting up libpython3.13-minimal:amd64 (3.13.2-2) ... 90s Setting up apparmor (4.1.0~beta5-0ubuntu8) ... 90s Installing new version of config file /etc/apparmor.d/openvpn ... 91s Reloading AppArmor profiles 93s Setting up libglib2.0-0t64:amd64 (2.84.0-1) ... 93s No schema files found: doing nothing. 93s Setting up libglib2.0-data (2.84.0-1) ... 93s Setting up libncurses6:amd64 (6.5+20250216-2) ... 93s Setting up strace (6.13+ds-1ubuntu1) ... 93s Setting up xz-utils (5.6.4-1) ... 93s Setting up gir1.2-glib-2.0:amd64 (2.84.0-1) ... 93s Setting up linux-modules-6.14.0-10-generic (6.14.0-10.10) ... 95s Setting up libncursesw6:amd64 (6.5+20250216-2) ... 95s Setting up libpci3:amd64 (1:3.13.0-2) ... 95s Setting up python-apt-common (2.9.9build1) ... 95s Setting up libmm-glib0:amd64 (1.23.4-0ubuntu3) ... 95s Setting up pnp.ids (0.393-3) ... 95s Setting up libnl-3-200:amd64 (3.7.0-1) ... 95s Setting up python3.13-minimal (3.13.2-2) ... 96s Setting up libgirepository-1.0-1:amd64 (1.83.4-1) ... 96s Setting up libbinutils:amd64 (2.44-3ubuntu1) ... 96s Setting up libpython3.13-stdlib:amd64 (3.13.2-2) ... 96s Setting up libxml2:amd64 (2.12.7+dfsg+really2.9.14-0.2ubuntu5) ... 96s Setting up rsync (3.4.1+ds1-3) ... 96s rsync.service is a disabled or a static unit not running, not starting it. 96s Setting up python3.13-gdbm (3.13.2-2) ... 96s Setting up libpython3-stdlib:amd64 (3.13.2-2) ... 96s Setting up ncurses-term (6.5+20250216-2) ... 96s Setting up libctf0:amd64 (2.44-3ubuntu1) ... 96s Setting up libpython3.13:amd64 (3.13.2-2) ... 96s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 96s Setting up libdebuginfod1t64:amd64 (0.192-4) ... 96s Setting up linux-headers-virtual (6.14.0-10.10) ... 96s Setting up libcurl4t64:amd64 (8.12.1-3ubuntu1) ... 96s Setting up python3.13 (3.13.2-2) ... 97s Setting up htop (3.4.0-2) ... 97s Setting up linux-image-6.14.0-10-generic (6.14.0-10.10) ... 99s I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.12.0-16-generic 99s I: /boot/initrd.img.old is now a symlink to initrd.img-6.12.0-16-generic 99s I: /boot/vmlinuz is now a symlink to vmlinuz-6.14.0-10-generic 99s I: /boot/initrd.img is now a symlink to initrd.img-6.14.0-10-generic 99s Setting up libfwupd3:amd64 (2.0.6-4) ... 99s Setting up python3 (3.13.2-2) ... 100s Setting up python3-markupsafe (2.1.5-1build4) ... 100s Setting up linux-modules-extra-6.14.0-10-generic (6.14.0-10.10) ... 102s Setting up libnl-route-3-200:amd64 (3.7.0-1) ... 102s Setting up hwdata (0.393-3) ... 102s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 102s Setting up libgprofng0:amd64 (2.44-3ubuntu1) ... 102s Setting up linux-perf (6.14.0-10.10) ... 102s Setting up gir1.2-girepository-2.0:amd64 (1.83.4-1) ... 102s Setting up python3-gi (3.50.0-4build1) ... 102s Setting up pciutils (1:3.13.0-2) ... 102s Setting up libnl-genl-3-200:amd64 (3.7.0-1) ... 102s Setting up curl (8.12.1-3ubuntu1) ... 102s Setting up linux-image-virtual (6.14.0-10.10) ... 102s Setting up linux-tools-common (6.14.0-10.10) ... 102s Setting up fwupd (2.0.6-4) ... 102s fwupd-refresh.service is a disabled or a static unit not running, not starting it. 103s Setting up python3-systemd (235-1build6) ... 103s Setting up python3-cffi-backend:amd64 (1.17.1-2build2) ... 103s Setting up binutils-x86-64-linux-gnu (2.44-3ubuntu1) ... 103s Setting up linux-image-generic (6.14.0-10.10) ... 103s Setting up python3-dbus (1.3.2-5build5) ... 103s Setting up linux-tools-6.14.0-10 (6.14.0-10.10) ... 103s Setting up linux-generic (6.14.0-10.10) ... 103s Setting up python3-apt (2.9.9build1) ... 103s Setting up python3-yaml (6.0.2-1build2) ... 103s Setting up python3-lazr.uri (1.0.6-6) ... 103s Setting up binutils (2.44-3ubuntu1) ... 103s Setting up cloud-init-base (25.1-0ubuntu3) ... 105s Setting up linux-virtual (6.14.0-10.10) ... 105s Setting up linux-tools-6.14.0-10-generic (6.14.0-10.10) ... 105s Setting up cloud-init (25.1-0ubuntu3) ... 105s Processing triggers for systemd (257.3-1ubuntu3) ... 105s Processing triggers for man-db (2.13.0-1) ... 106s Processing triggers for dbus (1.16.2-1ubuntu1) ... 106s Processing triggers for libc-bin (2.41-1ubuntu1) ... 107s Processing triggers for initramfs-tools (0.146ubuntu1) ... 107s update-initramfs: Generating /boot/initrd.img-6.12.0-16-generic 107s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 117s Processing triggers for linux-image-6.14.0-10-generic (6.14.0-10.10) ... 117s /etc/kernel/postinst.d/initramfs-tools: 117s update-initramfs: Generating /boot/initrd.img-6.14.0-10-generic 117s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 126s /etc/kernel/postinst.d/zz-update-grub: 126s Sourcing file `/etc/default/grub' 126s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 126s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 126s Generating grub configuration file ... 126s Found linux image: /boot/vmlinuz-6.14.0-10-generic 126s Found initrd image: /boot/initrd.img-6.14.0-10-generic 127s Found linux image: /boot/vmlinuz-6.12.0-16-generic 127s Found initrd image: /boot/initrd.img-6.12.0-16-generic 127s Found linux image: /boot/vmlinuz-6.11.0-8-generic 127s Found initrd image: /boot/initrd.img-6.11.0-8-generic 127s Warning: os-prober will not be executed to detect other bootable partitions. 127s Systems on them will not be added to the GRUB boot configuration. 127s Check GRUB_DISABLE_OS_PROBER documentation entry. 127s Adding boot menu entry for UEFI Firmware Settings ... 127s done 128s Reading package lists... 129s Building dependency tree... 129s Reading state information... 129s Solving dependencies... 129s The following packages will be REMOVED: 129s libnl-genl-3-200* libnsl2* libpython3.12-minimal* libpython3.12-stdlib* 129s libpython3.12t64* linux-headers-6.11.0-8* linux-headers-6.11.0-8-generic* 129s linux-headers-6.12.0-16* linux-headers-6.12.0-16-generic* 129s linux-image-6.11.0-8-generic* linux-image-6.12.0-16-generic* 129s linux-modules-6.11.0-8-generic* linux-modules-6.12.0-16-generic* 129s linux-modules-extra-6.12.0-16-generic* linux-tools-6.11.0-8* 129s linux-tools-6.11.0-8-generic* linux-tools-6.12.0-16* 129s linux-tools-6.12.0-16-generic* 129s 0 upgraded, 0 newly installed, 18 to remove and 5 not upgraded. 129s After this operation, 545 MB disk space will be freed. 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 ... 148643 files and directories currently installed.) 129s Removing libnl-genl-3-200:amd64 (3.7.0-1) ... 129s Removing linux-tools-6.11.0-8-generic (6.11.0-8.8) ... 129s Removing linux-tools-6.11.0-8 (6.11.0-8.8) ... 129s Removing libpython3.12t64:amd64 (3.12.9-1) ... 129s Removing libpython3.12-stdlib:amd64 (3.12.9-1) ... 130s Removing libnsl2:amd64 (1.3.0-3build3) ... 130s Removing libpython3.12-minimal:amd64 (3.12.9-1) ... 130s Removing linux-headers-6.11.0-8-generic (6.11.0-8.8) ... 130s Removing linux-headers-6.11.0-8 (6.11.0-8.8) ... 132s Removing linux-headers-6.12.0-16-generic (6.12.0-16.16) ... 133s Removing linux-headers-6.12.0-16 (6.12.0-16.16) ... 134s Removing linux-image-6.11.0-8-generic (6.11.0-8.8) ... 135s /etc/kernel/postrm.d/initramfs-tools: 135s update-initramfs: Deleting /boot/initrd.img-6.11.0-8-generic 135s /etc/kernel/postrm.d/zz-update-grub: 135s Sourcing file `/etc/default/grub' 135s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 135s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 135s Generating grub configuration file ... 135s Found linux image: /boot/vmlinuz-6.14.0-10-generic 135s Found initrd image: /boot/initrd.img-6.14.0-10-generic 135s Found linux image: /boot/vmlinuz-6.12.0-16-generic 135s Found initrd image: /boot/initrd.img-6.12.0-16-generic 135s Warning: os-prober will not be executed to detect other bootable partitions. 135s Systems on them will not be added to the GRUB boot configuration. 135s Check GRUB_DISABLE_OS_PROBER documentation entry. 135s Adding boot menu entry for UEFI Firmware Settings ... 135s done 135s Removing linux-image-6.12.0-16-generic (6.12.0-16.16) ... 136s W: Removing the running kernel 136s I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.14.0-10-generic 136s I: /boot/initrd.img.old is now a symlink to initrd.img-6.14.0-10-generic 136s /etc/kernel/postrm.d/initramfs-tools: 136s update-initramfs: Deleting /boot/initrd.img-6.12.0-16-generic 136s /etc/kernel/postrm.d/zz-update-grub: 136s Sourcing file `/etc/default/grub' 136s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 136s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 136s Generating grub configuration file ... 136s Found linux image: /boot/vmlinuz-6.14.0-10-generic 136s Found initrd image: /boot/initrd.img-6.14.0-10-generic 136s Warning: os-prober will not be executed to detect other bootable partitions. 136s Systems on them will not be added to the GRUB boot configuration. 136s Check GRUB_DISABLE_OS_PROBER documentation entry. 136s Adding boot menu entry for UEFI Firmware Settings ... 136s done 136s Removing linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 136s Removing linux-modules-extra-6.12.0-16-generic (6.12.0-16.16) ... 138s Removing linux-modules-6.12.0-16-generic (6.12.0-16.16) ... 138s Removing linux-tools-6.12.0-16-generic (6.12.0-16.16) ... 138s Removing linux-tools-6.12.0-16 (6.12.0-16.16) ... 138s Processing triggers for libc-bin (2.41-1ubuntu1) ... 138s (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 ... 76972 files and directories currently installed.) 138s Purging configuration files for linux-image-6.11.0-8-generic (6.11.0-8.8) ... 138s Purging configuration files for libpython3.12-minimal:amd64 (3.12.9-1) ... 138s Purging configuration files for linux-modules-extra-6.12.0-16-generic (6.12.0-16.16) ... 138s Purging configuration files for linux-modules-6.12.0-16-generic (6.12.0-16.16) ... 138s dpkg: warning: while removing linux-modules-6.12.0-16-generic, directory '/lib/modules/6.12.0-16-generic' not empty so not removed 138s Purging configuration files for linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 138s Purging configuration files for linux-image-6.12.0-16-generic (6.12.0-16.16) ... 138s rmdir: failed to remove '/lib/modules/6.12.0-16-generic': Directory not empty 138s autopkgtest [23:24:49]: upgrading testbed (apt dist-upgrade and autopurge) 138s Reading package lists... 139s Building dependency tree... 139s Reading state information... 139s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 139s Starting 2 pkgProblemResolver with broken count: 0 139s Done 140s Entering ResolveByKeep 140s 140s Calculating upgrade... 140s The following packages will be upgraded: 140s libc-bin libc-dev-bin libc6 libc6-dev locales 140s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 140s Need to get 10.5 MB of archives. 140s After this operation, 1024 B of additional disk space will be used. 140s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc6-dev amd64 2.41-1ubuntu2 [2183 kB] 140s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc-dev-bin amd64 2.41-1ubuntu2 [24.7 kB] 140s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc6 amd64 2.41-1ubuntu2 [3327 kB] 141s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc-bin amd64 2.41-1ubuntu2 [700 kB] 141s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 locales all 2.41-1ubuntu2 [4246 kB] 141s Preconfiguring packages ... 141s Fetched 10.5 MB in 0s (38.3 MB/s) 141s (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 ... 76968 files and directories currently installed.) 141s Preparing to unpack .../libc6-dev_2.41-1ubuntu2_amd64.deb ... 141s Unpacking libc6-dev:amd64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 141s Preparing to unpack .../libc-dev-bin_2.41-1ubuntu2_amd64.deb ... 141s Unpacking libc-dev-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 141s Preparing to unpack .../libc6_2.41-1ubuntu2_amd64.deb ... 141s Unpacking libc6:amd64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 142s Setting up libc6:amd64 (2.41-1ubuntu2) ... 142s (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 ... 76968 files and directories currently installed.) 142s Preparing to unpack .../libc-bin_2.41-1ubuntu2_amd64.deb ... 142s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 142s Setting up libc-bin (2.41-1ubuntu2) ... 142s (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 ... 76968 files and directories currently installed.) 142s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 142s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 142s Setting up locales (2.41-1ubuntu2) ... 143s Generating locales (this might take a while)... 144s en_US.UTF-8... done 144s Generation complete. 144s Setting up libc-dev-bin (2.41-1ubuntu2) ... 144s Setting up libc6-dev:amd64 (2.41-1ubuntu2) ... 144s Processing triggers for man-db (2.13.0-1) ... 145s Processing triggers for systemd (257.3-1ubuntu3) ... 146s Reading package lists... 146s Building dependency tree... 146s Reading state information... 146s Starting pkgProblemResolver with broken count: 0 146s Starting 2 pkgProblemResolver with broken count: 0 146s Done 147s Solving dependencies... 147s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 147s autopkgtest [23:24:58]: rebooting testbed after setup commands that affected boot 151s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 162s autopkgtest [23:25:13]: testbed running kernel: Linux 6.14.0-10-generic #10-Ubuntu SMP PREEMPT_DYNAMIC Wed Mar 12 16:07:00 UTC 2025 164s autopkgtest [23:25:15]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 165s Get:1 http://ftpmaster.internal/ubuntu plucky/universe r-cran-matrixstats 1.5.0-1 (dsc) [2228 B] 165s Get:2 http://ftpmaster.internal/ubuntu plucky/universe r-cran-matrixstats 1.5.0-1 (tar) [212 kB] 165s Get:3 http://ftpmaster.internal/ubuntu plucky/universe r-cran-matrixstats 1.5.0-1 (diff) [4864 B] 165s gpgv: Signature made Sat Jan 18 11:46:01 2025 UTC 165s gpgv: using RSA key 724D609337113C710550D7473C26763F6C67E6E2 165s gpgv: Can't check signature: No public key 165s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.5.0-1.dsc: no acceptable signature found 165s autopkgtest [23:25:16]: testing package r-cran-matrixstats version 1.5.0-1 165s autopkgtest [23:25:16]: build not needed 174s autopkgtest [23:25:25]: test run-unit-test: preparing testbed 174s Reading package lists... 175s Building dependency tree... 175s Reading state information... 175s Starting pkgProblemResolver with broken count: 0 175s Starting 2 pkgProblemResolver with broken count: 0 175s Done 176s The following NEW packages will be installed: 176s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 176s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libdatrie1 176s libdeflate0 libfontconfig1 libgfortran5 libgomp1 libgraphite2-3 176s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 176s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 176s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 176s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 176s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 176s libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 176s r-cran-base64enc r-cran-cli r-cran-colorspace r-cran-commonmark 176s r-cran-digest r-cran-evaluate r-cran-fansi r-cran-farver r-cran-ggplot2 176s r-cran-glue r-cran-gtable r-cran-highr r-cran-isoband r-cran-knitr 176s r-cran-labeling r-cran-lattice r-cran-lifecycle r-cran-magrittr 176s r-cran-markdown r-cran-mass r-cran-matrix r-cran-matrixstats r-cran-mgcv 176s r-cran-microbenchmark r-cran-munsell r-cran-nlme r-cran-pillar 176s r-cran-pkgconfig r-cran-r.cache r-cran-r.devices r-cran-r.methodss3 176s r-cran-r.oo r-cran-r.rsp r-cran-r.utils r-cran-r6 r-cran-rcolorbrewer 176s r-cran-rlang r-cran-scales r-cran-tibble r-cran-utf8 r-cran-vctrs 176s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml tcl tcl8.6 unzip 176s x11-common xdg-utils zip 176s 0 upgraded, 99 newly installed, 0 to remove and 0 not upgraded. 176s Need to get 87.3 MB of archives. 176s After this operation, 197 MB of additional disk space will be used. 176s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-dejavu-mono all 2.37-8 [502 kB] 176s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-dejavu-core all 2.37-8 [835 kB] 176s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 fontconfig-config amd64 2.15.0-2ubuntu1 [37.4 kB] 176s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 libfontconfig1 amd64 2.15.0-2ubuntu1 [164 kB] 176s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 fontconfig amd64 2.15.0-2ubuntu1 [180 kB] 176s Get:6 http://ftpmaster.internal/ubuntu plucky/universe amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-3 [118 kB] 176s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 176s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 libblas3 amd64 3.12.1-2 [359 kB] 176s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 libpixman-1-0 amd64 0.44.0-3 [427 kB] 176s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 libxcb-render0 amd64 1.17.0-2 [16.2 kB] 176s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 libxcb-shm0 amd64 1.17.0-2 [5758 B] 176s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 libxrender1 amd64 1:0.9.10-1.1build1 [19.0 kB] 176s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 libcairo2 amd64 1.18.2-2 [569 kB] 176s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 libdatrie1 amd64 0.2.13-3build1 [19.0 kB] 176s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libdeflate0 amd64 1.23-1 [64.1 kB] 176s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libgfortran5 amd64 15-20250222-0ubuntu1 [919 kB] 176s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 libgomp1 amd64 15-20250222-0ubuntu1 [148 kB] 176s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 libgraphite2-3 amd64 1.3.14-2ubuntu1 [73.1 kB] 176s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 libharfbuzz0b amd64 10.2.0-1 [543 kB] 176s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 x11-common all 1:7.7+23ubuntu3 [21.7 kB] 176s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 libice6 amd64 2:1.1.1-1 [44.1 kB] 176s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg-turbo8 amd64 2.1.5-3ubuntu2 [179 kB] 176s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg8 amd64 8c-2ubuntu11 [2148 B] 176s Get:24 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-bootstrap all 3.4.1+dfsg-3 [129 kB] 176s Get:25 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-highlight.js all 9.18.5+dfsg1-2 [385 kB] 176s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 176s Get:27 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-jquery-datatables all 1.11.5+dfsg-2 [146 kB] 176s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 liblapack3 amd64 3.12.1-2 [3179 kB] 176s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 liblerc4 amd64 4.0.0+ds-5ubuntu1 [271 kB] 176s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 libthai-data all 0.1.29-2build1 [158 kB] 176s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 libthai0 amd64 0.1.29-2build1 [18.9 kB] 176s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 libpango-1.0-0 amd64 1.56.2-1 [255 kB] 176s Get:33 http://ftpmaster.internal/ubuntu plucky/main amd64 libpangoft2-1.0-0 amd64 1.56.2-1 [52.6 kB] 176s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 libpangocairo-1.0-0 amd64 1.56.2-1 [29.1 kB] 176s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 libpaper2 amd64 2.2.5-0.3 [17.4 kB] 176s Get:36 http://ftpmaster.internal/ubuntu plucky/main amd64 libpaper-utils amd64 2.2.5-0.3 [15.5 kB] 176s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 libsharpyuv0 amd64 1.5.0-0.1 [25.9 kB] 176s Get:38 http://ftpmaster.internal/ubuntu plucky/main amd64 libsm6 amd64 2:1.2.4-1 [17.4 kB] 176s Get:39 http://ftpmaster.internal/ubuntu plucky/main amd64 libtcl8.6 amd64 8.6.16+dfsg-1 [1086 kB] 176s Get:40 http://ftpmaster.internal/ubuntu plucky/main amd64 libjbig0 amd64 2.1-6.1ubuntu2 [29.7 kB] 176s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 libwebp7 amd64 1.5.0-0.1 [378 kB] 176s Get:42 http://ftpmaster.internal/ubuntu plucky/main amd64 libtiff6 amd64 4.5.1+git230720-4ubuntu4 [200 kB] 176s Get:43 http://ftpmaster.internal/ubuntu plucky/main amd64 libxft2 amd64 2.3.6-1build1 [45.3 kB] 176s Get:44 http://ftpmaster.internal/ubuntu plucky/main amd64 libxss1 amd64 1:1.2.3-1build3 [7204 B] 176s Get:45 http://ftpmaster.internal/ubuntu plucky/main amd64 libtk8.6 amd64 8.6.16-1 [868 kB] 176s Get:46 http://ftpmaster.internal/ubuntu plucky/main amd64 libxt6t64 amd64 1:1.2.1-1.2build1 [171 kB] 176s Get:47 http://ftpmaster.internal/ubuntu plucky/universe amd64 node-normalize.css all 8.0.1-5 [10.8 kB] 176s Get:48 http://ftpmaster.internal/ubuntu plucky/main amd64 zip amd64 3.0-14ubuntu2 [185 kB] 176s Get:49 http://ftpmaster.internal/ubuntu plucky/main amd64 unzip amd64 6.0-28ubuntu6 [181 kB] 176s Get:50 http://ftpmaster.internal/ubuntu plucky/main amd64 xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 176s Get:51 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-base-core amd64 4.4.3-1 [28.9 MB] 176s Get:52 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-base64enc amd64 0.1-3-3 [27.6 kB] 176s Get:53 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-cli amd64 3.6.4-1 [1394 kB] 176s Get:54 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-colorspace amd64 2.1-1+dfsg-1 [1563 kB] 176s Get:55 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-commonmark amd64 1.9.2-2 [137 kB] 176s Get:56 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-digest amd64 0.6.37-1 [200 kB] 176s Get:57 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-evaluate all 1.0.3-1 [114 kB] 176s Get:58 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-fansi amd64 1.0.5-1 [619 kB] 176s Get:59 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-farver amd64 2.1.2-1 [1355 kB] 176s Get:60 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-glue amd64 1.8.0-1 [164 kB] 176s Get:61 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-rlang amd64 1.1.5-1 [1719 kB] 176s Get:62 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-lifecycle all 1.0.4+dfsg-1 [110 kB] 176s Get:63 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 176s Get:64 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-isoband amd64 0.2.7-1 [1481 kB] 176s Get:65 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-mass amd64 7.3-64-1 [1114 kB] 176s Get:66 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-lattice amd64 0.22-6-1 [1340 kB] 176s Get:67 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-nlme amd64 3.1.167-1 [2320 kB] 176s Get:68 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-matrix amd64 1.7-3-1 [4349 kB] 176s Get:69 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-mgcv amd64 1.9-1-1 [3252 kB] 176s Get:70 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-labeling all 0.4.3-1 [62.1 kB] 176s Get:71 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-munsell all 0.5.1-1 [213 kB] 176s Get:72 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r6 all 2.6.1-1 [101 kB] 176s Get:73 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-rcolorbrewer all 1.1-3-1build1 [55.4 kB] 176s Get:74 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-viridislite all 0.4.2-2 [1088 kB] 176s Get:75 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-scales all 1.3.0-1 [603 kB] 176s Get:76 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-magrittr amd64 2.0.3-1 [154 kB] 176s Get:77 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-utf8 amd64 1.2.4-1 [140 kB] 176s Get:78 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-vctrs amd64 0.6.5-1 [1335 kB] 176s Get:79 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-pillar all 1.10.1+dfsg-1 [453 kB] 176s Get:80 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-pkgconfig all 2.0.3-2build1 [19.7 kB] 176s Get:81 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-tibble amd64 3.2.1+dfsg-3 [419 kB] 176s Get:82 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 176s Get:83 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-ggplot2 all 3.5.1+dfsg-1 [3940 kB] 177s Get:84 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-xfun amd64 0.51+dfsg-1 [574 kB] 177s Get:85 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 177s Get:86 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-yaml amd64 2.3.10-1 [109 kB] 177s Get:87 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 177s Get:88 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-knitr all 1.49+dfsg-1 [859 kB] 177s Get:89 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-markdown all 1.13-1 [162 kB] 177s Get:90 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-matrixstats amd64 1.5.0-1 [542 kB] 177s Get:91 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-microbenchmark amd64 1.5.0-1 [67.4 kB] 177s Get:92 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 177s Get:93 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.oo all 1.27.0-1 [979 kB] 177s Get:94 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.utils all 2.13.0-1 [1423 kB] 177s Get:95 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.cache all 0.16.0-1 [113 kB] 177s Get:96 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.devices all 2.17.2+ds-1 [398 kB] 177s Get:97 http://ftpmaster.internal/ubuntu plucky/main amd64 tcl8.6 amd64 8.6.16+dfsg-1 [14.9 kB] 177s Get:98 http://ftpmaster.internal/ubuntu plucky/main amd64 tcl amd64 8.6.14build1 [4124 B] 177s Get:99 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 177s Preconfiguring packages ... 177s Fetched 87.3 MB in 1s (82.4 MB/s) 177s Selecting previously unselected package fonts-dejavu-mono. 177s (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 ... 76968 files and directories currently installed.) 177s Preparing to unpack .../00-fonts-dejavu-mono_2.37-8_all.deb ... 177s Unpacking fonts-dejavu-mono (2.37-8) ... 177s Selecting previously unselected package fonts-dejavu-core. 177s Preparing to unpack .../01-fonts-dejavu-core_2.37-8_all.deb ... 177s Unpacking fonts-dejavu-core (2.37-8) ... 177s Selecting previously unselected package fontconfig-config. 177s Preparing to unpack .../02-fontconfig-config_2.15.0-2ubuntu1_amd64.deb ... 178s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 178s Selecting previously unselected package libfontconfig1:amd64. 178s Preparing to unpack .../03-libfontconfig1_2.15.0-2ubuntu1_amd64.deb ... 178s Unpacking libfontconfig1:amd64 (2.15.0-2ubuntu1) ... 178s Selecting previously unselected package fontconfig. 178s Preparing to unpack .../04-fontconfig_2.15.0-2ubuntu1_amd64.deb ... 178s Unpacking fontconfig (2.15.0-2ubuntu1) ... 178s Selecting previously unselected package fonts-glyphicons-halflings. 178s Preparing to unpack .../05-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-3_all.deb ... 178s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 178s Selecting previously unselected package fonts-mathjax. 178s Preparing to unpack .../06-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 178s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 178s Selecting previously unselected package libblas3:amd64. 178s Preparing to unpack .../07-libblas3_3.12.1-2_amd64.deb ... 178s Unpacking libblas3:amd64 (3.12.1-2) ... 178s Selecting previously unselected package libpixman-1-0:amd64. 178s Preparing to unpack .../08-libpixman-1-0_0.44.0-3_amd64.deb ... 178s Unpacking libpixman-1-0:amd64 (0.44.0-3) ... 178s Selecting previously unselected package libxcb-render0:amd64. 178s Preparing to unpack .../09-libxcb-render0_1.17.0-2_amd64.deb ... 178s Unpacking libxcb-render0:amd64 (1.17.0-2) ... 178s Selecting previously unselected package libxcb-shm0:amd64. 178s Preparing to unpack .../10-libxcb-shm0_1.17.0-2_amd64.deb ... 178s Unpacking libxcb-shm0:amd64 (1.17.0-2) ... 178s Selecting previously unselected package libxrender1:amd64. 178s Preparing to unpack .../11-libxrender1_1%3a0.9.10-1.1build1_amd64.deb ... 178s Unpacking libxrender1:amd64 (1:0.9.10-1.1build1) ... 178s Selecting previously unselected package libcairo2:amd64. 178s Preparing to unpack .../12-libcairo2_1.18.2-2_amd64.deb ... 178s Unpacking libcairo2:amd64 (1.18.2-2) ... 178s Selecting previously unselected package libdatrie1:amd64. 178s Preparing to unpack .../13-libdatrie1_0.2.13-3build1_amd64.deb ... 178s Unpacking libdatrie1:amd64 (0.2.13-3build1) ... 178s Selecting previously unselected package libdeflate0:amd64. 178s Preparing to unpack .../14-libdeflate0_1.23-1_amd64.deb ... 178s Unpacking libdeflate0:amd64 (1.23-1) ... 178s Selecting previously unselected package libgfortran5:amd64. 178s Preparing to unpack .../15-libgfortran5_15-20250222-0ubuntu1_amd64.deb ... 178s Unpacking libgfortran5:amd64 (15-20250222-0ubuntu1) ... 178s Selecting previously unselected package libgomp1:amd64. 178s Preparing to unpack .../16-libgomp1_15-20250222-0ubuntu1_amd64.deb ... 178s Unpacking libgomp1:amd64 (15-20250222-0ubuntu1) ... 178s Selecting previously unselected package libgraphite2-3:amd64. 178s Preparing to unpack .../17-libgraphite2-3_1.3.14-2ubuntu1_amd64.deb ... 178s Unpacking libgraphite2-3:amd64 (1.3.14-2ubuntu1) ... 178s Selecting previously unselected package libharfbuzz0b:amd64. 178s Preparing to unpack .../18-libharfbuzz0b_10.2.0-1_amd64.deb ... 178s Unpacking libharfbuzz0b:amd64 (10.2.0-1) ... 178s Selecting previously unselected package x11-common. 178s Preparing to unpack .../19-x11-common_1%3a7.7+23ubuntu3_all.deb ... 178s Unpacking x11-common (1:7.7+23ubuntu3) ... 178s Selecting previously unselected package libice6:amd64. 178s Preparing to unpack .../20-libice6_2%3a1.1.1-1_amd64.deb ... 178s Unpacking libice6:amd64 (2:1.1.1-1) ... 178s Selecting previously unselected package libjpeg-turbo8:amd64. 178s Preparing to unpack .../21-libjpeg-turbo8_2.1.5-3ubuntu2_amd64.deb ... 178s Unpacking libjpeg-turbo8:amd64 (2.1.5-3ubuntu2) ... 178s Selecting previously unselected package libjpeg8:amd64. 178s Preparing to unpack .../22-libjpeg8_8c-2ubuntu11_amd64.deb ... 178s Unpacking libjpeg8:amd64 (8c-2ubuntu11) ... 178s Selecting previously unselected package libjs-bootstrap. 178s Preparing to unpack .../23-libjs-bootstrap_3.4.1+dfsg-3_all.deb ... 178s Unpacking libjs-bootstrap (3.4.1+dfsg-3) ... 178s Selecting previously unselected package libjs-highlight.js. 178s Preparing to unpack .../24-libjs-highlight.js_9.18.5+dfsg1-2_all.deb ... 178s Unpacking libjs-highlight.js (9.18.5+dfsg1-2) ... 178s Selecting previously unselected package libjs-jquery. 178s Preparing to unpack .../25-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 178s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 178s Selecting previously unselected package libjs-jquery-datatables. 178s Preparing to unpack .../26-libjs-jquery-datatables_1.11.5+dfsg-2_all.deb ... 178s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2) ... 178s Selecting previously unselected package liblapack3:amd64. 178s Preparing to unpack .../27-liblapack3_3.12.1-2_amd64.deb ... 178s Unpacking liblapack3:amd64 (3.12.1-2) ... 179s Selecting previously unselected package liblerc4:amd64. 179s Preparing to unpack .../28-liblerc4_4.0.0+ds-5ubuntu1_amd64.deb ... 179s Unpacking liblerc4:amd64 (4.0.0+ds-5ubuntu1) ... 179s Selecting previously unselected package libthai-data. 179s Preparing to unpack .../29-libthai-data_0.1.29-2build1_all.deb ... 179s Unpacking libthai-data (0.1.29-2build1) ... 179s Selecting previously unselected package libthai0:amd64. 179s Preparing to unpack .../30-libthai0_0.1.29-2build1_amd64.deb ... 179s Unpacking libthai0:amd64 (0.1.29-2build1) ... 179s Selecting previously unselected package libpango-1.0-0:amd64. 179s Preparing to unpack .../31-libpango-1.0-0_1.56.2-1_amd64.deb ... 179s Unpacking libpango-1.0-0:amd64 (1.56.2-1) ... 179s Selecting previously unselected package libpangoft2-1.0-0:amd64. 179s Preparing to unpack .../32-libpangoft2-1.0-0_1.56.2-1_amd64.deb ... 179s Unpacking libpangoft2-1.0-0:amd64 (1.56.2-1) ... 179s Selecting previously unselected package libpangocairo-1.0-0:amd64. 179s Preparing to unpack .../33-libpangocairo-1.0-0_1.56.2-1_amd64.deb ... 179s Unpacking libpangocairo-1.0-0:amd64 (1.56.2-1) ... 179s Selecting previously unselected package libpaper2:amd64. 179s Preparing to unpack .../34-libpaper2_2.2.5-0.3_amd64.deb ... 179s Unpacking libpaper2:amd64 (2.2.5-0.3) ... 179s Selecting previously unselected package libpaper-utils. 179s Preparing to unpack .../35-libpaper-utils_2.2.5-0.3_amd64.deb ... 179s Unpacking libpaper-utils (2.2.5-0.3) ... 179s Selecting previously unselected package libsharpyuv0:amd64. 179s Preparing to unpack .../36-libsharpyuv0_1.5.0-0.1_amd64.deb ... 179s Unpacking libsharpyuv0:amd64 (1.5.0-0.1) ... 179s Selecting previously unselected package libsm6:amd64. 179s Preparing to unpack .../37-libsm6_2%3a1.2.4-1_amd64.deb ... 179s Unpacking libsm6:amd64 (2:1.2.4-1) ... 179s Selecting previously unselected package libtcl8.6:amd64. 179s Preparing to unpack .../38-libtcl8.6_8.6.16+dfsg-1_amd64.deb ... 179s Unpacking libtcl8.6:amd64 (8.6.16+dfsg-1) ... 179s Selecting previously unselected package libjbig0:amd64. 179s Preparing to unpack .../39-libjbig0_2.1-6.1ubuntu2_amd64.deb ... 179s Unpacking libjbig0:amd64 (2.1-6.1ubuntu2) ... 179s Selecting previously unselected package libwebp7:amd64. 179s Preparing to unpack .../40-libwebp7_1.5.0-0.1_amd64.deb ... 179s Unpacking libwebp7:amd64 (1.5.0-0.1) ... 179s Selecting previously unselected package libtiff6:amd64. 179s Preparing to unpack .../41-libtiff6_4.5.1+git230720-4ubuntu4_amd64.deb ... 179s Unpacking libtiff6:amd64 (4.5.1+git230720-4ubuntu4) ... 179s Selecting previously unselected package libxft2:amd64. 179s Preparing to unpack .../42-libxft2_2.3.6-1build1_amd64.deb ... 179s Unpacking libxft2:amd64 (2.3.6-1build1) ... 179s Selecting previously unselected package libxss1:amd64. 179s Preparing to unpack .../43-libxss1_1%3a1.2.3-1build3_amd64.deb ... 179s Unpacking libxss1:amd64 (1:1.2.3-1build3) ... 179s Selecting previously unselected package libtk8.6:amd64. 179s Preparing to unpack .../44-libtk8.6_8.6.16-1_amd64.deb ... 179s Unpacking libtk8.6:amd64 (8.6.16-1) ... 179s Selecting previously unselected package libxt6t64:amd64. 179s Preparing to unpack .../45-libxt6t64_1%3a1.2.1-1.2build1_amd64.deb ... 179s Unpacking libxt6t64:amd64 (1:1.2.1-1.2build1) ... 179s Selecting previously unselected package node-normalize.css. 179s Preparing to unpack .../46-node-normalize.css_8.0.1-5_all.deb ... 179s Unpacking node-normalize.css (8.0.1-5) ... 179s Selecting previously unselected package zip. 179s Preparing to unpack .../47-zip_3.0-14ubuntu2_amd64.deb ... 179s Unpacking zip (3.0-14ubuntu2) ... 179s Selecting previously unselected package unzip. 179s Preparing to unpack .../48-unzip_6.0-28ubuntu6_amd64.deb ... 179s Unpacking unzip (6.0-28ubuntu6) ... 179s Selecting previously unselected package xdg-utils. 179s Preparing to unpack .../49-xdg-utils_1.2.1-2ubuntu1_all.deb ... 179s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 179s Selecting previously unselected package r-base-core. 179s Preparing to unpack .../50-r-base-core_4.4.3-1_amd64.deb ... 179s Unpacking r-base-core (4.4.3-1) ... 180s Selecting previously unselected package r-cran-base64enc. 180s Preparing to unpack .../51-r-cran-base64enc_0.1-3-3_amd64.deb ... 180s Unpacking r-cran-base64enc (0.1-3-3) ... 180s Selecting previously unselected package r-cran-cli. 180s Preparing to unpack .../52-r-cran-cli_3.6.4-1_amd64.deb ... 180s Unpacking r-cran-cli (3.6.4-1) ... 180s Selecting previously unselected package r-cran-colorspace. 180s Preparing to unpack .../53-r-cran-colorspace_2.1-1+dfsg-1_amd64.deb ... 180s Unpacking r-cran-colorspace (2.1-1+dfsg-1) ... 180s Selecting previously unselected package r-cran-commonmark. 180s Preparing to unpack .../54-r-cran-commonmark_1.9.2-2_amd64.deb ... 180s Unpacking r-cran-commonmark (1.9.2-2) ... 180s Selecting previously unselected package r-cran-digest. 180s Preparing to unpack .../55-r-cran-digest_0.6.37-1_amd64.deb ... 180s Unpacking r-cran-digest (0.6.37-1) ... 180s Selecting previously unselected package r-cran-evaluate. 180s Preparing to unpack .../56-r-cran-evaluate_1.0.3-1_all.deb ... 180s Unpacking r-cran-evaluate (1.0.3-1) ... 180s Selecting previously unselected package r-cran-fansi. 180s Preparing to unpack .../57-r-cran-fansi_1.0.5-1_amd64.deb ... 180s Unpacking r-cran-fansi (1.0.5-1) ... 180s Selecting previously unselected package r-cran-farver. 180s Preparing to unpack .../58-r-cran-farver_2.1.2-1_amd64.deb ... 180s Unpacking r-cran-farver (2.1.2-1) ... 180s Selecting previously unselected package r-cran-glue. 180s Preparing to unpack .../59-r-cran-glue_1.8.0-1_amd64.deb ... 180s Unpacking r-cran-glue (1.8.0-1) ... 180s Selecting previously unselected package r-cran-rlang. 180s Preparing to unpack .../60-r-cran-rlang_1.1.5-1_amd64.deb ... 180s Unpacking r-cran-rlang (1.1.5-1) ... 180s Selecting previously unselected package r-cran-lifecycle. 180s Preparing to unpack .../61-r-cran-lifecycle_1.0.4+dfsg-1_all.deb ... 180s Unpacking r-cran-lifecycle (1.0.4+dfsg-1) ... 180s Selecting previously unselected package r-cran-gtable. 180s Preparing to unpack .../62-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 180s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 180s Selecting previously unselected package r-cran-isoband. 180s Preparing to unpack .../63-r-cran-isoband_0.2.7-1_amd64.deb ... 180s Unpacking r-cran-isoband (0.2.7-1) ... 180s Selecting previously unselected package r-cran-mass. 180s Preparing to unpack .../64-r-cran-mass_7.3-64-1_amd64.deb ... 180s Unpacking r-cran-mass (7.3-64-1) ... 180s Selecting previously unselected package r-cran-lattice. 180s Preparing to unpack .../65-r-cran-lattice_0.22-6-1_amd64.deb ... 180s Unpacking r-cran-lattice (0.22-6-1) ... 180s Selecting previously unselected package r-cran-nlme. 180s Preparing to unpack .../66-r-cran-nlme_3.1.167-1_amd64.deb ... 180s Unpacking r-cran-nlme (3.1.167-1) ... 180s Selecting previously unselected package r-cran-matrix. 180s Preparing to unpack .../67-r-cran-matrix_1.7-3-1_amd64.deb ... 180s Unpacking r-cran-matrix (1.7-3-1) ... 180s Selecting previously unselected package r-cran-mgcv. 180s Preparing to unpack .../68-r-cran-mgcv_1.9-1-1_amd64.deb ... 180s Unpacking r-cran-mgcv (1.9-1-1) ... 180s Selecting previously unselected package r-cran-labeling. 180s Preparing to unpack .../69-r-cran-labeling_0.4.3-1_all.deb ... 180s Unpacking r-cran-labeling (0.4.3-1) ... 180s Selecting previously unselected package r-cran-munsell. 180s Preparing to unpack .../70-r-cran-munsell_0.5.1-1_all.deb ... 180s Unpacking r-cran-munsell (0.5.1-1) ... 180s Selecting previously unselected package r-cran-r6. 180s Preparing to unpack .../71-r-cran-r6_2.6.1-1_all.deb ... 180s Unpacking r-cran-r6 (2.6.1-1) ... 180s Selecting previously unselected package r-cran-rcolorbrewer. 180s Preparing to unpack .../72-r-cran-rcolorbrewer_1.1-3-1build1_all.deb ... 180s Unpacking r-cran-rcolorbrewer (1.1-3-1build1) ... 180s Selecting previously unselected package r-cran-viridislite. 180s Preparing to unpack .../73-r-cran-viridislite_0.4.2-2_all.deb ... 180s Unpacking r-cran-viridislite (0.4.2-2) ... 180s Selecting previously unselected package r-cran-scales. 180s Preparing to unpack .../74-r-cran-scales_1.3.0-1_all.deb ... 180s Unpacking r-cran-scales (1.3.0-1) ... 181s Selecting previously unselected package r-cran-magrittr. 181s Preparing to unpack .../75-r-cran-magrittr_2.0.3-1_amd64.deb ... 181s Unpacking r-cran-magrittr (2.0.3-1) ... 181s Selecting previously unselected package r-cran-utf8. 181s Preparing to unpack .../76-r-cran-utf8_1.2.4-1_amd64.deb ... 181s Unpacking r-cran-utf8 (1.2.4-1) ... 181s Selecting previously unselected package r-cran-vctrs. 181s Preparing to unpack .../77-r-cran-vctrs_0.6.5-1_amd64.deb ... 181s Unpacking r-cran-vctrs (0.6.5-1) ... 181s Selecting previously unselected package r-cran-pillar. 181s Preparing to unpack .../78-r-cran-pillar_1.10.1+dfsg-1_all.deb ... 181s Unpacking r-cran-pillar (1.10.1+dfsg-1) ... 181s Selecting previously unselected package r-cran-pkgconfig. 181s Preparing to unpack .../79-r-cran-pkgconfig_2.0.3-2build1_all.deb ... 181s Unpacking r-cran-pkgconfig (2.0.3-2build1) ... 181s Selecting previously unselected package r-cran-tibble. 181s Preparing to unpack .../80-r-cran-tibble_3.2.1+dfsg-3_amd64.deb ... 181s Unpacking r-cran-tibble (3.2.1+dfsg-3) ... 181s Selecting previously unselected package r-cran-withr. 181s Preparing to unpack .../81-r-cran-withr_3.0.2+dfsg-1_all.deb ... 181s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 181s Selecting previously unselected package r-cran-ggplot2. 181s Preparing to unpack .../82-r-cran-ggplot2_3.5.1+dfsg-1_all.deb ... 181s Unpacking r-cran-ggplot2 (3.5.1+dfsg-1) ... 181s Selecting previously unselected package r-cran-xfun. 181s Preparing to unpack .../83-r-cran-xfun_0.51+dfsg-1_amd64.deb ... 181s Unpacking r-cran-xfun (0.51+dfsg-1) ... 181s Selecting previously unselected package r-cran-highr. 181s Preparing to unpack .../84-r-cran-highr_0.11+dfsg-1_all.deb ... 181s Unpacking r-cran-highr (0.11+dfsg-1) ... 181s Selecting previously unselected package r-cran-yaml. 181s Preparing to unpack .../85-r-cran-yaml_2.3.10-1_amd64.deb ... 181s Unpacking r-cran-yaml (2.3.10-1) ... 181s Selecting previously unselected package libjs-mathjax. 181s Preparing to unpack .../86-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 181s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 182s Selecting previously unselected package r-cran-knitr. 182s Preparing to unpack .../87-r-cran-knitr_1.49+dfsg-1_all.deb ... 182s Unpacking r-cran-knitr (1.49+dfsg-1) ... 182s Selecting previously unselected package r-cran-markdown. 182s Preparing to unpack .../88-r-cran-markdown_1.13-1_all.deb ... 182s Unpacking r-cran-markdown (1.13-1) ... 182s Selecting previously unselected package r-cran-matrixstats. 182s Preparing to unpack .../89-r-cran-matrixstats_1.5.0-1_amd64.deb ... 182s Unpacking r-cran-matrixstats (1.5.0-1) ... 182s Selecting previously unselected package r-cran-microbenchmark. 182s Preparing to unpack .../90-r-cran-microbenchmark_1.5.0-1_amd64.deb ... 182s Unpacking r-cran-microbenchmark (1.5.0-1) ... 182s Selecting previously unselected package r-cran-r.methodss3. 182s Preparing to unpack .../91-r-cran-r.methodss3_1.8.2-1_all.deb ... 182s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 182s Selecting previously unselected package r-cran-r.oo. 182s Preparing to unpack .../92-r-cran-r.oo_1.27.0-1_all.deb ... 182s Unpacking r-cran-r.oo (1.27.0-1) ... 182s Selecting previously unselected package r-cran-r.utils. 182s Preparing to unpack .../93-r-cran-r.utils_2.13.0-1_all.deb ... 182s Unpacking r-cran-r.utils (2.13.0-1) ... 182s Selecting previously unselected package r-cran-r.cache. 182s Preparing to unpack .../94-r-cran-r.cache_0.16.0-1_all.deb ... 182s Unpacking r-cran-r.cache (0.16.0-1) ... 182s Selecting previously unselected package r-cran-r.devices. 182s Preparing to unpack .../95-r-cran-r.devices_2.17.2+ds-1_all.deb ... 182s Unpacking r-cran-r.devices (2.17.2+ds-1) ... 182s Selecting previously unselected package tcl8.6. 182s Preparing to unpack .../96-tcl8.6_8.6.16+dfsg-1_amd64.deb ... 182s Unpacking tcl8.6 (8.6.16+dfsg-1) ... 182s Selecting previously unselected package tcl. 182s Preparing to unpack .../97-tcl_8.6.14build1_amd64.deb ... 182s Unpacking tcl (8.6.14build1) ... 182s Selecting previously unselected package r-cran-r.rsp. 182s Preparing to unpack .../98-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 182s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 182s Setting up libgraphite2-3:amd64 (1.3.14-2ubuntu1) ... 182s Setting up libpixman-1-0:amd64 (0.44.0-3) ... 182s Setting up libsharpyuv0:amd64 (1.5.0-0.1) ... 182s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 182s Setting up liblerc4:amd64 (4.0.0+ds-5ubuntu1) ... 182s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 182s Setting up libxrender1:amd64 (1:0.9.10-1.1build1) ... 182s Setting up libdatrie1:amd64 (0.2.13-3build1) ... 182s Setting up libxcb-render0:amd64 (1.17.0-2) ... 182s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 182s Setting up unzip (6.0-28ubuntu6) ... 182s Setting up x11-common (1:7.7+23ubuntu3) ... 183s Setting up libdeflate0:amd64 (1.23-1) ... 183s Setting up libxcb-shm0:amd64 (1.17.0-2) ... 183s Setting up libgomp1:amd64 (15-20250222-0ubuntu1) ... 183s Setting up libjbig0:amd64 (2.1-6.1ubuntu2) ... 183s Setting up zip (3.0-14ubuntu2) ... 183s Setting up libblas3:amd64 (3.12.1-2) ... 183s update-alternatives: using /usr/lib/x86_64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/x86_64-linux-gnu/libblas.so.3 (libblas.so.3-x86_64-linux-gnu) in auto mode 183s Setting up fonts-dejavu-mono (2.37-8) ... 183s Setting up libtcl8.6:amd64 (8.6.16+dfsg-1) ... 183s Setting up fonts-dejavu-core (2.37-8) ... 183s Setting up libjpeg-turbo8:amd64 (2.1.5-3ubuntu2) ... 183s Setting up libgfortran5:amd64 (15-20250222-0ubuntu1) ... 183s Setting up libwebp7:amd64 (1.5.0-0.1) ... 183s Setting up libjs-highlight.js (9.18.5+dfsg1-2) ... 183s Setting up libharfbuzz0b:amd64 (10.2.0-1) ... 183s Setting up libthai-data (0.1.29-2build1) ... 183s Setting up libxss1:amd64 (1:1.2.3-1build3) ... 183s Setting up libpaper2:amd64 (2.2.5-0.3) ... 183s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 183s Setting up node-normalize.css (8.0.1-5) ... 183s Setting up xdg-utils (1.2.1-2ubuntu1) ... 183s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 183s Setting up libjs-bootstrap (3.4.1+dfsg-3) ... 183s Setting up libjpeg8:amd64 (8c-2ubuntu11) ... 183s Setting up libice6:amd64 (2:1.1.1-1) ... 183s Setting up tcl8.6 (8.6.16+dfsg-1) ... 183s Setting up liblapack3:amd64 (3.12.1-2) ... 183s update-alternatives: using /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/x86_64-linux-gnu/liblapack.so.3 (liblapack.so.3-x86_64-linux-gnu) in auto mode 183s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 183s Setting up libpaper-utils (2.2.5-0.3) ... 183s Setting up libjs-jquery-datatables (1.11.5+dfsg-2) ... 183s Setting up libthai0:amd64 (0.1.29-2build1) ... 183s Setting up libtiff6:amd64 (4.5.1+git230720-4ubuntu4) ... 183s Setting up tcl (8.6.14build1) ... 183s Setting up libfontconfig1:amd64 (2.15.0-2ubuntu1) ... 183s Setting up libsm6:amd64 (2:1.2.4-1) ... 183s Setting up fontconfig (2.15.0-2ubuntu1) ... 185s Regenerating fonts cache... done. 185s Setting up libxft2:amd64 (2.3.6-1build1) ... 185s Setting up libtk8.6:amd64 (8.6.16-1) ... 185s Setting up libpango-1.0-0:amd64 (1.56.2-1) ... 185s Setting up libcairo2:amd64 (1.18.2-2) ... 185s Setting up libxt6t64:amd64 (1:1.2.1-1.2build1) ... 185s Setting up libpangoft2-1.0-0:amd64 (1.56.2-1) ... 185s Setting up libpangocairo-1.0-0:amd64 (1.56.2-1) ... 185s Setting up r-base-core (4.4.3-1) ... 185s Creating config file /etc/R/Renviron with new version 185s Setting up r-cran-labeling (0.4.3-1) ... 185s Setting up r-cran-lattice (0.22-6-1) ... 185s Setting up r-cran-nlme (3.1.167-1) ... 185s Setting up r-cran-farver (2.1.2-1) ... 185s Setting up r-cran-viridislite (0.4.2-2) ... 185s Setting up r-cran-commonmark (1.9.2-2) ... 185s Setting up r-cran-r6 (2.6.1-1) ... 185s Setting up r-cran-magrittr (2.0.3-1) ... 185s Setting up r-cran-microbenchmark (1.5.0-1) ... 185s Setting up r-cran-rlang (1.1.5-1) ... 185s Setting up r-cran-matrixstats (1.5.0-1) ... 185s Setting up r-cran-xfun (0.51+dfsg-1) ... 185s Setting up r-cran-withr (3.0.2+dfsg-1) ... 185s Setting up r-cran-base64enc (0.1-3-3) ... 185s Setting up r-cran-digest (0.6.37-1) ... 185s Setting up r-cran-yaml (2.3.10-1) ... 185s Setting up r-cran-evaluate (1.0.3-1) ... 185s Setting up r-cran-highr (0.11+dfsg-1) ... 185s Setting up r-cran-fansi (1.0.5-1) ... 185s Setting up r-cran-mass (7.3-64-1) ... 185s Setting up r-cran-glue (1.8.0-1) ... 185s Setting up r-cran-cli (3.6.4-1) ... 185s Setting up r-cran-lifecycle (1.0.4+dfsg-1) ... 185s Setting up r-cran-r.methodss3 (1.8.2-1) ... 185s Setting up r-cran-pkgconfig (2.0.3-2build1) ... 185s Setting up r-cran-utf8 (1.2.4-1) ... 185s Setting up r-cran-colorspace (2.1-1+dfsg-1) ... 185s Setting up r-cran-markdown (1.13-1) ... 185s Setting up r-cran-rcolorbrewer (1.1-3-1build1) ... 185s Setting up r-cran-isoband (0.2.7-1) ... 185s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 185s Setting up r-cran-matrix (1.7-3-1) ... 185s Setting up r-cran-knitr (1.49+dfsg-1) ... 185s Setting up r-cran-mgcv (1.9-1-1) ... 185s Setting up r-cran-vctrs (0.6.5-1) ... 185s Setting up r-cran-pillar (1.10.1+dfsg-1) ... 185s Setting up r-cran-munsell (0.5.1-1) ... 185s Setting up r-cran-tibble (3.2.1+dfsg-3) ... 185s Setting up r-cran-r.oo (1.27.0-1) ... 185s Setting up r-cran-scales (1.3.0-1) ... 185s Setting up r-cran-r.utils (2.13.0-1) ... 185s Setting up r-cran-ggplot2 (3.5.1+dfsg-1) ... 185s Setting up r-cran-r.devices (2.17.2+ds-1) ... 185s Setting up r-cran-r.cache (0.16.0-1) ... 185s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 185s Processing triggers for libc-bin (2.41-1ubuntu2) ... 185s Processing triggers for man-db (2.13.0-1) ... 187s Processing triggers for install-info (7.1.1-1) ... 187s autopkgtest [23:25:38]: test run-unit-test: [----------------------- 187s 187s R version 4.4.3 (2025-02-28) -- "Trophy Case" 187s Copyright (C) 2025 The R Foundation for Statistical Computing 187s Platform: x86_64-pc-linux-gnu 187s 187s R is free software and comes with ABSOLUTELY NO WARRANTY. 187s You are welcome to redistribute it under certain conditions. 187s Type 'license()' or 'licence()' for distribution details. 187s 187s R is a collaborative project with many contributors. 187s Type 'contributors()' for more information and 187s 'citation()' on how to cite R or R packages in publications. 187s 187s Type 'demo()' for some demos, 'help()' for on-line help, or 187s 'help.start()' for an HTML browser interface to help. 187s Type 'q()' to quit R. 187s 188s > library("matrixStats") 188s > 188s > allocArray_R <- function(nrow, ncol, value = NA) { 188s + array(data = value, dim = dim) 188s + } 188s > 188s > values <- list( 188s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 188s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 188s + .Machine$double.xmin, .Machine$double.xmax, 188s + .Machine$double.eps, .Machine$double.neg.eps, 188s + FALSE, TRUE, NA 188s + ) 188s > 188s > dim <- c(2L, 4L, 3L) 188s > for (value in values) { 188s + x0 <- allocArray_R(dim, value = value) 188s + x <- allocArray(dim, value = value) 188s + if (!identical(x, x0)) { 188s + str(list(dim = dim, value = value, x = x, x0 = x0)) 188s + stopifnot(identical(x, x0)) 188s + } 188s + } 188s > 188s 188s R version 4.4.3 (2025-02-28) -- "Trophy Case" 188s Copyright (C) 2025 The R Foundation for Statistical Computing 188s Platform: x86_64-pc-linux-gnu 188s 188s R is free software and comes with ABSOLUTELY NO WARRANTY. 188s You are welcome to redistribute it under certain conditions. 188s Type 'license()' or 'licence()' for distribution details. 188s 188s R is a collaborative project with many contributors. 188s Type 'contributors()' for more information and 188s 'citation()' on how to cite R or R packages in publications. 188s 188s Type 'demo()' for some demos, 'help()' for on-line help, or 188s 'help.start()' for an HTML browser interface to help. 188s Type 'q()' to quit R. 188s 188s > library("matrixStats") 188s > 188s > allocMatrix_R <- function(nrow, ncol, value = NA) { 188s + matrix(data = value, nrow = nrow, ncol = ncol) 188s + } 188s > 188s > values <- list( 188s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 188s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 188s + .Machine$double.xmin, .Machine$double.xmax, 188s + .Machine$double.eps, .Machine$double.neg.eps, 188s + FALSE, TRUE, NA 188s + ) 188s > 188s > nrow <- 2L 188s > ncol <- 3L 188s > for (value in values) { 188s + x0 <- allocMatrix_R(nrow, ncol, value = value) 188s + x <- allocMatrix(nrow, ncol, value = value) 188s + if (!identical(x, x0)) { 188s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 188s + stopifnot(identical(x, x0)) 188s + } 188s + } 188s > 188s 188s R version 4.4.3 (2025-02-28) -- "Trophy Case" 188s Copyright (C) 2025 The R Foundation for Statistical Computing 188s Platform: x86_64-pc-linux-gnu 188s 188s R is free software and comes with ABSOLUTELY NO WARRANTY. 188s You are welcome to redistribute it under certain conditions. 188s Type 'license()' or 'licence()' for distribution details. 188s 188s R is a collaborative project with many contributors. 188s Type 'contributors()' for more information and 188s 'citation()' on how to cite R or R packages in publications. 188s 188s Type 'demo()' for some demos, 'help()' for on-line help, or 188s 'help.start()' for an HTML browser interface to help. 188s Type 'q()' to quit R. 188s 188s > library("matrixStats") 188s > 188s > allocVector_R <- function(length, value = NA) { 188s + x <- vector(mode = typeof(value), length = length) 188s + if (!is.finite(value) || value != 0) x[] <- value 188s + x 188s + } 188s > 188s > values <- list( 188s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 188s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 188s + .Machine$double.xmin, .Machine$double.xmax, 188s + .Machine$double.eps, .Machine$double.neg.eps, 188s + FALSE, TRUE, NA 188s + ) 188s > 188s > n <- 10L 188s > for (value in values) { 188s + x0 <- allocVector_R(n, value = value) 188s + x <- allocVector(n, value = value) 188s + if (!identical(x, x0)) { 188s + str(list(n = n, value = value, x = x, x0 = x0)) 188s + stopifnot(identical(x, x0)) 188s + } 188s + } 188s > 188s 188s R version 4.4.3 (2025-02-28) -- "Trophy Case" 188s Copyright (C) 2025 The R Foundation for Statistical Computing 188s Platform: x86_64-pc-linux-gnu 188s 188s R is free software and comes with ABSOLUTELY NO WARRANTY. 188s You are welcome to redistribute it under certain conditions. 188s Type 'license()' or 'licence()' for distribution details. 188s 188s R is a collaborative project with many contributors. 188s Type 'contributors()' for more information and 188s 'citation()' on how to cite R or R packages in publications. 188s 188s Type 'demo()' for some demos, 'help()' for on-line help, or 188s 'help.start()' for an HTML browser interface to help. 188s Type 'q()' to quit R. 188s 188s > library("matrixStats") 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Setup 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > data <- data.frame( 188s + logical = c(TRUE, FALSE, TRUE), 188s + integer = 1:3, 188s + double = seq(from = 1.0, to = 3.0, by = 1.0), 188s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 188s + character = letters[1:3], 188s + stringsAsFactors = FALSE 188s + ) 188s > 188s > modes <- names(data) 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special cases 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("NULL...\n") 188s NULL... 188s > stopifnot(identical(anyMissing(NULL), FALSE)) 188s > cat("NULL...done\n") 188s NULL...done 188s > 188s > cat("raw...\n") 188s raw... 188s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 188s > cat("raw...done\n") 188s raw...done 188s > 188s > cat("list(NULL)...\n") 188s list(NULL)... 188s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 188s > cat("list(NULL)...done\n") 188s list(NULL)...done 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Scalars, vectors, and matrices of various modes 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > for (mode in modes) { 188s + cat(sprintf("Mode: %s...\n", mode)) 188s + values <- data[[mode]] 188s + 188s + # Scalars 188s + cat(" scalar\n") 188s + x <- values[1L] 188s + print(x) 188s + stopifnot(identical(anyMissing(x), FALSE)) 188s + is.na(x) <- TRUE 188s + print(x) 188s + stopifnot(identical(anyMissing(x), TRUE)) 188s + 188s + # Vectors 188s + cat(" vector\n") 188s + x <- values 188s + print(x) 188s + stopifnot(identical(anyMissing(x), FALSE)) 188s + is.na(x)[2L] <- TRUE 188s + print(x) 188s + stopifnot(identical(anyMissing(x), TRUE)) 188s + 188s + # Matrices 188s + cat(" matrix\n") 188s + x <- matrix(c(values, values), ncol = 2L) 188s + print(x) 188s + stopifnot(identical(anyMissing(x), FALSE)) 188s + is.na(x)[2L] <- TRUE 188s + print(x) 188s + stopifnot(identical(anyMissing(x), TRUE)) 188s + 188s + cat(sprintf("Mode: %s...done\n", mode)) 188s + } # for (mode ...) 188s Mode: logical... 188s scalar 188s [1] TRUE 188s [1] NA 188s vector 188s [1] TRUE FALSE TRUE 188s [1] TRUE NA TRUE 188s matrix 188s [,1] [,2] 188s [1,] TRUE TRUE 188s [2,] FALSE FALSE 188s [3,] TRUE TRUE 188s [,1] [,2] 188s [1,] TRUE TRUE 188s [2,] NA FALSE 188s [3,] TRUE TRUE 188s Mode: logical...done 188s Mode: integer... 188s scalar 188s [1] 1 188s [1] NA 188s vector 188s [1] 1 2 3 188s [1] 1 NA 3 188s matrix 188s [,1] [,2] 188s [1,] 1 1 188s [2,] 2 2 188s [3,] 3 3 188s [,1] [,2] 188s [1,] 1 1 188s [2,] NA 2 188s [3,] 3 3 188s Mode: integer...done 188s Mode: double... 188s scalar 188s [1] 1 188s [1] NA 188s vector 188s [1] 1 2 3 188s [1] 1 NA 3 188s matrix 188s [,1] [,2] 188s [1,] 1 1 188s [2,] 2 2 188s [3,] 3 3 188s [,1] [,2] 188s [1,] 1 1 188s [2,] NA 2 188s [3,] 3 3 188s Mode: double...done 188s Mode: complex... 188s scalar 188s [1] 1+1i 188s [1] NA 188s vector 188s [1] 1+1i 2+1i 3+1i 188s [1] 1+1i NA 3+1i 188s matrix 188s [,1] [,2] 188s [1,] 1+1i 1+1i 188s [2,] 2+1i 2+1i 188s [3,] 3+1i 3+1i 188s [,1] [,2] 188s [1,] 1+1i 1+1i 188s [2,] NA 2+1i 188s [3,] 3+1i 3+1i 188s Mode: complex...done 188s Mode: character... 188s scalar 188s [1] "a" 188s [1] NA 188s vector 188s [1] "a" "b" "c" 188s [1] "a" NA "c" 188s matrix 188s [,1] [,2] 188s [1,] "a" "a" 188s [2,] "b" "b" 188s [3,] "c" "c" 188s [,1] [,2] 188s [1,] "a" "a" 188s [2,] NA "b" 188s [3,] "c" "c" 188s Mode: character...done 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Data frames 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("data.frame...\n") 188s data.frame... 188s > x <- data 188s > stopifnot(identical(anyMissing(x), FALSE)) 188s > for (mode in modes) { 188s + x <- data 188s + is.na(x[[mode]])[2L] <- TRUE 188s + print(x) 188s + stopifnot(identical(anyMissing(x), TRUE)) 188s + } # for (mode ...) 188s logical integer double complex character 188s 1 TRUE 1 1 1+1i a 188s 2 NA 2 2 2+1i b 188s 3 TRUE 3 3 3+1i c 188s logical integer double complex character 188s 1 TRUE 1 1 1+1i a 188s 2 FALSE NA 2 2+1i b 188s 3 TRUE 3 3 3+1i c 188s logical integer double complex character 188s 1 TRUE 1 1 1+1i a 188s 2 FALSE 2 NA 2+1i b 188s 3 TRUE 3 3 3+1i c 188s logical integer double complex character 188s 1 TRUE 1 1 1+1i a 188s 2 FALSE 2 2 NA b 188s 3 TRUE 3 3 3+1i c 188s logical integer double complex character 188s 1 TRUE 1 1 1+1i a 188s 2 FALSE 2 2 2+1i 188s 3 TRUE 3 3 3+1i c 188s > cat("data.frame...done\n") 188s data.frame...done 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Lists 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("list...\n") 188s list... 188s > x <- as.list(data) 188s > stopifnot(identical(anyMissing(x), FALSE)) 188s > for (mode in modes) { 188s + x <- as.list(data) 188s + is.na(x[[mode]])[2L] <- TRUE 188s + print(x) 188s + stopifnot(identical(anyMissing(x), TRUE)) 188s + } # for (mode ...) 188s $logical 188s [1] TRUE NA TRUE 188s 188s $integer 188s [1] 1 2 3 188s 188s $double 188s [1] 1 2 3 188s 188s $complex 188s [1] 1+1i 2+1i 3+1i 188s 188s $character 188s [1] "a" "b" "c" 188s 188s $logical 188s [1] TRUE FALSE TRUE 188s 188s $integer 188s [1] 1 NA 3 188s 188s $double 188s [1] 1 2 3 188s 188s $complex 188s [1] 1+1i 2+1i 3+1i 188s 188s $character 188s [1] "a" "b" "c" 188s 188s $logical 188s [1] TRUE FALSE TRUE 188s 188s $integer 188s [1] 1 2 3 188s 188s $double 188s [1] 1 NA 3 188s 188s $complex 188s [1] 1+1i 2+1i 3+1i 188s 188s $character 188s [1] "a" "b" "c" 188s 188s $logical 188s [1] TRUE FALSE TRUE 188s 188s $integer 188s [1] 1 2 3 188s 188s $double 188s [1] 1 2 3 188s 188s $complex 188s [1] 1+1i NA 3+1i 188s 188s $character 188s [1] "a" "b" "c" 188s 188s $logical 188s [1] TRUE FALSE TRUE 188s 188s $integer 188s [1] 1 2 3 188s 188s $double 188s [1] 1 2 3 188s 188s $complex 188s [1] 1+1i 2+1i 3+1i 188s 188s $character 188s [1] "a" NA "c" 188s 188s > cat("list...done\n") 188s list...done 188s > 188s 188s R version 4.4.3 (2025-02-28) -- "Trophy Case" 188s Copyright (C) 2025 The R Foundation for Statistical Computing 188s Platform: x86_64-pc-linux-gnu 188s 188s R is free software and comes with ABSOLUTELY NO WARRANTY. 188s You are welcome to redistribute it under certain conditions. 188s Type 'license()' or 'licence()' for distribution details. 188s 188s R is a collaborative project with many contributors. 188s Type 'contributors()' for more information and 188s 'citation()' on how to cite R or R packages in publications. 188s 188s Type 'demo()' for some demos, 'help()' for on-line help, or 188s 'help.start()' for an HTML browser interface to help. 188s Type 'q()' to quit R. 188s 188s > library("matrixStats") 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Subsetted tests 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > source("utils/validateIndicesFramework.R") 188s > x <- runif(4, min = -3, max = 3) 188s > x[2] <- NA 188s > for (mode in c("integer", "numeric")) { 188s + storage.mode(x) <- mode 188s + for (idxs in index_cases) { 188s + validateIndicesTestVector(x, idxs, 188s + ftest = anyMissing, fsure = function(x, ...) { 188s + anyValue(x, value = NA) 188s + }) 188s + } 188s + } 188s > 188s 188s R version 4.4.3 (2025-02-28) -- "Trophy Case" 188s Copyright (C) 2025 The R Foundation for Statistical Computing 188s Platform: x86_64-pc-linux-gnu 188s 188s R is free software and comes with ABSOLUTELY NO WARRANTY. 188s You are welcome to redistribute it under certain conditions. 188s Type 'license()' or 'licence()' for distribution details. 188s 188s R is a collaborative project with many contributors. 188s Type 'contributors()' for more information and 188s 'citation()' on how to cite R or R packages in publications. 188s 188s Type 'demo()' for some demos, 'help()' for on-line help, or 188s 'help.start()' for an HTML browser interface to help. 188s Type 'q()' to quit R. 188s 189s > ## Don't test with valgrind 189s > if (Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 189s + 189s + ## 3. Make sure all suggested packages are installed / can be loaded 189s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 189s + "R.devices", "R.rsp") 189s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 189s + html <- matrixStats:::benchmark("binCounts") 189s + print(html) 189s + } 189s + 189s + rm(list = "pkgs") 189s + 189s + } 189s Loading required namespace: base64enc 189s Loading required namespace: ggplot2 189s Loading required namespace: knitr 189s Loading required namespace: markdown 189s Loading required namespace: microbenchmark 189s Loading required namespace: R.devices 189s Loading required namespace: R.rsp 190s integer: unsorted 192s integer: sorted 193s double: unsorted 196s double: sorted 197s RspFileProduct: 197s Pathname: /tmp/autopkgtest.nE0koB/autopkgtest_tmp/reports/binCounts.html 197s File size: 71.36 kB (73074 bytes) 197s Content type: text/html 197s Metadata 'author': 'Henrik Bengtsson' 197s Metadata 'title': 'binCounts() benchmarks' 197s Metadata 'date': '2014-05-25' 197s Has processor: FALSE 197s > 197s Warning message: 197s In par(parT) : argument 1 does not name a graphical parameter 197s 197s R version 4.4.3 (2025-02-28) -- "Trophy Case" 197s Copyright (C) 2025 The R Foundation for Statistical Computing 197s Platform: x86_64-pc-linux-gnu 197s 197s R is free software and comes with ABSOLUTELY NO WARRANTY. 197s You are welcome to redistribute it under certain conditions. 197s Type 'license()' or 'licence()' for distribution details. 197s 197s R is a collaborative project with many contributors. 197s Type 'contributors()' for more information and 197s 'citation()' on how to cite R or R packages in publications. 197s 197s Type 'demo()' for some demos, 'help()' for on-line help, or 197s 'help.start()' for an HTML browser interface to help. 197s Type 'q()' to quit R. 197s 197s > library("matrixStats") 197s > library("stats") 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Local functions 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 197s + n0 <- graphics::hist(x, breaks = bx, right = right, 197s + include.lowest = TRUE, plot = FALSE)$counts 197s + } 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Non-sorted and sorted positions 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > nx <- 1000L # Number of data points 197s > nb <- 200L # Number of bins 197s > 197s > # Uniformely distributed bins 197s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 197s > bx <- c(-1, bx, 2) 197s > 197s > # Sample data points 197s > set.seed(0xBEEF) 197s > x <- runif(nx, min = 0, max = 1) 197s > 197s > for (kk in 1:2) { 197s + n0 <- binCounts_hist(x, bx = bx) 197s + n1 <- binCounts(x, bx = bx) 197s + # Sanity check 197s + stopifnot(identical(n1, n0)) 197s + 197s + # Check reversed 197s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 197s + stopifnot(identical(n1r, n1)) 197s + 197s + # Retry with a sorted vector 197s + x <- sort(x) 197s + } # for (kk in 1:2) 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Missing values 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > x <- 1:40 197s > x[20] <- NA_integer_ 197s > nx <- length(x) 197s > 197s > # Bins 197s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 197s > 197s > y_smooth0 <- binCounts_hist(x, bx = bx) 197s > y_smooth <- binCounts(x, bx = bx) 197s > # Sanity check 197s > stopifnot(all.equal(y_smooth, y_smooth0)) 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Border cases 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > x <- 1:10 197s > bx <- min(x) - c(10, 1) 197s > y_smooth <- binCounts(x, bx = bx) 197s > stopifnot(all.equal(y_smooth, 0L)) 197s > bx <- range(x) 197s > y_smooth <- binCounts(x, bx = bx) 197s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 197s > bx <- max(x) + c(1, 10) 197s > y_smooth <- binCounts(x, bx = bx) 197s > stopifnot(all.equal(y_smooth, 0L)) 197s > 197s > # Every second empty 197s > x <- 1:10 197s > bx <- rep(x, each = 2L) 197s > y_smooth <- binCounts(x, bx = bx) 197s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 197s > ## NOTE: binCounts_hist() does not give the same last bin count 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Exception handling 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Zero bin boundaries (invalid bin definition) 197s > bx <- double(0L) 197s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 197s > stopifnot(inherits(res, "try-error")) 197s > 197s > # One bin boundary (invalid bin definition) 197s > bx <- double(1L) 197s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 197s > stopifnot(inherits(res, "try-error")) 197s > 197s 197s R version 4.4.3 (2025-02-28) -- "Trophy Case" 197s Copyright (C) 2025 The R Foundation for Statistical Computing 197s Platform: x86_64-pc-linux-gnu 197s 197s R is free software and comes with ABSOLUTELY NO WARRANTY. 197s You are welcome to redistribute it under certain conditions. 197s Type 'license()' or 'licence()' for distribution details. 197s 197s R is a collaborative project with many contributors. 197s Type 'contributors()' for more information and 197s 'citation()' on how to cite R or R packages in publications. 197s 197s Type 'demo()' for some demos, 'help()' for on-line help, or 197s 'help.start()' for an HTML browser interface to help. 197s Type 'q()' to quit R. 197s 197s > library("matrixStats") 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Local functions 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 197s + n0 <- graphics::hist(x, breaks = bx, right = right, 197s + include.lowest = TRUE, plot = FALSE)$counts 197s + } 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Subsetted tests 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > source("utils/validateIndicesFramework.R") 197s > x <- runif(6, min = -6, max = 6) 197s > storage.mode(x) <- "integer" 197s > bx <- c(-6, 0, 3, 4, 10) 197s > for (idxs in index_cases) { 197s + validateIndicesTestVector(x, idxs, 197s + ftest = binCounts, fsure = binCounts_hist, 197s + bx = bx, right = FALSE) 197s + validateIndicesTestVector(x, idxs, 197s + ftest = binCounts, fsure = binCounts_hist, 197s + bx = bx, right = TRUE) 197s + } 198s > 198s 198s R version 4.4.3 (2025-02-28) -- "Trophy Case" 198s Copyright (C) 2025 The R Foundation for Statistical Computing 198s Platform: x86_64-pc-linux-gnu 198s 198s R is free software and comes with ABSOLUTELY NO WARRANTY. 198s You are welcome to redistribute it under certain conditions. 198s Type 'license()' or 'licence()' for distribution details. 198s 198s R is a collaborative project with many contributors. 198s Type 'contributors()' for more information and 198s 'citation()' on how to cite R or R packages in publications. 198s 198s Type 'demo()' for some demos, 'help()' for on-line help, or 198s 'help.start()' for an HTML browser interface to help. 198s Type 'q()' to quit R. 198s 198s > library("matrixStats") 198s > library("stats") 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Naive R implementation of binMeans() 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 198s + n_smooth <- length(bx) - 1L 198s + res <- double(n_smooth) 198s + counts <- rep(NaN, times = n_smooth) 198s + 198s + if (na.rm) { 198s + keep <- !is.na(x) & !is.na(y) 198s + x <- x[keep] 198s + y <- y[keep] 198s + } 198s + 198s + # For each bin... 198s + for (kk in seq_len(n_smooth)) { 198s + if (right) { 198s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 198s + } else { 198s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 198s + } 198s + y_kk <- y[idxs] 198s + res[kk] <- mean(y_kk) 198s + counts[kk] <- length(idxs) 198s + } # for (kk ...) 198s + 198s + if (count) attr(res, "count") <- counts 198s + res 198s + } 198s > 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Case #1 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > x <- 1:100 198s > nx <- length(x) 198s > y <- double(nx) 198s > y[1:25] <- 5 198s > y[51:75] <- -5 198s > y <- y + rnorm(nx) 198s > 198s > # Bins 198s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 198s > 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 198s > y_smooth <- binMeans(y, x = x, bx = bx) 198s > n_smooth <- binCounts(x, bx = bx) 198s > # Sanity check 198s > stopifnot(all.equal(y_smooth, y_smooth0)) 198s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 198s > 198s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 198s + count = FALSE, right = TRUE)) 198s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 198s + count = FALSE, right = TRUE)) 198s > # Sanity check 198s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 198s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 198s > 198s > 198s > # Integer input 198s > y <- as.integer(y) 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 198s > y_smooth <- binMeans(y, x = x, bx = bx) 198s > n_smooth <- binCounts(x, bx = bx) 198s > # Sanity check 198s > stopifnot(is.integer(y), 198s + all.equal(y_smooth, y_smooth0), 198s + all.equal(attr(y_smooth, "count"), n_smooth)) 198s > 198s > # Logical input 198s > y <- as.logical(y) 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 198s > y_smooth <- binMeans(y, x = x, bx = bx) 198s > n_smooth <- binCounts(x, bx = bx) 198s > # Sanity check 198s > stopifnot(is.logical(y), 198s + all.equal(y_smooth, y_smooth0), 198s + all.equal(attr(y_smooth, "count"), n_smooth)) 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Case #2 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > nx <- 1e3 198s > x <- runif(nx) 198s > y <- runif(nx) 198s > 198s > nb <- 10 198s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 198s > bx1 <- c(bx[-1], bx[nb] + 1) 198s > 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 198s > y_smooth <- binMeans(y, x = x, bx = bx1) 198s > n_smooth <- binCounts(x, bx = bx1) 198s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 198s > 198s > # Sanity check 198s > stopifnot(all.equal(y_smooth, y_smooth0)) 198s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 198s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Empty bins 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > x <- c(6:8, 16:19) 198s > nx <- length(x) 198s > y <- runif(nx) 198s > bx <- c(0, 5, 10, 15, 20, 25) 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 198s > y_smooth <- binMeans(y, x = x, bx = bx) 198s > n_smooth <- binCounts(x, bx = bx) 198s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 198s > stopifnot(all.equal(y_smooth, y_smooth0)) 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Missing values 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > x <- 1:100 198s > x[50] <- NA_integer_ 198s > nx <- length(x) 198s > y <- double(nx) 198s > y[1:25] <- 5 198s > y[51:75] <- -5 198s > y[82:92] <- NA_real_ 198s > y <- y + rnorm(nx) 198s > 198s > # Bins 198s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 198s > 198s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 198s > y_smooth <- binMeans(y, x = x, bx = bx) 198s > # Sanity check 198s > stopifnot(all.equal(y_smooth, y_smooth0)) 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Exception handling 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Zero bin boundaries (invalid bin definition) 198s > bx <- double(0L) 198s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 198s > stopifnot(inherits(res, "try-error")) 198s > 198s > # One bin boundary (invalid bin definition) 198s > bx <- double(1L) 198s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 198s > stopifnot(inherits(res, "try-error")) 198s > 198s 198s R version 4.4.3 (2025-02-28) -- "Trophy Case" 198s Copyright (C) 2025 The R Foundation for Statistical Computing 198s Platform: x86_64-pc-linux-gnu 198s 198s R is free software and comes with ABSOLUTELY NO WARRANTY. 198s You are welcome to redistribute it under certain conditions. 198s Type 'license()' or 'licence()' for distribution details. 198s 198s R is a collaborative project with many contributors. 198s Type 'contributors()' for more information and 198s 'citation()' on how to cite R or R packages in publications. 198s 198s Type 'demo()' for some demos, 'help()' for on-line help, or 198s 'help.start()' for an HTML browser interface to help. 198s Type 'q()' to quit R. 198s 198s > library("matrixStats") 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Naive R implementation of binMeans() 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 198s + n_smooth <- length(bx) - 1L 198s + res <- double(n_smooth) 198s + counts <- rep(NaN, times = n_smooth) 198s + 198s + if (na.rm) { 198s + keep <- !is.na(x) & !is.na(y) 198s + x <- x[keep] 198s + y <- y[keep] 198s + } 198s + 198s + # For each bin... 198s + for (kk in seq_len(n_smooth)) { 198s + if (right) { 198s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 198s + } else { 198s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 198s + } 198s + y_kk <- y[idxs] 198s + res[kk] <- mean(y_kk) 198s + counts[kk] <- length(idxs) 198s + } # for (kk ...) 198s + 198s + if (count) attr(res, "count") <- counts 198s + res 198s + } 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Subsetted tests 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > source("utils/validateIndicesFramework.R") 198s > y <- runif(6, min = -6, max = 6) 198s > x <- runif(6, min = -6, max = 6) 198s > storage.mode(x) <- "integer" 198s > bx <- c(-6, 0, 3, 4, 10) 198s > for (idxs in index_cases) { 198s + for (na.rm in c(TRUE, FALSE)) { 198s + validateIndicesTestVector_w(y, x, idxs, 198s + ftest = binMeans, fsure = binMeans0, 198s + bx = bx, na.rm = na.rm, 198s + count = TRUE, right = FALSE) 198s + validateIndicesTestVector_w(y, x, idxs, 198s + ftest = binMeans, fsure = binMeans0, 198s + bx = bx, na.rm = na.rm, 198s + count = TRUE, right = TRUE) 198s + } 198s + } 198s > 198s 198s R version 4.4.3 (2025-02-28) -- "Trophy Case" 198s Copyright (C) 2025 The R Foundation for Statistical Computing 198s Platform: x86_64-pc-linux-gnu 198s 198s R is free software and comes with ABSOLUTELY NO WARRANTY. 198s You are welcome to redistribute it under certain conditions. 198s Type 'license()' or 'licence()' for distribution details. 198s 198s R is a collaborative project with many contributors. 198s Type 'contributors()' for more information and 198s 'citation()' on how to cite R or R packages in publications. 198s 198s Type 'demo()' for some demos, 'help()' for on-line help, or 198s 'help.start()' for an HTML browser interface to help. 198s Type 'q()' to quit R. 198s 198s > library("matrixStats") 198s > 198s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 198s + if (is.na(value)) { 198s + counts <- sum(is.na(x)) 198s + } else { 198s + counts <- sum(x == value, na.rm = na.rm) 198s + } 198s + as.integer(counts) 198s + } 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Data type: integer and numeric 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > for (mode in c("integer", "double")) { 198s + x <- runif(20 * 5, min = -3, max = 3) 198s + x[sample.int(length(x), size = 7)] <- 0 198s + storage.mode(x) <- mode 198s + 198s + for (na.rm in c(FALSE, TRUE)) { 198s + # Count zeros 198s + n0 <- count_R(x, value = 0, na.rm = na.rm) 198s + n1 <- count(x, value = 0, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + all <- allValue(x, value = 0, na.rm = na.rm) 198s + any <- anyValue(x, value = 0, na.rm = na.rm) 198s + 198s + # Count NAs 198s + n0 <- count_R(x, value = NA, na.rm = na.rm) 198s + n1 <- count(x, value = NA, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + all <- allValue(x, value = NA, na.rm = na.rm) 198s + any <- anyValue(x, value = NA, na.rm = na.rm) 198s + 198s + if (mode == "integer") { 198s + ux <- unique(as.vector(x)) 198s + n0 <- n1 <- integer(length(x)) 198s + for (value in ux) { 198s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 198s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + } 198s + stopifnot(all(n0 == ncol(x))) 198s + } # if (mode == "integer") 198s + 198s + } # for (na.rm ...) 198s + } # for (mode ...) 198s > 198s > # All NAs 198s > na_list <- list(NA_integer_, NA_real_, NaN) 198s > for (na_value in na_list) { 198s + x <- rep(na_value, times = 10L) 198s + for (na.rm in c(FALSE, TRUE)) { 198s + n0 <- count_R(x, na.rm = na.rm) 198s + n1 <- count(x, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + 198s + # Count NAs 198s + n0 <- count_R(x, value = NA, na.rm = na.rm) 198s + n1 <- count(x, value = NA, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + any <- anyValue(x, value = NA, na.rm = na.rm) 198s + all <- allValue(x, value = NA, na.rm = na.rm) 198s + stopifnot(any) 198s + stopifnot(all) 198s + } 198s + } # for (na_value ...) 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Data type: logical 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > x <- logical(length = 10L) 198s > x[3:7] <- TRUE 198s > 198s > # Row/column counts 198s > for (na.rm in c(FALSE, TRUE)) { 198s + n0 <- count_R(x, na.rm = na.rm) 198s + n1 <- count(x, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + 198s + n_true <- count(x, value = TRUE, na.rm = na.rm) 198s + n_false <- count(x, value = FALSE, na.rm = na.rm) 198s + stopifnot(n_true + n_false == ncol(x)) 198s + 198s + # Count NAs 198s + n0 <- count_R(x, value = NA, na.rm = na.rm) 198s + n1 <- count(x, value = NA, na.rm = na.rm) 198s + stopifnot(identical(n1, n0)) 198s + } 198s > 198s 198s R version 4.4.3 (2025-02-28) -- "Trophy Case" 198s Copyright (C) 2025 The R Foundation for Statistical Computing 198s Platform: x86_64-pc-linux-gnu 198s 198s R is free software and comes with ABSOLUTELY NO WARRANTY. 198s You are welcome to redistribute it under certain conditions. 198s Type 'license()' or 'licence()' for distribution details. 198s 198s R is a collaborative project with many contributors. 198s Type 'contributors()' for more information and 198s 'citation()' on how to cite R or R packages in publications. 198s 198s Type 'demo()' for some demos, 'help()' for on-line help, or 198s 'help.start()' for an HTML browser interface to help. 198s Type 'q()' to quit R. 198s 198s > library("matrixStats") 198s > 198s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 198s + if (is.na(value)) { 198s + counts <- sum(is.na(x)) 198s + } else { 198s + counts <- sum(x == value, na.rm = na.rm) 198s + } 198s + as.integer(counts) 198s + } 198s > 198s > 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > # Subsetted tests 198s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 198s > source("utils/validateIndicesFramework.R") 198s > x <- runif(6, min = -3, max = 3) 198s > storage.mode(x) <- "integer" 198s > for (idxs in index_cases) { 198s + validateIndicesTestVector(x, idxs, 198s + ftest = count, fsure = count_R, 198s + value = 0, na.rm = TRUE) 198s + validateIndicesTestVector(x, idxs, 198s + ftest = count, fsure = count_R, 198s + value = 0, na.rm = FALSE) 198s + validateIndicesTestVector(x, idxs, 198s + ftest = count, fsure = count_R, 198s + value = NA_integer_) 198s + } 198s > 199s 199s R version 4.4.3 (2025-02-28) -- "Trophy Case" 199s Copyright (C) 2025 The R Foundation for Statistical Computing 199s Platform: x86_64-pc-linux-gnu 199s 199s R is free software and comes with ABSOLUTELY NO WARRANTY. 199s You are welcome to redistribute it under certain conditions. 199s Type 'license()' or 'licence()' for distribution details. 199s 199s R is a collaborative project with many contributors. 199s Type 'contributors()' for more information and 199s 'citation()' on how to cite R or R packages in publications. 199s 199s Type 'demo()' for some demos, 'help()' for on-line help, or 199s 'help.start()' for an HTML browser interface to help. 199s Type 'q()' to quit R. 199s 199s > library("matrixStats") 199s > 199s > diff2_R <- function(..., useNames = TRUE){ 199s + res <- diff(...) 199s + if (!useNames) names(res) <- NULL 199s + res 199s + } 199s > 199s > set.seed(0x42) 199s > 199s > for (mode in c("integer", "double")) { 199s + x <- rnorm(10, sd = 5) 199s + storage.mode(x) <- mode 199s + str(x) 199s + 199s + for (has_na in c(FALSE, TRUE)) { 199s + for (setNames in c(TRUE, FALSE)) { 199s + for (useNames in c(TRUE, FALSE)) { 199s + if (has_na) { 199s + x[sample(1:10, size = 3)] <- NA 199s + } 199s + if (setNames) { 199s + names(x) <- LETTERS[1:10] 199s + } 199s + for (l in 1:3) { 199s + for (d in 1:4) { 199s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 199s + mode, has_na, l, d, setNames, useNames)) 199s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 199s + str(y0) 199s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 199s + str(y1) 199s + stopifnot(identical(y1, y0)) 199s + } 199s + } 199s + } 199s + } 199s + } # for (has_na ...) 199s + } 199s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 199s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 199s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 199s Named int [1:8] 11 -3 1 -1 2 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] 11 -3 1 -1 2 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 199s Named int [1:7] -14 4 -2 3 7 -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] -14 4 -2 3 7 -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 199s Named int [1:6] 18 -6 5 4 -31 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] 18 -6 5 4 -31 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 199s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 199s Named int [1:6] 6 -2 1 12 5 -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] 6 -2 1 12 5 -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 199s Named int [1:4] -5 14 4 -27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] -5 14 4 -27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 199s Named int [1:2] 9 -41 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named int [1:2] 9 -41 199s - attr(*, "names")= chr [1:2] "I" "J" 199s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 199s Named int [1:7] -11 -2 -5 -3 7 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] -11 -2 -5 -3 7 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 199s Named int [1:4] 8 9 8 6 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] 8 9 8 6 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 199s Named int -2 199s - attr(*, "names")= chr "J" 199s Named int -2 199s - attr(*, "names")= chr "J" 199s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 199s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 199s int [1:8] 11 -3 1 -1 2 9 -15 6 199s int [1:8] 11 -3 1 -1 2 9 -15 6 199s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 199s int [1:7] -14 4 -2 3 7 -24 21 199s int [1:7] -14 4 -2 3 7 -24 21 199s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 199s int [1:6] 18 -6 5 4 -31 45 199s int [1:6] 18 -6 5 4 -31 45 199s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 199s int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 199s int [1:6] 6 -2 1 12 5 -15 199s int [1:6] 6 -2 1 12 5 -15 199s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 199s int [1:4] -5 14 4 -27 199s int [1:4] -5 14 4 -27 199s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 199s int [1:2] 9 -41 199s int [1:2] 9 -41 199s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 199s int [1:7] -11 -2 -5 -3 7 3 3 199s int [1:7] -11 -2 -5 -3 7 3 3 199s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 199s int [1:4] 8 9 8 6 199s int [1:4] 8 9 8 6 199s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 199s int -2 199s int -2 199s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 199s int(0) 199s int(0) 199s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 199s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 199s Named int [1:8] 11 -3 1 -1 2 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] 11 -3 1 -1 2 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 199s Named int [1:7] -14 4 -2 3 7 -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] -14 4 -2 3 7 -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 199s Named int [1:6] 18 -6 5 4 -31 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] 18 -6 5 4 -31 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 199s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 199s Named int [1:6] 6 -2 1 12 5 -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] 6 -2 1 12 5 -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 199s Named int [1:4] -5 14 4 -27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] -5 14 4 -27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 199s Named int [1:2] 9 -41 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named int [1:2] 9 -41 199s - attr(*, "names")= chr [1:2] "I" "J" 199s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 199s Named int [1:7] -11 -2 -5 -3 7 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] -11 -2 -5 -3 7 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 199s Named int [1:4] 8 9 8 6 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] 8 9 8 6 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 199s Named int -2 199s - attr(*, "names")= chr "J" 199s Named int -2 199s - attr(*, "names")= chr "J" 199s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 199s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 199s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 199s int [1:8] 11 -3 1 -1 2 9 -15 6 199s int [1:8] 11 -3 1 -1 2 9 -15 6 199s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 199s int [1:7] -14 4 -2 3 7 -24 21 199s int [1:7] -14 4 -2 3 7 -24 21 199s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 199s int [1:6] 18 -6 5 4 -31 45 199s int [1:6] 18 -6 5 4 -31 45 199s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 199s int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s int [1:8] -9 -1 -3 -3 -2 9 3 -6 199s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 199s int [1:6] 6 -2 1 12 5 -15 199s int [1:6] 6 -2 1 12 5 -15 199s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 199s int [1:4] -5 14 4 -27 199s int [1:4] -5 14 4 -27 199s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 199s int [1:2] 9 -41 199s int [1:2] 9 -41 199s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 199s int [1:7] -11 -2 -5 -3 7 3 3 199s int [1:7] -11 -2 -5 -3 7 3 3 199s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 199s int [1:4] 8 9 8 6 199s int [1:4] 8 9 8 6 199s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 199s int -2 199s int -2 199s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 199s int(0) 199s int(0) 199s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 199s Named int [1:9] NA NA NA NA NA 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named int [1:9] NA NA NA NA NA 0 9 -6 0 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 199s Named int [1:8] NA NA NA NA NA 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] NA NA NA NA NA 9 -15 6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 199s Named int [1:7] NA NA NA NA NA -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] NA NA NA NA NA -24 21 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 199s Named int [1:6] NA NA NA NA NA 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] NA NA NA NA NA 45 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 199s Named int [1:8] -9 NA NA NA NA 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] -9 NA NA NA NA 9 3 -6 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 199s Named int [1:6] NA NA NA NA NA -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] NA NA NA NA NA -15 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 199s Named int [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named int [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 199s Named int [1:7] NA NA -5 NA NA 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] NA NA -5 NA NA 3 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 199s Named int [1:4] NA NA 8 NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] NA NA 8 NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 199s Named int NA 199s - attr(*, "names")= chr "J" 199s Named int NA 199s - attr(*, "names")= chr "J" 199s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 199s int [1:9] NA NA NA NA NA 0 9 NA NA 199s int [1:9] NA NA NA NA NA 0 9 NA NA 199s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 199s int [1:8] NA NA NA NA NA 9 NA NA 199s int [1:8] NA NA NA NA NA 9 NA NA 199s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 199s int [1:7] NA NA NA NA NA NA NA 199s int [1:7] NA NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 199s int [1:6] NA NA NA NA NA NA 199s int [1:6] NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 199s int [1:8] NA NA NA NA NA 9 NA -6 199s int [1:8] NA NA NA NA NA 9 NA -6 199s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 199s int [1:6] NA NA NA NA NA -15 199s int [1:6] NA NA NA NA NA -15 199s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 199s int [1:4] NA NA NA NA 199s int [1:4] NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 199s int [1:2] NA NA 199s int [1:2] NA NA 199s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 199s int [1:7] NA NA NA NA NA NA 3 199s int [1:7] NA NA NA NA NA NA 3 199s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 199s int [1:4] NA NA NA NA 199s int [1:4] NA NA NA NA 199s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 199s int NA 199s int NA 199s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 199s int(0) 199s int(0) 199s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 199s Named int [1:9] NA NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named int [1:9] NA NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 199s Named int [1:8] NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 199s Named int [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 199s Named int [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 199s Named int [1:8] NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named int [1:8] NA NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 199s Named int [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named int [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 199s Named int [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named int [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 199s Named int [1:7] NA NA NA NA NA NA 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named int [1:7] NA NA NA NA NA NA 3 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named int [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 199s Named int NA 199s - attr(*, "names")= chr "J" 199s Named int NA 199s - attr(*, "names")= chr "J" 199s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s Named int(0) 199s - attr(*, "names")= chr(0) 199s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 199s int [1:9] NA NA NA NA NA NA NA NA NA 199s int [1:9] NA NA NA NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 199s int [1:8] NA NA NA NA NA NA NA NA 199s int [1:8] NA NA NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 199s int [1:7] NA NA NA NA NA NA NA 199s int [1:7] NA NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 199s int [1:6] NA NA NA NA NA NA 199s int [1:6] NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 199s int [1:8] NA NA NA NA NA NA NA NA 199s int [1:8] NA NA NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 199s int [1:6] NA NA NA NA NA NA 199s int [1:6] NA NA NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 199s int [1:4] NA NA NA NA 199s int [1:4] NA NA NA NA 199s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 199s int [1:2] NA NA 199s int [1:2] NA NA 199s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 199s int [1:7] NA NA NA NA NA NA 3 199s int [1:7] NA NA NA NA NA NA 3 199s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 199s int [1:4] NA NA NA NA 199s int [1:4] NA NA NA NA 199s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 199s int NA 199s int NA 199s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 199s int(0) 199s int(0) 199s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 199s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 199s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 199s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 199s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 199s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 199s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 199s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 199s Named num [1:4] 0.368 42.988 15.396 -29.313 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] 0.368 42.988 15.396 -29.313 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 199s Named num [1:2] 15 -72.3 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named num [1:2] 15 -72.3 199s - attr(*, "names")= chr [1:2] "I" "J" 199s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 199s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 199s Named num [1:4] -23.52 7.92 11.38 23.27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] -23.52 7.92 11.38 23.27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 199s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 199s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 199s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 199s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 199s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 199s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 199s num [1:4] 0.368 42.988 15.396 -29.313 199s num [1:4] 0.368 42.988 15.396 -29.313 199s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 199s num [1:2] 15 -72.3 199s num [1:2] 15 -72.3 199s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 199s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 199s num [1:4] -23.52 7.92 11.38 23.27 199s num [1:4] -23.52 7.92 11.38 23.27 199s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 199s num 46.8 199s num 46.8 199s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 199s num(0) 199s num(0) 199s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 199s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 199s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 199s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 199s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 199s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 199s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 199s Named num [1:4] 0.368 42.988 15.396 -29.313 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] 0.368 42.988 15.396 -29.313 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 199s Named num [1:2] 15 -72.3 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named num [1:2] 15 -72.3 199s - attr(*, "names")= chr [1:2] "I" "J" 199s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 199s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 199s Named num [1:4] -23.52 7.92 11.38 23.27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] -23.52 7.92 11.38 23.27 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 199s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 199s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 199s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 199s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 199s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 199s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 199s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 199s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 199s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 199s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 199s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 199s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 199s num [1:4] 0.368 42.988 15.396 -29.313 199s num [1:4] 0.368 42.988 15.396 -29.313 199s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 199s num [1:2] 15 -72.3 199s num [1:2] 15 -72.3 199s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 199s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 199s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 199s num [1:4] -23.52 7.92 11.38 23.27 199s num [1:4] -23.52 7.92 11.38 23.27 199s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 199s num 46.8 199s num 46.8 199s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 199s num(0) 199s num(0) 199s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 199s Named num [1:9] -2.929 0.673 8.826 NA NA ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named num [1:9] -2.929 0.673 8.826 NA NA ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 199s Named num [1:8] 3.6 8.15 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] 3.6 8.15 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 199s Named num [1:7] 4.55 NA NA NA NA ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 4.55 NA NA NA NA ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 199s Named num [1:8] -2.26 9.5 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] -2.26 9.5 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 199s Named num [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named num [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 199s Named num [1:7] 6.57 NA NA -16.95 NA ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] 6.57 NA NA -16.95 NA ... 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 199s Named num [1:4] -23.5 NA NA 23.3 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] -23.5 NA NA 23.3 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s Named num 46.8 199s - attr(*, "names")= chr "J" 199s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 199s num [1:9] NA 0.673 8.826 NA NA ... 199s num [1:9] NA 0.673 8.826 NA NA ... 199s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 199s num [1:8] NA 8.15 NA NA NA ... 199s num [1:8] NA 8.15 NA NA NA ... 199s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 199s num [1:7] NA NA NA NA NA NA NA 199s num [1:7] NA NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 199s num [1:6] NA NA NA NA NA NA 199s num [1:6] NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 199s num [1:8] NA 9.5 NA NA NA ... 199s num [1:8] NA 9.5 NA NA NA ... 199s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 199s num [1:6] NA NA NA NA NA NA 199s num [1:6] NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 199s num [1:4] NA NA NA NA 199s num [1:4] NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 199s num [1:2] NA NA 199s num [1:2] NA NA 199s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 199s num [1:7] NA NA NA NA NA NA NA 199s num [1:7] NA NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 199s num [1:4] NA NA NA NA 199s num [1:4] NA NA NA NA 199s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 199s num NA 199s num NA 199s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 199s num(0) 199s num(0) 199s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 199s Named num [1:9] NA 0.673 8.826 NA NA ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s Named num [1:9] NA 0.673 8.826 NA NA ... 199s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 199s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 199s Named num [1:8] NA 8.15 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] NA 8.15 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 199s Named num [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 199s Named num [1:8] NA 9.5 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s Named num [1:8] NA 9.5 NA NA NA ... 199s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 199s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s Named num [1:6] NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 199s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 199s Named num [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s Named num [1:2] NA NA 199s - attr(*, "names")= chr [1:2] "I" "J" 199s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 199s Named num [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s Named num [1:7] NA NA NA NA NA NA NA 199s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 199s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s Named num [1:4] NA NA NA NA 199s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 199s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 199s Named num NA 199s - attr(*, "names")= chr "J" 199s Named num NA 199s - attr(*, "names")= chr "J" 199s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s Named num(0) 199s - attr(*, "names")= chr(0) 199s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 199s num [1:9] NA 0.673 8.826 NA NA ... 199s num [1:9] NA 0.673 8.826 NA NA ... 199s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 199s num [1:8] NA 8.15 NA NA NA ... 199s num [1:8] NA 8.15 NA NA NA ... 199s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 199s num [1:7] NA NA NA NA NA NA NA 199s num [1:7] NA NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 199s num [1:6] NA NA NA NA NA NA 199s num [1:6] NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 199s num [1:8] NA 9.5 NA NA NA ... 199s num [1:8] NA 9.5 NA NA NA ... 199s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 199s num [1:6] NA NA NA NA NA NA 199s num [1:6] NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 199s num [1:4] NA NA NA NA 199s num [1:4] NA NA NA NA 199s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 199s num [1:2] NA NA 199s num [1:2] NA NA 199s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 199s num [1:7] NA NA NA NA NA NA NA 199s num [1:7] NA NA NA NA NA NA NA 199s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 199s num [1:4] NA NA NA NA 199s num [1:4] NA NA NA NA 199s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 199s num NA 199s num NA 199s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 199s num(0) 199s num(0) 199s > 199s 199s R version 4.4.3 (2025-02-28) -- "Trophy Case" 199s Copyright (C) 2025 The R Foundation for Statistical Computing 199s Platform: x86_64-pc-linux-gnu 199s 199s R is free software and comes with ABSOLUTELY NO WARRANTY. 199s You are welcome to redistribute it under certain conditions. 199s Type 'license()' or 'licence()' for distribution details. 199s 199s R is a collaborative project with many contributors. 199s Type 'contributors()' for more information and 199s 'citation()' on how to cite R or R packages in publications. 199s 199s Type 'demo()' for some demos, 'help()' for on-line help, or 199s 'help.start()' for an HTML browser interface to help. 199s Type 'q()' to quit R. 199s 199s > library("matrixStats") 199s > 199s > diff2_R <- function(..., useNames=NA){ 199s + res <- diff(...) 199s + if (!useNames) names(res) <- NULL 199s + res 199s + } 199s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 199s > # Subsetted tests 199s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 199s > source("utils/validateIndicesFramework.R") 199s > x <- runif(6, min = -6, max = 6) 199s > for (setNames in c(TRUE, FALSE)) { 199s + if (setNames) names(x) <- LETTERS[1:6] 199s + else names(x) <- NULL 199s + for (l in 1:2) { 199s + for (d in 1:2) { 199s + for (idxs in index_cases) { 199s + for (useNames in c(TRUE, FALSE)) { 199s + validateIndicesTestVector(x, idxs, 199s + ftest = diff2, fsure = diff2_R, 199s + lag = l, differences = d, useNames = useNames) 199s + } 199s + } 199s + } 199s + } 199s + } 199s > 199s 199s R version 4.4.3 (2025-02-28) -- "Trophy Case" 199s Copyright (C) 2025 The R Foundation for Statistical Computing 199s Platform: x86_64-pc-linux-gnu 199s 199s R is free software and comes with ABSOLUTELY NO WARRANTY. 199s You are welcome to redistribute it under certain conditions. 199s Type 'license()' or 'licence()' for distribution details. 199s 199s R is a collaborative project with many contributors. 199s Type 'contributors()' for more information and 199s 'citation()' on how to cite R or R packages in publications. 199s 199s Type 'demo()' for some demos, 'help()' for on-line help, or 199s 'help.start()' for an HTML browser interface to help. 199s Type 'q()' to quit R. 199s 199s > library("matrixStats") 199s > 199s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 199s + n <- prod(dim) 199s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 199s + if (!is.null(idxs)) 199s + x <- x[idxs] 199s + as.vector(x) 199s + } 199s > 199s > 199s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 199s + n <- prod(dim) 199s + if (is.null(idxs)) { 199s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 199s + as.vector(x) 199s + } else { 199s + idxs <- idxs - 1L 199s + cols <- idxs %/% dim[2L] 199s + rows <- idxs %% dim[2L] 199s + cols + dim[1L] * rows + 1L 199s + } 199s + } 199s > 199s > 199s > dim <- c(5L, 4L) 199s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 199s > y <- t(x) 199s > idxs_by_cols <- seq_along(x) 199s > 199s > # Assign by columns 199s > x[idxs_by_cols] <- idxs_by_cols 199s > print(x) 199s [,1] [,2] [,3] [,4] 199s [1,] 1 6 11 16 199s [2,] 2 7 12 17 199s [3,] 3 8 13 18 199s [4,] 4 9 14 19 199s [5,] 5 10 15 20 199s > 199s > # Truth 199s > y0 <- t(x) 199s > idxs_by_rows <- as.vector(y0) 199s > 199s > # Assert 199s > idxs <- indexByRow(dim) 199s > stopifnot(all.equal(idxs, idxs_by_rows)) 199s > y <- x 199s > y[idxs_by_rows] <- idxs 199s > print(y) 199s [,1] [,2] [,3] [,4] 199s [1,] 1 6 11 16 199s [2,] 2 7 12 17 199s [3,] 3 8 13 18 199s [4,] 4 9 14 19 199s [5,] 5 10 15 20 199s > stopifnot(all(as.vector(y) == as.vector(x))) 199s > 199s > idxs_R1 <- indexByRow_R1(dim) 199s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 199s > 199s > idxs_R2 <- indexByRow_R2(dim) 199s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 199s > 199s > # Assert 199s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 199s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 199s > 199s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 199s > stopifnot(all(idxs == idxs_by_rows)) 199s > 199s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 199s > stopifnot(all(idxs_R1 == idxs_by_rows)) 199s > 199s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 199s > stopifnot(all(idxs_R2 == idxs_by_rows)) 199s > 199s > 199s > ## DEFUNCT: Backward compatibility 199s > res <- tryCatch({ 199s + idxs1 <- indexByRow(x) 199s + }, error = identity) 199s > stopifnot(inherits(res, "error")) 199s > 199s > 199s > ## Exceptions: 199s > ## Too large matrices are not supported, which happens 199s > ## when prod(dim) > .Machine$integer.max 199s > dim_too_large <- c(.Machine$integer.max, 2L) 199s > res <- tryCatch({ 199s + idxs <- indexByRow(dim_too_large, idxs = 1L) 199s + }, error = identity) 199s > stopifnot(inherits(res, "error")) 199s > 199s > ## Non-positive indices are not supported 199s > res <- tryCatch({ 199s + idxs <- indexByRow(c(1,1), idxs = 0L) 199s + }, error = identity) 199s > stopifnot(inherits(res, "error")) 199s > 199s > res <- tryCatch({ 199s + idxs <- indexByRow(c(1,1), idxs = -1L) 199s + }, error = identity) 199s > stopifnot(inherits(res, "error")) 199s > 199s 199s R version 4.4.3 (2025-02-28) -- "Trophy Case" 199s Copyright (C) 2025 The R Foundation for Statistical Computing 199s Platform: x86_64-pc-linux-gnu 199s 199s R is free software and comes with ABSOLUTELY NO WARRANTY. 199s You are welcome to redistribute it under certain conditions. 199s Type 'license()' or 'licence()' for distribution details. 199s 199s R is a collaborative project with many contributors. 199s Type 'contributors()' for more information and 199s 'citation()' on how to cite R or R packages in publications. 199s 199s Type 'demo()' for some demos, 'help()' for on-line help, or 199s 'help.start()' for an HTML browser interface to help. 199s Type 'q()' to quit R. 199s 200s > library("matrixStats") 200s > library("stats") 200s > 200s > logSumExp_R <- function(lx, na.rm = FALSE) { 200s + log(sum(exp(lx), na.rm = na.rm)) 200s + } 200s > 200s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 200s > 200s > for (mode in c("integer", "double")) { 200s + cat("mode: ", mode, "\n", sep = "") 200s + 200s + set.seed(1) 200s + x <- runif(20, min = 1.0, max = 3.0) 200s + storage.mode(x) <- mode 200s + str(x) 200s + 200s + ## The logarithm of the harmonic mean 200s + y0 <- log(1 / mean(1 / x)) 200s + print(y0) ## -1.600885 200s + 200s + lx <- log(x) 200s + y1 <- log(length(x)) - logSumExp(-lx) 200s + print(y1) ## [1] -1.600885 200s + 200s + # Sanity check 200s + stopifnot(all.equal(y1, y0)) 200s + 200s + y2 <- log(length(x)) - logSumExp_R(-lx) 200s + # Sanity check 200s + stopifnot(all.equal(y2, y0)) 200s + } # for (mode ...) 200s mode: integer 200s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 200s [1] 0.3215836 200s [1] 0.3215836 200s mode: double 200s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 200s [1] 0.6673156 200s [1] 0.6673156 200s > 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Missing values 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > ## NA values 200s > lx <- c(1, 2, 3) 200s > lx[2] <- NA_real_ 200s > y0 <- logSumExp_R(lx, na.rm = FALSE) 200s > y <- logSumExp(lx, na.rm = FALSE) 200s > print(y) 200s [1] NA 200s > stopifnot(identical(y, NA_real_)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > y0 <- logSumExp_R(lx, na.rm = TRUE) 200s > y <- logSumExp(lx, na.rm = TRUE) 200s > print(y) 200s [1] 3.126928 200s > stopifnot(all.equal(y, y0)) 200s > 200s > ## NaN values 200s > lx <- c(1, 2, 3) 200s > lx[2] <- NaN 200s > y0 <- logSumExp_R(lx, na.rm = FALSE) 200s > y <- logSumExp(lx, na.rm = FALSE) 200s > print(y) 200s [1] NA 200s > stopifnot(identical(y, NA_real_)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > y0 <- logSumExp_R(lx, na.rm = TRUE) 200s > y <- logSumExp(lx, na.rm = TRUE) 200s > print(y) 200s [1] 3.126928 200s > stopifnot(all.equal(y, y0)) 200s > 200s > 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Corner cases 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > ## Zero-length vectors 200s > lx <- numeric(0L) 200s > y0 <- logSumExp_R(lx) 200s > y <- logSumExp(lx) 200s > print(y) 200s [1] -Inf 200s > stopifnot(identical(y, -Inf)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > ## Vectors of length one 200s > lx <- 1.0 200s > y0 <- logSumExp_R(lx) 200s > y <- logSumExp(lx) 200s > print(y) 200s [1] 1 200s > stopifnot(identical(y, lx)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > lx <- NA_real_ 200s > y0 <- logSumExp_R(lx, na.rm = TRUE) 200s > y <- logSumExp(lx, na.rm = TRUE) 200s > print(y) 200s [1] -Inf 200s > stopifnot(identical(y, -Inf)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > ## All missing values 200s > lx <- c(NA_real_, NA_real_) 200s > y0 <- logSumExp_R(lx, na.rm = TRUE) 200s > y <- logSumExp(lx, na.rm = TRUE) 200s > print(y) 200s [1] -Inf 200s > stopifnot(identical(y, -Inf)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > lx <- c(NA_real_, NA_real_) 200s > y0 <- logSumExp_R(lx, na.rm = FALSE) 200s > y <- logSumExp(lx, na.rm = FALSE) 200s > print(y) 200s [1] NA 200s > stopifnot(identical(y, NA_real_)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > 200s > ## +Inf values 200s > lx <- c(1, 2, +Inf) 200s > y0 <- logSumExp_R(lx) 200s > y <- logSumExp(lx) 200s > print(y) 200s [1] Inf 200s > stopifnot(identical(y, +Inf)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > ## First element is a missing value, cf. PR #33 200s > lx <- c(NA_real_, 1) 200s > y0 <- logSumExp_R(lx) 200s > print(y0) 200s [1] NA 200s > y <- logSumExp(lx, na.rm = FALSE) 200s > print(y) 200s [1] NA 200s > stopifnot(identical(y, NA_real_)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > y0 <- logSumExp_R(lx, na.rm = TRUE) 200s > print(y0) 200s [1] 1 200s > y <- logSumExp(lx, na.rm = TRUE) 200s > print(y) 200s [1] 1 200s > stopifnot(identical(y, 1)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > ## Multiple -Inf values, cf. issue #84 200s > lx <- c(-Inf, -Inf) 200s > y0 <- logSumExp_R(lx) 200s > y <- logSumExp(lx) 200s > print(y) 200s [1] -Inf 200s > stopifnot(identical(y, -Inf)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s > lx <- c(-Inf, 5, -Inf) 200s > y0 <- logSumExp_R(lx) 200s > y <- logSumExp(lx) 200s > print(y) 200s [1] 5 200s > stopifnot(identical(y, 5)) 200s > stopifnot(all.equal(y, y0)) 200s > 200s 200s R version 4.4.3 (2025-02-28) -- "Trophy Case" 200s Copyright (C) 2025 The R Foundation for Statistical Computing 200s Platform: x86_64-pc-linux-gnu 200s 200s R is free software and comes with ABSOLUTELY NO WARRANTY. 200s You are welcome to redistribute it under certain conditions. 200s Type 'license()' or 'licence()' for distribution details. 200s 200s R is a collaborative project with many contributors. 200s Type 'contributors()' for more information and 200s 'citation()' on how to cite R or R packages in publications. 200s 200s Type 'demo()' for some demos, 'help()' for on-line help, or 200s 'help.start()' for an HTML browser interface to help. 200s Type 'q()' to quit R. 200s 200s > library("matrixStats") 200s > 200s > logSumExp_R <- function(lx, na.rm = FALSE) { 200s + log(sum(exp(lx), na.rm = na.rm)) 200s + } 200s > 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Subsetted tests 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > source("utils/validateIndicesFramework.R") 200s > x <- runif(6, min = -6, max = 6) 200s > for (idxs in index_cases) { 200s + validateIndicesTestVector(x, idxs, 200s + ftest = logSumExp, fsure = logSumExp_R, 200s + na.rm = FALSE) 200s + validateIndicesTestVector(x, idxs, 200s + ftest = logSumExp, fsure = logSumExp_R, 200s + na.rm = TRUE) 200s + } 200s > 200s 200s R version 4.4.3 (2025-02-28) -- "Trophy Case" 200s Copyright (C) 2025 The R Foundation for Statistical Computing 200s Platform: x86_64-pc-linux-gnu 200s 200s R is free software and comes with ABSOLUTELY NO WARRANTY. 200s You are welcome to redistribute it under certain conditions. 200s Type 'license()' or 'licence()' for distribution details. 200s 200s R is a collaborative project with many contributors. 200s Type 'contributors()' for more information and 200s 'citation()' on how to cite R or R packages in publications. 200s 200s Type 'demo()' for some demos, 'help()' for on-line help, or 200s 'help.start()' for an HTML browser interface to help. 200s Type 'q()' to quit R. 200s 200s > library("matrixStats") 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Consistency checks 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > set.seed(1) 200s > 200s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 200s + if (is.null(idxs)) { 200s + mean(x, na.rm = na.rm) 200s + } else { 200s + mean(x[idxs], na.rm = na.rm) 200s + } 200s + } # mean2_R() 200s > 200s > 200s > cat("Consistency checks:\n") 200s Consistency checks: 200s > for (kk in 1:20) { 200s + cat("Random test #", kk, "\n", sep = "") 200s + 200s + # Simulate data in a matrix of any shape 200s + n <- sample(100L, size = 1L) 200s + x <- rnorm(n, sd = 100) 200s + 200s + # Add NAs? 200s + if ((kk %% 4) %in% c(3, 0)) { 200s + cat("Adding NAs\n") 200s + nna <- sample(n, size = 1L) 200s + na_values <- c(NA_real_, NaN) 200s + t <- sample(na_values, size = nna, replace = TRUE) 200s + x[sample(length(x), size = nna)] <- t 200s + } 200s + 200s + # Integer or double? 200s + if ((kk %% 4) %in% c(2, 0)) { 200s + cat("Coercing to integers\n") 200s + storage.mode(x) <- "integer" 200s + } 200s + 200s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 200s + 200s + # Sum over all 200s + y0 <- mean2_R(x, na.rm = na.rm) 200s + y1 <- mean2(x, na.rm = na.rm) 200s + stopifnot(all.equal(y1, y0)) 200s + 200s + # Sum over subset 200s + nidxs <- sample(n, size = 1L) 200s + idxs <- sample(n, size = nidxs) 200s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 200s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 200s + stopifnot(all.equal(y1, y0)) 200s + 200s + if (storage.mode(x) == "integer") { 200s + storage.mode(x) <- "logical" 200s + 200s + y0 <- mean2_R(x, na.rm = na.rm) 200s + y1 <- mean2(x, na.rm = na.rm) 200s + stopifnot(all.equal(y1, y0)) 200s + 200s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 200s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 200s + stopifnot(all.equal(y1, y0)) 200s + } 200s + } # for (kk ...) 200s Random test #1 200s Random test #2 200s Coercing to integers 200s Random test #3 200s Adding NAs 200s Random test #4 200s Adding NAs 200s Coercing to integers 200s Random test #5 200s Random test #6 200s Coercing to integers 200s Random test #7 200s Adding NAs 200s Random test #8 200s Adding NAs 200s Coercing to integers 200s Random test #9 200s Random test #10 200s Coercing to integers 200s Random test #11 200s Adding NAs 200s Random test #12 200s Adding NAs 200s Coercing to integers 200s Random test #13 200s Random test #14 200s Coercing to integers 200s Random test #15 200s Adding NAs 200s Random test #16 200s Adding NAs 200s Coercing to integers 200s Random test #17 200s Random test #18 200s Coercing to integers 200s Random test #19 200s Adding NAs 200s Random test #20 200s Adding NAs 200s Coercing to integers 200s > 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Special cases 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > for (na.rm in c(FALSE, TRUE)) { 200s + # Averaging over zero elements (integers) 200s + x <- integer(0) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + x <- 1:5 200s + idxs <- integer(0) 200s + s1 <- mean(x[idxs], na.rm = na.rm) 200s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over NA_integer_:s 200s + x <- rep(NA_integer_, times = 5L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + x <- rep(NA_integer_, times = 5L) 200s + idxs <- 1:3 200s + s1 <- mean(x[idxs], na.rm = na.rm) 200s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + 200s + # Averaging over zero elements (doubles) 200s + x <- double(0) 200s + s1 <- mean(x) 200s + s2 <- mean2(x) 200s + stopifnot(identical(s1, s2)) 200s + 200s + x <- as.double(1:10) 200s + idxs <- integer(0) 200s + s1 <- mean(x[idxs]) 200s + s2 <- mean2(x, idxs = idxs) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over NA_real_:s 200s + x <- rep(NA_real_, times = 5L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + x <- rep(NA_real_, times = 5L) 200s + idxs <- 1:3 200s + s1 <- mean(x[idxs], na.rm = na.rm) 200s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over -Inf:s 200s + x <- rep(-Inf, times = 3L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over +Inf:s 200s + x <- rep(+Inf, times = 3L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over mix of -Inf:s and +Inf:s 200s + x <- rep(c(-Inf, +Inf), times = 3L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over mix of -Inf:s and +Inf:s and numerics 200s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + stopifnot(identical(s1, s2)) 200s + 200s + # Averaging over mix of NaN, NA, +Inf, and numerics 200s + x <- c(NaN, NA, +Inf, 3.14) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + if (na.rm) { 200s + stopifnot(identical(s2, s1)) 200s + } else { 200s + stopifnot(is.na(s1), is.na(s2)) 200s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 200s + ## returned here (as one would expect). NaN might very well be returned, 200s + ## when both NA and NaN are involved. This is an accepted feature in R, 200s + ## which is documented in help("is.nan"). See also 200s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 200s + ## Thus, we cannot guarantee that s1 is identical to s0. 200s + } 200s + 200s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 200s + x <- c(NA_real_, NaN, +Inf, 3.14) 200s + s1 <- mean(x, na.rm = na.rm) 200s + s2 <- mean2(x, na.rm = na.rm) 200s + if (na.rm) { 200s + stopifnot(identical(s2, s1)) 200s + } else { 200s + stopifnot(is.na(s1), is.na(s2)) 200s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 200s + ## returned here (as one would expect). NaN might very well be returned, 200s + ## when both NA and NaN are involved. This is an accepted feature in R, 200s + ## which is documented in help("is.nan"). See also 200s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 200s + ## Thus, we cannot guarantee that s1 is identical to s0. 200s + } 200s + } 200s > 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Argument 'idxs' 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > x <- 1:5 200s > idxs_list <- list( 200s + integer = 1:3, 200s + double = as.double(1:3), 200s + logical = (x <= 3) 200s + ) 200s > 200s > for (idxs in idxs_list) { 200s + cat("idxs:\n") 200s + str(idxs) 200s + s1 <- mean(x[idxs], na.rm = TRUE) 200s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 200s + stopifnot(identical(s1, s2)) 200s + } 200s idxs: 200s int [1:3] 1 2 3 200s idxs: 200s num [1:3] 1 2 3 200s idxs: 200s logi [1:5] TRUE TRUE TRUE FALSE FALSE 200s > 200s 200s R version 4.4.3 (2025-02-28) -- "Trophy Case" 200s Copyright (C) 2025 The R Foundation for Statistical Computing 200s Platform: x86_64-pc-linux-gnu 200s 200s R is free software and comes with ABSOLUTELY NO WARRANTY. 200s You are welcome to redistribute it under certain conditions. 200s Type 'license()' or 'licence()' for distribution details. 200s 200s R is a collaborative project with many contributors. 200s Type 'contributors()' for more information and 200s 'citation()' on how to cite R or R packages in publications. 200s 200s Type 'demo()' for some demos, 'help()' for on-line help, or 200s 'help.start()' for an HTML browser interface to help. 200s Type 'q()' to quit R. 200s 200s > library("matrixStats") 200s > 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > # Subsetted tests 200s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 200s > source("utils/validateIndicesFramework.R") 200s > x <- runif(6, min = -6, max = 6) 200s > storage.mode(x) <- "integer" 200s > for (idxs in index_cases) { 200s + validateIndicesTestVector(x, idxs, 200s + ftest = mean2, fsure = mean, 200s + na.rm = FALSE) 200s + validateIndicesTestVector(x, idxs, 200s + ftest = mean2, fsure = mean, 200s + na.rm = TRUE) 200s + } 200s > 200s 200s R version 4.4.3 (2025-02-28) -- "Trophy Case" 200s Copyright (C) 2025 The R Foundation for Statistical Computing 200s Platform: x86_64-pc-linux-gnu 200s 200s R is free software and comes with ABSOLUTELY NO WARRANTY. 200s You are welcome to redistribute it under certain conditions. 200s Type 'license()' or 'licence()' for distribution details. 200s 200s R is a collaborative project with many contributors. 200s Type 'contributors()' for more information and 200s 'citation()' on how to cite R or R packages in publications. 200s 200s Type 'demo()' for some demos, 'help()' for on-line help, or 200s 'help.start()' for an HTML browser interface to help. 200s Type 'q()' to quit R. 200s 201s > library("matrixStats") 201s > 201s > for (mode in c("integer", "double")) { 201s + cat("mode: ", mode, "\n", sep = "") 201s + 201s + # Empty vector 201s + x <- 0 201s + storage.mode(x) <- mode 201s + y <- prod(x, na.rm = TRUE) 201s + print(y) 201s + z <- product(x, na.rm = TRUE) 201s + print(z) 201s + stopifnot(all.equal(z, y)) 201s + 201s + # Test negative values 201s + x <- c(1, -4, 2) 201s + storage.mode(x) <- mode 201s + y <- prod(x, na.rm = TRUE) 201s + print(y) 201s + z <- product(x, na.rm = TRUE) 201s + print(z) 201s + stopifnot(all.equal(z, y)) 201s + 201s + # Test missing values 201s + x <- c(1, NA, NaN, 2) 201s + storage.mode(x) <- mode 201s + y <- prod(x, na.rm = TRUE) 201s + print(y) 201s + z <- product(x, na.rm = TRUE) 201s + print(z) 201s + stopifnot(all.equal(z, y)) 201s + 201s + x <- c(1, NA, NaN, 2) 201s + storage.mode(x) <- mode 201s + y <- prod(x, na.rm = FALSE) 201s + print(y) 201s + z <- product(x, na.rm = FALSE) 201s + print(z) 201s + stopifnot(all(is.na(z), is.na(y))) 201s + 201s + x <- c(1, NaN, 2) 201s + storage.mode(x) <- mode 201s + y <- prod(x, na.rm = FALSE) 201s + print(y) 201s + stopifnot(is.na(y)) 201s + z <- product(x, na.rm = FALSE) 201s + print(z) 201s + stopifnot(is.na(z)) 201s + 201s + } # for (mode ...) 201s mode: integer 201s [1] 0 201s [1] 0 201s [1] -8 201s [1] -8 201s [1] 2 201s [1] 2 201s [1] NA 201s [1] NA 201s [1] NA 201s [1] NA 201s mode: double 201s [1] 0 201s [1] 0 201s [1] -8 201s [1] -8 201s [1] 2 201s [1] 2 201s [1] NA 201s [1] NA 201s [1] NaN 201s [1] NA 201s > 201s > 201s > # NAs following 0s 201s > x <- c(0L, NA_integer_) 201s > y <- prod(x, na.rm = FALSE) 201s > print(y) 201s [1] NA 201s > z <- product(x, na.rm = FALSE) 201s > print(z) 201s [1] NA 201s > stopifnot(identical(z, y)) 201s > 201s 201s R version 4.4.3 (2025-02-28) -- "Trophy Case" 201s Copyright (C) 2025 The R Foundation for Statistical Computing 201s Platform: x86_64-pc-linux-gnu 201s 201s R is free software and comes with ABSOLUTELY NO WARRANTY. 201s You are welcome to redistribute it under certain conditions. 201s Type 'license()' or 'licence()' for distribution details. 201s 201s R is a collaborative project with many contributors. 201s Type 'contributors()' for more information and 201s 'citation()' on how to cite R or R packages in publications. 201s 201s Type 'demo()' for some demos, 'help()' for on-line help, or 201s 'help.start()' for an HTML browser interface to help. 201s Type 'q()' to quit R. 201s 201s > library("matrixStats") 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Subsetted tests 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > source("utils/validateIndicesFramework.R") 201s > x <- runif(6, min = -6, max = 6) 201s > storage.mode(x) <- "integer" 201s > for (idxs in index_cases) { 201s + validateIndicesTestVector(x, idxs, 201s + ftest = product, fsure = prod, 201s + na.rm = TRUE) 201s + validateIndicesTestVector(x, idxs, 201s + ftest = product, fsure = prod, 201s + na.rm = FALSE) 201s + } 201s > 201s 201s R version 4.4.3 (2025-02-28) -- "Trophy Case" 201s Copyright (C) 2025 The R Foundation for Statistical Computing 201s Platform: x86_64-pc-linux-gnu 201s 201s R is free software and comes with ABSOLUTELY NO WARRANTY. 201s You are welcome to redistribute it under certain conditions. 201s Type 'license()' or 'licence()' for distribution details. 201s 201s R is a collaborative project with many contributors. 201s Type 'contributors()' for more information and 201s 'citation()' on how to cite R or R packages in publications. 201s 201s Type 'demo()' for some demos, 'help()' for on-line help, or 201s 'help.start()' for an HTML browser interface to help. 201s Type 'q()' to quit R. 201s 201s > library("matrixStats") 201s > library("utils") ## utils::str 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Local functions 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > psortKM_R <- function(x, k, m) { 201s + x <- sort(x) 201s + x[(k - m + 1):k] 201s + } 201s > 201s > psortKM_R2 <- function(x, k, m) { 201s + partial <- (k - m + 1):k 201s + x <- sort.int(x, partial = partial) 201s + x[partial] 201s + } 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Consistency checks 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > set.seed(1) 201s > 201s > cat("Consistency checks:\n") 201s Consistency checks: 201s > x <- 1:30 201s > x[18:20] <- 20 201s > y <- sample(x) 201s > cat("x:\n") 201s x: 201s > str(x) 201s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 201s > cat("sample(x):\n") 201s sample(x): 201s > str(y) 201s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 201s > 201s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 201s + for (m in 1:min(5L, k)) { 201s + px0 <- psortKM_R(x, k = k, m = m) 201s + px0b <- psortKM_R2(x, k = k, m = m) 201s + stopifnot(identical(px0b, px0)) 201s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 201s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 201s + print(px1) 201s + stopifnot(identical(px1, px0)) 201s + 201s + py0 <- psortKM_R(y, k = k, m = m) 201s + py0b <- psortKM_R2(y, k = k, m = m) 201s + stopifnot(identical(py0b, py0)) 201s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 201s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 201s + print(py1) 201s + stopifnot(identical(py1, py0)) 201s + stopifnot(identical(py1, px1)) 201s + } # for (m ...) 201s + } # for (k ...) 201s .psortKM(x, k = 1, m = 1): 201s [1] 1 201s .psortKM(y, k = 1, m = 1): 201s [1] 1 201s .psortKM(x, k = 2, m = 1): 201s [1] 2 201s .psortKM(y, k = 2, m = 1): 201s [1] 2 201s .psortKM(x, k = 2, m = 2): 201s [1] 1 2 201s .psortKM(y, k = 2, m = 2): 201s [1] 1 2 201s .psortKM(x, k = 20, m = 1): 201s [1] 20 201s .psortKM(y, k = 20, m = 1): 201s [1] 20 201s .psortKM(x, k = 20, m = 2): 201s [1] 20 20 201s .psortKM(y, k = 20, m = 2): 201s [1] 20 20 201s .psortKM(x, k = 20, m = 3): 201s [1] 20 20 20 201s .psortKM(y, k = 20, m = 3): 201s [1] 20 20 20 201s .psortKM(x, k = 20, m = 4): 201s [1] 17 20 20 20 201s .psortKM(y, k = 20, m = 4): 201s [1] 17 20 20 20 201s .psortKM(x, k = 20, m = 5): 201s [1] 16 17 20 20 20 201s .psortKM(y, k = 20, m = 5): 201s [1] 16 17 20 20 20 201s .psortKM(x, k = 21, m = 1): 201s [1] 21 201s .psortKM(y, k = 21, m = 1): 201s [1] 21 201s .psortKM(x, k = 21, m = 2): 201s [1] 20 21 201s .psortKM(y, k = 21, m = 2): 201s [1] 20 21 201s .psortKM(x, k = 21, m = 3): 201s [1] 20 20 21 201s .psortKM(y, k = 21, m = 3): 201s [1] 20 20 21 201s .psortKM(x, k = 21, m = 4): 201s [1] 20 20 20 21 201s .psortKM(y, k = 21, m = 4): 201s [1] 20 20 20 21 201s .psortKM(x, k = 21, m = 5): 201s [1] 17 20 20 20 21 201s .psortKM(y, k = 21, m = 5): 201s [1] 17 20 20 20 21 201s .psortKM(x, k = 30, m = 1): 201s [1] 30 201s .psortKM(y, k = 30, m = 1): 201s [1] 30 201s .psortKM(x, k = 30, m = 2): 201s [1] 29 30 201s .psortKM(y, k = 30, m = 2): 201s [1] 29 30 201s .psortKM(x, k = 30, m = 3): 201s [1] 28 29 30 201s .psortKM(y, k = 30, m = 3): 201s [1] 28 29 30 201s .psortKM(x, k = 30, m = 4): 201s [1] 27 28 29 30 201s .psortKM(y, k = 30, m = 4): 201s [1] 27 28 29 30 201s .psortKM(x, k = 30, m = 5): 201s [1] 26 27 28 29 30 201s .psortKM(y, k = 30, m = 5): 201s [1] 26 27 28 29 30 201s > 201s 201s R version 4.4.3 (2025-02-28) -- "Trophy Case" 201s Copyright (C) 2025 The R Foundation for Statistical Computing 201s Platform: x86_64-pc-linux-gnu 201s 201s R is free software and comes with ABSOLUTELY NO WARRANTY. 201s You are welcome to redistribute it under certain conditions. 201s Type 'license()' or 'licence()' for distribution details. 201s 201s R is a collaborative project with many contributors. 201s Type 'contributors()' for more information and 201s 'citation()' on how to cite R or R packages in publications. 201s 201s Type 'demo()' for some demos, 'help()' for on-line help, or 201s 'help.start()' for an HTML browser interface to help. 201s Type 'q()' to quit R. 201s 201s > library("matrixStats") 201s > 201s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 201s + if (is.na(value)) { 201s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 201s + } else { 201s + y <- x == value 201s + 201s + # Preserve dimnames attribute 201s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 201s + if (!isTRUE(all.equal(dim(y), dim))) { 201s + dim(y) <- dim 201s + dimnames(y) <- dimnames(x) 201s + } 201s + 201s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 201s + } 201s + if (!useNames) names(res) <- NULL 201s + res 201s + } 201s > 201s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 201s + if (is.na(value)) { 201s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 201s + } else { 201s + y <- x == value 201s + 201s + # Preserve dimnames attribute 201s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 201s + if (!isTRUE(all.equal(dim(y), dim))) { 201s + dim(y) <- dim 201s + dimnames(y) <- dimnames(x) 201s + } 201s + 201s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 201s + } 201s + if (!useNames) names(res) <- NULL 201s + res 201s + } 201s > 201s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 201s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 201s + if (!useNames) names(res) <- NULL 201s + res 201s + } 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Data type: logical 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 201s > x[7:8, 2:3] <- TRUE 201s > x[1:3, ] <- TRUE 201s > x[, 1] <- TRUE 201s > x[4, ] <- FALSE 201s > x[, 4] <- FALSE 201s > x[2, ] <- FALSE 201s > x[3, ] <- TRUE 201s > 201s > # To check names attribute 201s > dimnames <- list(letters[1:10], LETTERS[1:4]) 201s > 201s > for (kk in 1:3) { 201s + if (kk == 2) { 201s + x[2, 2] <- NA 201s + } else if (kk == 3) { 201s + x[, 2] <- NA 201s + x[2, ] <- NA 201s + } 201s + 201s + # Test with and without dimnames on x 201s + for (setDimnames in c(TRUE, FALSE)) { 201s + dimnames(x) <- if (setDimnames) dimnames else NULL 201s + 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 201s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 201s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 201s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 201s + stopifnot(identical(m1, m0)) 201s + stopifnot(identical(m2, m0)) 201s + 201s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 201s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 201s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 201s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 201s + stopifnot(identical(m1, m0)) 201s + stopifnot(identical(m2, m0)) 201s + 201s + m0 <- rowAnyMissings_R(x, useNames = useNames) 201s + m1 <- rowAnyMissings(x, useNames = useNames) 201s + m2 <- colAnyMissings(t(x), useNames = useNames) 201s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 201s + stopifnot(identical(m1, m0)) 201s + stopifnot(identical(m2, m0)) 201s + } 201s + } 201s + } 201s + } # for (kk ...) 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "any()" 201s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s List of 4 201s $ : chr "all()" 201s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 201s List of 4 201s $ : chr "any()" 201s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 201s List of 4 201s $ : chr "anyMissing()" 201s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Data type: integer 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 201s > x[2, ] <- 7L 201s > x[3, 1] <- 7L 201s > x[2:3, 3:4] <- NA_integer_ 201s > 201s > # To check names attribute 201s > dimnames <- list(letters[1:4], LETTERS[1:5]) 201s > 201s > # Row/column counts 201s > value <- 7L 201s > 201s > # Test with and without dimnames on x 201s > for (setDimnames in c(TRUE, FALSE)) { 201s + dimnames(x) <- if (setDimnames) dimnames else NULL 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 201s + stopifnot(identical(r1, r0)) 201s + stopifnot(identical(r2, r1)) 201s + if (!useNames && !setDimnames) { 201s + for (rr in seq_len(nrow(x))) { 201s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, r1[rr])) 201s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, r1[rr])) 201s + } 201s + } 201s + 201s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 201s + stopifnot(identical(r1, r0)) 201s + stopifnot(identical(r2, r1)) 201s + if (!useNames && !setDimnames) { 201s + for (rr in seq_len(nrow(x))) { 201s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, r1[rr])) 201s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, r1[rr])) 201s + } 201s + } 201s + } 201s + } 201s + } 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > x <- matrix(0, nrow = 4L, ncol = 5L) 201s > x[2:4, 2] <- (1:3) / 4 201s > x[2, 2:4] <- (1:3) / 4 201s > x[3:4, 3] <- (3:4) / 4 201s > x[3, 3:4] <- (3:4) / 4 201s > x[1:4, 5] <- (1:4) / 5 201s > x[4, 4] <- NA_real_ 201s > 201s > # To check names attribute 201s > dimnames <- list(letters[1:4], LETTERS[1:5]) 201s > 201s > for (value in c(TRUE, FALSE)) { 201s + for (na.rm in c(FALSE, TRUE)) { 201s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 201s + y <- rowAnys(x, na.rm = na.rm, value = value) 201s + stopifnot(identical(y, y0)) 201s + # Check names attribute 201s + dimnames(x) <- dimnames 201s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 201s + stopifnot(all.equal(y, y0)) 201s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 201s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 201s + stopifnot(all.equal(y, y0)) 201s + dimnames(x) <- NULL 201s + 201s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 201s + y <- colAnys(x, na.rm = na.rm, value = value) 201s + stopifnot(identical(y, y0)) 201s + # Check names attribute 201s + dimnames(x) <- dimnames 201s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 201s + stopifnot(all.equal(y, y0)) 201s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 201s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 201s + stopifnot(all.equal(y, y0)) 201s + dimnames(x) <- NULL 201s + 201s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 201s + y <- rowAlls(x, na.rm = na.rm, value = value) 201s + stopifnot(identical(y, y0)) 201s + # Check names attribute 201s + dimnames(x) <- dimnames 201s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 201s + stopifnot(all.equal(y, y0)) 201s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 201s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 201s + stopifnot(all.equal(y, y0)) 201s + dimnames(x) <- NULL 201s + 201s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 201s + y <- colAlls(x, na.rm = na.rm, value = value) 201s + stopifnot(identical(y, y0)) 201s + print(y0) 201s + # Check names attribute 201s + dimnames(x) <- dimnames 201s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 201s + stopifnot(all.equal(y, y0)) 201s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 201s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 201s + stopifnot(all.equal(y, y0)) 201s + dimnames(x) <- NULL 201s + } ## for (na.rm ...) 201s + } ## for(value ...) 201s [1] FALSE FALSE FALSE FALSE TRUE 201s [1] FALSE FALSE FALSE FALSE TRUE 201s [1] TRUE FALSE FALSE FALSE FALSE 201s [1] TRUE FALSE FALSE FALSE FALSE 201s > 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Data type: character (not sure if this should be supported) 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > all_R <- function(x, value = TRUE, ...) { 201s + if (is.na(value)) { 201s + all(is.na(x), ...) 201s + } else { 201s + all(x == value, ...) 201s + } 201s + } 201s > 201s > any_R <- function(x, value = TRUE, ...) { 201s + if (is.na(value)) { 201s + any(is.na(x), ...) 201s + } else { 201s + any(x == value, ...) 201s + } 201s + } 201s > 201s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 201s > x[2, ] <- "g" 201s > x[2:4, 3:4] <- NA_character_ 201s > 201s > # To check names attribute 201s > dimnames <- list(letters[1:10], LETTERS[1:5]) 201s > 201s > # Test with and without dimnames on x 201s > for (setDimnames in c(TRUE, FALSE)) { 201s + dimnames(x) <- if (setDimnames) dimnames else NULL 201s + 201s + # Row/column counts 201s + for (value in c("g", NA_character_)) { 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 201s + stopifnot(identical(r1, r0)) 201s + stopifnot(identical(r2, r1)) 201s + if (!useNames && !setDimnames) { 201s + for (rr in seq_len(nrow(x))) { 201s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 201s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, r1[rr])) 201s + stopifnot(identical(c, c0)) 201s + } 201s + } 201s + 201s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 201s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 201s + stopifnot(identical(r1, r0)) 201s + stopifnot(identical(r2, r1)) 201s + if (!useNames && !setDimnames) { 201s + for (rr in seq_len(nrow(x))) { 201s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 201s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 201s + stopifnot(identical(c, c0)) 201s + stopifnot(identical(c, r1[rr])) 201s + } 201s + } 201s + } 201s + } 201s + } 201s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # NA 0 test 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > x <- matrix(0, nrow = 3L, ncol = 3L) 202s > x[1, ] <- c(NA_real_, NA_real_, 0) 202s > x[3, ] <- c(1, 0, 1) 202s > 202s > dimnames <- list(letters[1:3], LETTERS[1:3]) 202s > 202s > # Test with and without dimnames on x 202s > for (setDimnames in c(TRUE, FALSE)) { 202s + dimnames(x) <- if (setDimnames) dimnames else NULL 202s + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 202s + r1 <- rowAnys(x, value = 0, useNames = useNames) 202s + stopifnot(identical(r0, r1)) 202s + } 202s + } 202s > 202s 202s R version 4.4.3 (2025-02-28) -- "Trophy Case" 202s Copyright (C) 2025 The R Foundation for Statistical Computing 202s Platform: x86_64-pc-linux-gnu 202s 202s R is free software and comes with ABSOLUTELY NO WARRANTY. 202s You are welcome to redistribute it under certain conditions. 202s Type 'license()' or 'licence()' for distribution details. 202s 202s R is a collaborative project with many contributors. 202s Type 'contributors()' for more information and 202s 'citation()' on how to cite R or R packages in publications. 202s 202s Type 'demo()' for some demos, 'help()' for on-line help, or 202s 'help.start()' for an HTML browser interface to help. 202s Type 'q()' to quit R. 202s 202s > library("matrixStats") 202s > 202s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 202s + if (is.na(value)) { 202s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 202s + } else { 202s + y <- x == value 202s + 202s + # Preserve dimnames attribute 202s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 202s + if (!isTRUE(all.equal(dim(y), dim))) { 202s + dim(y) <- dim 202s + dimnames(y) <- dimnames(x) 202s + } 202s + 202s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 202s + } 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 202s + if (is.na(value)) { 202s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 202s + } else { 202s + y <- x == value 202s + 202s + # Preserve dimnames attribute 202s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 202s + if (!isTRUE(all.equal(dim(y), dim))) { 202s + dim(y) <- dim 202s + dimnames(y) <- dimnames(x) 202s + } 202s + 202s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 202s + } 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 202s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > 202s > all_R <- function(x, value = TRUE, ...) { 202s + if (is.na(value)) { 202s + all(is.na(x), ...) 202s + } else { 202s + all(x == value, ...) 202s + } 202s + } 202s > 202s > any_R <- function(x, value = TRUE, ...) { 202s + if (is.na(value)) { 202s + any(is.na(x), ...) 202s + } else { 202s + any(x == value, ...) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Subsetted tests 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > source("utils/validateIndicesFramework.R") 202s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 202s > storage.mode(x) <- "integer" 202s > x[2:3, ] <- NA_integer_ 202s > x[2, 1] <- 0L 202s > x[4:5, ] <- 0L 202s > x[4, 6] <- NA_integer_ 202s > 202s > # To check names attribute 202s > dimnames <- list(letters[1:6], LETTERS[1:6]) 202s > 202s > # Test with and without dimnames on x 202s > for (setDimnames in c(TRUE, FALSE)) { 202s + if (setDimnames) dimnames(x) <- dimnames 202s + else dimnames(x) <- NULL 202s + 202s + count <- 0L 202s + for (rows in index_cases) { 202s + for (cols in index_cases) { 202s + count <- count + 1L 202s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 202s + useNames <- c(TRUE, FALSE) 202s + useNames <- useNames[count %% length(useNames) + 1] 202s + 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAlls, fsure = rowAlls_R, 202s + value = 0, na.rm = TRUE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAlls, fsure = rowAlls_R, 202s + value = 0, na.rm = FALSE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAlls, fsure = rowAlls_R, 202s + value = NA_integer_, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAlls, fsure = rowAlls_R, 202s + value = 0, na.rm = TRUE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAlls, fsure = rowAlls_R, 202s + value = 0, na.rm = FALSE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAlls, fsure = rowAlls_R, 202s + value = NA_integer_, useNames = useNames) 202s + 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAnys, fsure = rowAnys_R, 202s + value = 0, na.rm = TRUE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAnys, fsure = rowAnys_R, 202s + value = 0, na.rm = FALSE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAnys, fsure = rowAnys_R, 202s + value = NA_integer_, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAnys, fsure = rowAnys_R, 202s + value = 0, na.rm = TRUE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAnys, fsure = rowAnys_R, 202s + value = 0, na.rm = FALSE, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAnys, fsure = rowAnys_R, 202s + value = NA_integer_, useNames = useNames) 202s + 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowAnyMissings, 202s + fsure = rowAnyMissings_R, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colAnyMissings, 202s + fsure = rowAnyMissings_R, useNames = useNames) 202s + } 202s + } 202s + } 203s > 203s > for (rr in seq_len(nrow(x))) { 203s + for (idxs in index_cases) { 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = allValue, fsure = all_R, 203s + value = 0, na.rm = TRUE) 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = allValue, fsure = all_R, 203s + value = 0, na.rm = FALSE) 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = allValue, fsure = all_R, 203s + value = NA_integer_) 203s + 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = anyValue, fsure = any_R, 203s + value = 0, na.rm = TRUE) 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = anyValue, fsure = any_R, 203s + value = 0, na.rm = FALSE) 203s + validateIndicesTestVector(x[rr, ], idxs, 203s + ftest = anyValue, fsure = any_R, 203s + value = NA_integer_) 203s + } 203s + } 203s > 203s > 203s > storage.mode(x) <- "character" 203s > # Test with and without dimnames on x 203s > for (setDimnames in c(TRUE, FALSE)) { 203s + if (setDimnames) dimnames(x) <- dimnames 203s + else dimnames(x) <- NULL 203s + for (rows in index_cases) { 203s + for (cols in index_cases) { 203s + # Check names attribute 203s + for (useNames in c(TRUE, FALSE)) { 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAlls, fsure = rowAlls_R, 203s + value = "0", na.rm = TRUE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAlls, fsure = rowAlls_R, 203s + value = "0", na.rm = FALSE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAlls, fsure = rowAlls_R, 203s + value = NA_character_, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAlls, fsure = rowAlls_R, 203s + value = "0", na.rm = TRUE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAlls, fsure = rowAlls_R, 203s + value = "0", na.rm = FALSE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAlls, fsure = rowAlls_R, 203s + value = NA_character_, useNames = useNames) 203s + 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAnys, fsure = rowAnys_R, 203s + value = "0", na.rm = TRUE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAnys, fsure = rowAnys_R, 203s + value = "0", na.rm = FALSE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAnys, fsure = rowAnys_R, 203s + value = NA_character_, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAnys, fsure = rowAnys_R, 203s + value = "0", na.rm = TRUE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAnys, fsure = rowAnys_R, 203s + value = "0", na.rm = FALSE, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAnys, fsure = rowAnys_R, 203s + value = NA_character_, useNames = useNames) 203s + 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowAnyMissings, 203s + fsure = rowAnyMissings_R, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + fcoltest = colAnyMissings, 203s + fsure = rowAnyMissings_R, useNames = useNames) 203s + } 203s + } 203s + } 203s + } 206s > 206s > for (rr in seq_len(nrow(x))) { 206s + for (idxs in index_cases) { 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = allValue, fsure = all_R, 206s + value = "0", na.rm = TRUE) 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = allValue, fsure = all_R, 206s + value = "0", na.rm = FALSE) 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = allValue, fsure = all_R, 206s + value = NA_integer_) 206s + 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = anyValue, fsure = any_R, 206s + value = "0", na.rm = TRUE) 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = anyValue, fsure = any_R, 206s + value = "0", na.rm = FALSE) 206s + validateIndicesTestVector(x[rr, ], idxs, 206s + ftest = anyValue, fsure = any_R, 206s + value = NA_integer_) 206s + } 206s + } 206s > 207s 207s R version 4.4.3 (2025-02-28) -- "Trophy Case" 207s Copyright (C) 2025 The R Foundation for Statistical Computing 207s Platform: x86_64-pc-linux-gnu 207s 207s R is free software and comes with ABSOLUTELY NO WARRANTY. 207s You are welcome to redistribute it under certain conditions. 207s Type 'license()' or 'licence()' for distribution details. 207s 207s R is a collaborative project with many contributors. 207s Type 'contributors()' for more information and 207s 'citation()' on how to cite R or R packages in publications. 207s 207s Type 'demo()' for some demos, 'help()' for on-line help, or 207s 'help.start()' for an HTML browser interface to help. 207s Type 'q()' to quit R. 207s 207s > library("matrixStats") 207s > 207s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 207s > rownames(X) <- LETTERS[1:nrow(X)] 207s > colnames(X) <- letters[1:ncol(X)] 207s > print(X) 207s a b c d e f 207s A -1.3044150 0.33644027 0.2524469 0.64994758 -0.83174257 0.06155486 207s B 0.7950073 0.48180096 -1.0896436 -1.07874353 -0.25633497 1.41490673 207s C -1.5009571 -0.60223595 0.5062055 -0.42918126 0.06504291 0.33894661 207s D 0.2205183 -0.11488093 0.9370991 1.18220363 -0.22370661 -0.64182891 207s E -0.7507351 -2.26013307 0.7205694 -0.96940854 -0.06425332 -2.28398137 207s F -0.3007563 -0.60337301 0.3986972 -1.83757573 -1.79830602 -0.45100800 207s G 1.1352295 0.45281677 1.3550457 -0.36361451 -1.76825497 0.10883577 207s H -0.5115650 0.11672002 -0.8436426 -0.51628020 -0.71931021 -0.61293445 207s I -0.2702834 1.01718217 -0.7154675 -0.76831919 -0.67594564 -0.52240089 207s J -0.1855491 -1.66643837 0.6115564 1.15329038 1.01657582 -0.04185847 207s K -1.9834611 0.68694061 1.3313534 -0.58636834 -0.50992978 -0.13509438 207s L -0.9532194 -0.07516376 -0.7448959 -0.44480944 -0.09545949 -0.57830877 207s M 0.3646970 0.53171225 1.2007105 0.97564111 0.16192781 -0.16397067 207s N -1.6467764 -0.45199525 -0.1750381 0.04097547 0.91639570 0.66266866 207s O -0.6605723 -0.44698204 1.0888995 1.62056733 0.16246653 -1.12246328 207s P -0.4512110 1.14501862 0.2521422 -0.25974260 -0.57861273 1.61602925 207s Q 0.8353186 -0.92375035 -0.5047205 -0.86370668 1.09349424 -0.40482243 207s R -1.1317843 -0.77771419 0.7062858 0.05866576 0.09253932 0.19761293 207s S 1.1491131 -0.77835872 -1.6590084 0.14893767 0.02203705 -0.62876957 207s T 0.2416236 -0.73720253 -1.4756296 -0.62316241 0.30324449 0.90866762 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Apply rowMeans() for 3 sets of 2 columns 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > nbr_of_sets <- 3L 207s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 207s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 207s > print(S) 207s s1 s2 s3 207s [1,] 1 3 5 207s [2,] 2 4 6 207s > 207s > Z <- rowAvgsPerColSet(X, S = S) 207s > print(Z) 207s s1 s2 s3 207s A -0.48398734 0.451197253 -0.385093853 207s B 0.63840413 -1.084193568 0.579285882 207s C -1.05159655 0.038512104 0.201994761 207s D 0.05281870 1.059651370 -0.432767758 207s E -1.50543410 -0.124419593 -1.174117345 207s F -0.45206466 -0.719439278 -1.124657012 207s G 0.79402315 0.495715613 -0.829709598 207s H -0.19742248 -0.679961418 -0.666122330 207s I 0.37344938 -0.741893360 -0.599173268 207s J -0.92599376 0.882423409 0.487358676 207s K -0.64826023 0.372492513 -0.322512078 207s L -0.51419156 -0.594852691 -0.336884128 207s M 0.44820462 1.088175800 -0.001021427 207s N -1.04938581 -0.067031298 0.789532182 207s O -0.55377716 1.354733439 -0.479998371 207s P 0.34690380 -0.003800192 0.518708258 207s Q -0.04421588 -0.684213609 0.344335903 207s R -0.95474925 0.382475758 0.145076123 207s S 0.18537721 -0.755035343 -0.303366262 207s T -0.24778949 -1.049396004 0.605956059 207s > 207s > # Validation 207s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 207s + s3 = rowMeans(X[, 5:6])) 207s > stopifnot(identical(drop(Z), Z0)) 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Apply colMeans() for 5 sets of 4 rows 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > nbr_of_sets <- 5L 207s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 207s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 207s > print(S) 207s s1 s2 s3 s4 s5 207s [1,] 1 5 9 13 17 207s [2,] 2 6 10 14 18 207s [3,] 3 7 11 15 19 207s [4,] 4 8 12 16 20 207s > 207s > Z <- colAvgsPerRowSet(X, S = S) 207s > print(Z) 207s a b c d e f 207s s1 -0.4474616 0.025281088 0.1515270 0.08105661 -0.31168531 0.29339482 207s s2 -0.1069567 -0.573492322 0.4076674 -0.92171975 -1.08753113 -0.80977201 207s s3 -0.8481282 -0.009369839 0.1206366 -0.16155165 -0.06618977 -0.31941563 207s s4 -0.5984657 0.194438396 0.5916785 0.59436033 0.16554433 0.24806599 207s s5 0.2735677 -0.804256447 -0.7332682 -0.31981642 0.37782878 0.01817214 207s > 207s > # Validation 207s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 207s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 207s + s5 = colMeans(X[17:20, ])) 207s > stopifnot(identical(drop(Z), Z0)) 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # When there is only one "complete" set 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > nbr_of_sets <- 1L 207s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 207s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 207s > print(S) 207s s1 207s [1,] 1 207s [2,] 2 207s [3,] 3 207s [4,] 4 207s [5,] 5 207s [6,] 6 207s > 207s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 207s > print(Z) 207s s1 207s A -0.13929465 207s B 0.04449881 207s C -0.27036323 207s D 0.22656744 207s E -0.93465701 207s F -0.76538698 207s G 0.15334305 207s H -0.51450207 207s I -0.32253908 207s J 0.14792944 207s K -0.19942660 207s L -0.48197613 207s M 0.51178633 207s N -0.10896164 207s O 0.10698597 207s P 0.28727062 207s Q -0.12803119 207s R -0.14239912 207s S -0.29100813 207s T -0.23040981 207s > 207s > Z0 <- rowMeans(X) 207s > stopifnot(identical(drop(Z), Z0)) 207s > 207s > 207s > nbr_of_sets <- 1L 207s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 207s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 207s > print(S) 207s s1 207s [1,] 1 207s [2,] 2 207s [3,] 3 207s [4,] 4 207s [5,] 5 207s [6,] 6 207s [7,] 7 207s [8,] 8 207s [9,] 9 207s [10,] 10 207s [11,] 11 207s [12,] 12 207s [13,] 13 207s [14,] 14 207s [15,] 15 207s [16,] 16 207s [17,] 17 207s [18,] 18 207s [19,] 19 207s [20,] 20 207s > 207s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 207s > print(Z) 207s a b c d e f 207s s1 -0.3454889 -0.2334798 0.1076483 -0.1455342 -0.1844066 -0.1139109 207s > 207s > Z0 <- colMeans(X) 207s > stopifnot(identical(drop(Z), Z0)) 207s > 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Use weights 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > nbr_of_sets <- 3L 207s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 207s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 207s > print(S) 207s s1 s2 s3 207s [1,] 1 3 5 207s [2,] 2 4 6 207s > 207s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 207s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 207s > print(Z1) 207s s1 s2 s3 207s A -0.48398734 0.451197253 -0.385093853 207s B 0.63840413 -1.084193568 0.579285882 207s C -1.05159655 0.038512104 0.201994761 207s D 0.05281870 1.059651370 -0.432767758 207s E -1.50543410 -0.124419593 -1.174117345 207s F -0.45206466 -0.719439278 -1.124657012 207s G 0.79402315 0.495715613 -0.829709598 207s H -0.19742248 -0.679961418 -0.666122330 207s I 0.37344938 -0.741893360 -0.599173268 207s J -0.92599376 0.882423409 0.487358676 207s K -0.64826023 0.372492513 -0.322512078 207s L -0.51419156 -0.594852691 -0.336884128 207s M 0.44820462 1.088175800 -0.001021427 207s N -1.04938581 -0.067031298 0.789532182 207s O -0.55377716 1.354733439 -0.479998371 207s P 0.34690380 -0.003800192 0.518708258 207s Q -0.04421588 -0.684213609 0.344335903 207s R -0.95474925 0.382475758 0.145076123 207s S 0.18537721 -0.755035343 -0.303366262 207s T -0.24778949 -1.049396004 0.605956059 207s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 207s > print(Z2) 207s a b c d e f 207s s1 -0.2547038 0.4091206 -0.4185983 -0.2143980 -0.54403877 0.7382308 207s s2 -0.6402194 -0.3585584 0.7216523 0.3765112 -0.07933185 -0.1514411 207s s3 -0.5257457 -1.4317530 0.5596333 -1.4034921 -0.93127967 -1.3674947 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Result should always be a matrix, including when nrow(X) <= 1 207s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 207s > S <- matrix(1, nrow = 1L, ncol = 1L) 207s > Z1 <- rowAvgsPerColSet(X, S = S) 207s > stopifnot(is.matrix(Z1)) 207s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 207s > stopifnot(is.matrix(Z2)) 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Works with many, one or zero columns / rows 207s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > S <- cbind(1:2, 3:4, 5:6) 207s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 207s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 207s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 207s + colSums2(X[S[,2], ,drop=FALSE]), 207s + colSums2(X[S[,3], ,drop=FALSE])) 207s > stopifnot(identical(Z2, Z2_ref)) 207s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 207s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 207s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 207s + colSums2(X[S[,2], ,drop=FALSE]), 207s + colSums2(X[S[,3], ,drop=FALSE])) 207s > stopifnot(identical(Z1, Z1_ref)) 207s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 207s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 207s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 207s > stopifnot(identical(Z0, unname(Z0_ref))) 207s > 207s > 207s > S <- rbind(1:4, 5:8) 207s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 207s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 207s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 207s + rowMeans2(X[,S[,2],drop=FALSE]), 207s + rowMeans2(X[,S[,3],drop=FALSE]), 207s + rowMeans2(X[,S[,4],drop=FALSE])) 207s > stopifnot(identical(Z2, Z2_ref)) 207s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 207s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 207s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 207s + rowMeans2(X[,S[,2],drop=FALSE]), 207s + rowMeans2(X[,S[,3],drop=FALSE]), 207s + rowMeans2(X[,S[,4],drop=FALSE])) 207s > stopifnot(identical(Z1, Z1_ref)) 207s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 207s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 207s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 207s > stopifnot(identical(Z0, Z0_ref)) 207s > 207s 207s R version 4.4.3 (2025-02-28) -- "Trophy Case" 207s Copyright (C) 2025 The R Foundation for Statistical Computing 207s Platform: x86_64-pc-linux-gnu 207s 207s R is free software and comes with ABSOLUTELY NO WARRANTY. 207s You are welcome to redistribute it under certain conditions. 207s Type 'license()' or 'licence()' for distribution details. 207s 207s R is a collaborative project with many contributors. 207s Type 'contributors()' for more information and 207s 'citation()' on how to cite R or R packages in publications. 207s 207s Type 'demo()' for some demos, 'help()' for on-line help, or 207s 'help.start()' for an HTML browser interface to help. 207s Type 'q()' to quit R. 207s 207s > library("matrixStats") 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Subsetted tests 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > source("utils/validateIndicesFramework.R") 207s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 207s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 207s > for (rows in index_cases) { 207s + for (cols in index_cases) { 207s + if (is.null(rows)) { 207s + rows <- seq_len(nrow(x)) 207s + rows_finite <- rows 207s + } else { 207s + rows_finite <- rows[is.finite(rows)] 207s + } 207s + 207s + if (is.null(cols)) { 207s + cols <- seq_len(ncol(x)) 207s + cols_finite <- cols 207s + } else { 207s + cols_finite <- cols[is.finite(cols)] 207s + } 207s + 207s + suppressWarnings({ 207s + actual <- tryCatch({ 207s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 207s + FUN = rowMeans) 207s + }, error = function(c) "error") 207s + expect <- tryCatch({ 207s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 207s + }, error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(as.vector(actual), expect)) 207s + 207s + suppressWarnings({ 207s + actual <- tryCatch({ 207s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 207s + FUN = colMeans) 207s + }, error = function(c) "error") 207s + expect <- tryCatch({ 207s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 207s + }, error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(as.vector(actual), expect)) 207s + } 207s + } 207s > 207s 207s R version 4.4.3 (2025-02-28) -- "Trophy Case" 207s Copyright (C) 2025 The R Foundation for Statistical Computing 207s Platform: x86_64-pc-linux-gnu 207s 207s R is free software and comes with ABSOLUTELY NO WARRANTY. 207s You are welcome to redistribute it under certain conditions. 207s Type 'license()' or 'licence()' for distribution details. 207s 207s R is a collaborative project with many contributors. 207s Type 'contributors()' for more information and 207s 'citation()' on how to cite R or R packages in publications. 207s 207s Type 'demo()' for some demos, 'help()' for on-line help, or 207s 'help.start()' for an HTML browser interface to help. 207s Type 'q()' to quit R. 207s 207s > library("matrixStats") 207s > 207s > x <- matrix(1:27, ncol = 3) 207s > 207s > # To check names attribute 207s > dimnames <- list(letters[1:9], LETTERS[1:3]) 207s > 207s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 207s + res <- x[, idxs] 207s + # Preserve names attribute? 207s + if (!useNames) names(res) <- NULL 207s + res 207s + } 207s > 207s > idxs <- 1L 207s > # Test with and without dimnames on x 207s > for (setDimnames in c(TRUE, FALSE)) { 207s + if (setDimnames) dimnames(x) <- dimnames 207s + else dimnames(x) <- NULL 207s + # Check names attribute 207s + for (useNames in c(TRUE, FALSE)) { 207s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 207s + y <- rowCollapse(x, idxs, useNames = useNames) 207s + stopifnot(identical(y, y_truth)) 207s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 207s + stopifnot(identical(y2, y)) 207s + } 207s + } 207s > 207s > idxs <- 2L 207s > # Test with and without dimnames on x 207s > for (setDimnames in c(TRUE, FALSE)) { 207s + if (setDimnames) dimnames(x) <- dimnames 207s + else dimnames(x) <- NULL 207s + # Check names attribute 207s + for (useNames in c(TRUE, FALSE)) { 207s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 207s + y <- rowCollapse(x, idxs, useNames = useNames) 207s + stopifnot(identical(y, y_truth)) 207s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 207s + stopifnot(identical(y2, y)) 207s + } 207s + } 207s > 207s > 207s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 207s + res <- c(x[1:5, 1], x[6:9, 3]) 207s + # Preserve names attribute? 207s + if (!useNames) names(res) <- NULL 207s + res 207s + } 207s > 207s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 207s > # Test with and without dimnames on x 207s > for (setDimnames in c(TRUE, FALSE)) { 207s + if (setDimnames) dimnames(x) <- dimnames 207s + else dimnames(x) <- NULL 207s + # Check names attribute 207s + for (useNames in c(TRUE, FALSE)) { 207s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 207s + y <- rowCollapse(x, idxs, useNames = useNames) 207s + stopifnot(identical(y, y_truth)) 207s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 207s + stopifnot(identical(y2, y)) 207s + } 207s + } 207s > 207s > 207s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 207s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 207s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 207s + # Preserve names attribute? 207s + if (useNames) { 207s + names <- rownames(x) 207s + if (!is.null(names)) names(res) <- names 207s + } 207s + res 207s + } 207s > 207s > idxs <- 1:3 207s > # Test with and without dimnames on x 207s > for (setDimnames in c(TRUE, FALSE)) { 207s + if (setDimnames) dimnames(x) <- dimnames 207s + else dimnames(x) <- NULL 207s + # Check names attribute 207s + for (useNames in c(TRUE, FALSE)) { 207s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 207s + y <- rowCollapse(x, idxs, useNames = useNames) 207s + stopifnot(identical(y, y_truth)) 207s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 207s + stopifnot(identical(y2, y)) 207s + } 207s + } 207s > 207s 207s R version 4.4.3 (2025-02-28) -- "Trophy Case" 207s Copyright (C) 2025 The R Foundation for Statistical Computing 207s Platform: x86_64-pc-linux-gnu 207s 207s R is free software and comes with ABSOLUTELY NO WARRANTY. 207s You are welcome to redistribute it under certain conditions. 207s Type 'license()' or 'licence()' for distribution details. 207s 207s R is a collaborative project with many contributors. 207s Type 'contributors()' for more information and 207s 'citation()' on how to cite R or R packages in publications. 207s 207s Type 'demo()' for some demos, 'help()' for on-line help, or 207s 'help.start()' for an HTML browser interface to help. 207s Type 'q()' to quit R. 207s 207s > library("matrixStats") 207s > 207s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 207s + ans <- c() 207s + storage.mode(ans) <- storage.mode(x) 207s + for (ii in seq_len(length(idxs))) { 207s + ans[ii] <- x[ii, idxs[ii]] 207s + } 207s + 207s + # Preserve names attribute 207s + if (useNames) { 207s + names <- rownames(x) 207s + if (!is.null(names)) names(ans) <- names 207s + } 207s + 207s + ans 207s + } 207s > 207s > 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > # Subsetted tests 207s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 207s > source("utils/validateIndicesFramework.R") 207s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 207s > storage.mode(x) <- "integer" 207s > 207s > # To check names attribute 207s > dimnames <- list(letters[1:6], LETTERS[1:6]) 207s > 207s > for (rows in index_cases) { 207s + if (is.null(rows)) rows <- seq_len(nrow(x)) 207s + 207s + for (idxs in list(2L, seq_len(6L))) { 207s + for (useNames in c(TRUE, FALSE)) { 207s + suppressWarnings({ 207s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 207s + error = function(c) "error") 207s + expect <- tryCatch({ 207s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 207s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 207s + }, error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(actual, expect)) 207s + 207s + suppressWarnings({ 207s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 207s + error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(actual, expect)) 207s + 207s + # Check names attribute 207s + dimnames(x) <- dimnames 207s + suppressWarnings({ 207s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 207s + error = function(c) "error") 207s + expect <- tryCatch({ 207s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 207s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 207s + }, error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(actual, expect)) 207s + 207s + suppressWarnings({ 207s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 207s + error = function(c) "error") 207s + }) 207s + stopifnot(all.equal(actual, expect)) 207s + 207s + dimnames(x) <- NULL 207s + } 207s + } 207s + } 207s > 208s 208s R version 4.4.3 (2025-02-28) -- "Trophy Case" 208s Copyright (C) 2025 The R Foundation for Statistical Computing 208s Platform: x86_64-pc-linux-gnu 208s 208s R is free software and comes with ABSOLUTELY NO WARRANTY. 208s You are welcome to redistribute it under certain conditions. 208s Type 'license()' or 'licence()' for distribution details. 208s 208s R is a collaborative project with many contributors. 208s Type 'contributors()' for more information and 208s 'citation()' on how to cite R or R packages in publications. 208s 208s Type 'demo()' for some demos, 'help()' for on-line help, or 208s 'help.start()' for an HTML browser interface to help. 208s Type 'q()' to quit R. 208s 208s > library("matrixStats") 208s > 208s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 208s + if (is.na(value)) { 208s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 208s + sum(is.na(x)) 208s + ) 208s + } else { 208s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 208s + sum(x == value, na.rm = na.rm) 208s + ) 208s + } 208s + # Preserve names attribute 208s + names <- names(counts) 208s + counts <- as.integer(counts) 208s + if (useNames && !is.null(names)) names(counts) <- names 208s + counts 208s + } 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Data type: integer and numeric 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > for (mode in c("integer", "double")) { 208s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 208s + x[sample.int(length(x), size = 7L)] <- 0 208s + storage.mode(x) <- mode 208s + 208s + dimnames = list(letters[1:10], LETTERS[1:5]) 208s + 208s + # Test with and without dimnames on x 208s + for (setDimnames in c(TRUE, FALSE)) { 208s + if (setDimnames) dimnames(x) <- dimnames 208s + else dimnames(x) <- NULL 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + # Count zeros 208s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + 208s + # Count NAs 208s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + 208s + if (mode == "integer") { 208s + ux <- unique(as.vector(x)) 208s + r0 <- r1 <- r2 <- integer(nrow(x)) 208s + for (value in ux) { 208s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 208s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 208s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + } 208s + stopifnot(all(r0 == ncol(x))) 208s + } # if (mode == "integer") 208s + } # for (useNames ...) 208s + } # for (na.rm ...) 208s + } # for (setDimnames ...) 208s + } # for (mode ...) 208s > 208s > 208s > # All NAs 208s > na_list <- list(NA_integer_, NA_real_, NaN) 208s > for (na_value in na_list) { 208s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 208s + # Test with and without dimnames on x 208s + for (setDimnames in c(TRUE, FALSE)) { 208s + if (setDimnames) dimnames(x) <- dimnames 208s + else dimnames(x) <- NULL 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + 208s + # Count NAs 208s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 208s + stopifnot(all(r0 == ncol(x))) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + } 208s + } 208s + } 208s + } # for (na_value ...) 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Data type: logical 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 208s > x[7:8, 2:3] <- TRUE 208s > x[1:3, ] <- TRUE 208s > x[, 1] <- TRUE 208s > x[4, ] <- FALSE 208s > x[, 4] <- FALSE 208s > x[2, ] <- FALSE 208s > x[3, ] <- TRUE 208s > 208s > # To check names attribute 208s > dimnames <- list(letters[1:10], LETTERS[1:4]) 208s > 208s > # Test with and without dimnames on x 208s > for (setDimnames in c(TRUE, FALSE)) { 208s + if (setDimnames) dimnames(x) <- dimnames 208s + else dimnames(x) <- NULL 208s + # Row/column counts 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + 208s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 208s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 208s + stopifnot(r_true + r_false == ncol(x)) 208s + 208s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 208s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 208s + stopifnot(c_true + c_false == nrow(x)) 208s + 208s + # Count NAs 208s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 208s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + } 208s + } 208s + } 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Data type: character (not sure if this should be supported) 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 208s > x[2:3, 3:4] <- NA_character_ 208s > 208s > # Row/column counts 208s > for (na.rm in c(FALSE, TRUE)) { 208s + for (value in c("g", NA_character_)) { 208s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 208s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 208s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 208s + stopifnot(identical(r1, r0)) 208s + stopifnot(identical(r2, r0)) 208s + 208s + c <- count(x[1, ], value = value, na.rm = na.rm) 208s + stopifnot(identical(c, r1[1])) 208s + 208s + c <- count(x[2, ], value = value, na.rm = na.rm) 208s + stopifnot(identical(c, r1[2])) 208s + } 208s + } 208s > 208s > # NA row 208s > x <- matrix(0, nrow = 2L, ncol = 2L) 208s > x[1, ] <- NA_integer_ 208s > 208s > dimnames <- list(letters[1:2], LETTERS[1:2]) 208s > 208s > # Test with and without dimnames on x 208s > for (setDimnames in c(TRUE, FALSE)) { 208s + if (setDimnames) dimnames(x) <- dimnames 208s + else dimnames(x) <- NULL 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + r0 <- rowCounts(x, value = 0, useNames = useNames) 208s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 208s + stopifnot(identical(r0, r1)) 208s + } 208s + } 208s > 208s 208s R version 4.4.3 (2025-02-28) -- "Trophy Case" 208s Copyright (C) 2025 The R Foundation for Statistical Computing 208s Platform: x86_64-pc-linux-gnu 208s 208s R is free software and comes with ABSOLUTELY NO WARRANTY. 208s You are welcome to redistribute it under certain conditions. 208s Type 'license()' or 'licence()' for distribution details. 208s 208s R is a collaborative project with many contributors. 208s Type 'contributors()' for more information and 208s 'citation()' on how to cite R or R packages in publications. 208s 208s Type 'demo()' for some demos, 'help()' for on-line help, or 208s 'help.start()' for an HTML browser interface to help. 208s Type 'q()' to quit R. 208s 208s > library("matrixStats") 208s > 208s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 208s + if (is.na(value)) { 208s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 208s + sum(is.na(x)) 208s + ) 208s + } else { 208s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 208s + sum(x == value, na.rm = na.rm) 208s + ) 208s + } 208s + # Preserve names attribute 208s + names <- names(counts) 208s + counts <- as.integer(counts) 208s + if (useNames && !is.null(names)) names(counts) <- names 208s + counts 208s + } # rowCounts_R() 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Subsetted tests 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > source("utils/validateIndicesFramework.R") 208s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 208s > x[2:3, 3:4] <- NA_real_ 208s > storage.mode(x) <- "integer" 208s > 208s > # To check names attribute 208s > dimnames <- list(letters[1:6], LETTERS[1:6]) 208s > 208s > # Test with and without dimnames on x 208s > for (setDimnames in c(TRUE, FALSE)) { 208s + if (setDimnames) dimnames(x) <- dimnames 208s + else dimnames(x) <- NULL 208s + for (rows in index_cases) { 208s + for (cols in index_cases) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + validateIndicesTestMatrix(x, rows, cols, 208s + ftest = rowCounts, fsure = rowCounts_R, 208s + value = 0, na.rm = TRUE, useNames = useNames) 208s + validateIndicesTestMatrix(x, rows, cols, 208s + fcoltest = colCounts, fsure = rowCounts_R, 208s + value = 0, na.rm = TRUE, useNames = useNames) 208s + for (value in c(0, NA_integer_)) { 208s + validateIndicesTestMatrix(x, rows, cols, 208s + ftest = rowCounts, fsure = rowCounts_R, 208s + value = value, useNames = useNames) 208s + validateIndicesTestMatrix(x, rows, cols, 208s + fcoltest = colCounts, fsure = rowCounts_R, 208s + value = value, useNames = useNames) 208s + } 208s + } 208s + } 208s + } 208s + } 209s > 209s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 209s > x[2:3, 3:4] <- NA_character_ 209s > # Test with and without dimnames on x 209s > for (setDimnames in c(TRUE, FALSE)) { 209s + if (setDimnames) dimnames(x) <- dimnames 209s + else dimnames(x) <- NULL 209s + 209s + count <- 0L 209s + for (rows in index_cases) { 209s + for (cols in index_cases) { 209s + count <- count + 1L 209s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 209s + useNames <- c(TRUE, FALSE) 209s + useNames <- useNames[count %% length(useNames) + 1] 209s + 209s + validateIndicesTestMatrix(x, rows, cols, 209s + ftest = rowCounts, fsure = rowCounts_R, 209s + value = "g", na.rm = TRUE, useNames = useNames) 209s + validateIndicesTestMatrix(x, rows, cols, 209s + fcoltest = colCounts, fsure = rowCounts_R, 209s + value = "g", na.rm = TRUE, useNames = useNames) 209s + for (value in c("g", NA_character_)) { 209s + validateIndicesTestMatrix(x, rows, cols, 209s + ftest = rowCounts, fsure = rowCounts_R, 209s + value = value, useNames = useNames) 209s + validateIndicesTestMatrix(x, rows, cols, 209s + fcoltest = colCounts, fsure = rowCounts_R, 209s + value = value, useNames = useNames) 209s + } 209s + } 209s + } 209s + } 210s > 210s 210s R version 4.4.3 (2025-02-28) -- "Trophy Case" 210s Copyright (C) 2025 The R Foundation for Statistical Computing 210s Platform: x86_64-pc-linux-gnu 210s 210s R is free software and comes with ABSOLUTELY NO WARRANTY. 210s You are welcome to redistribute it under certain conditions. 210s Type 'license()' or 'licence()' for distribution details. 210s 210s R is a collaborative project with many contributors. 210s Type 'contributors()' for more information and 210s 'citation()' on how to cite R or R packages in publications. 210s 210s Type 'demo()' for some demos, 'help()' for on-line help, or 210s 'help.start()' for an HTML browser interface to help. 210s Type 'q()' to quit R. 210s 210s > library("matrixStats") 210s > 210s > rowCummins_R <- function(x, ..., useNames = TRUE) { 210s + suppressWarnings({ 210s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 210s + }) 210s + 210s + # Preserve dimnames attribute? 210s + dim(y) <- dim(x) 210s + dimnames(y) <- if (useNames) dimnames(x) else NULL 210s + y 210s + } 210s > 210s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 210s + mode <- storage.mode(x) 210s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 210s + storage.mode(x) <- "numeric" 210s + suppressWarnings({ 210s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 210s + }) 210s + 210s + # Preserve dimnames attribute? 210s + dim(y) <- dim(x) 210s + dimnames(y) <- if (useNames) dimnames(x) else NULL 210s + 210s + y 210s + } 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # With and without some NAs 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > for (mode in c("logical", "integer", "double")) { 210s + for (add_na in c(FALSE, TRUE)) { 210s + cat("add_na = ", add_na, "\n", sep = "") 210s + 210s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 210s + diag(x) <- 0 210s + if (add_na) { 210s + x[3:7, c(2, 4)] <- NA_real_ 210s + } 210s + cat("mode: ", mode, "\n", sep = "") 210s + storage.mode(x) <- mode 210s + str(x) 210s + 210s + # To check dimnames attribute 210s + dimnames <- list(letters[1:10], LETTERS[1:5]) 210s + 210s + # Test with and without dimnames on x 210s + for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) dimnames(x) <- dimnames 210s + else dimnames(x) <- NULL 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + # Row/column ranges 210s + r0 <- rowCummins_R(x, useNames = useNames) 210s + r1 <- rowCummins(x, useNames = useNames) 210s + r2 <- t(colCummins(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + 210s + r0 <- rowCummaxs_R(x, useNames = useNames) 210s + r1 <- rowCummaxs(x, useNames = useNames) 210s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + } # for (useNames ...) 210s + } # for (setDimnames ...) 210s + } # for (add_na ...) 210s + } # for (mode ...) 210s add_na = FALSE 210s mode: logical 210s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 210s add_na = TRUE 210s mode: logical 210s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 210s add_na = FALSE 210s mode: integer 210s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 210s add_na = TRUE 210s mode: integer 210s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 210s add_na = FALSE 210s mode: double 210s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 210s add_na = TRUE 210s mode: double 210s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # All NAs 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > for (mode in c("logical", "integer", "double")) { 210s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 210s + cat("mode: ", mode, "\n", sep = "") 210s + storage.mode(x) <- mode 210s + str(x) 210s + 210s + # Test with and without dimnames on x 210s + for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) dimnames(x) <- dimnames 210s + else dimnames(x) <- NULL 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + r0 <- rowCummins_R(x, useNames = useNames) 210s + r1 <- rowCummins(x, useNames = useNames) 210s + r2 <- t(colCummins(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + 210s + r0 <- rowCummaxs_R(x, useNames = useNames) 210s + r1 <- rowCummaxs(x, useNames = useNames) 210s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + } # for (useNames ...) 210s + } # for (setDimnames ...) 210s + } # for (mode ...) 210s mode: logical 210s logi [1:10, 1:5] NA NA NA NA NA NA ... 210s mode: integer 210s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 210s mode: double 210s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # A 1x1 matrix 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > for (mode in c("logical", "integer", "double")) { 210s + x <- matrix(0, nrow = 1L, ncol = 1L) 210s + cat("mode: ", mode, "\n", sep = "") 210s + storage.mode(x) <- mode 210s + str(x) 210s + 210s + # To check dimnames attribute 210s + dimnames <- list("a", "A") 210s + 210s + # Test with and without dimnames on x 210s + for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) dimnames(x) <- dimnames 210s + else dimnames(x) <- NULL 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + r0 <- rowCummins_R(x, useNames = useNames) 210s + r1 <- rowCummins(x, useNames = useNames) 210s + r2 <- t(colCummins(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + 210s + r0 <- rowCummaxs_R(x, useNames = useNames) 210s + r1 <- rowCummaxs(x, useNames = useNames) 210s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + } # for (useNames ...) 210s + } # for (setDimnames ...) 210s + } # for (mode ...) 210s mode: logical 210s logi [1, 1] FALSE 210s mode: integer 210s int [1, 1] 0 210s mode: double 210s num [1, 1] 0 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # Corner cases 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > for (mode in c("logical", "integer", "double")) { 210s + cat("mode: ", mode, "\n", sep = "") 210s + value <- 0 210s + storage.mode(value) <- mode 210s + value0 <- if (mode == "logical") 0L else value 210s + 210s + # A 0x0 matrix 210s + x <- matrix(value, nrow = 0L, ncol = 0L) 210s + str(x) 210s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 210s + r1 <- rowCummins(x) 210s + r2 <- t(colCummins(t(x))) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + 210s + # A 0xK matrix 210s + x <- matrix(value, nrow = 0L, ncol = 5L) 210s + str(x) 210s + colnames <- LETTERS[1:5] 210s + # Test with and without dimnames on x 210s + for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) colnames(x) <- colnames 210s + else dimnames(x) <- NULL 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + r0 <- rowCummins_R(x, useNames = useNames) 210s + r1 <- rowCummins(x, useNames = useNames) 210s + r2 <- t(colCummins(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + r0 <- rowCummaxs_R(x, useNames = useNames) 210s + r1 <- rowCummaxs(x, useNames = useNames) 210s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + } # for (useNames ...) 210s + } # for (setDimnames ...) 210s + 210s + # A Nx0 matrix 210s + x <- matrix(value, nrow = 5L, ncol = 0L) 210s + str(x) 210s + rownames <- LETTERS[1:5] 210s + # Test with and without dimnames on x 210s + for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) rownames(x) <- rownames 210s + else dimnames(x) <- NULL 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + r0 <- rowCummins_R(x, useNames = useNames) 210s + r1 <- rowCummins(x, useNames = useNames) 210s + r2 <- t(colCummins(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + 210s + r0 <- rowCummaxs_R(x, useNames = useNames) 210s + r1 <- rowCummaxs(x, useNames = useNames) 210s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 210s + stopifnot(all.equal(r1, r2)) 210s + stopifnot(all.equal(r1, r0)) 210s + stopifnot(all.equal(r2, r0)) 210s + } # for (useNames ...) 210s + } # for (setDimnames ...) 210s + } # for (mode ...) 210s mode: logical 210s logi[0 , 0 ] 210s logi[0 , 1:5] 210s logi[1:5, 0 ] 210s mode: integer 210s int[0 , 0 ] 210s int[0 , 1:5] 210s int[1:5, 0 ] 210s mode: double 210s num[0 , 0 ] 210s num[0 , 1:5] 210s num[1:5, 0 ] 210s > 210s 210s R version 4.4.3 (2025-02-28) -- "Trophy Case" 210s Copyright (C) 2025 The R Foundation for Statistical Computing 210s Platform: x86_64-pc-linux-gnu 210s 210s R is free software and comes with ABSOLUTELY NO WARRANTY. 210s You are welcome to redistribute it under certain conditions. 210s Type 'license()' or 'licence()' for distribution details. 210s 210s R is a collaborative project with many contributors. 210s Type 'contributors()' for more information and 210s 'citation()' on how to cite R or R packages in publications. 210s 210s Type 'demo()' for some demos, 'help()' for on-line help, or 210s 'help.start()' for an HTML browser interface to help. 210s Type 'q()' to quit R. 210s 210s > library("matrixStats") 210s > 210s > rowCummins_R <- function(x, ..., useNames = TRUE) { 210s + suppressWarnings({ 210s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 210s + }) 210s + 210s + # Preserve dimnames attribute? 210s + dim(y) <- dim(x) 210s + dimnames(y) <- if (useNames) dimnames(x) else NULL 210s + 210s + y 210s + } 210s > 210s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 210s + mode <- storage.mode(x) 210s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 210s + storage.mode(x) <- "numeric" 210s + suppressWarnings({ 210s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 210s + }) 210s + 210s + # Preserve dimnames attribute? 210s + dim(y) <- dim(x) 210s + dimnames(y) <- if (useNames) dimnames(x) else NULL 210s + 210s + storage.mode(y) <- mode 210s + y 210s + } 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # Subsetted tests 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > source("utils/validateIndicesFramework.R") 210s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 210s > storage.mode(x) <- "integer" 210s > 210s > # To check dimnames attribute 210s > dimnames <- list(letters[1:6], LETTERS[1:6]) 210s > 210s > # Test with and without dimnames on x 210s > for (setDimnames in c(TRUE, FALSE)) { 210s + if (setDimnames) dimnames(x) <- dimnames 210s + else dimnames(x) <- NULL 210s + for (rows in index_cases) { 210s + for (cols in index_cases) { 210s + # Check names attribute 210s + for (useNames in c(TRUE, FALSE)) { 210s + validateIndicesTestMatrix(x, rows, cols, 210s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 210s + validateIndicesTestMatrix(x, rows, cols, 210s + ftest = function(x, rows, cols, ..., useNames) { 210s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 210s + }, fsure = rowCummins_R, useNames = useNames) 210s + 210s + validateIndicesTestMatrix(x, rows, cols, 210s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 210s + validateIndicesTestMatrix(x, rows, cols, 210s + ftest = function(x, rows, cols, ..., useNames) { 210s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 210s + }, fsure = rowCummaxs_R, useNames = useNames) 210s + } 210s + } 210s + } 210s + } 212s > 212s 212s R version 4.4.3 (2025-02-28) -- "Trophy Case" 212s Copyright (C) 2025 The R Foundation for Statistical Computing 212s Platform: x86_64-pc-linux-gnu 212s 212s R is free software and comes with ABSOLUTELY NO WARRANTY. 212s You are welcome to redistribute it under certain conditions. 212s Type 'license()' or 'licence()' for distribution details. 212s 212s R is a collaborative project with many contributors. 212s Type 'contributors()' for more information and 212s 'citation()' on how to cite R or R packages in publications. 212s 212s Type 'demo()' for some demos, 'help()' for on-line help, or 212s 'help.start()' for an HTML browser interface to help. 212s Type 'q()' to quit R. 212s 212s > library("matrixStats") 212s > 212s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 212s + suppressWarnings({ 212s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 212s + }) 212s + 212s + # Preserve dimnames attribute? 212s + dim(y) <- dim(x) 212s + dimnames(y) <- if (useNames) dimnames(x) else NULL 212s + 212s + y 212s + } 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # With and without some NAs 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (mode in c("logical", "integer", "double")) { 212s + for (add_na in c(FALSE, TRUE)) { 212s + cat("add_na = ", add_na, "\n", sep = "") 212s + 212s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 212s + if (add_na) { 212s + x[3:7, c(2, 4)] <- NA_real_ 212s + } 212s + cat("mode: ", mode, "\n", sep = "") 212s + storage.mode(x) <- mode 212s + str(x) 212s + 212s + # To check dimnames attribute 212s + dimnames <- list(letters[1:10], LETTERS[1:5]) 212s + 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) dimnames(x) <- dimnames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + # Row/column ranges 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(colCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + } # for (add_na ...) 212s + } # for (mode ...) 212s add_na = FALSE 212s mode: logical 212s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 212s add_na = TRUE 212s mode: logical 212s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 212s add_na = FALSE 212s mode: integer 212s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 212s add_na = TRUE 212s mode: integer 212s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 212s add_na = FALSE 212s mode: double 212s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 212s add_na = TRUE 212s mode: double 212s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # All NAs 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (mode in c("logical", "integer", "double")) { 212s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 212s + cat("mode: ", mode, "\n", sep = "") 212s + storage.mode(x) <- mode 212s + str(x) 212s + 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) dimnames(x) <- dimnames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + # Row/column ranges 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(colCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + } # for (mode ...) 212s mode: logical 212s logi [1:10, 1:5] NA NA NA NA NA NA ... 212s mode: integer 212s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 212s mode: double 212s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # A 1x1 matrix 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (mode in c("logical", "integer", "double")) { 212s + x <- matrix(0, nrow = 1L, ncol = 1L) 212s + cat("mode: ", mode, "\n", sep = "") 212s + storage.mode(x) <- mode 212s + str(x) 212s + 212s + dimnames <- list("a", "A") 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) dimnames(x) <- dimnames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + # Row/column ranges 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(colCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + } 212s mode: logical 212s logi [1, 1] FALSE 212s mode: integer 212s int [1, 1] 0 212s mode: double 212s num [1, 1] 0 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (mode in c("logical", "integer", "double")) { 212s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 212s + x[1, 2] <- 0 212s + x[2, 2] <- 1 212s + x[3, 1] <- 0 212s + storage.mode(x) <- mode 212s + cat("mode: ", mode, "\n", sep = "") 212s + str(x) 212s + 212s + dimnames <- list(letters[1:3], LETTERS[1:2]) 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) dimnames(x) <- dimnames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + # Row/column ranges 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(colCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + } 212s mode: logical 212s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 212s mode: integer 212s int [1:3, 1:2] NA NA 0 0 1 NA 212s mode: double 212s num [1:3, 1:2] NA NA 0 0 1 NA 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Corner cases 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (mode in c("logical", "integer", "double")) { 212s + cat("mode: ", mode, "\n", sep = "") 212s + value <- 0 212s + storage.mode(value) <- mode 212s + if (mode == "logical") value2 <- 0L 212s + 212s + # A 0x0 matrix 212s + x <- matrix(value, nrow = 0L, ncol = 0L) 212s + str(x) 212s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 212s + r1 <- rowCumprods(x) 212s + r2 <- t(colCumprods(t(x))) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + 212s + # A 0xK matrix 212s + x <- matrix(value, nrow = 0L, ncol = 5L) 212s + str(x) 212s + colnames <- LETTERS[1:5] 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) colnames(x) <- colnames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + 212s + # A Nx0 matrix 212s + x <- matrix(value, nrow = 5L, ncol = 0L) 212s + str(x) 212s + rownames <- LETTERS[1:5] 212s + # Test with and without dimnames on x 212s + for (setDimnames in c(TRUE, FALSE)) { 212s + if (setDimnames) rownames(x) <- rownames 212s + else dimnames(x) <- NULL 212s + # Check names attribute 212s + for (useNames in c(TRUE, FALSE)) { 212s + r0 <- rowCumprods_R(x, useNames = useNames) 212s + r1 <- rowCumprods(x, useNames = useNames) 212s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 212s + stopifnot(all.equal(r1, r2)) 212s + stopifnot(all.equal(r1, r0)) 212s + stopifnot(all.equal(r2, r0)) 212s + } # for (useNames ...) 212s + } # for (setDimnames ...) 212s + } # for (mode ...) 212s mode: logical 212s logi[0 , 0 ] 212s logi[0 , 1:5] 212s logi[1:5, 0 ] 212s mode: integer 212s int[0 , 0 ] 212s int[0 , 1:5] 212s int[1:5, 0 ] 212s mode: double 212s num[0 , 0 ] 212s num[0 , 1:5] 212s num[1:5, 0 ] 212s > 212s 212s R version 4.4.3 (2025-02-28) -- "Trophy Case" 212s Copyright (C) 2025 The R Foundation for Statistical Computing 212s Platform: x86_64-pc-linux-gnu 212s 212s R is free software and comes with ABSOLUTELY NO WARRANTY. 212s You are welcome to redistribute it under certain conditions. 212s Type 'license()' or 'licence()' for distribution details. 212s 212s R is a collaborative project with many contributors. 212s Type 'contributors()' for more information and 212s 'citation()' on how to cite R or R packages in publications. 212s 212s Type 'demo()' for some demos, 'help()' for on-line help, or 212s 'help.start()' for an HTML browser interface to help. 212s Type 'q()' to quit R. 212s 213s > library("matrixStats") 213s > 213s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 213s + suppressWarnings({ 213s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 213s + }) 213s + 213s + # Preserve dimnames attribute? 213s + dim(y) <- dim(x) 213s + dimnames(y) <- if (useNames) dimnames(x) else NULL 213s + 213s + y 213s + } 213s > 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Subsetted tests 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > source("utils/validateIndicesFramework.R") 213s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 213s > storage.mode(x) <- "integer" 213s > 213s > # To check dimnames attribute 213s > dimnames <- list(letters[1:6], LETTERS[1:6]) 213s > 213s > # Test with and without dimnames on x 213s > for (setDimnames in c(TRUE, FALSE)) { 213s + if (setDimnames) dimnames(x) <- dimnames 213s + else dimnames(x) <- NULL 213s + for (rows in index_cases) { 213s + for (cols in index_cases) { 213s + # Check names attribute 213s + for (useNames in c(TRUE, FALSE)) { 213s + validateIndicesTestMatrix(x, rows, cols, 213s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 213s + validateIndicesTestMatrix(x, rows, cols, 213s + ftest = function(x, rows, cols, ..., useNames) { 213s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 213s + }, fsure = rowCumprods_R, useNames = useNames) 213s + } 213s + } 213s + } 213s + } 213s > 213s 213s R version 4.4.3 (2025-02-28) -- "Trophy Case" 213s Copyright (C) 2025 The R Foundation for Statistical Computing 213s Platform: x86_64-pc-linux-gnu 213s 213s R is free software and comes with ABSOLUTELY NO WARRANTY. 213s You are welcome to redistribute it under certain conditions. 213s Type 'license()' or 'licence()' for distribution details. 213s 213s R is a collaborative project with many contributors. 213s Type 'contributors()' for more information and 213s 'citation()' on how to cite R or R packages in publications. 213s 213s Type 'demo()' for some demos, 'help()' for on-line help, or 213s 'help.start()' for an HTML browser interface to help. 213s Type 'q()' to quit R. 213s 213s > library("matrixStats") 214s > 214s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 214s + suppressWarnings({ 214s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 214s + }) 214s + 214s + # Preserve dimnames attribute? 214s + dim(y) <- dim(x) 214s + dimnames(y) <- if (useNames) dimnames(x) else NULL 214s + 214s + y 214s + } 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # With and without some NAs 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 214s > for (mode in c("logical", "integer", "double")) { 214s + for (add_na in c(FALSE, TRUE)) { 214s + cat("add_na = ", add_na, "\n", sep = "") 214s + 214s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 214s + if (add_na) { 214s + x[3:7, c(2, 4)] <- NA_real_ 214s + } 214s + cat("mode: ", mode, "\n", sep = "") 214s + storage.mode(x) <- mode 214s + str(x) 214s + 214s + # Test with and without dimnames on x 214s + for (setDimnames in c(TRUE, FALSE)) { 214s + if (setDimnames) dimnames(x) <- dimnames 214s + else dimnames(x) <- NULL 214s + # Check names attribute 214s + for (useNames in c(TRUE, FALSE)) { 214s + # Row/column ranges 214s + r0 <- rowCumsums_R(x, useNames = useNames) 214s + r1 <- rowCumsums(x, useNames = useNames) 214s + r2 <- t(colCumsums(t(x), useNames = useNames)) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + } # for (useNames ...) 214s + } # for (setDimnames ...) 214s + } # for (add_na ...) 214s + } 214s add_na = FALSE 214s mode: logical 214s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 214s add_na = TRUE 214s mode: logical 214s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 214s add_na = FALSE 214s mode: integer 214s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 214s add_na = TRUE 214s mode: integer 214s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 214s add_na = FALSE 214s mode: double 214s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 214s add_na = TRUE 214s mode: double 214s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # All NAs 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > for (mode in c("logical", "integer", "double")) { 214s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 214s + cat("mode: ", mode, "\n", sep = "") 214s + storage.mode(x) <- mode 214s + str(x) 214s + 214s + # Test with and without dimnames on x 214s + for (setDimnames in c(TRUE, FALSE)) { 214s + if (setDimnames) dimnames(x) <- dimnames 214s + else dimnames(x) <- NULL 214s + # Check names attribute 214s + for (useNames in c(TRUE, FALSE)) { 214s + # Row/column ranges 214s + r0 <- rowCumsums_R(x, useNames = useNames) 214s + r1 <- rowCumsums(x, useNames = useNames) 214s + r2 <- t(colCumsums(t(x), useNames = useNames)) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + } # for (useNames ...) 214s + } # for (setDimnames ...) 214s + } # for (mode ...) 214s mode: logical 214s logi [1:10, 1:5] NA NA NA NA NA NA ... 214s mode: integer 214s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 214s mode: double 214s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # A 1x1 matrix 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > dimnames <- list("a", "A") # to check dimnames attribute 214s > for (mode in c("logical", "integer", "double")) { 214s + x <- matrix(0, nrow = 1L, ncol = 1L) 214s + cat("mode: ", mode, "\n", sep = "") 214s + storage.mode(x) <- mode 214s + str(x) 214s + 214s + r0 <- rowCumsums_R(x) 214s + r1 <- rowCumsums(x) 214s + r2 <- t(colCumsums(t(x))) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + 214s + # Check dimnames attribute 214s + dimnames(x) <- dimnames 214s + # r0 <- rowCumsums_R(x) 214s + # > r0 214s + # a 214s + # [1,] 0 214s + r1 <- rowCumsums(x, useNames = TRUE) 214s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 214s + stopifnot(identical(dimnames(r1), dimnames)) 214s + stopifnot(identical(dimnames(r2), dimnames)) 214s + dimnames(x) <- NULL 214s + } 214s mode: logical 214s logi [1, 1] FALSE 214s mode: integer 214s int [1, 1] 0 214s mode: double 214s num [1, 1] 0 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # Corner cases 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > names <- LETTERS[1:5] # to check dimnames attribute 214s > for (mode in c("logical", "integer", "double")) { 214s + cat("mode: ", mode, "\n", sep = "") 214s + value <- 0 214s + storage.mode(value) <- mode 214s + value2 <- value 214s + if (mode == "logical") value2 <- 0L 214s + 214s + # A 0x0 matrix 214s + x <- matrix(value, nrow = 0L, ncol = 0L) 214s + str(x) 214s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 214s + r1 <- rowCumsums(x) 214s + r2 <- t(colCumsums(t(x))) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + 214s + # A 0xK matrix 214s + x <- matrix(value, nrow = 0L, ncol = 5L) 214s + str(x) 214s + colnames <- LETTERS[1:5] 214s + # Test with and without dimnames on x 214s + for (setDimnames in c(TRUE, FALSE)) { 214s + if (setDimnames) colnames(x) <- colnames 214s + else dimnames(x) <- NULL 214s + # Check names attribute 214s + for (useNames in c(TRUE, FALSE)) { 214s + r0 <- rowCumsums_R(x, useNames = useNames) 214s + r1 <- rowCumsums(x, useNames = useNames) 214s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + } # for (useNames ...) 214s + } # for (setDimnames ...) 214s + 214s + # A Nx0 matrix 214s + x <- matrix(value, nrow = 5L, ncol = 0L) 214s + str(x) 214s + rownames <- LETTERS[1:5] 214s + # Test with and without dimnames on x 214s + for (setDimnames in c(TRUE, FALSE)) { 214s + if (setDimnames) rownames(x) <- rownames 214s + else dimnames(x) <- NULL 214s + # Check names attribute 214s + for (useNames in c(TRUE, FALSE)) { 214s + r0 <- rowCumsums_R(x, useNames = useNames) 214s + r1 <- rowCumsums(x, useNames = useNames) 214s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 214s + stopifnot(all.equal(r1, r2)) 214s + stopifnot(all.equal(r1, r0)) 214s + stopifnot(all.equal(r2, r0)) 214s + } # for (useNames ...) 214s + } # for (setDimnames ...) 214s + } # for (mode ...) 214s mode: logical 214s logi[0 , 0 ] 214s logi[0 , 1:5] 214s logi[1:5, 0 ] 214s mode: integer 214s int[0 , 0 ] 214s int[0 , 1:5] 214s int[1:5, 0 ] 214s mode: double 214s num[0 , 0 ] 214s num[0 , 1:5] 214s num[1:5, 0 ] 214s > 214s 214s R version 4.4.3 (2025-02-28) -- "Trophy Case" 214s Copyright (C) 2025 The R Foundation for Statistical Computing 214s Platform: x86_64-pc-linux-gnu 214s 214s R is free software and comes with ABSOLUTELY NO WARRANTY. 214s You are welcome to redistribute it under certain conditions. 214s Type 'license()' or 'licence()' for distribution details. 214s 214s R is a collaborative project with many contributors. 214s Type 'contributors()' for more information and 214s 'citation()' on how to cite R or R packages in publications. 214s 214s Type 'demo()' for some demos, 'help()' for on-line help, or 214s 'help.start()' for an HTML browser interface to help. 214s Type 'q()' to quit R. 214s 214s > library("matrixStats") 214s > 214s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 214s + suppressWarnings({ 214s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 214s + }) 214s + 214s + # Preserve dimnames attribute? 214s + dim(y) <- dim(x) 214s + dimnames(y) <- if (useNames) dimnames(x) else NULL 214s + 214s + y 214s + } 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # Subsetted tests 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > source("utils/validateIndicesFramework.R") 214s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 214s > storage.mode(x) <- "integer" 214s > 214s > # To check dimnames attribute 214s > dimnames <- list(letters[1:6], LETTERS[1:6]) 214s > 214s > # Test with and without dimnames on x 214s > for (setDimnames in c(TRUE, FALSE)) { 214s + if (setDimnames) dimnames(x) <- dimnames 214s + else dimnames(x) <- NULL 214s + for (rows in index_cases) { 214s + for (cols in index_cases) { 214s + # Check names attribute 214s + for (useNames in c(TRUE, FALSE)) { 214s + validateIndicesTestMatrix(x, rows, cols, 214s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 214s + validateIndicesTestMatrix(x, rows, cols, 214s + ftest = function(x, rows, cols, ..., useNames) { 214s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 214s + }, fsure = rowCumsums_R, useNames = useNames) 214s + } 214s + } 214s + } 214s + } 215s > 215s 215s R version 4.4.3 (2025-02-28) -- "Trophy Case" 215s Copyright (C) 2025 The R Foundation for Statistical Computing 215s Platform: x86_64-pc-linux-gnu 215s 215s R is free software and comes with ABSOLUTELY NO WARRANTY. 215s You are welcome to redistribute it under certain conditions. 215s Type 'license()' or 'licence()' for distribution details. 215s 215s R is a collaborative project with many contributors. 215s Type 'contributors()' for more information and 215s 'citation()' on how to cite R or R packages in publications. 215s 215s Type 'demo()' for some demos, 'help()' for on-line help, or 215s 'help.start()' for an HTML browser interface to help. 215s Type 'q()' to quit R. 215s 215s > library("matrixStats") 215s > 215s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 215s + ncol2 <- ncol(x) - lag * differences 215s + if (ncol2 <= 0) { 215s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 215s + # Preserve names attribute 215s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 215s + return(y) 215s + } 215s + suppressWarnings({ 215s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 215s + }) 215s + y <- t(y) 215s + 215s + # Preserve dimnames attribute 215s + dim(y) <- c(nrow(x), ncol2) 215s + if (useNames && !is.null(dimnames(x))) { 215s + colnames <- colnames(x) 215s + if (!is.null(colnames)) { 215s + len <- length(colnames) 215s + colnames <- colnames[(len - ncol2 + 1):len] 215s + } 215s + dimnames(y) <- list(rownames(x), colnames) 215s + } 215s + else dimnames(y) <- NULL 215s + 215s + y 215s + } 215s > 215s > 215s > set.seed(0x42) 215s > 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > # With and without some NAs 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > for (mode in c("integer", "double")) { 215s + cat("mode: ", mode, "\n", sep = "") 215s + 215s + for (add_na in c(FALSE, TRUE)) { 215s + cat("add_na = ", add_na, "\n", sep = "") 215s + 215s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 215s + if (add_na) { 215s + x[3:7, c(2, 4)] <- NA_real_ 215s + } 215s + storage.mode(x) <- mode 215s + str(x) 215s + 215s + dimnames <- list(letters[1:10], LETTERS[1:8]) 215s + 215s + # Test with and without dimnames on x 215s + for (setDimnames in c(TRUE, FALSE)) { 215s + if (setDimnames) dimnames(x) <- dimnames 215s + else dimnames(x) <- NULL 215s + # Check dimnames attribute 215s + for (useNames in c(TRUE, FALSE)) { 215s + for (lag in 1:4) { 215s + for (differences in 1:3) { 215s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 215s + mode, lag, differences)) 215s + # Row/column ranges 215s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 215s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 215s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 215s + stopifnot(all.equal(r1, r0)) 215s + stopifnot(all.equal(r2, r0)) 215s + stopifnot(all.equal(r1, r2)) 215s + } 215s + } 215s + } # for (useNames ...) 215s + } # for (setDimnames ...) 215s + } # for (add_na ...) 215s + } # for (mode ...) 215s mode: integer 215s add_na = FALSE 215s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s add_na = TRUE 215s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: integer, lag = 1, differences = 1 215s mode: integer, lag = 1, differences = 2 215s mode: integer, lag = 1, differences = 3 215s mode: integer, lag = 2, differences = 1 215s mode: integer, lag = 2, differences = 2 215s mode: integer, lag = 2, differences = 3 215s mode: integer, lag = 3, differences = 1 215s mode: integer, lag = 3, differences = 2 215s mode: integer, lag = 3, differences = 3 215s mode: integer, lag = 4, differences = 1 215s mode: integer, lag = 4, differences = 2 215s mode: integer, lag = 4, differences = 3 215s mode: double 215s add_na = FALSE 215s 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 ... 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s add_na = TRUE 215s 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 ... 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s mode: double, lag = 1, differences = 1 215s mode: double, lag = 1, differences = 2 215s mode: double, lag = 1, differences = 3 215s mode: double, lag = 2, differences = 1 215s mode: double, lag = 2, differences = 2 215s mode: double, lag = 2, differences = 3 215s mode: double, lag = 3, differences = 1 215s mode: double, lag = 3, differences = 2 215s mode: double, lag = 3, differences = 3 215s mode: double, lag = 4, differences = 1 215s mode: double, lag = 4, differences = 2 215s mode: double, lag = 4, differences = 3 215s > 215s > 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > # All NAs 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > for (mode in c("integer", "double")) { 215s + cat("mode: ", mode, "\n", sep = "") 215s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 215s + storage.mode(x) <- mode 215s + str(x) 215s + 215s + dimnames <- list(letters[1:10], LETTERS[1:5]) 215s + 215s + # Test with and without dimnames on x 215s + for (setDimnames in c(TRUE, FALSE)) { 215s + if (setDimnames) dimnames(x) <- dimnames 215s + else dimnames(x) <- NULL 215s + # Check dimnames attribute 215s + for (useNames in c(TRUE, FALSE)) { 215s + r0 <- rowDiffs_R(x, useNames = useNames) 215s + r1 <- rowDiffs(x, useNames = useNames) 215s + r2 <- t(colDiffs(t(x), useNames = useNames)) 215s + stopifnot(all.equal(r1, r0)) 215s + stopifnot(all.equal(r2, r0)) 215s + stopifnot(all.equal(r1, r2)) 215s + } # for (useNames ...) 215s + } # for (setDimnames ...) 215s + } # for (mode ...) 215s mode: integer 215s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 215s mode: double 215s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 215s > 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > # A 1x1 matrix 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > x <- matrix(0, nrow = 1L, ncol = 1L) 215s > dimnames <- list("a", "A") 215s > # Test with and without dimnames on x 215s > for (setDimnames in c(TRUE, FALSE)) { 215s + if (setDimnames) dimnames(x) <- dimnames 215s + else dimnames(x) <- NULL 215s + # Check dimnames attribute 215s + for (useNames in c(TRUE, FALSE)) { 215s + r0 <- rowDiffs_R(x, useNames = useNames) 215s + r1 <- rowDiffs(x, useNames = useNames) 215s + r2 <- t(colDiffs(t(x), useNames = useNames)) 215s + stopifnot(all.equal(r1, r0)) 215s + stopifnot(all.equal(r2, r0)) 215s + stopifnot(all.equal(r1, r2)) 215s + } # for (useNames ...) 215s + } # for (setDimnames ...) 215s > 215s 215s R version 4.4.3 (2025-02-28) -- "Trophy Case" 215s Copyright (C) 2025 The R Foundation for Statistical Computing 215s Platform: x86_64-pc-linux-gnu 215s 215s R is free software and comes with ABSOLUTELY NO WARRANTY. 215s You are welcome to redistribute it under certain conditions. 215s Type 'license()' or 'licence()' for distribution details. 215s 215s R is a collaborative project with many contributors. 215s Type 'contributors()' for more information and 215s 'citation()' on how to cite R or R packages in publications. 215s 215s Type 'demo()' for some demos, 'help()' for on-line help, or 215s 'help.start()' for an HTML browser interface to help. 215s Type 'q()' to quit R. 215s 215s > library("matrixStats") 215s > 215s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 215s + ncol2 <- ncol(x) - lag * differences 215s + if (ncol2 <= 0) { 215s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 215s + # Preserve names attribute 215s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 215s + return(y) 215s + } 215s + suppressWarnings({ 215s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 215s + }) 215s + y <- t(y) 215s + 215s + # Preserve dimnames attribute 215s + dim(y) <- c(nrow(x), ncol2) 215s + if (useNames && !is.null(dimnames(x))) { 215s + colnames <- colnames(x) 215s + if (!is.null(colnames)) { 215s + len <- length(colnames) 215s + colnames <- colnames[(len - ncol2 + 1):len] 215s + } 215s + dimnames(y) <- list(rownames(x), colnames) 215s + } 215s + else dimnames(y) <- NULL 215s + 215s + y 215s + } 215s > 215s > 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > # Subsetted tests 215s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215s > source("utils/validateIndicesFramework.R") 215s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 215s > storage.mode(x) <- "integer" 215s > 215s > # To check dimnames attribute 215s > dimnames <- list(letters[1:6], LETTERS[1:6]) 215s > 215s > # Test with and without dimnames on x 215s > for (setDimnames in c(TRUE, FALSE)) { 215s + if (setDimnames) dimnames(x) <- dimnames 215s + else dimnames(x) <- NULL 215s + 215s + count <- 0L 215s + for (rows in index_cases) { 215s + for (cols in index_cases) { 215s + count <- count + 1L 215s + for (lag in 1:2) { 215s + for (differences in 1:3) { 215s + # Check dimnames attribute 215s + useNames <- c(TRUE, FALSE) 215s + useNames <- useNames[count %% length(useNames) + 1] 215s + validateIndicesTestMatrix(x, rows, cols, 215s + ftest = rowDiffs, fsure = rowDiffs_R, 215s + lag = lag, differences = differences, useNames = useNames) 215s + validateIndicesTestMatrix(x, rows, cols, 215s + ftest = function(x, rows, cols, ..., useNames) { 215s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 215s + }, fsure = rowDiffs_R, 215s + lag = lag, differences = differences, useNames = useNames) 215s + } 215s + } 215s + } 215s + } 215s + } 217s > 218s 218s R version 4.4.3 (2025-02-28) -- "Trophy Case" 218s Copyright (C) 2025 The R Foundation for Statistical Computing 218s Platform: x86_64-pc-linux-gnu 218s 218s R is free software and comes with ABSOLUTELY NO WARRANTY. 218s You are welcome to redistribute it under certain conditions. 218s Type 'license()' or 'licence()' for distribution details. 218s 218s R is a collaborative project with many contributors. 218s Type 'contributors()' for more information and 218s 'citation()' on how to cite R or R packages in publications. 218s 218s Type 'demo()' for some demos, 'help()' for on-line help, or 218s 'help.start()' for an HTML browser interface to help. 218s Type 'q()' to quit R. 218s 218s > library("matrixStats") 218s > 218s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 218s + quantile_na <- function(x, ..., na.rm = FALSE) { 218s + if (!na.rm && anyMissing(x)) 218s + return(c(NA_real_, NA_real_)) 218s + quantile(x, ..., na.rm = na.rm) 218s + } 218s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 218s + probs = c(0.25, 0.75), na.rm = na.rm) 218s + rownames(q) <- NULL # Not needed anymore 218s + 218s + # Preserve names attribute 218s + dim(q) <- c(2L, nrow(x)) 218s + colnames(q) <- if (useNames) rownames(x) else NULL 218s + 218s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 218s + } 218s > 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > # Test with multiple quantiles 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > for (mode in c("integer", "double")) { 218s + cat("mode: ", mode, "\n", sep = "") 218s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 218s + storage.mode(x) <- mode 218s + str(x) 218s + 218s + # To check names attribute 218s + dimnames <- list(letters[1:10], LETTERS[1:10]) 218s + 218s + for (add_na in c(FALSE, TRUE)) { 218s + if (add_na) { 218s + x[3:5, 6:9] <- NA 218s + } 218s + # Test with and without dimnames on x 218s + for (setDimnames in c(TRUE, FALSE)) { 218s + if (setDimnames) dimnames(x) <- dimnames 218s + else dimnames(x) <- NULL 218s + for (na.rm in c(FALSE, TRUE)) { 218s + # Check names attribute 218s + for (useNames in c(TRUE, FALSE)) { 218s + probs <- c(0, 0.5, 1) 218s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 218s + print(q0) 218s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 218s + print(q1) 218s + stopifnot(all.equal(q1, q0)) 218s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 218s + stopifnot(all.equal(q2, q0)) 218s + 218s + q <- iqr(x[3, ], na.rm = na.rm) 218s + print(q) 218s + } # for (useNames ...) 218s + } # for (na.rm ...) 218s + } # for (setDimnames ...) 218s + } # for (add_na ...) 218s + } # for (mode ...) 218s mode: integer 218s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s a b c d e f g h i j 218s 45 45 NA NA NA 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s a b c d e f g h i j 218s 45 45 25 25 25 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s mode: double 218s 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 ... 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 45 45 45 45 45 45 45 45 45 218s [1] 45 218s a b c d e f g h i j 218s 45 45 NA NA NA 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s a b c d e f g h i j 218s 45 45 25 25 25 45 45 45 45 45 218s a b c d e f g h i j 218s 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] 45 45 NA NA NA 45 45 45 45 45 218s [1] NA 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 45 45 25 25 25 45 45 45 45 45 218s [1] 25 218s > 218s > 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > # Test corner cases 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > for (mode in c("integer", "double")) { 218s + cat("mode: ", mode, "\n", sep = "") 218s + # Empty vectors 218s + x <- integer(0L) 218s + storage.mode(x) <- mode 218s + str(x) 218s + q <- iqr(x) 218s + print(q) 218s + stopifnot(identical(q, NA_real_)) 218s + 218s + # Scalar 218s + x <- 1L 218s + storage.mode(x) <- mode 218s + str(x) 218s + q <- iqr(x) 218s + str(q) 218s + stopifnot(identical(q, 0)) 218s + } 218s mode: integer 218s int(0) 218s [1] NA 218s int 1 218s num 0 218s mode: double 218s num(0) 218s [1] NA 218s num 1 218s num 0 218s > 218s > 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > # Single row matrices 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > x <- matrix(1, nrow = 1L, ncol = 2L) 218s > dimnames <- list("a", LETTERS[1:2]) 218s > # Test with and without dimnames on x 218s > for (setDimnames in c(TRUE, FALSE)) { 218s + if (setDimnames) dimnames(x) <- dimnames 218s + else dimnames(x) <- NULL 218s + # Check names attribute 218s + for (useNames in c(TRUE, FALSE)) { 218s + q0 <- rowIQRs_R(x, useNames = useNames) 218s + q1 <- rowIQRs(x, useNames = useNames) 218s + q2 <- colIQRs(t(x), useNames = useNames) 218s + stopifnot(all.equal(q0, q1)) 218s + stopifnot(all.equal(q0, q2)) 218s + } 218s + } 218s > 218s > x <- matrix(1, nrow = 2L, ncol = 1L) 218s > q <- colIQRs(x) 218s > stopifnot(identical(q, 0)) 218s > 218s 218s R version 4.4.3 (2025-02-28) -- "Trophy Case" 218s Copyright (C) 2025 The R Foundation for Statistical Computing 218s Platform: x86_64-pc-linux-gnu 218s 218s R is free software and comes with ABSOLUTELY NO WARRANTY. 218s You are welcome to redistribute it under certain conditions. 218s Type 'license()' or 'licence()' for distribution details. 218s 218s R is a collaborative project with many contributors. 218s Type 'contributors()' for more information and 218s 'citation()' on how to cite R or R packages in publications. 218s 218s Type 'demo()' for some demos, 'help()' for on-line help, or 218s 'help.start()' for an HTML browser interface to help. 218s Type 'q()' to quit R. 218s 218s > library("matrixStats") 218s > 218s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 218s + quantile_na <- function(x, ..., na.rm = FALSE) { 218s + if (!na.rm && anyMissing(x)) 218s + return(c(NA_real_, NA_real_)) 218s + quantile(x, ..., na.rm = na.rm) 218s + } 218s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 218s + probs = c(0.25, 0.75), na.rm = na.rm) 218s + rownames(q) <- NULL # Not needed anymore 218s + 218s + # Preserve names attribute 218s + dim(q) <- c(2L, nrow(x)) 218s + colnames(q) <- if (useNames) rownames(x) else NULL 218s + 218s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 218s + } 218s > 218s > 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > # Subsetted tests 218s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 218s > source("utils/validateIndicesFramework.R") 218s > x <- runif(6, min = -6, max = 6) 218s > for (idxs in index_cases) { 218s + for (na.rm in c(TRUE, FALSE)) { 218s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 218s + dim(x) <- c(1L, length(x)) 218s + rowIQRs_R(x, na.rm = na.rm) 218s + }, na.rm = na.rm) 218s + } 218s + } 218s > 218s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 218s > 218s > # To check names attribute 218s > dimnames <- list(letters[1:6], LETTERS[1:6]) 218s > 218s > # Test with and without dimnames on x 218s > for (setDimnames in c(TRUE, FALSE)) { 218s + if (setDimnames) dimnames(x) <- dimnames 218s + else dimnames(x) <- NULL 218s + 218s + count <- 0L 218s + for (rows in index_cases) { 218s + for (cols in index_cases) { 218s + count <- count + 1L 218s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 218s + useNames <- c(TRUE, FALSE) 218s + useNames <- useNames[count %% length(useNames) + 1] 218s + 218s + validateIndicesTestMatrix(x, rows, cols, 218s + ftest = rowIQRs, fsure = rowIQRs_R, 218s + na.rm = na.rm, useNames = useNames) 218s + validateIndicesTestMatrix(x, rows, cols, 218s + fcoltest = colIQRs, fsure = rowIQRs_R, 218s + na.rm = na.rm, useNames = useNames) 218s + } 218s + } 218s + } 219s > 219s 219s R version 4.4.3 (2025-02-28) -- "Trophy Case" 219s Copyright (C) 2025 The R Foundation for Statistical Computing 219s Platform: x86_64-pc-linux-gnu 219s 219s R is free software and comes with ABSOLUTELY NO WARRANTY. 219s You are welcome to redistribute it under certain conditions. 219s Type 'license()' or 'licence()' for distribution details. 219s 219s R is a collaborative project with many contributors. 219s Type 'contributors()' for more information and 219s 'citation()' on how to cite R or R packages in publications. 219s 219s Type 'demo()' for some demos, 'help()' for on-line help, or 219s 'help.start()' for an HTML browser interface to help. 219s Type 'q()' to quit R. 219s 219s > # Test inspired by the harmonic mean example in R-help 219s > # thread '[R] Beyond double-precision?' on May 9, 2009. 219s > 219s > library("matrixStats") 219s > library("stats") 219s > 219s > logSumExp0 <- function(lx) { 219s + idx_max <- which.max(lx) 219s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 219s + } 219s > 219s > n <- 200L 219s > set.seed(1) 219s > 219s > for (mode in c("integer", "double")) { 219s + cat("mode: ", mode, "\n", sep = "") 219s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 219s + storage.mode(x) <- mode 219s + str(x) 219s + 219s + # The logarithm of the harmonic mean by rows 219s + y_h <- log(1 / rowMeans(1 / x)) 219s + str(y_h) 219s + 219s + lx_neg <- -log(x) 219s + 219s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 219s + stopifnot(all.equal(y0, y_h)) 219s + 219s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 219s + stopifnot(all.equal(y1, y0)) 219s + 219s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 219s + stopifnot(all.equal(y2, y0)) 219s + 219s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 219s + stopifnot(all.equal(y3, y0)) 219s + 219s + 219s + # The logarithm of the harmonic mean by columns 219s + y_h <- log(1 / colMeans(1 / x)) 219s + str(y_h) 219s + 219s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 219s + stopifnot(all.equal(y0, y_h)) 219s + 219s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 219s + stopifnot(all.equal(y1, y0)) 219s + 219s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 219s + stopifnot(all.equal(y2, y0)) 219s + 219s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 219s + stopifnot(all.equal(y3, y0)) 219s + 219s + # Testing names 219s + rownames(lx_neg) <- seq_len(nrow(x)) 219s + colnames(lx_neg) <- seq_len(ncol(x)) 219s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 219s + stopifnot(identical(names(y2), rownames(lx_neg))) 219s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 219s + stopifnot(identical(names(y3), rownames(lx_neg))) 219s + } # for (mode ...) 219s mode: integer 219s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 219s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 219s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 219s mode: double 219s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 219s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 219s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 219s > 219s > 219s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 219s > # Corner cases 219s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 219s > ## Zero-size matrices 219s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s numeric(0) 219s > stopifnot(length(y) == nrow(lx)) 219s > 219s > y <- colLogSumExps(lx) 219s > print(y) 219s numeric(0) 219s > stopifnot(length(y) == ncol(lx)) 219s > 219s > ## Zero-height matrices 219s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s numeric(0) 219s > stopifnot(length(y) == nrow(lx)) 219s > 219s > y <- colLogSumExps(lx) 219s > print(y) 219s [1] -Inf -Inf -Inf -Inf -Inf 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(all(y == -Inf)) 219s > 219s > ## Zero-width matrices 219s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 219s > y <- colLogSumExps(lx) 219s > print(y) 219s numeric(0) 219s > stopifnot(length(y) == ncol(lx)) 219s > 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s [1] -Inf -Inf -Inf -Inf -Inf 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(y == -Inf)) 219s > 219s > 219s > ## Matrices with one element 219s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s [1] 1 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(y == lx)) 219s > 219s > y <- colLogSumExps(lx) 219s > print(y) 219s [1] 1 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(all(y == lx)) 219s > 219s > ## All missing values 219s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 219s > y <- rowLogSumExps(lx, na.rm = TRUE) 219s > print(y) 219s [1] -Inf 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(identical(y, -Inf)) 219s > 219s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 219s > y <- colLogSumExps(lx, na.rm = TRUE) 219s > print(y) 219s [1] -Inf 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(identical(y, -Inf)) 219s > 219s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 219s > y <- rowLogSumExps(lx, na.rm = TRUE) 219s > print(y) 219s [1] -Inf -Inf 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(y == -Inf)) 219s > 219s > y <- rowLogSumExps(lx, na.rm = FALSE) 219s > print(y) 219s [1] NA NA 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(is.na(y) & !is.nan(y))) 219s > 219s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 219s > y <- colLogSumExps(lx, na.rm = TRUE) 219s > print(y) 219s [1] -Inf -Inf 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(all(y == -Inf)) 219s > 219s > y <- colLogSumExps(lx, na.rm = FALSE) 219s > print(y) 219s [1] NA NA 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(all(is.na(y) & !is.nan(y))) 219s > 219s > ## +Inf values 219s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 219s > y <- colLogSumExps(lx, na.rm = TRUE) 219s > print(y) 219s [1] Inf Inf 219s > stopifnot(length(y) == ncol(lx)) 219s > stopifnot(all(y == +Inf)) 219s > 219s > ## multiple -Inf values 219s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s [1] -Inf -Inf 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(y == -Inf)) 219s > 219s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 219s > y <- rowLogSumExps(lx) 219s > print(y) 219s [1] 5 5 219s > stopifnot(length(y) == nrow(lx)) 219s > stopifnot(all(y == 5)) 219s > 219s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 219s > ## (This would core dump on Windows) 219s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 219s > y <- colLogSumExps(x) 219s > str(y) 219s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 219s > 219s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 219s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 219s > ## used) 219s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 219s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 219s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 219s > stopifnot(names(y) == c("c", "b", "a")) 219s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 219s > stopifnot(names(y) == "B") 219s > 219s > 219s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 219s > # Check names attributes 219s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 219s > 219s > ## Create isFALSE() if running on an old version of R 219s > if (!exists("isFALSE", mode="function")) { 219s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 219s + } 219s > 219s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 219s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 219s + log(sum(exp(rx), ...)) 219s + }, ...) 219s + if (isFALSE(useNames)) names(res) <- NULL 219s + res 219s + } 219s > 219s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 219s > 219s > # To check names attribute 219s > dimnames <- list(letters[1:6], LETTERS[1:6]) 219s > 219s > # Test with and without dimnames on x 219s > for (setDimnames in c(TRUE, FALSE)) { 219s + if (setDimnames) dimnames(x) <- dimnames 219s + else dimnames(x) <- NULL 219s + for (useNames in c(TRUE, FALSE)) { 219s + y0 <- rowLogSumExps_R(x, useNames = useNames) 219s + y1 <- rowLogSumExps(x, useNames = useNames) 219s + y2 <- colLogSumExps(t(x), useNames = useNames) 219s + stopifnot(all.equal(y1, y0)) 219s + stopifnot(all.equal(y2, y0)) 219s + } 219s + } 219s > 219s 219s R version 4.4.3 (2025-02-28) -- "Trophy Case" 219s Copyright (C) 2025 The R Foundation for Statistical Computing 219s Platform: x86_64-pc-linux-gnu 219s 219s R is free software and comes with ABSOLUTELY NO WARRANTY. 219s You are welcome to redistribute it under certain conditions. 219s Type 'license()' or 'licence()' for distribution details. 219s 219s R is a collaborative project with many contributors. 219s Type 'contributors()' for more information and 219s 'citation()' on how to cite R or R packages in publications. 219s 219s Type 'demo()' for some demos, 'help()' for on-line help, or 219s 'help.start()' for an HTML browser interface to help. 219s Type 'q()' to quit R. 219s 219s > library("matrixStats") 220s > 220s > ## Create isFALSE() if running on an old version of R 220s > if (!exists("isFALSE", mode="function")) { 220s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 220s + } 220s > 220s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 220s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 220s + log(sum(exp(rx), ...)) 220s + }, ...) 220s + if (isFALSE(useNames)) names(res) <- NULL 220s + res 220s + } 220s > 220s > 220s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 220s > # Subsetted tests 220s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 220s > source("utils/validateIndicesFramework.R") 220s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 220s > 220s > # To check names attribute 220s > dimnames <- list(letters[1:6], LETTERS[1:6]) 220s > 220s > # Test with and without dimnames on x 220s > for (setDimnames in c(TRUE, FALSE)) { 220s + if (setDimnames) dimnames(x) <- dimnames 220s + else dimnames(x) <- NULL 220s + for (rows in index_cases) { 220s + for (cols in index_cases) { 220s + for (na.rm in c(TRUE, FALSE)) { 220s + for (useNames in c(TRUE, FALSE)) { 220s + validateIndicesTestMatrix(x, rows, cols, 220s + ftest = rowLogSumExps, 220s + fsure = rowLogSumExps_R, 220s + na.rm = na.rm, useNames = useNames) 220s + validateIndicesTestMatrix(x, rows, cols, 220s + fcoltest = colLogSumExps, 220s + fsure = rowLogSumExps_R, 220s + na.rm = na.rm, useNames = useNames) 220s + } 220s + } 220s + } 220s + } 220s + } 220s > 220s 220s R version 4.4.3 (2025-02-28) -- "Trophy Case" 220s Copyright (C) 2025 The R Foundation for Statistical Computing 220s Platform: x86_64-pc-linux-gnu 220s 220s R is free software and comes with ABSOLUTELY NO WARRANTY. 220s You are welcome to redistribute it under certain conditions. 220s Type 'license()' or 'licence()' for distribution details. 220s 220s R is a collaborative project with many contributors. 220s Type 'contributors()' for more information and 220s 'citation()' on how to cite R or R packages in publications. 220s 220s Type 'demo()' for some demos, 'help()' for on-line help, or 220s 'help.start()' for an HTML browser interface to help. 220s Type 'q()' to quit R. 220s 221s > library("matrixStats") 221s > 221s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 221s > options(matrixStats.center.onUse = "ignore") 221s > 221s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 221s + suppressWarnings({ 221s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 221s + }) 221s + if (!useNames) names(res) <- NULL 221s + res 221s + } 221s > 221s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 221s + suppressWarnings({ 221s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 221s + }) 221s + if (!useNames) names(res) <- NULL 221s + res 221s + } 221s > 221s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 221s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 221s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 221s + } 221s > 221s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 221s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 221s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 221s + } 221s > 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # A 3x3 matrix (no ties) 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > for (mode in c("integer", "double")) { 221s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 221s + cat("mode: ", mode, "\n", sep = "") 221s + storage.mode(x) <- mode 221s + str(x) 221s + 221s + # To check name attribute 221s + dimnames <- list(letters[1:3], LETTERS[1:3]) 221s + 221s + # Test with and without dimnames on x 221s + for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("rowMads():\n") 221s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 221s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 221s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 221s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 221s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 221s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r1b, r1)) 221s + stopifnot(all.equal(r1c, r1)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r2b, r2)) 221s + 221s + cat("colMads():\n") 221s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 221s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 221s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 221s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 221s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 221s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r1b, r1)) 221s + stopifnot(all.equal(r1c, r1)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r2b, r2)) 221s + } 221s + } 221s + } 221s mode: integer 221s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s mode: double 221s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # Ties: a 4x4 matrix 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > for (mode in c("integer", "double")) { 221s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 221s + cat("mode: ", mode, "\n", sep = "") 221s + storage.mode(x) <- mode 221s + str(x) 221s + tx <- t(x) 221s + 221s + # To check name attribute 221s + dimnames <- list(letters[1:4], LETTERS[1:4]) 221s + 221s + # Test with and without dimnames on x 221s + for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("rowMads():\n") 221s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 221s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + 221s + cat("colMads():\n") 221s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 221s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + } 221s + } 221s + } 221s mode: integer 221s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s mode: double 221s 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 ... 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s > tx <- NULL 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # No ties: a 3x3 matrix with an NA value 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > for (mode in c("integer", "double")) { 221s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 221s + x[2, 2] <- NA_real_ 221s + 221s + cat("mode: ", mode, "\n", sep = "") 221s + storage.mode(x) <- mode 221s + str(x) 221s + tx <- t(x) 221s + 221s + # To check name attribute 221s + dimnames <- list(letters[1:3], LETTERS[1:3]) 221s + 221s + # Test with and without dimnames on x 221s + for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("rowMads():\n") 221s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 221s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + 221s + cat("colMads():\n") 221s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 221s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 221s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + } 221s + } 221s + } 221s mode: integer 221s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s mode: double 221s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s rowMads(): 221s colMads(): 221s > tx <- NULL 221s > 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # With and without some NAs 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > for (add_na in c(FALSE, TRUE)) { 221s + cat("add_na = ", add_na, "\n", sep = "") 221s + 221s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 221s + if (add_na) { 221s + x[3:7, c(2, 4)] <- NA_real_ 221s + } 221s + 221s + # To check name attribute 221s + dimnames <- list(letters[1:10], LETTERS[1:5]) 221s + 221s + # Test with and without dimnames on x 221s + for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Row/column ranges 221s + for (na.rm in c(FALSE, TRUE)) { 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("na.rm = ", na.rm, "\n", sep = "") 221s + cat("rowMads():\n") 221s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 221s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 221s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 221s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 221s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r2, r1)) 221s + stopifnot(all.equal(r3, r0)) 221s + stopifnot(all.equal(r3, r1)) 221s + stopifnot(all.equal(r3, r2)) 221s + 221s + cat("colMads():\n") 221s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 221s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 221s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 221s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 221s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r2, r1)) 221s + stopifnot(all.equal(r3, r0)) 221s + stopifnot(all.equal(r3, r1)) 221s + stopifnot(all.equal(r3, r2)) 221s + } 221s + } 221s + } 221s + tx <- NULL 221s + } # for (add_na ...) 221s add_na = FALSE 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s add_na = TRUE 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = FALSE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s na.rm = TRUE 221s rowMads(): 221s colMads(): 221s > 221s > 221s > 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # All NAs 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 221s > # Test with and without dimnames on x 221s > for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Row/column ranges 221s + for (na.rm in c(FALSE, TRUE)) { 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("na.rm = ", na.rm, "\n", sep = "") 221s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 221s + if (na.rm) r0[is.na(r0)] <- NaN 221s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 221s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r1, r2)) 221s + } 221s + } 221s + } 221s na.rm = FALSE 221s na.rm = FALSE 221s na.rm = TRUE 221s na.rm = TRUE 221s na.rm = FALSE 221s na.rm = FALSE 221s na.rm = TRUE 221s na.rm = TRUE 221s > tx <- NULL 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # A 1x1 matrix 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > x <- matrix(0, nrow = 1L, ncol = 1L) 221s > dimnames <- list("a", "A") 221s > # Test with and without dimnames on x 221s > for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + tx <- t(x) 221s + # Row/column ranges 221s + for (na.rm in c(FALSE, TRUE)) { 221s + # Check names attribute 221s + for (useNames in c(TRUE, FALSE)) { 221s + cat("na.rm = ", na.rm, "\n", sep = "") 221s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 221s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 221s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + stopifnot(all.equal(r1, r2)) 221s + } 221s + } 221s + } 221s na.rm = FALSE 221s na.rm = FALSE 221s na.rm = TRUE 221s na.rm = TRUE 221s na.rm = FALSE 221s na.rm = FALSE 221s na.rm = TRUE 221s na.rm = TRUE 221s > 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # A 0x0 matrix 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > x <- matrix(double(0), nrow = 0, ncol = 0) 221s > tx <- t(x) 221s > for (na.rm in c(FALSE, TRUE)) { 221s + cat("na.rm = ", na.rm, "\n", sep = "") 221s + r0 <- rowMads_R(x, na.rm = na.rm) 221s + r1 <- rowMads(x, na.rm = na.rm) 221s + r2 <- colMads(tx, na.rm = na.rm) 221s + stopifnot(all.equal(r1, r2)) 221s + stopifnot(all.equal(r1, r0)) 221s + stopifnot(all.equal(r2, r0)) 221s + } 221s na.rm = FALSE 221s na.rm = TRUE 221s > 221s 221s R version 4.4.3 (2025-02-28) -- "Trophy Case" 221s Copyright (C) 2025 The R Foundation for Statistical Computing 221s Platform: x86_64-pc-linux-gnu 221s 221s R is free software and comes with ABSOLUTELY NO WARRANTY. 221s You are welcome to redistribute it under certain conditions. 221s Type 'license()' or 'licence()' for distribution details. 221s 221s R is a collaborative project with many contributors. 221s Type 'contributors()' for more information and 221s 'citation()' on how to cite R or R packages in publications. 221s 221s Type 'demo()' for some demos, 'help()' for on-line help, or 221s 'help.start()' for an HTML browser interface to help. 221s Type 'q()' to quit R. 221s 221s > library("matrixStats") 221s > 221s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 221s > options(matrixStats.center.onUse = "ignore") 221s > 221s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 221s + suppressWarnings({ 221s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 221s + }) 221s + if (!useNames) names(res) <- NULL 221s + res 221s + } 221s > 221s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 221s + suppressWarnings({ 221s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 221s + }) 221s + if (!useNames) names(res) <- NULL 221s + res 221s + } 221s > 221s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 221s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 221s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 221s + } 221s > 221s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 221s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 221s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 221s + } 221s > 221s > 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > # Subsetted tests 221s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 221s > source("utils/validateIndicesFramework.R") 221s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 221s > storage.mode(x) <- "integer" 221s > 221s > # To check names attribute 221s > dimnames <- list(letters[1:6], LETTERS[1:6]) 221s > 221s > # Test with and without dimnames on x 221s > for (setDimnames in c(TRUE, FALSE)) { 221s + if (setDimnames) dimnames(x) <- dimnames 221s + else dimnames(x) <- NULL 221s + 221s + count <- 0L 221s + for (rows in index_cases) { 221s + for (cols in index_cases) { 221s + count <- count + 1L 221s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 221s + useNames <- c(TRUE, FALSE) 221s + useNames <- useNames[count %% length(useNames) + 1] 221s + 221s + validateIndicesTestMatrix(x, rows, cols, 221s + ftest = rowMads, fsure = rowMads_R, 221s + na.rm = na.rm, useNames = useNames) 221s + validateIndicesTestMatrix(x, rows, cols, 221s + ftest = rowMads_center, fsure = rowMads_R, 221s + na.rm = na.rm, useNames = useNames) 221s + 221s + validateIndicesTestMatrix(x, rows, cols, 221s + fcoltest = colMads, fsure = rowMads_R, 221s + na.rm = na.rm, useNames = useNames) 221s + validateIndicesTestMatrix(x, rows, cols, 221s + fcoltest = colMads_center, fsure = rowMads_R, 221s + na.rm = na.rm, useNames = useNames) 221s + } 221s + } 221s + } 222s > 222s 222s R version 4.4.3 (2025-02-28) -- "Trophy Case" 222s Copyright (C) 2025 The R Foundation for Statistical Computing 222s Platform: x86_64-pc-linux-gnu 222s 222s R is free software and comes with ABSOLUTELY NO WARRANTY. 222s You are welcome to redistribute it under certain conditions. 222s Type 'license()' or 'licence()' for distribution details. 222s 222s R is a collaborative project with many contributors. 222s Type 'contributors()' for more information and 222s 'citation()' on how to cite R or R packages in publications. 222s 222s Type 'demo()' for some demos, 'help()' for on-line help, or 222s 'help.start()' for an HTML browser interface to help. 222s Type 'q()' to quit R. 222s 222s > library("matrixStats") 222s > 222s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 222s + res <- rowMeans(x, na.rm = na.rm) 222s + if (!useNames) names(res) <- NULL 222s + res 222s + } 222s > 222s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 222s + res <- colMeans(x, na.rm = na.rm) 222s + if (!useNames) names(res) <- NULL 222s + res 222s + } 222s > 222s > for (mode in c("integer", "logical", "double")) { 222s + x <- matrix(-4:4, nrow = 3, ncol = 3) 222s + storage.mode(x) <- mode 222s + if (mode == "double") x <- x + 0.1 222s + 222s + # To check names attribute 222s + dimnames <- list(letters[1:3], LETTERS[1:3]) 222s + 222s + # Test with and without dimnames on x 222s + for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s + } 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: Single-element matrix 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: Single-element matrix:\n") 222s Special case: Single-element matrix: 222s > for (mode in c("integer", "logical", "double")) { 222s + x <- matrix(1, nrow = 1, ncol = 1) 222s + storage.mode(x) <- mode 222s + 222s + # To check names attribute 222s + dimnames <- list("a", "A") 222s + 222s + # Test with and without dimnames on x 222s + for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: Empty matrix 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: Empty matrix:\n") 222s Special case: Empty matrix: 222s > for (mode in c("integer", "logical", "double")) { 222s + x <- matrix(integer(0), nrow = 0, ncol = 0) 222s + storage.mode(x) <- mode 222s + 222s + y0 <- rowMeans(x, na.rm = FALSE) 222s + y1 <- rowMeans2(x, na.rm = FALSE) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans(x, na.rm = FALSE) 222s + y1 <- colMeans2(x, na.rm = FALSE) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: All NAs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: All NAs:\n") 222s Special case: All NAs: 222s > for (mode in c("integer", "logical", "double")) { 222s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 222s + storage.mode(x) <- mode 222s + 222s + # To check names attribute 222s + dimnames <- list(letters[1:3], LETTERS[1:3]) 222s + 222s + # Test with and without dimnames on x 222s + for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: All NaNs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: All NaNs:\n") 222s Special case: All NaNs: 222s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: All Infs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: All Infs:\n") 222s Special case: All Infs: 222s > x <- matrix(Inf, nrow = 3, ncol = 3) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: All -Infs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: All -Infs:\n") 222s Special case: All -Infs: 222s > x <- matrix(-Inf, nrow = 3, ncol = 3) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: Infs and -Infs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: Infs and -Infs:\n") 222s Special case: Infs and -Infs: 222s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 222s > 222s > # To check names attribute 222s > dimnames <- list(letters[1:4], LETTERS[1:4]) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: NaNs and NAs 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: NaNs and NAs:\n") 222s Special case: NaNs and NAs: 222s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + str(y0) 222s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + str(y1) 222s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s Named num [1:4] NaN NA NaN NA 222s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 222s Named num [1:4] NaN NA NaN NA 222s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 222s num [1:4] NaN NA NaN NA 222s num [1:4] NaN NA NaN NA 222s num [1:4] NaN NA NaN NA 222s num [1:4] NaN NA NaN NA 222s num [1:4] NaN NA NaN NA 222s num [1:4] NaN NA NaN NA 222s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 222s > ## returned here (as one would expect). NaN might very well be returned, 222s > ## when both NA and NaN are involved. This is an accepted feature in R, 222s > ## which is documented in help("is.nan"). See also 222s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 222s > ## Thus, we cannot guarantee that y1 is identical to y0. 222s > 222s > 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Special case: Integer overflow with ties 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > cat("Special case: Integer overflow with ties:\n") 222s Special case: Integer overflow with ties: 222s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + # Check names attribute 222s + for (useNames in c(TRUE, FALSE)) { 222s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + 222s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 222s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 222s + stopifnot(all.equal(y1, y0)) 222s + } 222s + } 222s > 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Consistency checks 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > set.seed(1) 222s > 222s > cat("Consistency checks:\n") 222s Consistency checks: 222s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 222s > for (kk in seq_len(n_sims)) { 222s + cat("Random test #", kk, "\n", sep = "") 222s + 222s + # Simulate data in a matrix of any shape 222s + dim <- sample(50:200, size = 2) 222s + n <- prod(dim) 222s + x <- rnorm(n, sd = 100) 222s + dim(x) <- dim 222s + 222s + # Add NAs? 222s + if ((kk %% 4) %in% c(3, 0)) { 222s + cat("Adding NAs\n") 222s + nna <- sample(n, size = 1) 222s + na_values <- c(NA_real_, NaN) 222s + t <- sample(na_values, size = nna, replace = TRUE) 222s + x[sample(length(x), size = nna)] <- t 222s + } 222s + 222s + # Mode? 222s + modes <- "double" 222s + if ((kk %% 4) %in% c(2, 0)) { 222s + modes <- c("integer", "logical") 222s + } 222s + 222s + for (mode in modes) { 222s + if (mode != "double") { 222s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 222s + storage.mode(x) <- mode 222s + } 222s + 222s + na.rm <- sample(c(TRUE, FALSE), size = 1) 222s + 222s + # rowMeans2(): 222s + y0 <- rowMeans(x, na.rm = na.rm) 222s + y1 <- rowMeans2(x, na.rm = na.rm) 222s + stopifnot(all.equal(y1, y0)) 222s + y2 <- colMeans2(t(x), na.rm = na.rm) 222s + stopifnot(all.equal(y2, y0)) 222s + 222s + # colMeans2(): 222s + y0 <- colMeans(x, na.rm = na.rm) 222s + y1 <- colMeans2(x, na.rm = na.rm) 222s + stopifnot(all.equal(y1, y0)) 222s + y2 <- rowMeans2(t(x), na.rm = na.rm) 222s + stopifnot(all.equal(y2, y0)) 222s + } 222s + } # for (kk ...) 222s Random test #1 222s Random test #2 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #3 222s Adding NAs 222s Random test #4 222s Adding NAs 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #5 222s Random test #6 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #7 222s Adding NAs 222s Random test #8 222s Adding NAs 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #9 222s Random test #10 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #11 222s Adding NAs 222s Random test #12 222s Adding NAs 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #13 222s Random test #14 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #15 222s Adding NAs 222s Random test #16 222s Adding NAs 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #17 222s Random test #18 222s Coercing from double to integer 222s Coercing from integer to logical 222s Random test #19 222s Adding NAs 222s Random test #20 222s Adding NAs 222s Coercing from double to integer 222s Coercing from integer to logical 222s > 222s 222s R version 4.4.3 (2025-02-28) -- "Trophy Case" 222s Copyright (C) 2025 The R Foundation for Statistical Computing 222s Platform: x86_64-pc-linux-gnu 222s 222s R is free software and comes with ABSOLUTELY NO WARRANTY. 222s You are welcome to redistribute it under certain conditions. 222s Type 'license()' or 'licence()' for distribution details. 222s 222s R is a collaborative project with many contributors. 222s Type 'contributors()' for more information and 222s 'citation()' on how to cite R or R packages in publications. 222s 222s Type 'demo()' for some demos, 'help()' for on-line help, or 222s 'help.start()' for an HTML browser interface to help. 222s Type 'q()' to quit R. 222s 222s > library("matrixStats") 222s > 222s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 222s + res <- rowMeans(x, na.rm = na.rm) 222s + if (!useNames) names(res) <- NULL 222s + res 222s + } 222s > 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > # Subsetted tests 222s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 222s > source("utils/validateIndicesFramework.R") 222s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 222s > storage.mode(x) <- "integer" 222s > 222s > # To check names attribute 222s > dimnames <- list(letters[1:6], LETTERS[1:6]) 222s > 222s > # Test with and without dimnames on x 222s > for (setDimnames in c(TRUE, FALSE)) { 222s + if (setDimnames) dimnames(x) <- dimnames 222s + else dimnames(x) <- NULL 222s + 222s + count <- 0L 222s + for (rows in index_cases) { 222s + for (cols in index_cases) { 222s + count <- count + 1L 222s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 222s + useNames <- c(TRUE, FALSE) 222s + useNames <- useNames[count %% length(useNames) + 1] 222s + 222s + validateIndicesTestMatrix(x, rows, cols, 222s + ftest = rowMeans2, fsure = rowMeans_R, 222s + na.rm = na.rm, useNames = useNames) 222s + validateIndicesTestMatrix(x, rows, cols, 222s + fcoltest = colMeans2, fsure = rowMeans_R, 222s + na.rm = na.rm, useNames = useNames) 222s + } 222s + } 222s + } 223s > 223s 223s R version 4.4.3 (2025-02-28) -- "Trophy Case" 223s Copyright (C) 2025 The R Foundation for Statistical Computing 223s Platform: x86_64-pc-linux-gnu 223s 223s R is free software and comes with ABSOLUTELY NO WARRANTY. 223s You are welcome to redistribute it under certain conditions. 223s Type 'license()' or 'licence()' for distribution details. 223s 223s R is a collaborative project with many contributors. 223s Type 'contributors()' for more information and 223s 'citation()' on how to cite R or R packages in publications. 223s 223s Type 'demo()' for some demos, 'help()' for on-line help, or 223s 'help.start()' for an HTML browser interface to help. 223s Type 'q()' to quit R. 223s 223s > library("matrixStats") 223s > 223s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 223s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 223s + if (!useNames) names(res) <- NULL 223s + res 223s + } 223s > 223s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 223s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 223s + if (!useNames) names(res) <- NULL 223s + res 223s + } 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Non-ties 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Non-ties:\n") 223s Special case: Non-ties: 223s > for (mode in c("integer", "double")) { 223s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 223s + storage.mode(x) <- mode 223s + 223s + # To check names attribute 223s + dimnames <- list(letters[1:3], LETTERS[1:3]) 223s + 223s + # Test with and without dimnames on x 223s + for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Ties 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Ties:\n") 223s Special case: Ties: 223s > for (mode in c("integer", "double")) { 223s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 223s + storage.mode(x) <- mode 223s + 223s + # To check names attribute 223s + dimnames <- list(letters[1:4], LETTERS[1:4]) 223s + 223s + # Test with and without dimnames on x 223s + for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Single-element matrix 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Single-element matrix:\n") 223s Special case: Single-element matrix: 223s > for (mode in c("integer", "double")) { 223s + x <- matrix(1, nrow = 1, ncol = 1) 223s + storage.mode(x) <- mode 223s + 223s + # To check names attribute 223s + dimnames <- list("a", "A") 223s + 223s + # Test with and without dimnames on x 223s + for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Empty matrix 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Empty matrix:\n") 223s Special case: Empty matrix: 223s > for (mode in c("integer", "double")) { 223s + x <- matrix(integer(0), nrow = 0, ncol = 0) 223s + storage.mode(x) <- mode 223s + 223s + y0 <- rowMedians_R(x, na.rm = FALSE) 223s + y1 <- rowMedians(x, na.rm = FALSE) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE) 223s + y1 <- colMedians(x, na.rm = FALSE) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: All NAs 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: All NAs:\n") 223s Special case: All NAs: 223s > for (mode in c("integer", "double")) { 223s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 223s + storage.mode(x) <- mode 223s + 223s + # To check names attribute 223s + dimnames <- list(letters[1:3], LETTERS[1:3]) 223s + 223s + # Test with and without dimnames on x 223s + for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: All NaNs 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: All NaNs:\n") 223s Special case: All NaNs: 223s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: All Infs 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: All Infs:\n") 223s Special case: All Infs: 223s > x <- matrix(Inf, nrow = 3, ncol = 3) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: All -Infs 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: All -Infs:\n") 223s Special case: All -Infs: 223s > x <- matrix(-Inf, nrow = 3, ncol = 3) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Infs and -Infs 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Infs and -Infs:\n") 223s Special case: Infs and -Infs: 223s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 223s > 223s > # To check names attribute 223s > dimnames <- list(letters[1:4], LETTERS[1:4]) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Special case: Integer overflow with ties 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > cat("Special case: Integer overflow with ties:\n") 223s Special case: Integer overflow with ties: 223s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + # Check names attribute 223s + for (useNames in c(TRUE, FALSE)) { 223s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + 223s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 223s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 223s + stopifnot(all.equal(y1, y0)) 223s + } 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Consistency checks 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > set.seed(1) 223s > 223s > cat("Consistency checks:\n") 223s Consistency checks: 223s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 223s > for (kk in seq_len(n_sims)) { 223s + cat("Random test #", kk, "\n", sep = "") 223s + 223s + # Simulate data in a matrix of any shape 223s + dim <- sample(50:200, size = 2) 223s + n <- prod(dim) 223s + x <- rnorm(n, sd = 100) 223s + dim(x) <- dim 223s + 223s + # Add NAs? 223s + if ((kk %% 4) %in% c(3, 0)) { 223s + cat("Adding NAs\n") 223s + nna <- sample(n, size = 1) 223s + na_values <- c(NA_real_, NaN) 223s + t <- sample(na_values, size = nna, replace = TRUE) 223s + x[sample(length(x), size = nna)] <- t 223s + } 223s + 223s + # Integer or double? 223s + if ((kk %% 4) %in% c(2, 0)) { 223s + cat("Coercing to integers\n") 223s + storage.mode(x) <- "integer" 223s + } 223s + 223s + na.rm <- sample(c(TRUE, FALSE), size = 1) 223s + 223s + # rowMedians(): 223s + y0 <- rowMedians_R(x, na.rm = na.rm) 223s + y1 <- rowMedians(x, na.rm = na.rm) 223s + stopifnot(all.equal(y1, y0)) 223s + y2 <- colMedians(t(x), na.rm = na.rm) 223s + stopifnot(all.equal(y2, y0)) 223s + 223s + # colMedians(): 223s + y0 <- colMedians_R(x, na.rm = na.rm) 223s + y1 <- colMedians(x, na.rm = na.rm) 223s + stopifnot(all.equal(y1, y0)) 223s + y2 <- rowMedians(t(x), na.rm = na.rm) 223s + stopifnot(all.equal(y2, y0)) 223s + } # for (kk ...) 223s Random test #1 223s Random test #2 223s Coercing to integers 223s Random test #3 223s Adding NAs 223s Random test #4 223s Adding NAs 223s Coercing to integers 223s Random test #5 223s Random test #6 223s Coercing to integers 223s Random test #7 223s Adding NAs 223s Random test #8 223s Adding NAs 223s Coercing to integers 223s Random test #9 223s Random test #10 223s Coercing to integers 223s Random test #11 223s Adding NAs 223s Random test #12 223s Adding NAs 223s Coercing to integers 223s Random test #13 223s Random test #14 223s Coercing to integers 223s Random test #15 223s Adding NAs 223s Random test #16 223s Adding NAs 223s Coercing to integers 223s Random test #17 223s Random test #18 223s Coercing to integers 223s Random test #19 223s Adding NAs 223s Random test #20 223s Adding NAs 223s Coercing to integers 223s > 223s 223s R version 4.4.3 (2025-02-28) -- "Trophy Case" 223s Copyright (C) 2025 The R Foundation for Statistical Computing 223s Platform: x86_64-pc-linux-gnu 223s 223s R is free software and comes with ABSOLUTELY NO WARRANTY. 223s You are welcome to redistribute it under certain conditions. 223s Type 'license()' or 'licence()' for distribution details. 223s 223s R is a collaborative project with many contributors. 223s Type 'contributors()' for more information and 223s 'citation()' on how to cite R or R packages in publications. 223s 223s Type 'demo()' for some demos, 'help()' for on-line help, or 223s 'help.start()' for an HTML browser interface to help. 223s Type 'q()' to quit R. 223s 223s > library("matrixStats") 223s > 223s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 223s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 223s + if (!useNames) names(res) <- NULL 223s + res 223s + } 223s > 223s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 223s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 223s + if (!useNames) names(res) <- NULL 223s + res 223s + } 223s > 223s > 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > # Subsetted tests 223s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 223s > source("utils/validateIndicesFramework.R") 223s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 223s > storage.mode(x) <- "integer" 223s > 223s > # To check names attribute 223s > dimnames <- list(letters[1:6], LETTERS[1:6]) 223s > 223s > # Test with and without dimnames on x 223s > for (setDimnames in c(TRUE, FALSE)) { 223s + if (setDimnames) dimnames(x) <- dimnames 223s + else dimnames(x) <- NULL 223s + 223s + count <- 0L 223s + for (rows in index_cases) { 223s + for (cols in index_cases) { 223s + count <- count + 1L 223s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 223s + useNames <- c(TRUE, FALSE) 223s + useNames <- useNames[count %% length(useNames) + 1] 223s + 223s + validateIndicesTestMatrix(x, rows, cols, 223s + ftest = rowMedians, fsure = rowMedians_R, 223s + na.rm = na.rm, useNames = useNames) 223s + validateIndicesTestMatrix(x, rows, cols, 223s + fcoltest = colMedians, fsure = rowMedians_R, 223s + na.rm = na.rm, useNames = useNames) 223s + } 223s + } 223s + } 224s > 224s 224s R version 4.4.3 (2025-02-28) -- "Trophy Case" 224s Copyright (C) 2025 The R Foundation for Statistical Computing 224s Platform: x86_64-pc-linux-gnu 224s 224s R is free software and comes with ABSOLUTELY NO WARRANTY. 224s You are welcome to redistribute it under certain conditions. 224s Type 'license()' or 'licence()' for distribution details. 224s 224s R is a collaborative project with many contributors. 224s Type 'contributors()' for more information and 224s 'citation()' on how to cite R or R packages in publications. 224s 224s Type 'demo()' for some demos, 'help()' for on-line help, or 224s 'help.start()' for an HTML browser interface to help. 224s Type 'q()' to quit R. 224s 224s > library("matrixStats") 224s > library("stats") 224s > 224s > asWhich <- function(probs, max) { 224s + idx <- as.integer(round(probs * max)) 224s + if (idx < 1L) { 224s + idx <- 1L 224s + } else if (idx > max) { 224s + idx <- max 224s + } 224s + idx 224s + } # asWhich() 224s > 224s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 224s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 224s + 224s + # Remove Attributes 224s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 224s + ans 224s + } # rowOrderStats_R() 224s > 224s > 224s > set.seed(1) 224s > 224s > 224s > # Simulate data in a matrix of any shape 224s > nrow <- 60L 224s > ncol <- 30L 224s > x <- rnorm(nrow * ncol) 224s > dim(x) <- c(nrow, ncol) 224s > probs <- 0.3 224s > which <- asWhich(probs, max = ncol) 224s > 224s > y0 <- rowOrderStats_R(x, probs = probs) 224s > y1 <- rowOrderStats(x, which = which) 224s > stopifnot(all.equal(y1, y0)) 224s > y2 <- colOrderStats(t(x), which = which) 224s > stopifnot(all.equal(y2, y0)) 224s > 224s > 224s > 224s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 224s > # Consistency checks 224s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 224s > for (mode in c("integer", "double")) { 224s + cat("Consistency checks without NAs:\n") 224s + for (kk in 1:3) { 224s + cat("Random test #", kk, "\n", sep = "") 224s + 224s + # Simulate data in a matrix of any shape 224s + nrow <- sample(20L, size = 1L) 224s + ncol <- sample(20L, size = 1L) 224s + x <- rnorm(nrow * ncol) 224s + dim(x) <- c(nrow, ncol) 224s + 224s + cat("mode: ", mode, "\n", sep = "") 224s + storage.mode(x) <- mode 224s + str(x) 224s + 224s + probs <- runif(1) 224s + which <- asWhich(probs, max = ncol) 224s + 224s + y0 <- rowOrderStats_R(x, probs = probs) 224s + y1 <- rowOrderStats(x, which = which) 224s + stopifnot(all.equal(y1, y0)) 224s + y2 <- colOrderStats(t(x), which = which) 224s + stopifnot(all.equal(y2, y0)) 224s + } # for (kk in ...) 224s + } # for (mode ...) 224s Consistency checks without NAs: 224s Random test #1 224s mode: integer 224s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 224s Random test #2 224s mode: integer 224s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 224s Random test #3 224s mode: integer 224s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 224s Consistency checks without NAs: 224s Random test #1 224s mode: double 224s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 224s Random test #2 224s mode: double 224s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 224s Random test #3 224s mode: double 224s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 224s > 224s > 224s > # Check names attribute 224s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 224s > 224s > probs <- runif(1) 224s > which <- asWhich(probs, max = ncol(x)) 224s > 224s > dimnames <- list(letters[1:3], LETTERS[1:3]) 224s > 224s > # Test with and without dimnames on x 224s > for (setDimnames in c(TRUE, FALSE)) { 224s + if (setDimnames) dimnames(x) <- dimnames 224s + else dimnames(x) <- NULL 224s + # Check names attribute 224s + for (useNames in c(TRUE, FALSE)) { 224s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 224s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 224s + stopifnot(all.equal(y1, y0)) 224s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 224s + stopifnot(all.equal(y2, y0)) 224s + } 224s + } 224s > 224s 224s R version 4.4.3 (2025-02-28) -- "Trophy Case" 224s Copyright (C) 2025 The R Foundation for Statistical Computing 224s Platform: x86_64-pc-linux-gnu 224s 224s R is free software and comes with ABSOLUTELY NO WARRANTY. 224s You are welcome to redistribute it under certain conditions. 224s Type 'license()' or 'licence()' for distribution details. 224s 224s R is a collaborative project with many contributors. 224s Type 'contributors()' for more information and 224s 'citation()' on how to cite R or R packages in publications. 224s 224s Type 'demo()' for some demos, 'help()' for on-line help, or 224s 'help.start()' for an HTML browser interface to help. 224s Type 'q()' to quit R. 224s 224s > library("matrixStats") 224s > 224s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 224s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 224s + 224s + # Remove Attributes 224s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 224s + ans 224s + } # rowOrderStats_R() 224s > 224s > 224s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 224s > # Subsetted tests 224s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 224s > source("utils/validateIndicesFramework.R") 224s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 224s > storage.mode(x) <- "integer" 224s > 224s > # To check names attribute 224s > dimnames <- list(letters[1:6], LETTERS[1:6]) 224s > 224s > probs <- 0.3 224s > # Test with and without dimnames on x 224s > for (setDimnames in c(TRUE, FALSE)) { 224s + if (setDimnames) dimnames(x) <- dimnames 224s + else dimnames(x) <- NULL 224s + for (rows in index_cases) { 224s + for (cols in index_cases) { 224s + # Check names attribute 224s + for (useNames in c(TRUE, FALSE)) { 224s + if (is.null(cols)) which <- round(probs * ncol(x)) 224s + else { 224s + xxrows <- rows 224s + suppressWarnings({ 224s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 224s + if (identical(xx, "error")) which <- 0L 224s + else which <- round(probs * ncol(xx)) 224s + }) 224s + } 224s + if (which == 0L) next 224s + 224s + validateIndicesTestMatrix(x, rows, cols, 224s + ftest = rowOrderStats, fsure = rowOrderStats_R, 224s + which = which, probs = probs, useNames = useNames) 224s + validateIndicesTestMatrix(x, rows, cols, 224s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 224s + which = which, probs = probs, useNames = useNames) 224s + } 224s + } 224s + } 224s + } 225s > 225s 225s R version 4.4.3 (2025-02-28) -- "Trophy Case" 225s Copyright (C) 2025 The R Foundation for Statistical Computing 225s Platform: x86_64-pc-linux-gnu 225s 225s R is free software and comes with ABSOLUTELY NO WARRANTY. 225s You are welcome to redistribute it under certain conditions. 225s Type 'license()' or 'licence()' for distribution details. 225s 225s R is a collaborative project with many contributors. 225s Type 'contributors()' for more information and 225s 'citation()' on how to cite R or R packages in publications. 225s 225s Type 'demo()' for some demos, 'help()' for on-line help, or 225s 'help.start()' for an HTML browser interface to help. 225s Type 'q()' to quit R. 225s 225s > library("matrixStats") 225s > 225s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 225s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 225s + if (!useNames) names(res) <- NULL 225s + res 225s + } 225s > 225s > all.equal.na <- function(target, current, ...) { 225s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 225s + current[is.nan(current)] <- NA_real_ 225s + target[is.nan(target)] <- NA_real_ 225s + all.equal(target, current, ...) 225s + } 225s > 225s > for (mode in c("integer", "double")) { 225s + # Missing values 225s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 225s + cat("mode: ", mode, "\n", sep = "") 225s + storage.mode(x) <- mode 225s + str(x) 225s + 225s + # To check names attribute 225s + dimnames <- list(letters[1:4], LETTERS[1:2]) 225s + 225s + # Test with and without dimnames on x 225s + for (setDimnames in c(TRUE, FALSE)) { 225s + if (setDimnames) dimnames(x) <- dimnames 225s + else dimnames(x) <- NULL 225s + # Check names attribute 225s + for (useNames in c(TRUE, FALSE)) { 225s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 225s + print(y0) 225s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 225s + print(y1) 225s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 225s + print(y2) 225s + stopifnot(all.equal(y1, y0)) 225s + stopifnot(all.equal(y2, y1)) 225s + 225s + # Missing values 225s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 225s + print(y0) 225s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 225s + print(y1) 225s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 225s + print(y2) 225s + stopifnot(all.equal(y1, y0)) 225s + stopifnot(all.equal(y2, y1)) 225s + 225s + # "Empty" rows 225s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 225s + print(y0) 225s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 225s + print(y1) 225s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 225s + print(y2) 225s + stopifnot(all.equal.na(y1, y0)) 225s + stopifnot(all.equal(y2, y1)) 225s + stopifnot(length(y1) == 0L) 225s + 225s + # Using product() 225s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 225s + print(y1) 225s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 225s + print(y2) 225s + stopifnot(all.equal(y2, y1)) 225s + } 225s + } 225s + } # for (mode ...) 225s mode: integer 225s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 NA NA 0 225s a b c d 225s 1 NA NA 0 225s a b c d 225s 1 NA NA 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s a b c d 225s 1 NA NA 0 225s a b c d 225s 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s mode: double 225s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 0 1 0 225s a b c d 225s 1 NA NaN 0 225s a b c d 225s 1 NA NaN 0 225s a b c d 225s 1 NA NaN 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s a b c d 225s 1 NA NA 0 225s a b c d 225s 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 0 1 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s [1] 1 NA NaN 0 225s numeric(0) 225s numeric(0) 225s numeric(0) 225s [1] 1 NA NA 0 225s [1] 1 NA NA 0 225s > 225s > 225s > # Bug report 2012-06-25 225s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 225s > y0 <- rowProds_R(x) 225s > print(y0) 225s [1] 1 0 1 0 225s > y1 <- rowProds(x) 225s > print(y1) 225s [1] 1 0 1 0 225s > y2 <- colProds(t(x)) 225s > print(y2) 225s [1] 1 0 1 0 225s > stopifnot(all.equal.na(y1, y0)) 225s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 225s > stopifnot(all.equal.na(y2, y1)) 225s > # Check names attribute 225s > dimnames(x) <- dimnames 225s > y0 <- rowProds_R(x, useNames = TRUE) 225s > print(y0) 225s a b c d 225s 1 0 1 0 225s > y1 <- rowProds(x, useNames = TRUE) 225s > print(y1) 225s a b c d 225s 1 0 1 0 225s > y2 <- colProds(t(x), useNames = TRUE) 225s > print(y2) 225s a b c d 225s 1 0 1 0 225s > stopifnot(all.equal.na(y1, y0)) 225s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 225s > stopifnot(all.equal.na(y2, y1)) 225s > 225s > # Bug report 2014-03-25 ("all rows contains a zero") 225s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 225s > # To check names attribute 225s > dimnames <- list(letters[1:2], LETTERS[1:2]) 225s > y0 <- rowProds_R(x) 225s > print(y0) 225s [1] 0 0 225s > y1 <- rowProds(x) 225s > print(y1) 225s [1] 0 0 225s > y2 <- colProds(t(x)) 225s > print(y2) 225s [1] 0 0 225s > stopifnot(all.equal.na(y1, y0)) 225s > stopifnot(all.equal.na(y1, c(0, 0))) 225s > stopifnot(all.equal.na(y2, y1)) 225s > # Check names attribute 225s > dimnames(x) <- dimnames 225s > y0 <- rowProds_R(x, useNames = TRUE) 225s > print(y0) 225s a b 225s 0 0 225s > y1 <- rowProds(x, useNames = TRUE) 225s > print(y1) 225s a b 225s 0 0 225s > y2 <- colProds(t(x), useNames = TRUE) 225s > print(y2) 225s a b 225s 0 0 225s > stopifnot(all.equal.na(y1, y0)) 225s > stopifnot(all.equal.na(y2, y1)) 225s > 225s 225s R version 4.4.3 (2025-02-28) -- "Trophy Case" 225s Copyright (C) 2025 The R Foundation for Statistical Computing 225s Platform: x86_64-pc-linux-gnu 225s 225s R is free software and comes with ABSOLUTELY NO WARRANTY. 225s You are welcome to redistribute it under certain conditions. 225s Type 'license()' or 'licence()' for distribution details. 225s 225s R is a collaborative project with many contributors. 225s Type 'contributors()' for more information and 225s 'citation()' on how to cite R or R packages in publications. 225s 225s Type 'demo()' for some demos, 'help()' for on-line help, or 225s 'help.start()' for an HTML browser interface to help. 225s Type 'q()' to quit R. 225s 225s > library("matrixStats") 225s > 225s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 225s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 225s + if (!useNames) names(res) <- NULL 225s + res 225s + } 225s > 225s > 225s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 225s > # Subsetted tests 225s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 225s > source("utils/validateIndicesFramework.R") 225s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 225s > storage.mode(x) <- "integer" 225s > 225s > # To check names attribute 225s > dimnames <- list(letters[1:6], LETTERS[1:6]) 225s > 225s > # Test with and without dimnames on x 225s > for (setDimnames in c(TRUE, FALSE)) { 225s + if (setDimnames) dimnames(x) <- dimnames 225s + else dimnames(x) <- NULL 225s + for (rows in index_cases) { 225s + for (cols in index_cases) { 225s + for (na.rm in c(TRUE, FALSE)) { 225s + for (useNames in c(TRUE, FALSE)) { 225s + validateIndicesTestMatrix(x, rows, cols, 225s + ftest = rowProds, fsure = rowProds_R, 225s + method = "expSumLog", 225s + FUN = product, na.rm = na.rm, useNames = useNames) 225s + validateIndicesTestMatrix(x, rows, cols, 225s + fcoltest = colProds, fsure = rowProds_R, 225s + method = "expSumLog", 225s + FUN = product, na.rm = na.rm, useNames = useNames) 225s + } 225s + } 225s + } 225s + } 225s + } 226s > 226s 226s R version 4.4.3 (2025-02-28) -- "Trophy Case" 226s Copyright (C) 2025 The R Foundation for Statistical Computing 226s Platform: x86_64-pc-linux-gnu 226s 226s R is free software and comes with ABSOLUTELY NO WARRANTY. 226s You are welcome to redistribute it under certain conditions. 226s Type 'license()' or 'licence()' for distribution details. 226s 226s R is a collaborative project with many contributors. 226s Type 'contributors()' for more information and 226s 'citation()' on how to cite R or R packages in publications. 226s 226s Type 'demo()' for some demos, 'help()' for on-line help, or 226s 'help.start()' for an HTML browser interface to help. 226s Type 'q()' to quit R. 226s 226s > library("matrixStats") 226s > 226s > ## Create isFALSE() if running on an old version of R 226s > if (!exists("isFALSE", mode="function")) { 226s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 226s + } 226s > 226s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = TRUE) { 226s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 226s + if (!na.rm && any(is.na(x))) { 226s + na_value <- NA_real_ 226s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 226s + rep(na_value, times = length(probs)) 226s + } else { 226s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 226s + } 226s + }, probs = probs, na.rm = na.rm) 226s + 226s + if (!is.null(dim(q))) q <- t(q) 226s + else dim(q) <- c(nrow(x), length(probs)) 226s + 226s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 226s + rownames(q) <- rownames(x) 226s + if (isFALSE(useNames)) dimnames(q) <- NULL 226s + 226s + if (drop) q <- drop(q) 226s + q 226s + } 226s > 226s > 226s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 226s > # Test with multiple quantiles 226s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 226s > for (mode in c("logical", "integer", "double")) { 226s + cat("mode: ", mode, "\n", sep = "") 226s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 226s + storage.mode(x) <- mode 226s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 226s + str(x) 226s + 226s + probs <- c(0, 0.5, 1) 226s + # Test with and without dimnames on x 226s + for (setDimnames in c(TRUE, FALSE)) { 226s + if (setDimnames) dimnames(x) <- dimnames 226s + else dimnames(x) <- NULL 226s + # Check names attribute 226s + for (useNames in c(TRUE, FALSE)) { 226s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 226s + print(q0) 226s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 226s + print(q1) 226s + stopifnot(all.equal(q1, q0)) 226s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 226s + stopifnot(all.equal(q2, q0)) 226s + } 226s + } 226s + } # for (mode ...) 226s mode: logical 226s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 226s 0% 50% 100% 226s a 1 1 1 226s b 1 1 1 226s c 1 1 1 226s d 1 1 1 226s e 1 1 1 226s f 1 1 1 226s g 1 1 1 226s h 1 1 1 226s 0% 50% 100% 226s a 1 1 1 226s b 1 1 1 226s c 1 1 1 226s d 1 1 1 226s e 1 1 1 226s f 1 1 1 226s g 1 1 1 226s h 1 1 1 227s [,1] [,2] [,3] 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s [,1] [,2] [,3] 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s 0% 50% 100% 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s 0% 50% 100% 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s [,1] [,2] [,3] 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s [,1] [,2] [,3] 227s [1,] 1 1 1 227s [2,] 1 1 1 227s [3,] 1 1 1 227s [4,] 1 1 1 227s [5,] 1 1 1 227s [6,] 1 1 1 227s [7,] 1 1 1 227s [8,] 1 1 1 227s mode: integer 227s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 227s 0% 50% 100% 227s a 1 17 33 227s b 2 18 34 227s c 3 19 35 227s d 4 20 36 227s e 5 21 37 227s f 6 22 38 227s g 7 23 39 227s h 8 24 40 227s 0% 50% 100% 227s a 1 17 33 227s b 2 18 34 227s c 3 19 35 227s d 4 20 36 227s e 5 21 37 227s f 6 22 38 227s g 7 23 39 227s h 8 24 40 227s [,1] [,2] [,3] 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s [,1] [,2] [,3] 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s 0% 50% 100% 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s 0% 50% 100% 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s [,1] [,2] [,3] 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s [,1] [,2] [,3] 227s [1,] 1 17 33 227s [2,] 2 18 34 227s [3,] 3 19 35 227s [4,] 4 20 36 227s [5,] 5 21 37 227s [6,] 6 22 38 227s [7,] 7 23 39 227s [8,] 8 24 40 227s mode: double 227s 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 ... 227s 0% 50% 100% 227s a 1.1 17.1 33.1 227s b 2.1 18.1 34.1 227s c 3.1 19.1 35.1 227s d 4.1 20.1 36.1 227s e 5.1 21.1 37.1 227s f 6.1 22.1 38.1 227s g 7.1 23.1 39.1 227s h 8.1 24.1 40.1 227s 0% 50% 100% 227s a 1.1 17.1 33.1 227s b 2.1 18.1 34.1 227s c 3.1 19.1 35.1 227s d 4.1 20.1 36.1 227s e 5.1 21.1 37.1 227s f 6.1 22.1 38.1 227s g 7.1 23.1 39.1 227s h 8.1 24.1 40.1 227s [,1] [,2] [,3] 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s [,1] [,2] [,3] 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s 0% 50% 100% 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s 0% 50% 100% 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s [,1] [,2] [,3] 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s [,1] [,2] [,3] 227s [1,] 1.1 17.1 33.1 227s [2,] 2.1 18.1 34.1 227s [3,] 3.1 19.1 35.1 227s [4,] 4.1 20.1 36.1 227s [5,] 5.1 21.1 37.1 227s [6,] 6.1 22.1 38.1 227s [7,] 7.1 23.1 39.1 227s [8,] 8.1 24.1 40.1 227s > 227s > 227s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 227s > # Test with a single quantile 227s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 227s > for (mode in c("logical", "integer", "double")) { 227s + cat("mode: ", mode, "\n", sep = "") 227s + x <- matrix(1:40, nrow = 8, ncol = 5) 227s + storage.mode(x) <- mode 227s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 227s + str(x) 227s + 227s + probs <- c(0.5) 227s + # Test with and without dimnames on x 227s + for (setDimnames in c(TRUE, FALSE)) { 227s + if (setDimnames) dimnames(x) <- dimnames 227s + else dimnames(x) <- NULL 227s + # Check names attribute 227s + for (useNames in c(TRUE, FALSE)) { 227s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 227s + print(q0) 227s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 227s + print(q1) 227s + stopifnot(all.equal(q1, q0)) 227s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 227s + stopifnot(all.equal(q2, q0)) 227s + } 227s + } 227s + } # for (mode ...) 227s mode: logical 227s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 227s a b c d e f g h 227s 1 1 1 1 1 1 1 1 227s a b c d e f g h 227s 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s [1] 1 1 1 1 1 1 1 1 227s mode: integer 227s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 227s a b c d e f g h 227s 17 18 19 20 21 22 23 24 227s a b c d e f g h 227s 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s mode: double 227s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 227s a b c d e f g h 227s 17 18 19 20 21 22 23 24 227s a b c d e f g h 227s 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s [1] 17 18 19 20 21 22 23 24 227s > 227s > 227s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 227s > # Consistency checks 227s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 227s > set.seed(1) 227s > 227s > probs <- seq(from = 0, to = 1, by = 0.25) 227s > 227s > cat("Consistency checks:\n") 227s Consistency checks: 227s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 227s > for (kk in seq_len(n_sims)) { 227s + cat("Random test #", kk, "\n", sep = "") 227s + 227s + # Simulate data in a matrix of any shape 227s + dim <- sample(20:60, size = 2L) 227s + n <- prod(dim) 227s + x <- rnorm(n, sd = 100) 227s + dim(x) <- dim 227s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 227s + 227s + # Add NAs? 227s + has_na <- ((kk %% 2) == 0L) 227s + if (has_na) { 227s + cat("Adding NAs\n") 227s + nna <- sample(n, size = 1) 227s + na_values <- c(NA_real_, NaN) 227s + t <- sample(na_values, size = nna, replace = TRUE) 227s + x[sample(length(x), size = nna)] <- t 227s + } 227s + 227s + # Logical, integer, or double? 227s + mode <- "numeric" 227s + if ((kk %% 6) %in% 1:2) { 227s + cat("Coercing to logical\n") 227s + mode <- "logical" 227s + } else if ((kk %% 6) %in% 3:4) { 227s + cat("Coercing to integers\n") 227s + mode <- "integer" 227s + } 227s + storage.mode(x) <- mode 227s + 227s + str(x) 227s + 227s + # rowQuantiles(): 227s + for (type in 1:9) { 227s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 227s + # Test with and without dimnames on x 227s + for (setDimnames in c(TRUE, FALSE)) { 227s + if (setDimnames) dimnames(x) <- dimnames 227s + else dimnames(x) <- NULL 227s + # Check names attribute 227s + for (useNames in c(TRUE, FALSE)) { 227s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 227s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 227s + stopifnot(all.equal(q1, q0)) 227s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 227s + stopifnot(all.equal(q2, q0)) 227s + } 227s + } 227s + } 227s + } # for (kk ...) 227s Random test #1 227s Coercing to logical 227s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 227s type=1, has_na=FALSE: 227s type=2, has_na=FALSE: 227s type=3, has_na=FALSE: 227s type=4, has_na=FALSE: 227s type=5, has_na=FALSE: 227s type=6, has_na=FALSE: 227s type=7, has_na=FALSE: 227s type=8, has_na=FALSE: 227s type=9, has_na=FALSE: 227s Random test #2 227s Adding NAs 227s Coercing to logical 227s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 227s type=1, has_na=TRUE: 227s type=2, has_na=TRUE: 227s type=3, has_na=TRUE: 227s type=4, has_na=TRUE: 227s type=5, has_na=TRUE: 227s type=6, has_na=TRUE: 227s type=7, has_na=TRUE: 227s type=8, has_na=TRUE: 227s type=9, has_na=TRUE: 227s Random test #3 227s Coercing to integers 227s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 227s type=1, has_na=FALSE: 227s type=2, has_na=FALSE: 227s type=3, has_na=FALSE: 227s type=4, has_na=FALSE: 227s type=5, has_na=FALSE: 227s type=6, has_na=FALSE: 228s type=7, has_na=FALSE: 228s type=8, has_na=FALSE: 228s type=9, has_na=FALSE: 228s Random test #4 228s Adding NAs 228s Coercing to integers 228s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 228s type=1, has_na=TRUE: 228s type=2, has_na=TRUE: 228s type=3, has_na=TRUE: 228s type=4, has_na=TRUE: 228s type=5, has_na=TRUE: 228s type=6, has_na=TRUE: 228s type=7, has_na=TRUE: 228s type=8, has_na=TRUE: 228s type=9, has_na=TRUE: 228s Random test #5 228s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 228s type=1, has_na=FALSE: 228s type=2, has_na=FALSE: 228s type=3, has_na=FALSE: 228s type=4, has_na=FALSE: 228s type=5, has_na=FALSE: 228s type=6, has_na=FALSE: 228s type=7, has_na=FALSE: 228s type=8, has_na=FALSE: 228s type=9, has_na=FALSE: 228s Random test #6 228s Adding NAs 228s num [1:46, 1:22] 197 -107 15 148 -110 ... 228s type=1, has_na=TRUE: 228s type=2, has_na=TRUE: 228s type=3, has_na=TRUE: 229s type=4, has_na=TRUE: 229s type=5, has_na=TRUE: 229s type=6, has_na=TRUE: 229s type=7, has_na=TRUE: 229s type=8, has_na=TRUE: 229s type=9, has_na=TRUE: 229s Random test #7 229s Coercing to logical 229s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 229s type=1, has_na=FALSE: 229s type=2, has_na=FALSE: 229s type=3, has_na=FALSE: 229s type=4, has_na=FALSE: 229s type=5, has_na=FALSE: 229s type=6, has_na=FALSE: 229s type=7, has_na=FALSE: 229s type=8, has_na=FALSE: 229s type=9, has_na=FALSE: 229s Random test #8 229s Adding NAs 229s Coercing to logical 229s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 229s type=1, has_na=TRUE: 229s type=2, has_na=TRUE: 229s type=3, has_na=TRUE: 229s type=4, has_na=TRUE: 229s type=5, has_na=TRUE: 229s type=6, has_na=TRUE: 229s type=7, has_na=TRUE: 229s type=8, has_na=TRUE: 229s type=9, has_na=TRUE: 229s Random test #9 229s Coercing to integers 229s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 229s type=1, has_na=FALSE: 229s type=2, has_na=FALSE: 229s type=3, has_na=FALSE: 229s type=4, has_na=FALSE: 229s type=5, has_na=FALSE: 230s type=6, has_na=FALSE: 230s type=7, has_na=FALSE: 230s type=8, has_na=FALSE: 230s type=9, has_na=FALSE: 230s Random test #10 230s Adding NAs 230s Coercing to integers 230s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 230s type=1, has_na=TRUE: 230s type=2, has_na=TRUE: 230s type=3, has_na=TRUE: 230s type=4, has_na=TRUE: 230s type=5, has_na=TRUE: 230s type=6, has_na=TRUE: 230s type=7, has_na=TRUE: 230s type=8, has_na=TRUE: 230s type=9, has_na=TRUE: 230s Random test #11 230s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 230s type=1, has_na=FALSE: 230s type=2, has_na=FALSE: 230s type=3, has_na=FALSE: 230s type=4, has_na=FALSE: 230s type=5, has_na=FALSE: 230s type=6, has_na=FALSE: 230s type=7, has_na=FALSE: 230s type=8, has_na=FALSE: 230s type=9, has_na=FALSE: 231s Random test #12 231s Adding NAs 231s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 231s type=1, has_na=TRUE: 231s type=2, has_na=TRUE: 231s type=3, has_na=TRUE: 231s type=4, has_na=TRUE: 231s type=5, has_na=TRUE: 231s type=6, has_na=TRUE: 231s type=7, has_na=TRUE: 231s type=8, has_na=TRUE: 231s type=9, has_na=TRUE: 231s Random test #13 231s Coercing to logical 231s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 231s type=1, has_na=FALSE: 231s type=2, has_na=FALSE: 231s type=3, has_na=FALSE: 231s type=4, has_na=FALSE: 231s type=5, has_na=FALSE: 231s type=6, has_na=FALSE: 231s type=7, has_na=FALSE: 231s type=8, has_na=FALSE: 231s type=9, has_na=FALSE: 231s Random test #14 231s Adding NAs 231s Coercing to logical 231s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 231s type=1, has_na=TRUE: 231s type=2, has_na=TRUE: 232s type=3, has_na=TRUE: 232s type=4, has_na=TRUE: 232s type=5, has_na=TRUE: 232s type=6, has_na=TRUE: 232s type=7, has_na=TRUE: 232s type=8, has_na=TRUE: 232s type=9, has_na=TRUE: 232s Random test #15 232s Coercing to integers 232s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 232s type=1, has_na=FALSE: 232s type=2, has_na=FALSE: 232s type=3, has_na=FALSE: 232s type=4, has_na=FALSE: 232s type=5, has_na=FALSE: 232s type=6, has_na=FALSE: 232s type=7, has_na=FALSE: 232s type=8, has_na=FALSE: 232s type=9, has_na=FALSE: 232s Random test #16 232s Adding NAs 232s Coercing to integers 232s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 232s type=1, has_na=TRUE: 232s type=2, has_na=TRUE: 232s type=3, has_na=TRUE: 232s type=4, has_na=TRUE: 232s type=5, has_na=TRUE: 232s type=6, has_na=TRUE: 232s type=7, has_na=TRUE: 232s type=8, has_na=TRUE: 232s type=9, has_na=TRUE: 232s Random test #17 232s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 232s type=1, has_na=FALSE: 232s type=2, has_na=FALSE: 232s type=3, has_na=FALSE: 232s type=4, has_na=FALSE: 232s type=5, has_na=FALSE: 232s type=6, has_na=FALSE: 232s type=7, has_na=FALSE: 232s type=8, has_na=FALSE: 232s type=9, has_na=FALSE: 233s Random test #18 233s Adding NAs 233s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 233s type=1, has_na=TRUE: 233s type=2, has_na=TRUE: 233s type=3, has_na=TRUE: 233s type=4, has_na=TRUE: 233s type=5, has_na=TRUE: 233s type=6, has_na=TRUE: 233s type=7, has_na=TRUE: 233s type=8, has_na=TRUE: 233s type=9, has_na=TRUE: 233s Random test #19 233s Coercing to logical 233s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 233s type=1, has_na=FALSE: 233s type=2, has_na=FALSE: 233s type=3, has_na=FALSE: 233s type=4, has_na=FALSE: 233s type=5, has_na=FALSE: 233s type=6, has_na=FALSE: 233s type=7, has_na=FALSE: 233s type=8, has_na=FALSE: 233s type=9, has_na=FALSE: 233s Random test #20 233s Adding NAs 233s Coercing to logical 233s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 233s type=1, has_na=TRUE: 233s type=2, has_na=TRUE: 233s type=3, has_na=TRUE: 233s type=4, has_na=TRUE: 234s type=5, has_na=TRUE: 234s type=6, has_na=TRUE: 234s type=7, has_na=TRUE: 234s type=8, has_na=TRUE: 234s type=9, has_na=TRUE: 234s Random test #21 234s Coercing to integers 234s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 234s type=1, has_na=FALSE: 234s type=2, has_na=FALSE: 234s type=3, has_na=FALSE: 234s type=4, has_na=FALSE: 234s type=5, has_na=FALSE: 234s type=6, has_na=FALSE: 234s type=7, has_na=FALSE: 234s type=8, has_na=FALSE: 234s type=9, has_na=FALSE: 234s Random test #22 234s Adding NAs 234s Coercing to integers 234s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 234s type=1, has_na=TRUE: 234s type=2, has_na=TRUE: 234s type=3, has_na=TRUE: 234s type=4, has_na=TRUE: 234s type=5, has_na=TRUE: 234s type=6, has_na=TRUE: 234s type=7, has_na=TRUE: 234s type=8, has_na=TRUE: 234s type=9, has_na=TRUE: 235s Random test #23 235s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 235s type=1, has_na=FALSE: 235s type=2, has_na=FALSE: 235s type=3, has_na=FALSE: 235s type=4, has_na=FALSE: 235s type=5, has_na=FALSE: 235s type=6, has_na=FALSE: 235s type=7, has_na=FALSE: 235s type=8, has_na=FALSE: 235s type=9, has_na=FALSE: 235s Random test #24 235s Adding NAs 235s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 235s type=1, has_na=TRUE: 235s type=2, has_na=TRUE: 235s type=3, has_na=TRUE: 235s type=4, has_na=TRUE: 235s type=5, has_na=TRUE: 235s type=6, has_na=TRUE: 235s type=7, has_na=TRUE: 235s type=8, has_na=TRUE: 235s type=9, has_na=TRUE: 235s > 235s > 235s > 235s > for (mode in c("logical", "integer", "double")) { 235s + naValue <- NA_real_ 235s + storage.mode(naValue) <- mode 235s + 235s + someValue <- 1 235s + storage.mode(someValue) <- mode 235s + 235s + for (type in 1:9) { 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + # All NA 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 235s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + # Test with and without dimnames on x 235s + for (setDimnames in c(TRUE, FALSE)) { 235s + if (setDimnames) dimnames(x) <- dimnames 235s + else dimnames(x) <- NULL 235s + # Check names attribute 235s + for (useNames in c(TRUE, FALSE)) { 235s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 235s + 235s + qr <- rowQuantiles(x, type = type, useNames = useNames) 235s + stopifnot(identical(qr, qr0)) 235s + 235s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 235s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 235s + 235s + stopifnot(identical(qc, qr)) 235s + } 235s + } 235s + 235s + 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + # Empty matrices 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + probs <- c(0, 0.25, 0.75, 1) 235s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 235s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 235s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 235s + 235s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 235s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 235s + 235s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 235s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 235s + 235s + 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + # Single column matrices 235s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 235s + probs <- c(0, 0.25, 0.75, 1) 235s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 235s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + print(qr) 235s + 235s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 235s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 235s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 235s + print(qc) 235s + 235s + stopifnot(identical(qc, qr)) 235s + } 235s + } 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s 0% 25% 75% 100% 235s a 1 1 1 1 235s b 1 1 1 1 235s > 235s 235s R version 4.4.3 (2025-02-28) -- "Trophy Case" 235s Copyright (C) 2025 The R Foundation for Statistical Computing 235s Platform: x86_64-pc-linux-gnu 235s 235s R is free software and comes with ABSOLUTELY NO WARRANTY. 235s You are welcome to redistribute it under certain conditions. 235s Type 'license()' or 'licence()' for distribution details. 235s 235s R is a collaborative project with many contributors. 235s Type 'contributors()' for more information and 235s 'citation()' on how to cite R or R packages in publications. 235s 235s Type 'demo()' for some demos, 'help()' for on-line help, or 235s 'help.start()' for an HTML browser interface to help. 235s Type 'q()' to quit R. 235s 236s > library("matrixStats") 236s > 236s > ## Create isFALSE() if running on an old version of R 236s > if (!exists("isFALSE", mode="function")) { 236s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 236s + } 236s > 236s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = TRUE) { 236s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 236s + if (!na.rm && any(is.na(x))) { 236s + na_value <- NA_real_ 236s + storage.mode(na_value) <- storage.mode(x) 236s + rep(na_value, times = length(probs)) 236s + 236s + } else { 236s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 236s + } 236s + }, probs = probs, na.rm = na.rm) 236s + 236s + if (!is.null(dim(q))) q <- t(q) 236s + else dim(q) <- c(nrow(x), length(probs)) 236s + 236s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 236s + rownames(q) <- rownames(x) 236s + if (isFALSE(useNames)) dimnames(q) <- NULL 236s + 236s + if (drop) q <- drop(q) 236s + q 236s + } 236s > 236s > 236s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 236s > # Subsetted tests 236s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 236s > source("utils/validateIndicesFramework.R") 236s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 236s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 236s > probs <- c(0, 0.25, 0.75, 1) 236s > # Test with and without dimnames on x 236s > for (setDimnames in c(TRUE, FALSE)) { 236s + if (setDimnames) dimnames(x) <- dimnames 236s + else dimnames(x) <- NULL 236s + 236s + count <- 0L 236s + for (rows in index_cases) { 236s + for (cols in index_cases) { 236s + count <- count + 1L 236s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 236s + useNames <- c(TRUE, FALSE) 236s + useNames <- useNames[count %% length(useNames) + 1] 236s + 236s + validateIndicesTestMatrix(x, rows, cols, 236s + ftest = rowQuantiles, fsure = rowQuantiles_R, 236s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 236s + validateIndicesTestMatrix(x, rows, cols, 236s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 236s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 236s + } 236s + } 236s + } 237s > 237s > 237s 237s R version 4.4.3 (2025-02-28) -- "Trophy Case" 237s Copyright (C) 2025 The R Foundation for Statistical Computing 237s Platform: x86_64-pc-linux-gnu 237s 237s R is free software and comes with ABSOLUTELY NO WARRANTY. 237s You are welcome to redistribute it under certain conditions. 237s Type 'license()' or 'licence()' for distribution details. 237s 237s R is a collaborative project with many contributors. 237s Type 'contributors()' for more information and 237s 'citation()' on how to cite R or R packages in publications. 237s 237s Type 'demo()' for some demos, 'help()' for on-line help, or 237s 'help.start()' for an HTML browser interface to help. 237s Type 'q()' to quit R. 237s 237s > library("matrixStats") 237s > 237s > rowMins_R <- function(x, ..., useNames = TRUE) { 237s + suppressWarnings({ 237s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 237s + }) 237s + if (!useNames) names(res) <- NULL 237s + res 237s + } # rowMins_R() 237s > 237s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 237s + suppressWarnings({ 237s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 237s + }) 237s + if (!useNames) names(res) <- NULL 237s + res 237s + } # rowMaxs_R() 237s > 237s > rowRanges_R <- function(x, ..., useNames = TRUE) { 237s + suppressWarnings({ 237s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 237s + }) 237s + 237s + # Preserve rownames attribute 237s + dim <- c(dim(x)[1], 2L) 237s + if (!isTRUE(all.equal(dim(ans), dim))) { 237s + dim(ans) <- dim 237s + rownames <- rownames(x) 237s + if (!is.null(dimnames)) rownames(ans) <- rownames 237s + } 237s + if (!useNames) dimnames(ans) <- NULL 237s + ans 237s + } # rowRanges_R() 237s > 237s > 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > # With and without some NAs 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > for (mode in c("integer", "double")) { 237s + cat("mode: ", mode, "\n", sep = "") 237s + 237s + for (add_na in c(FALSE, TRUE)) { 237s + cat("add_na = ", add_na, "\n", sep = "") 237s + 237s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 237s + if (add_na) { 237s + x[3:7, c(2, 4)] <- NA_real_ 237s + } 237s + storage.mode(x) <- mode 237s + str(x) 237s + 237s + # To check names attribute 237s + dimnames <- list(letters[1:10], LETTERS[1:5]) 237s + 237s + # Test with and without dimnames on x 237s + for (setDimnames in c(TRUE, FALSE)) { 237s + if (setDimnames) dimnames(x) <- dimnames 237s + else dimnames(x) <- NULL 237s + # Row/column extremes 237s + for (na.rm in c(FALSE, TRUE)) { 237s + # Check names attribute 237s + for (useNames in c(TRUE, FALSE)) { 237s + cat("na.rm = ", na.rm, "\n", sep = "") 237s + 237s + # Ranges 237s + cat("range:\n") 237s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 237s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 237s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 237s + stopifnot(all.equal(r1, r2)) 237s + stopifnot(all.equal(r1, r0)) 237s + 237s + # Min 237s + cat("min:\n") 237s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 237s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 237s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 237s + stopifnot(all.equal(m1, m2)) 237s + stopifnot(all.equal(m1, m0)) 237s + 237s + # Max 237s + cat("max:\n") 237s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 237s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 237s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 237s + stopifnot(all.equal(m1, m2)) 237s + stopifnot(all.equal(m1, m0)) 237s + } 237s + } 237s + } 237s + } # for (add_na ...) 237s + } # for (mode ...) 237s mode: integer 237s add_na = FALSE 237s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s add_na = TRUE 237s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s mode: double 237s add_na = FALSE 237s 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 ... 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s add_na = TRUE 237s 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 ... 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = FALSE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s na.rm = TRUE 237s range: 237s min: 237s max: 237s > 237s > 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > # All NAs 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > for (mode in c("integer", "double")) { 237s + cat("mode: ", mode, "\n", sep = "") 237s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 237s + storage.mode(x) <- mode 237s + str(x) 237s + 237s + # Test with and without dimnames on x 237s + for (setDimnames in c(TRUE, FALSE)) { 237s + if (setDimnames) dimnames(x) <- dimnames 237s + else dimnames(x) <- NULL 237s + for (na.rm in c(FALSE, TRUE)) { 237s + # Check names attribute 237s + for (useNames in c(TRUE, FALSE)) { 237s + cat("na.rm = ", na.rm, "\n", sep = "") 237s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 237s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 237s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 237s + stopifnot(all.equal(r1, r2)) 237s + stopifnot(all.equal(r1, r0)) 237s + } 237s + } 237s + } 237s + } # for (mode ...) 237s mode: integer 237s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 237s na.rm = FALSE 237s na.rm = FALSE 237s na.rm = TRUE 237s na.rm = TRUE 237s na.rm = FALSE 237s na.rm = FALSE 237s na.rm = TRUE 237s na.rm = TRUE 237s mode: double 237s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 237s na.rm = FALSE 237s na.rm = FALSE 237s na.rm = TRUE 237s na.rm = TRUE 237s na.rm = FALSE 237s na.rm = FALSE 237s na.rm = TRUE 237s na.rm = TRUE 237s > 237s > 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > # Special cases 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > # Nx0 matrix 237s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 237s > r0 <- rowRanges_R(x) 237s > #r1 <- rowRanges(x) 237s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 237s > #stopifnot(all.equal(r1, r_truth)) 237s > 237s > # 0xN matrix 237s > x <- t(x) 237s > #r1 <- colRanges(x) 237s > #stopifnot(all.equal(r1, r_truth)) 237s > 237s > # Nx1 matrix 237s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 237s > # To check names attribute 237s > dimnames <- list(letters[1:5], "A") 237s > r1 <- rowRanges(x) 237s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 237s > stopifnot(all.equal(r1, r_truth)) 237s > # Check names attribute 237s > dimnames(x) <- dimnames 237s > r0 <- rowRanges_R(x, useNames = TRUE) 237s > r1 <- rowRanges(x, useNames = TRUE) 237s > stopifnot(all.equal(r1, r0)) 237s > dimnames(x) <- NULL 237s > 237s > # 1xN matrix 237s > x <- t(x) 237s > r1 <- colRanges(x) 237s > stopifnot(all.equal(r1, r_truth)) 237s > # Check names attribute 237s > dimnames(x) <- list("a", LETTERS[1:5]) 237s > r1 <- colRanges(x, useNames = TRUE) 237s > stopifnot(identical(rownames(r1), colnames(x))) 237s > 237s > 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 237s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 237s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 237s > 237s > na_list <- list( 237s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 237s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 237s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 237s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 237s + ) 237s > 237s > na <- na_list[["real"]] 237s > na[2, 2] <- NA 237s > na_list[["real + NA cell"]] <- na 237s > 237s > na <- na_list[["real"]] 237s > na[2, ] <- NA 237s > na_list[["real + NA row"]] <- na 237s > 237s > na <- na_list[["real"]] 237s > na[2, ] <- NaN 237s > na_list[["real + NaN row"]] <- na 237s > 237s > na <- na_list[["real"]] 237s > na[2, 2] <- Inf 237s > na_list[["real + Inf cell"]] <- na 237s > 237s > na <- na_list[["real"]] 237s > na[2, ] <- Inf 237s > na_list[["real + Inf row"]] <- na 237s > 237s > na <- na_list[["real"]] 237s > na[2, 2] <- NaN 237s > na_list[["real + NaN cell"]] <- na 237s > 237s > na <- na_list[["real w/ NA"]] 237s > na[2, 2] <- NaN 237s > na_list[["real w/ NA + NaN cell"]] <- na 237s > 237s > na <- na_list[["real w/ NA"]] 237s > na[2, ] <- NaN 237s > na_list[["real w/ NA + NaN row"]] <- na 237s > 237s > # To check names attribute 237s > dimnames <- list(letters[1:4], LETTERS[1:3]) 237s > 237s > # Test with and without dimnames on x 237s > for (setDimnames in c(TRUE, FALSE)) { 237s + if (setDimnames) dimnames(x) <- dimnames 237s + else dimnames(x) <- NULL 237s + for (na.rm in c(FALSE, TRUE)) { 237s + for (name in names(na_list)) { 237s + # Check names attribute 237s + for (useNames in c(TRUE, FALSE)) { 237s + na <- na_list[[name]] 237s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 237s + print(na) 237s + 237s + cat(" min:\n") 237s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 237s + str(y0) 237s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 237s + str(y1) 237s + stopifnot(all.equal(y1, y0)) 237s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 237s + str(y1c) 237s + stopifnot(all.equal(y1c, y1)) 237s + 237s + cat(" max:\n") 237s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 237s + str(y0) 237s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 237s + str(y1) 237s + stopifnot(all.equal(y1, y0)) 237s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 237s + str(y1c) 237s + stopifnot(all.equal(y1c, y1)) 237s + 237s + cat(" range:\n") 237s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 237s + str(y0) 237s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 237s + str(y1) 237s + stopifnot(all.equal(y1, y0)) 237s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 237s + str(y1c) 237s + stopifnot(all.equal(y1c, y1)) 237s + } 237s + } # for (name ...) 237s + } # for (na.rm ...) 237s + } 237s integer (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer w/ NA (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s max: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s range: 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s integer w/ NA (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s max: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s range: 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real + NA cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + Inf cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s max: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s range: 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s real w/ NA + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s max: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s range: 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s integer (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer w/ NA (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s integer w/ NA (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real + NA cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NA cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NA row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NA row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s integer (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer w/ NA (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s max: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s range: 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s integer w/ NA (integer) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s max: 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s int [1:4] NA NA NA NA 237s range: 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s int [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real + NA cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NA row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s num [1:4] 1 NA 3 4 237s max: 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s num [1:4] 9 NA 11 12 237s range: 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 237s real + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + Inf cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s num [1:4] 1 NaN 3 4 237s max: 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s num [1:4] 9 NaN 11 12 237s range: 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 237s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s max: 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s num [1:4] NA NA NA NA 237s range: 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s num [1:4, 1:2] NA NA NA NA NA NA NA NA 237s real w/ NA + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s max: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s range: 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s real w/ NA + NaN row (double) w/ na.rm = FALSE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s max: 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s num [1:4] NA NaN NA NA 237s range: 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 237s integer (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s int [1:4] 1 2 3 4 237s max: 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s int [1:4] 9 10 11 12 237s range: 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s int [1:4, 1:2] 1 2 3 4 9 10 11 12 237s integer w/ NA (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s integer w/ NA (integer) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 6 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NA NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real + NA cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NA cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NA 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NA row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NA row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NA NA NA 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] NaN NaN NaN 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s num [1:4] 9 -Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 Inf 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s num [1:4, 1:2] 1 2 3 4 9 ... 237s real + Inf row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + Inf row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] Inf Inf Inf 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s num [1:4] 1 Inf 3 4 237s max: 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s num [1:4] 9 Inf 11 12 237s range: 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s num [1:4, 1:2] 1 Inf 3 4 9 ... 237s real + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] 1 5 9 237s [2,] 2 NaN 10 237s [3,] 3 7 11 237s [4,] 4 8 12 237s min: 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s num [1:4] 1 2 3 4 237s max: 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s num [1:4] 9 10 11 12 237s range: 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s num [1:4, 1:2] 1 2 3 4 9 10 11 12 237s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NA NaN NA 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s real w/ NA + NaN row (double) w/ na.rm = TRUE: 237s [,1] [,2] [,3] 237s [1,] NA NA NA 237s [2,] NaN NaN NaN 237s [3,] NA NA NA 237s [4,] NA NA NA 237s min: 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s num [1:4] Inf Inf Inf Inf 237s max: 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s num [1:4] -Inf -Inf -Inf -Inf 237s range: 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 237s > 237s 237s R version 4.4.3 (2025-02-28) -- "Trophy Case" 237s Copyright (C) 2025 The R Foundation for Statistical Computing 237s Platform: x86_64-pc-linux-gnu 237s 237s R is free software and comes with ABSOLUTELY NO WARRANTY. 237s You are welcome to redistribute it under certain conditions. 237s Type 'license()' or 'licence()' for distribution details. 237s 237s R is a collaborative project with many contributors. 237s Type 'contributors()' for more information and 237s 'citation()' on how to cite R or R packages in publications. 237s 237s Type 'demo()' for some demos, 'help()' for on-line help, or 237s 'help.start()' for an HTML browser interface to help. 237s Type 'q()' to quit R. 237s 238s > library("matrixStats") 238s > 238s > rowMins_R <- function(x, ..., useNames = TRUE) { 238s + suppressWarnings({ 238s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 238s + }) 238s + if (!useNames) names(res) <- NULL 238s + res 238s + } # rowMins_R() 238s > 238s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 238s + suppressWarnings({ 238s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 238s + }) 238s + if (!useNames) names(res) <- NULL 238s + res 238s + } # rowMaxs_R() 238s > 238s > rowRanges_R <- function(x, ..., useNames = TRUE) { 238s + suppressWarnings({ 238s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 238s + }) 238s + 238s + # Preserve rownames attribute 238s + dim <- c(dim(x)[1], 2L) 238s + if (!isTRUE(all.equal(dim(ans), dim))) { 238s + dim(ans) <- dim 238s + rownames <- rownames(x) 238s + if (!is.null(dimnames)) rownames(ans) <- rownames 238s + } 238s + if (!useNames) dimnames(ans) <- NULL 238s + ans 238s + } # rowRanges_R() 238s > 238s > 238s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 238s > # Subsetted tests 238s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 238s > source("utils/validateIndicesFramework.R") 238s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 238s > storage.mode(x) <- "integer" 238s > 238s > # To check rownames/names attributes 238s > dimnames <- list(letters[1:6], LETTERS[1:6]) 238s > 238s > # Test with and without dimnames on x 238s > for (setDimnames in c(TRUE, FALSE)) { 238s + if (setDimnames) dimnames(x) <- dimnames 238s + else dimnames(x) <- NULL 238s + 238s + count <- 0L 238s + for (rows in index_cases) { 238s + for (cols in index_cases) { 238s + count <- count + 1L 238s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 238s + useNames <- c(TRUE, FALSE) 238s + useNames <- useNames[count %% length(useNames) + 1] 238s + 238s + validateIndicesTestMatrix(x, rows, cols, 238s + ftest = rowRanges, fsure = rowRanges_R, 238s + na.rm = na.rm, useNames = useNames) 238s + validateIndicesTestMatrix(x, rows, cols, 238s + ftest = rowMins, fsure = rowMins_R, 238s + na.rm = na.rm, useNames = useNames) 238s + validateIndicesTestMatrix(x, rows, cols, 238s + ftest = rowMaxs, fsure = rowMaxs_R, 238s + na.rm = na.rm, useNames = useNames) 238s + 238s + validateIndicesTestMatrix(x, rows, cols, 238s + fcoltest = colRanges, fsure = rowRanges_R, 238s + na.rm = na.rm, useNames = useNames) 238s + validateIndicesTestMatrix(x, rows, cols, 238s + fcoltest = colMins, fsure = rowMins_R, 238s + na.rm = na.rm, useNames = useNames) 238s + validateIndicesTestMatrix(x, rows, cols, 238s + fcoltest = colMaxs, fsure = rowMaxs_R, 238s + na.rm = na.rm, useNames = useNames) 238s + } 238s + } 238s + } 239s > 239s 239s R version 4.4.3 (2025-02-28) -- "Trophy Case" 239s Copyright (C) 2025 The R Foundation for Statistical Computing 239s Platform: x86_64-pc-linux-gnu 239s 239s R is free software and comes with ABSOLUTELY NO WARRANTY. 239s You are welcome to redistribute it under certain conditions. 239s Type 'license()' or 'licence()' for distribution details. 239s 239s R is a collaborative project with many contributors. 239s Type 'contributors()' for more information and 239s 'citation()' on how to cite R or R packages in publications. 239s 239s Type 'demo()' for some demos, 'help()' for on-line help, or 239s 'help.start()' for an HTML browser interface to help. 239s Type 'q()' to quit R. 239s 239s > library("matrixStats") 239s > 239s > dense_rank <- function(x) match(x, table = sort(unique(x))) 239s > 239s > rowRanks_R <- function(x, ties.method, ..., useNames = TRUE) { 239s + if (ties.method == "dense") { 239s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 239s + } else { 239s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 239s + } 239s + 239s + # Preserve dimnames attribute? 239s + dim(res) <- dim(x) 239s + dimnames(res) <- if (useNames) dimnames(x) else NULL 239s + 239s + res 239s + } 239s > 239s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 239s + if (ties.method == "dense") { 239s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 239s + } else { 239s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 239s + } 239s + 239s + # Preserve dimnames attribute? 239s + tx <- t(x) 239s + dim(res) <- dim(tx) 239s + dimnames(res) <- if (useNames) dimnames(tx) else NULL 239s + 239s + if (preserveShape) res <- t(res) 239s + res 239s + } 239s > 239s > set.seed(1) 239s > 239s > cat("Consistency checks:\n") 239s Consistency checks: 239s > xs <- vector("list", length = 4L) 239s > for (kk in 1:4) { 239s + 239s + # Simulate data in a matrix of any shape 239s + dim <- sample(40:80, size = 2L) 239s + n <- prod(dim) 239s + x <- rnorm(n, sd = 10) 239s + dim(x) <- dim 239s + 239s + # Add NAs? 239s + if ((kk %% 4) %in% c(3, 0)) { 239s + cat("Adding NAs\n") 239s + nna <- sample(n, size = 1L) 239s + x[sample(length(x), size = nna)] <- NA_real_ 239s + } 239s + 239s + # Integer or double? 239s + if ((kk %% 4) %in% c(2, 0)) { 239s + cat("Coercing to integers\n") 239s + storage.mode(x) <- "integer" 239s + } 239s + 239s + xs[[kk]] <- x 239s + } # for (kk ...) 239s Coercing to integers 239s Adding NAs 239s Adding NAs 239s Coercing to integers 239s > str(xs) 239s List of 4 239s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 239s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 239s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 239s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 239s > 239s > for (kk in 1:4) { 239s + cat("Random test #", kk, "\n", sep = "") 239s + x <- xs[[kk]] 239s + tx <- t(x) 239s + 239s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 239s + cat(sprintf("ties.method = %s\n", ties)) 239s + # rowRanks(): 239s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 239s + y2 <- rowRanks_R(x, ties.method = ties) 239s + stopifnot(identical(y1, y2)) 239s + 239s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 239s + stopifnot(identical(y1, y3)) 239s + 239s + # colRanks(): 239s + y1 <- matrixStats::colRanks(x, ties.method = ties) 239s + y2 <- colRanks_R(x, ties.method = ties) 239s + stopifnot(identical(y1, y2)) 239s + 239s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 239s + stopifnot(identical(y1, y3)) 239s + } 239s + } # for (kk ...) 239s Random test #1 239s ties.method = max 239s ties.method = min 239s ties.method = average 239s ties.method = first 239s ties.method = last 239s ties.method = dense 239s Random test #2 239s ties.method = max 239s ties.method = min 239s ties.method = average 239s ties.method = first 239s ties.method = last 239s ties.method = dense 239s Random test #3 239s ties.method = max 239s ties.method = min 239s ties.method = average 239s ties.method = first 239s ties.method = last 239s ties.method = dense 239s Random test #4 239s ties.method = max 239s ties.method = min 239s ties.method = average 239s ties.method = first 239s ties.method = last 239s ties.method = dense 239s > 239s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 239s > 239s > cat("Consistency checks for random:\n") 239s Consistency checks for random: 239s > tolerance <- 0.1 239s > nsamples <- 10000 239s > for (kk in 1:4) { 239s + cat("Random test #", kk, "\n", sep = "") 239s + x <- xs[[kk]] 239s + tx <- t(x) 239s + 239s + for (ties in c("random")) { 239s + cat(sprintf("ties.method = %s\n", ties)) 239s + 239s + ## rowRanks(): 239s + y0 <- rowRanks_R(x, ties.method = ties) 239s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 239s + 239s + ## Assert symmetric rank differences 239s + d <- y1 - y0 239s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 239s + 239s + ## Assert within [min, max] 239s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 239s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 239s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 239s + ## Assert near average 239s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 239s + y1mean <- Reduce(`+`, y1list) / nsamples 239s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 239s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 239s + 239s + ## colRanks(): 239s + y0 <- colRanks_R(x, ties.method = ties) 239s + y1 <- matrixStats::colRanks(x, ties.method = ties) 239s + 239s + ## Assert symmetric rank differences 239s + d <- y1 - y0 239s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 239s + 239s + ## Assert within [min, max] 239s + y2min <- matrixStats::colRanks(x, ties.method = "min") 239s + y2max <- matrixStats::colRanks(x, ties.method = "max") 239s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 239s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 239s + y1mean <- Reduce(`+`, y1list) / nsamples 239s + ## Assert near average 239s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 239s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 239s + } 239s + } # for (kk ...) 239s Random test #1 239s ties.method = random 242s Random test #2 242s ties.method = random 244s Random test #3 244s ties.method = random 244s Random test #4 244s ties.method = random 245s > 245s > 245s > ## Exception handling 245s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 245s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 245s > stopifnot(inherits(y, "try-error")) 245s > 245s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 245s > stopifnot(inherits(y, "try-error")) 245s > 245s > dimnames <- list(letters[1:3], LETTERS[1:4]) 245s > for (mode in c("integer", "double")){ 245s + storage.mode(x) <- mode 245s + # Test with and without dimnames on x 245s + for (setDimnames in c(TRUE, FALSE)) { 245s + if (setDimnames) dimnames(x) <- dimnames 245s + else dimnames(x) <- NULL 245s + # Check names attribute 245s + for (useNames in c(TRUE, FALSE)) { 245s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 245s + cat(sprintf("ties.method = %s\n", ties)) 245s + # rowRanks(): 245s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 245s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 245s + stopifnot(identical(y1, y2)) 245s + 245s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 245s + stopifnot(identical(y1, y3)) 245s + 245s + # colRanks(): 245s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 245s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 245s + stopifnot(identical(y1, y2)) 245s + 245s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 245s + stopifnot(identical(y1, y3)) 245s + 245s + # Check preserveShape 245s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 245s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 245s + stopifnot(identical(y1, y2)) 245s + } 245s + } 245s + } 245s + } 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s ties.method = max 245s ties.method = min 245s ties.method = average 245s ties.method = first 245s ties.method = last 245s ties.method = dense 245s ties.method = random 245s > 245s 245s R version 4.4.3 (2025-02-28) -- "Trophy Case" 245s Copyright (C) 2025 The R Foundation for Statistical Computing 245s Platform: x86_64-pc-linux-gnu 245s 245s R is free software and comes with ABSOLUTELY NO WARRANTY. 245s You are welcome to redistribute it under certain conditions. 245s Type 'license()' or 'licence()' for distribution details. 245s 245s R is a collaborative project with many contributors. 245s Type 'contributors()' for more information and 245s 'citation()' on how to cite R or R packages in publications. 245s 245s Type 'demo()' for some demos, 'help()' for on-line help, or 245s 'help.start()' for an HTML browser interface to help. 245s Type 'q()' to quit R. 245s 246s > library("matrixStats") 246s > 246s > rowRanks_R <- function(x, ties.method = "average", ..., useNames = TRUE) { 246s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 246s + ties.method = ties.method)) 246s + 246s + # Preserve dimnames attribute? 246s + dim(ans) <- dim(x) 246s + dimnames(ans) <- if (useNames) dimnames(x) else NULL 246s + 246s + ans 246s + } 246s > 246s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 246s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 246s + 246s + # Preserve dimnames attribute? 246s + tx <- t(x) 246s + dim(ans) <- dim(tx) 246s + dimnames(ans) <- if (useNames) dimnames(tx) else NULL 246s + 246s + if (preserveShape) ans <- t(ans) 246s + ans 246s + } 246s > 246s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 246s > # Subsetted tests 246s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 246s > source("utils/validateIndicesFramework.R") 246s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 246s > storage.mode(x) <- "integer" 246s > 246s > # To check dimnames attribute 246s > dimnames <- list(letters[1:6], LETTERS[1:6]) 246s > 246s > colRanks_R_t <- function(x, rows, cols, ..., useNames = TRUE) { 246s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 246s + } 246s > 246s > # Test with and without dimnames on x 246s > for (setDimnames in c(TRUE, FALSE)) { 246s + if (setDimnames) dimnames(x) <- dimnames 246s + else dimnames(x) <- NULL 246s + 246s + count <- 0L 246s + for (rows in index_cases) { 246s + for (cols in index_cases) { 246s + count <- count + 1L 246s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 246s + useNames <- c(TRUE, FALSE) 246s + useNames <- useNames[count %% length(useNames) + 1] 246s + 246s + validateIndicesTestMatrix(x, rows, cols, 246s + ftest = rowRanks, fsure = rowRanks_R, 246s + ties.method = "average", useNames = useNames) 246s + 246s + validateIndicesTestMatrix(x, rows, cols, 246s + ftest = colRanks_R_t, fsure = rowRanks_R, 246s + ties.method = "average", useNames = useNames) 246s + 246s + for (perserveShape in c(TRUE, FALSE)) { 246s + validateIndicesTestMatrix(x, rows, cols, 246s + ftest = colRanks, fsure = colRanks_R, 246s + ties.method = "average", perserveShape = perserveShape, 246s + useNames = useNames) 246s + } 246s + } 246s + } 246s + } 247s > 247s 247s R version 4.4.3 (2025-02-28) -- "Trophy Case" 247s Copyright (C) 2025 The R Foundation for Statistical Computing 247s Platform: x86_64-pc-linux-gnu 247s 247s R is free software and comes with ABSOLUTELY NO WARRANTY. 247s You are welcome to redistribute it under certain conditions. 247s Type 'license()' or 'licence()' for distribution details. 247s 247s R is a collaborative project with many contributors. 247s Type 'contributors()' for more information and 247s 'citation()' on how to cite R or R packages in publications. 247s 247s Type 'demo()' for some demos, 'help()' for on-line help, or 247s 'help.start()' for an HTML browser interface to help. 247s Type 'q()' to quit R. 247s 247s > library("matrixStats") 247s > 247s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 247s > options(matrixStats.center.onUse = "ignore") 247s > 247s > ## Create isFALSE() if running on an old version of R 247s > if (!exists("isFALSE", mode="function")) { 247s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 247s + } 247s > 247s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 247s + suppressWarnings({ 247s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 247s + }) 247s + stopifnot(!any(is.infinite(sigma))) 247s + 247s + # Keep naming support consistency same as rowSds() 247s + if (is.null(center) || ncol(x) <= 1L) { 247s + if (isFALSE(useNames)) names(sigma) <- NULL 247s + } 247s + else if (isFALSE(useNames)) names(sigma) <- NULL 247s + sigma 247s + } 247s > 247s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 247s + suppressWarnings({ 247s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 247s + }) 247s + stopifnot(!any(is.infinite(sigma))) 247s + 247s + # Keep naming support consistency same as colSds() 247s + if (is.null(center) || nrow(x) <= 1L) { 247s + if (isFALSE(useNames)) names(sigma) <- NULL 247s + } 247s + if (isFALSE(useNames)) names(sigma) <- NULL 247s + sigma 247s + } 247s > 247s > 247s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 247s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 247s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 247s + stopifnot(!any(is.infinite(sigma))) 247s + sigma 247s + } 247s > 247s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 247s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 247s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 247s + stopifnot(!any(is.infinite(sigma))) 247s + sigma 247s + } 247s > 247s > 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > # With and without some NAs 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > for (mode in c("integer", "double")) { 247s + for (add_na in c(FALSE, TRUE)) { 247s + cat("add_na = ", add_na, "\n", sep = "") 247s + 247s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 247s + if (add_na) { 247s + x[3:7, c(2, 4)] <- NA_real_ 247s + } 247s + cat("mode: ", mode, "\n", sep = "") 247s + storage.mode(x) <- mode 247s + str(x) 247s + 247s + # To check names attribute 247s + dimnames <- list(letters[1:10], LETTERS[1:5]) 247s + 247s + # Test with and without dimnames on x 247s + for (setDimnames in c(TRUE, FALSE)) { 247s + if (setDimnames) dimnames(x) <- dimnames 247s + else dimnames(x) <- NULL 247s + # Row/column ranges 247s + for (na.rm in c(FALSE, TRUE)) { 247s + # Check names attribute 247s + for (useNames in c(TRUE, FALSE)) { 247s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 247s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 247s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 247s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 247s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 247s + stopifnot(all.equal(r1, r2)) 247s + stopifnot(all.equal(r1, r0)) 247s + stopifnot(all.equal(r2, r0)) 247s + stopifnot(all.equal(r1b, r2b)) 247s + stopifnot( 247s + !any(is.infinite(r1)), 247s + !any(is.infinite(r2)), 247s + !any(is.infinite(r1b)), 247s + !any(is.infinite(r2b)) 247s + ) 247s + } 247s + } 247s + } 247s + } # for (add_na ...) 247s + } 247s add_na = FALSE 247s mode: integer 247s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 247s add_na = TRUE 247s mode: integer 247s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 247s add_na = FALSE 247s mode: double 247s 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 ... 247s add_na = TRUE 247s mode: double 247s 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 ... 247s > 247s > 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > # All NAs 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > for (mode in c("integer", "double")) { 247s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 247s + cat("mode: ", mode, "\n", sep = "") 247s + storage.mode(x) <- mode 247s + str(x) 247s + 247s + # Test with and without dimnames on x 247s + for (setDimnames in c(TRUE, FALSE)) { 247s + if (setDimnames) dimnames(x) <- dimnames 247s + else dimnames(x) <- NULL 247s + # Row/column ranges 247s + for (na.rm in c(FALSE, TRUE)) { 247s + # Check names attribute 247s + for (useNames in c(TRUE, FALSE)) { 247s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 247s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 247s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 247s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 247s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 247s + stopifnot(all.equal(r1, r2)) 247s + stopifnot(all.equal(r1, r0)) 247s + stopifnot(all.equal(r2, r0)) 247s + stopifnot(all.equal(r1b, r2b)) 247s + stopifnot( 247s + !any(is.infinite(r1)), 247s + !any(is.infinite(r2)), 247s + !any(is.infinite(r1b)), 247s + !any(is.infinite(r2b)) 247s + ) 247s + } 247s + } 247s + } 247s + } 247s mode: integer 247s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 247s mode: double 247s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 247s > 247s > 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > # A 1x1 matrix 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > x <- matrix(0, nrow = 1L, ncol = 1L) 247s > dimnames <- list("a", "A") 247s > for (na.rm in c(FALSE, TRUE)) { 247s + cat("na.rm = ", na.rm, "\n", sep = "") 247s + 247s + # Test with and without dimnames on x 247s + for (setDimnames in c(TRUE, FALSE)) { 247s + if (setDimnames) dimnames(x) <- dimnames 247s + else dimnames(x) <- NULL 247s + # Row/column ranges 247s + for (na.rm in c(FALSE, TRUE)) { 247s + # Check names attribute 247s + for (useNames in c(TRUE, FALSE)) { 247s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 247s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 247s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 247s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 247s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 247s + stopifnot(all.equal(r1, r2)) 247s + stopifnot(all.equal(r1, r0)) 247s + stopifnot(all.equal(r2, r0)) 247s + stopifnot(all.equal(r1b, r2b)) 247s + stopifnot( 247s + !any(is.infinite(r1)), 247s + !any(is.infinite(r2)), 247s + !any(is.infinite(r1b)), 247s + !any(is.infinite(r2b)) 247s + ) 247s + } 247s + } 247s + } 247s + } 247s na.rm = FALSE 247s na.rm = TRUE 247s > 247s 247s R version 4.4.3 (2025-02-28) -- "Trophy Case" 247s Copyright (C) 2025 The R Foundation for Statistical Computing 247s Platform: x86_64-pc-linux-gnu 247s 247s R is free software and comes with ABSOLUTELY NO WARRANTY. 247s You are welcome to redistribute it under certain conditions. 247s Type 'license()' or 'licence()' for distribution details. 247s 247s R is a collaborative project with many contributors. 247s Type 'contributors()' for more information and 247s 'citation()' on how to cite R or R packages in publications. 247s 247s Type 'demo()' for some demos, 'help()' for on-line help, or 247s 'help.start()' for an HTML browser interface to help. 247s Type 'q()' to quit R. 247s 247s > library("matrixStats") 247s > 247s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 247s > options(matrixStats.center.onUse = "ignore") 247s > 247s > ## Create isFALSE() if running on an old version of R 247s > if (!exists("isFALSE", mode="function")) { 247s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 247s + } 247s > 247s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 247s + suppressWarnings({ 247s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 247s + }) 247s + stopifnot(!any(is.infinite(sigma))) 247s + 247s + # Keep naming support consistency same as rowSds() 247s + if (is.null(center) || ncol(x) <= 1L) { 247s + if (isFALSE(useNames)) names(sigma) <- NULL 247s + } 247s + else if (isFALSE(useNames)) names(sigma) <- NULL 247s + sigma 247s + } 247s > 247s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 247s + suppressWarnings({ 247s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 247s + }) 247s + stopifnot(!any(is.infinite(sigma))) 247s + 247s + # Keep naming support consistency same as colSds() 247s + if (is.null(center) || nrow(x) <= 1L) { 247s + if (isFALSE(useNames)) names(sigma) <- NULL 247s + } 247s + else if (isFALSE(useNames)) names(sigma) <- NULL 247s + sigma 247s + } 247s > 247s > 247s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 247s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 247s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 247s + stopifnot(!any(is.infinite(sigma))) 247s + sigma 247s + } 247s > 247s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 247s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 247s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 247s + stopifnot(!any(is.infinite(sigma))) 247s + sigma 247s + } 247s > 247s > 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > # Subsetted tests 247s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 247s > source("utils/validateIndicesFramework.R") 247s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 247s > storage.mode(x) <- "integer" 247s > 247s > # To check names attribute 247s > dimnames <- list(letters[1:6], LETTERS[1:6]) 247s > 247s > # Test with and without dimnames on x 247s > for (setDimnames in c(TRUE, FALSE)) { 247s + if (setDimnames) dimnames(x) <- dimnames 247s + else dimnames(x) <- NULL 247s + 247s + count <- 0L 247s + for (rows in index_cases) { 247s + for (cols in index_cases) { 247s + count <- count + 1L 247s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 247s + useNames <- c(TRUE, FALSE) 247s + useNames <- useNames[count %% length(useNames) + 1] 247s + 247s + validateIndicesTestMatrix(x, rows, cols, 247s + ftest = rowSds, fsure = rowSds_R, 247s + na.rm = na.rm, useNames = useNames) 247s + validateIndicesTestMatrix(x, rows, cols, 247s + ftest = rowSds_center, fsure = rowSds_R, 247s + na.rm = na.rm, center = TRUE, useNames = useNames) 247s + 247s + validateIndicesTestMatrix(x, rows, cols, 247s + fcoltest = colSds, fsure = rowSds_R, 247s + na.rm = na.rm, useNames = useNames) 247s + validateIndicesTestMatrix(x, rows, cols, 247s + fcoltest = colSds_center, fsure = rowSds_R, 247s + na.rm = na.rm, center = TRUE, useNames = useNames) 247s + } 247s + } 247s + } 248s > 248s 248s R version 4.4.3 (2025-02-28) -- "Trophy Case" 248s Copyright (C) 2025 The R Foundation for Statistical Computing 248s Platform: x86_64-pc-linux-gnu 248s 248s R is free software and comes with ABSOLUTELY NO WARRANTY. 248s You are welcome to redistribute it under certain conditions. 248s Type 'license()' or 'licence()' for distribution details. 248s 248s R is a collaborative project with many contributors. 248s Type 'contributors()' for more information and 248s 'citation()' on how to cite R or R packages in publications. 248s 248s Type 'demo()' for some demos, 'help()' for on-line help, or 248s 'help.start()' for an HTML browser interface to help. 248s Type 'q()' to quit R. 248s 248s > library("matrixStats") 248s > 248s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 248s + ## FIXME: sum() may overflow for integers, whereas 248s + ## base::rowSums() doesn't. What should rowSums2() do? 248s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 248s + res <- rowSums(x, na.rm = na.rm) 248s + if (!useNames) names(res) <- NULL 248s + res 248s + } 248s > 248s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 248s + ## FIXME: sum() may overflow for integers, whereas 248s + ## base::colSums() doesn't. What should colSums2() do? 248s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 248s + res <- colSums(x, na.rm = na.rm) 248s + if (!useNames) names(res) <- NULL 248s + res 248s + } 248s > 248s > for (mode in c("integer", "logical", "double")) { 248s + x <- matrix(-4:4, nrow = 3, ncol = 3) 248s + storage.mode(x) <- mode 248s + if (mode == "double") x <- x + 0.1 248s + 248s + # To check names attribute 248s + dimnames <- list(letters[1:3], LETTERS[1:3]) 248s + 248s + # Test with and without dimnames on x 248s + for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s + } 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: Single-element matrix 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: Single-element matrix:\n") 248s Special case: Single-element matrix: 248s > for (mode in c("integer", "logical", "double")) { 248s + x <- matrix(1, nrow = 1, ncol = 1) 248s + storage.mode(x) <- mode 248s + 248s + # To check names attribute 248s + dimnames <- list("a", "A") 248s + 248s + # Test with and without dimnames on x 248s + for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: Empty matrix 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: Empty matrix:\n") 248s Special case: Empty matrix: 248s > for (mode in c("integer", "logical", "double")) { 248s + x <- matrix(integer(0), nrow = 0, ncol = 0) 248s + storage.mode(x) <- mode 248s + 248s + y0 <- rowSums2_R(x, na.rm = FALSE) 248s + y1 <- rowSums2(x, na.rm = FALSE) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE) 248s + y1 <- colSums2(x, na.rm = FALSE) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: All NAs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: All NAs:\n") 248s Special case: All NAs: 248s > for (mode in c("integer", "logical", "double")) { 248s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 248s + storage.mode(x) <- mode 248s + 248s + # To check names attribute 248s + dimnames <- list(letters[1:3], LETTERS[1:3]) 248s + 248s + # Test with and without dimnames on x 248s + for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: All NaNs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: All NaNs:\n") 248s Special case: All NaNs: 248s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: All Infs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: All Infs:\n") 248s Special case: All Infs: 248s > x <- matrix(Inf, nrow = 3, ncol = 3) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: All -Infs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: All -Infs:\n") 248s Special case: All -Infs: 248s > x <- matrix(-Inf, nrow = 3, ncol = 3) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: Infs and -Infs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: Infs and -Infs:\n") 248s Special case: Infs and -Infs: 248s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 248s > 248s > # To check names attribute 248s > dimnames <- list(letters[1:4], LETTERS[1:4]) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: NaNs and NAs 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: Infs and -Infs:\n") 248s Special case: Infs and -Infs: 248s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 248s > 248s > y0 <- rowSums(x, na.rm = FALSE) 248s > str(y0) 248s num [1:4] NaN NA NaN NA 248s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 248s > y1 <- rowSums2(x, na.rm = FALSE) 248s > str(y0) 248s num [1:4] NaN NA NaN NA 248s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 248s > stopifnot(all.equal(y1, y0)) 248s > 248s > y0 <- colSums(x, na.rm = FALSE) 248s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 248s > y1 <- colSums2(x, na.rm = FALSE) 248s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 248s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 248s > ## returned here (as one would expect). NaN might very well be returned, 248s > ## when both NA and NaN are involved. This is an accepted feature in R, 248s > ## which is documented in help("is.nan"). See also 248s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 248s > ## Thus, we cannot guarantee that y1 is identical to y0. 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Special case: Integer overflow with ties 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > cat("Special case: Integer overflow with ties:\n") 248s Special case: Integer overflow with ties: 248s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + # Check names attribute 248s + for (useNames in c(TRUE, FALSE)) { 248s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + 248s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 248s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 248s + stopifnot(all.equal(y1, y0)) 248s + } 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Consistency checks 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > set.seed(1) 248s > 248s > cat("Consistency checks:\n") 248s Consistency checks: 248s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 248s > for (kk in seq_len(n_sims)) { 248s + cat("Random test #", kk, "\n", sep = "") 248s + 248s + # Simulate data in a matrix of any shape 248s + dim <- sample(50:200, size = 2) 248s + n <- prod(dim) 248s + x <- rnorm(n, sd = 100) 248s + dim(x) <- dim 248s + 248s + # Add NAs? 248s + if ((kk %% 4) %in% c(3, 0)) { 248s + cat("Adding NAs\n") 248s + nna <- sample(n, size = 1) 248s + na_values <- c(NA_real_, NaN) 248s + t <- sample(na_values, size = nna, replace = TRUE) 248s + x[sample(length(x), size = nna)] <- t 248s + } 248s + 248s + # Mode? 248s + modes <- "double" 248s + if ((kk %% 4) %in% c(2, 0)) { 248s + modes <- c("integer", "logical") 248s + } 248s + 248s + for (mode in modes) { 248s + if (mode != "double") { 248s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 248s + storage.mode(x) <- mode 248s + } 248s + 248s + na.rm <- sample(c(TRUE, FALSE), size = 1) 248s + 248s + # rowSums2(): 248s + y0 <- rowSums2_R(x, na.rm = na.rm) 248s + y1 <- rowSums2(x, na.rm = na.rm) 248s + stopifnot(all.equal(y1, y0)) 248s + y2 <- colSums2(t(x), na.rm = na.rm) 248s + stopifnot(all.equal(y2, y0)) 248s + 248s + # colSums2(): 248s + y0 <- colSums2_R(x, na.rm = na.rm) 248s + y1 <- colSums2(x, na.rm = na.rm) 248s + stopifnot(all.equal(y1, y0)) 248s + y2 <- rowSums2(t(x), na.rm = na.rm) 248s + stopifnot(all.equal(y2, y0)) 248s + } 248s + } # for (kk ...) 248s Random test #1 248s Random test #2 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #3 248s Adding NAs 248s Random test #4 248s Adding NAs 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #5 248s Random test #6 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #7 248s Adding NAs 248s Random test #8 248s Adding NAs 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #9 248s Random test #10 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #11 248s Adding NAs 248s Random test #12 248s Adding NAs 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #13 248s Random test #14 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #15 248s Adding NAs 248s Random test #16 248s Adding NAs 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #17 248s Random test #18 248s Coercing from double to integer 248s Coercing from integer to logical 248s Random test #19 248s Adding NAs 248s Random test #20 248s Adding NAs 248s Coercing from double to integer 248s Coercing from integer to logical 248s > 248s 248s R version 4.4.3 (2025-02-28) -- "Trophy Case" 248s Copyright (C) 2025 The R Foundation for Statistical Computing 248s Platform: x86_64-pc-linux-gnu 248s 248s R is free software and comes with ABSOLUTELY NO WARRANTY. 248s You are welcome to redistribute it under certain conditions. 248s Type 'license()' or 'licence()' for distribution details. 248s 248s R is a collaborative project with many contributors. 248s Type 'contributors()' for more information and 248s 'citation()' on how to cite R or R packages in publications. 248s 248s Type 'demo()' for some demos, 'help()' for on-line help, or 248s 'help.start()' for an HTML browser interface to help. 248s Type 'q()' to quit R. 248s 248s > library("matrixStats") 248s > 248s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 248s + ## FIXME: sum() may overflow for integers, whereas 248s + ## base::rowSums() doesn't. What should rowSums2() do? 248s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 248s + res <- rowSums(x, na.rm = na.rm) 248s + if (!useNames) names(res) <- NULL 248s + res 248s + } 248s > 248s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 248s + ## FIXME: sum() may overflow for integers, whereas 248s + ## base::colSums() doesn't. What should colSums2() do? 248s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 248s + res <- colSums(x, na.rm = na.rm) 248s + if (!useNames) names(res) <- NULL 248s + res 248s + } 248s > 248s > 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > # Subsetted tests 248s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 248s > source("utils/validateIndicesFramework.R") 248s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 248s > storage.mode(x) <- "integer" 248s > 248s > # To check names attribute 248s > dimnames <- list(letters[1:6], LETTERS[1:6]) 248s > 248s > # Test with and without dimnames on x 248s > for (setDimnames in c(TRUE, FALSE)) { 248s + if (setDimnames) dimnames(x) <- dimnames 248s + else dimnames(x) <- NULL 248s + for (rows in index_cases) { 248s + for (cols in index_cases) { 248s + for (na.rm in c(TRUE, FALSE)) { 248s + for (useNames in c(TRUE, FALSE)) { 248s + validateIndicesTestMatrix(x, rows, cols, 248s + ftest = rowSums2, fsure = rowSums2_R, 248s + na.rm = na.rm, useNames = useNames) 248s + validateIndicesTestMatrix(x, rows, cols, 248s + fcoltest = colSums2, fsure = rowSums2_R, 248s + na.rm = na.rm, useNames = useNames) 248s + } 248s + } 248s + } 248s + } 248s + } 249s > 249s 249s R version 4.4.3 (2025-02-28) -- "Trophy Case" 249s Copyright (C) 2025 The R Foundation for Statistical Computing 249s Platform: x86_64-pc-linux-gnu 249s 249s R is free software and comes with ABSOLUTELY NO WARRANTY. 249s You are welcome to redistribute it under certain conditions. 249s Type 'license()' or 'licence()' for distribution details. 249s 249s R is a collaborative project with many contributors. 249s Type 'contributors()' for more information and 249s 'citation()' on how to cite R or R packages in publications. 249s 249s Type 'demo()' for some demos, 'help()' for on-line help, or 249s 'help.start()' for an HTML browser interface to help. 249s Type 'q()' to quit R. 249s 249s > library("matrixStats") 249s > 249s > nrow <- 6L 249s > ncol <- 5L 249s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 249s > 249s > # To check names attribute 249s > dimnames <- list(letters[1:6], LETTERS[1:5]) 249s > 249s > modes <- c("integer", "logical", "raw") 249s > for (mode in modes) { 249s + cat(sprintf("Mode: %s...\n", mode)) 249s + 249s + x <- data 249s + if (mode == "logical") x <- x - 2L 249s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 249s + storage.mode(x) <- mode 249s + print(x) 249s + 249s + unique_values <- unique(as.vector(x)) 249s + nbr_of_unique_values <- length(unique_values) 249s + 249s + y <- rowTabulates(x) 249s + print(y) 249s + stopifnot( 249s + identical(dim(y), c(nrow, nbr_of_unique_values)), 249s + all(y >= 0) 249s + ) 249s + if (mode != "raw") { 249s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 249s + stopifnot(all(y == y0)) 249s + } 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- rowTabulates(x, useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y <- rowTabulates(x, useNames = TRUE) 249s + stopifnot(identical(rownames(y), rownames(x))) 249s + dimnames(x) <- NULL 249s + 249s + y <- colTabulates(x) 249s + print(y) 249s + stopifnot( 249s + identical(dim(y), c(ncol, nbr_of_unique_values)), 249s + all(y >= 0) 249s + ) 249s + if (mode != "raw") { 249s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 249s + stopifnot(all(y == y0)) 249s + } 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- colTabulates(x, useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y <- colTabulates(x, useNames = TRUE) 249s + stopifnot(identical(rownames(y), colnames(x))) 249s + dimnames(x) <- NULL 249s + 249s + # Count only certain values 249s + if (mode == "integer") { 249s + subset <- c(0:2, NA_integer_) 249s + } else if (mode == "logical") { 249s + subset <- c(TRUE, FALSE, NA) 249s + } else { 249s + subset <- c(0:2) 249s + } 249s + y <- rowTabulates(x, values = subset) 249s + print(y) 249s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y <- rowTabulates(x, values = subset, useNames = TRUE) 249s + stopifnot(identical(rownames(y), rownames(x))) 249s + dimnames(x) <- NULL 249s + 249s + y <- colTabulates(x, values = subset) 249s + print(y) 249s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y <- colTabulates(x, values = subset, useNames = TRUE) 249s + stopifnot(identical(rownames(y), colnames(x))) 249s + dimnames(x) <- NULL 249s + 249s + # Raw 249s + if (mode %in% c("integer", "raw")) { 249s + subset <- c(0:2) 249s + 249s + y <- rowTabulates(x, values = as.raw(subset)) 249s + print(y) 249s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 249s + stopifnot(identical(rownames(y3), rownames(x))) 249s + dimnames(x) <- NULL 249s + 249s + y2 <- colTabulates(t(x), values = as.raw(subset)) 249s + print(y2) 249s + stopifnot( 249s + identical(dim(y2), c(nrow, length(subset))), 249s + identical(y2, y) 249s + ) 249s + # Check names attribute 249s + dimnames(x) <- dimnames 249s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 249s + stopifnot(all.equal(y1, y)) 249s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 249s + stopifnot(identical(rownames(y), colnames(t(x)))) 249s + dimnames(x) <- NULL 249s + } 249s + 249s + cat(sprintf("Mode: %s...done\n", mode)) 249s + } # for (mode ...) 249s Mode: integer... 249s [,1] [,2] [,3] [,4] [,5] 249s [1,] 0 NA 2 3 4 249s [2,] NA 2 3 4 0 249s [3,] 2 3 4 0 1 249s [4,] 3 4 0 1 2 249s [5,] NA 0 1 2 3 249s [6,] 0 1 2 3 4 249s 0 1 2 3 4 249s [1,] 1 0 1 1 1 1 249s [2,] 1 0 1 1 1 1 249s [3,] 1 1 1 1 1 0 249s [4,] 1 1 1 1 1 0 249s [5,] 1 1 1 1 0 1 249s [6,] 1 1 1 1 1 0 249s 0 1 2 3 4 249s [1,] 2 0 1 1 0 2 249s [2,] 1 1 1 1 1 1 249s [3,] 1 1 2 1 1 0 249s [4,] 1 1 1 2 1 0 249s [5,] 1 1 1 1 2 0 249s 0 1 2 249s [1,] 1 0 1 1 249s [2,] 1 0 1 1 249s [3,] 1 1 1 0 249s [4,] 1 1 1 0 249s [5,] 1 1 1 1 249s [6,] 1 1 1 0 249s 0 1 2 249s [1,] 2 0 1 2 249s [2,] 1 1 1 1 249s [3,] 1 1 2 0 249s [4,] 1 1 1 0 249s [5,] 1 1 1 0 249s 0x0 0x1 0x2 249s [1,] 1 0 1 249s [2,] 1 0 1 249s [3,] 1 1 1 249s [4,] 1 1 1 249s [5,] 1 1 1 249s [6,] 1 1 1 249s 0x0 0x1 0x2 249s [1,] 1 0 1 249s [2,] 1 0 1 249s [3,] 1 1 1 249s [4,] 1 1 1 249s [5,] 1 1 1 249s [6,] 1 1 1 249s Mode: integer...done 249s Mode: logical... 249s [,1] [,2] [,3] [,4] [,5] 249s [1,] TRUE NA FALSE TRUE TRUE 249s [2,] NA FALSE TRUE TRUE TRUE 249s [3,] FALSE TRUE TRUE TRUE TRUE 249s [4,] TRUE TRUE TRUE TRUE FALSE 249s [5,] NA TRUE TRUE FALSE TRUE 249s [6,] TRUE TRUE FALSE TRUE TRUE 249s FALSE TRUE 249s [1,] 1 3 1 249s [2,] 1 3 1 249s [3,] 1 4 0 249s [4,] 1 4 0 249s [5,] 1 3 1 249s [6,] 1 4 0 249s FALSE TRUE 249s [1,] 1 3 2 249s [2,] 1 4 1 249s [3,] 2 4 0 249s [4,] 1 5 0 249s [5,] 1 5 0 249s TRUE FALSE 249s [1,] 3 1 1 249s [2,] 3 1 1 249s [3,] 4 1 0 249s [4,] 4 1 0 249s [5,] 3 1 1 249s [6,] 4 1 0 249s TRUE FALSE 249s [1,] 3 1 2 249s [2,] 4 1 1 249s [3,] 4 2 0 249s [4,] 5 1 0 249s [5,] 5 1 0 249s Mode: logical...done 249s Mode: raw... 249s [,1] [,2] [,3] [,4] [,5] 249s [1,] 00 01 02 03 04 249s [2,] 01 02 03 04 00 249s [3,] 02 03 04 00 01 249s [4,] 03 04 00 01 02 249s [5,] 04 00 01 02 03 249s [6,] 00 01 02 03 04 249s 0x0 0x1 0x2 0x3 0x4 249s [1,] 1 1 1 1 1 249s [2,] 1 1 1 1 1 249s [3,] 1 1 1 1 1 249s [4,] 1 1 1 1 1 249s [5,] 1 1 1 1 1 249s [6,] 1 1 1 1 1 249s 0x0 0x1 0x2 0x3 0x4 249s [1,] 2 1 1 1 1 249s [2,] 1 2 1 1 1 249s [3,] 1 1 2 1 1 249s [4,] 1 1 1 2 1 249s [5,] 1 1 1 1 2 249s 0 1 2 249s [1,] 1 1 1 249s [2,] 1 1 1 249s [3,] 1 1 1 249s [4,] 1 1 1 249s [5,] 1 1 1 249s [6,] 1 1 1 249s 0 1 2 249s [1,] 2 1 1 249s [2,] 1 2 1 249s [3,] 1 1 2 249s [4,] 1 1 1 249s [5,] 1 1 1 249s 0x0 0x1 0x2 249s [1,] 1 1 1 249s [2,] 1 1 1 249s [3,] 1 1 1 249s [4,] 1 1 1 249s [5,] 1 1 1 249s [6,] 1 1 1 249s 0x0 0x1 0x2 249s [1,] 1 1 1 249s [2,] 1 1 1 249s [3,] 1 1 1 249s [4,] 1 1 1 249s [5,] 1 1 1 249s [6,] 1 1 1 249s Mode: raw...done 249s > 249s 249s R version 4.4.3 (2025-02-28) -- "Trophy Case" 249s Copyright (C) 2025 The R Foundation for Statistical Computing 249s Platform: x86_64-pc-linux-gnu 249s 249s R is free software and comes with ABSOLUTELY NO WARRANTY. 249s You are welcome to redistribute it under certain conditions. 249s Type 'license()' or 'licence()' for distribution details. 249s 249s R is a collaborative project with many contributors. 249s Type 'contributors()' for more information and 249s 'citation()' on how to cite R or R packages in publications. 249s 249s Type 'demo()' for some demos, 'help()' for on-line help, or 249s 'help.start()' for an HTML browser interface to help. 249s Type 'q()' to quit R. 249s 249s > library("matrixStats") 249s > 249s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 249s > # Subsetted tests 249s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 249s > source("utils/validateIndicesFramework.R") 249s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 249s > storage.mode(x) <- "integer" 249s > 249s > # To check names attribute 249s > dimnames <- list(letters[1:6], LETTERS[1:6]) 249s > 249s > # Test with and without dimnames on x 249s > for (setDimnames in c(TRUE, FALSE)) { 249s + if (setDimnames) dimnames(x) <- dimnames 249s + else dimnames(x) <- NULL 249s + 249s + count <- 0L 249s + for (rows in index_cases) { 249s + for (cols in index_cases) { 249s + count <- count + 1L 249s + useNames <- c(TRUE, FALSE) 249s + useNames <- useNames[count %% length(useNames) + 1] 249s + 249s + validateIndicesTestMatrix(x, rows, cols, 249s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 249s + validateIndicesTestMatrix(x, rows, cols, 249s + ftest = rowTabulates, fsure = rowTabulates, 249s + values = 1:3, useNames = useNames) 249s + 249s + validateIndicesTestMatrix(x, rows, cols, 249s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 249s + validateIndicesTestMatrix(x, rows, cols, 249s + ftest = colTabulates, fsure = colTabulates, 249s + values = 1:3, useNames = useNames) 249s + } 249s + } 249s + } 251s > 251s 251s R version 4.4.3 (2025-02-28) -- "Trophy Case" 251s Copyright (C) 2025 The R Foundation for Statistical Computing 251s Platform: x86_64-pc-linux-gnu 251s 251s R is free software and comes with ABSOLUTELY NO WARRANTY. 251s You are welcome to redistribute it under certain conditions. 251s Type 'license()' or 'licence()' for distribution details. 251s 251s R is a collaborative project with many contributors. 251s Type 'contributors()' for more information and 251s 'citation()' on how to cite R or R packages in publications. 251s 251s Type 'demo()' for some demos, 'help()' for on-line help, or 251s 'help.start()' for an HTML browser interface to help. 251s Type 'q()' to quit R. 251s 251s > library("matrixStats") 251s > 251s > fcns <- list( 251s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 251s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 251s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 251s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 251s + ) 251s > 251s > for (fcn in names(fcns)) { 251s + cat(sprintf("%s()...\n", fcn)) 251s + row_fcn <- fcns[[fcn]][[1L]] 251s + col_fcn <- fcns[[fcn]][[2L]] 251s + 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + # With and without some NAs 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + for (mode in c("integer", "double")) { 251s + for (add_na in c(FALSE, TRUE)) { 251s + cat("add_na = ", add_na, "\n", sep = "") 251s + 251s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 251s + if (add_na) { 251s + x[3:7, c(2, 4)] <- NA_real_ 251s + } 251s + cat("mode: ", mode, "\n", sep = "") 251s + storage.mode(x) <- mode 251s + str(x) 251s + 251s + # To check names attribute 251s + dimnames <- list(letters[1:10], LETTERS[1:5]) 251s + 251s + # Test with and without dimnames on x 251s + for (setDimnames in c(TRUE, FALSE)) { 251s + if (setDimnames) dimnames(x) <- dimnames 251s + else dimnames(x) <- NULL 251s + # Row/column ranges 251s + for (na.rm in c(FALSE, TRUE)) { 251s + # Check names attribute 251s + for (useNames in c(TRUE, FALSE)) { 251s + cat("na.rm = ", na.rm, "\n", sep = "") 251s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 251s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 251s + stopifnot(all.equal(r1, r2)) 251s + } 251s + } 251s + } 251s + } # for (add_na ...) 251s + } 251s + 251s + 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + # All NAs 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + for (mode in c("integer", "double")) { 251s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 251s + cat("mode: ", mode, "\n", sep = "") 251s + storage.mode(x) <- mode 251s + str(x) 251s + 251s + # Test with and without dimnames on x 251s + for (setDimnames in c(TRUE, FALSE)) { 251s + if (setDimnames) dimnames(x) <- dimnames 251s + else dimnames(x) <- NULL 251s + # Row/column ranges 251s + for (na.rm in c(FALSE, TRUE)) { 251s + # Check names attribute 251s + for (useNames in c(TRUE, FALSE)) { 251s + cat("na.rm = ", na.rm, "\n", sep = "") 251s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 251s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 251s + stopifnot(all.equal(r1, r2)) 251s + } 251s + } 251s + } 251s + } 251s + 251s + 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + # A 1x1 matrix 251s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s + x <- matrix(0, nrow = 1L, ncol = 1L) 251s + dimnames <- list("a", "A") 251s + # Test with and without dimnames on x 251s + for (setDimnames in c(TRUE, FALSE)) { 251s + if (setDimnames) dimnames(x) <- dimnames 251s + else dimnames(x) <- NULL 251s + # Row/column ranges 251s + for (na.rm in c(FALSE, TRUE)) { 251s + # Check names attribute 251s + for (useNames in c(TRUE, FALSE)) { 251s + cat("na.rm = ", na.rm, "\n", sep = "") 251s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 251s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 251s + stopifnot(all.equal(r1, r2)) 251s + } 251s + } 251s + } 251s + 251s + cat(sprintf("%s()...DONE\n", fcn)) 251s + } # for (fcn ...) 251s rowVarDiffs()... 251s add_na = FALSE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = FALSE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: integer 251s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: double 251s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s rowVarDiffs()...DONE 251s rowSdDiffs()... 251s add_na = FALSE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = FALSE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: integer 251s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: double 251s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s rowSdDiffs()...DONE 251s rowMadDiffs()... 251s add_na = FALSE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = FALSE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: integer 251s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: double 251s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s rowMadDiffs()...DONE 251s rowIQRDiffs()... 251s add_na = FALSE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: integer 251s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = FALSE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s add_na = TRUE 251s mode: double 251s 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 ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: integer 251s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s mode: double 251s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s na.rm = FALSE 251s na.rm = FALSE 251s na.rm = TRUE 251s na.rm = TRUE 251s rowIQRDiffs()...DONE 251s > 251s 251s R version 4.4.3 (2025-02-28) -- "Trophy Case" 251s Copyright (C) 2025 The R Foundation for Statistical Computing 251s Platform: x86_64-pc-linux-gnu 251s 251s R is free software and comes with ABSOLUTELY NO WARRANTY. 251s You are welcome to redistribute it under certain conditions. 251s Type 'license()' or 'licence()' for distribution details. 251s 251s R is a collaborative project with many contributors. 251s Type 'contributors()' for more information and 251s 'citation()' on how to cite R or R packages in publications. 251s 251s Type 'demo()' for some demos, 'help()' for on-line help, or 251s 'help.start()' for an HTML browser interface to help. 251s Type 'q()' to quit R. 251s 251s > library("matrixStats") 251s > 251s > fcns <- list( 251s + madDiff = c(rowMadDiffs, colMadDiffs), 251s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 251s + ) 251s > 251s > 251s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s > # Subsetted tests 251s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251s > source("utils/validateIndicesFramework.R") 251s > # To check names attribute 251s > dimnames <- list(letters[1:6], LETTERS[1:6]) 251s > trim <- runif(1, min = 0, max = 0.5) 251s > for (fcn in names(fcns)) { 251s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 251s + row_fcn <- fcns[[fcn]][[1L]] 251s + col_fcn <- fcns[[fcn]][[2L]] 251s + 251s + for (mode in c("numeric", "integer")) { 251s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 251s + storage.mode(x) <- mode 251s + if (mode == "numeric") x[1:2, 3:4] <- Inf 251s + 251s + # Test with and without dimnames on x 251s + for (setDimnames in c(TRUE, FALSE)) { 251s + if (setDimnames) dimnames(x) <- dimnames 251s + else dimnames(x) <- NULL 251s + 251s + count <- 0L 251s + for (diff in 1:2) { 251s + for (rows in index_cases) { 251s + for (cols in index_cases) { 251s + count <- count + 1L 251s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 251s + useNames <- c(TRUE, FALSE) 251s + useNames <- useNames[count %% length(useNames) + 1] 251s + validateIndicesTestMatrix(x, rows, cols, 251s + ftest = row_fcn, fsure = row_fcn, 251s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 251s + validateIndicesTestMatrix(x, rows, cols, 251s + fcoltest = col_fcn, fsure = row_fcn, 251s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 251s + } 251s + } 251s + } 251s + } 251s + } 251s + cat(sprintf("%s()...DONE\n", fcn)) 251s + } 251s subsetted tests on madDiff()... 253s madDiff()...DONE 253s subsetted tests on iqrDiff()... 255s iqrDiff()...DONE 255s > 255s 255s R version 4.4.3 (2025-02-28) -- "Trophy Case" 255s Copyright (C) 2025 The R Foundation for Statistical Computing 255s Platform: x86_64-pc-linux-gnu 255s 255s R is free software and comes with ABSOLUTELY NO WARRANTY. 255s You are welcome to redistribute it under certain conditions. 255s Type 'license()' or 'licence()' for distribution details. 255s 255s R is a collaborative project with many contributors. 255s Type 'contributors()' for more information and 255s 'citation()' on how to cite R or R packages in publications. 255s 255s Type 'demo()' for some demos, 'help()' for on-line help, or 255s 'help.start()' for an HTML browser interface to help. 255s Type 'q()' to quit R. 255s 255s > library("matrixStats") 255s > 255s > fcns <- list( 255s + varDiff = c(rowVarDiffs, colVarDiffs), 255s + sdDiff = c(rowSdDiffs, colSdDiffs) 255s + ) 255s > 255s > 255s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 255s > # Subsetted tests 255s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 255s > source("utils/validateIndicesFramework.R") 255s > # To check names attribute 255s > dimnames <- list(letters[1:6], LETTERS[1:6]) 255s > trim <- runif(1, min = 0, max = 0.5) 255s > for (fcn in names(fcns)) { 255s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 255s + row_fcn <- fcns[[fcn]][[1L]] 255s + col_fcn <- fcns[[fcn]][[2L]] 255s + 255s + for (mode in c("numeric", "integer")) { 255s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 255s + storage.mode(x) <- mode 255s + if (mode == "numeric") x[1:2, 3:4] <- Inf 255s + 255s + # Test with and without dimnames on x 255s + for (setDimnames in c(TRUE, FALSE)) { 255s + if (setDimnames) dimnames(x) <- dimnames 255s + else dimnames(x) <- NULL 255s + 255s + count <- 0L 255s + for (diff in 1:2) { 255s + for (rows in index_cases) { 255s + for (cols in index_cases) { 255s + count <- count + 1L 255s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 255s + useNames <- c(TRUE, FALSE) 255s + useNames <- useNames[count %% length(useNames) + 1] 255s + 255s + validateIndicesTestMatrix(x, rows, cols, 255s + ftest = row_fcn, fsure = row_fcn, 255s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 255s + validateIndicesTestMatrix(x, rows, cols, 255s + fcoltest = col_fcn, fsure = row_fcn, 255s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 255s + } 255s + } 255s + } 255s + } 255s + } 255s + cat(sprintf("%s()...DONE\n", fcn)) 255s + } 255s subsetted tests on varDiff()... 257s varDiff()...DONE 257s subsetted tests on sdDiff()... 258s sdDiff()...DONE 258s > 258s 258s R version 4.4.3 (2025-02-28) -- "Trophy Case" 258s Copyright (C) 2025 The R Foundation for Statistical Computing 258s Platform: x86_64-pc-linux-gnu 258s 258s R is free software and comes with ABSOLUTELY NO WARRANTY. 258s You are welcome to redistribute it under certain conditions. 258s Type 'license()' or 'licence()' for distribution details. 258s 258s R is a collaborative project with many contributors. 258s Type 'contributors()' for more information and 258s 'citation()' on how to cite R or R packages in publications. 258s 258s Type 'demo()' for some demos, 'help()' for on-line help, or 258s 'help.start()' for an HTML browser interface to help. 258s Type 'q()' to quit R. 258s 259s > library("matrixStats") 259s > 259s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 259s > options(matrixStats.center.onUse = "ignore") 259s > options(matrixStats.vars.formula.freq = Inf) 259s > 259s > ## Create isFALSE() if running on an old version of R 259s > if (!exists("isFALSE", mode="function")) { 259s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 259s + } 259s > 259s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 259s + suppressWarnings({ 259s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 259s + }) 259s + stopifnot(!any(is.infinite(res))) 259s + 259s + # Keep naming support consistency same as rowVars() 259s + if (is.null(center) || ncol(x) <= 1L) { 259s + if (isFALSE(useNames)) names(res) <- NULL 259s + } 259s + else if (isFALSE(useNames)) names(res) <- NULL 259s + res 259s + } 259s > 259s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 259s + suppressWarnings({ 259s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 259s + }) 259s + stopifnot(!any(is.infinite(res))) 259s + 259s + # Keep naming support consistency same as colVars() 259s + if (is.null(center) || ncol(x) <= 1L) { 259s + if (isFALSE(useNames)) names(res) <- NULL 259s + } 259s + else if (isFALSE(useNames)) names(res) <- NULL 259s + res 259s + } 259s > 259s > 259s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 259s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 259s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 259s + x[is.infinite(center), ] <- NaN 259s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 259s + x[, is.infinite(center)] <- NaN 259s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # With and without some NAs or Infs 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > for (mode in c("integer", "double")) { 259s + if (mode == "integer") { 259s + specials <- c(0L, NA_integer_) 259s + delta <- 0L 259s + } else { 259s + specials <- c(0, NA_real_, Inf) 259s + delta <- 0.1 259s + } 259s + 259s + for (special in specials) { 259s + cat("special = ", special, "\n", sep = "") 259s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 259s + x[3:7, c(2, 4)] <- special 259s + cat("mode: ", mode, "\n", sep = "") 259s + str(x) 259s + stopifnot(storage.mode(x) == mode) 259s + 259s + # To check names attribute 259s + dimnames <- list(letters[1:10], LETTERS[1:5]) 259s + 259s + # Test with and without dimnames on x 259s + for (setDimnames in c(TRUE, FALSE)) { 259s + if (setDimnames) dimnames(x) <- dimnames 259s + else dimnames(x) <- NULL 259s + # Row/column variance 259s + for (na.rm in c(FALSE, TRUE)) { 259s + # Check names attribute 259s + for (useNames in c(TRUE, FALSE)) { 259s + cat("na.rm = ", na.rm, "\n", sep = "") 259s + center <- rowMeans(x, na.rm = na.rm) 259s + 259s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 259s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 259s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 259s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 259s + 259s + tx <- t(x) 259s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 259s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 259s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 259s + tx <- NULL 259s + 259s + stopifnot(all.equal(r1, r2)) 259s + stopifnot(all.equal(r1, r0)) 259s + stopifnot(all.equal(r1b, r1c)) 259s + stopifnot(all.equal(r2, r0)) 259s + stopifnot(all.equal(r2b, r2c)) 259s + 259s + center <- colMeans(x, na.rm = na.rm) 259s + 259s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 259s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 259s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 259s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 259s + stopifnot(all.equal(r3b, r3)) 259s + stopifnot(all.equal(r3c, r3)) 259s + stopifnot(all.equal(r3d, r3)) 259s + 259s + stopifnot( 259s + !any(is.infinite(r0)), 259s + !any(is.infinite(r1)), 259s + !any(is.infinite(r2)), 259s + !any(is.infinite(r3)), 259s + !any(is.infinite(r1b)), 259s + !any(is.infinite(r1c)), 259s + !any(is.infinite(r2b)), 259s + !any(is.infinite(r2c)), 259s + !any(is.infinite(r3b)), 259s + !any(is.infinite(r3c)), 259s + !any(is.infinite(r3d)) 259s + ) 259s + } 259s + } 259s + } 259s + } # for (special ...) 259s + } 259s special = 0 259s mode: integer 259s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s special = NA 259s mode: integer 259s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s special = 0 259s mode: double 259s 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 ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s special = NA 259s mode: double 259s 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 ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s special = Inf 259s mode: double 259s 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 ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s > 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # All NAs 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > for (mode in c("integer", "double")) { 259s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 259s + cat("mode: ", mode, "\n", sep = "") 259s + storage.mode(x) <- mode 259s + str(x) 259s + 259s + # Test with and without dimnames on x 259s + for (setDimnames in c(TRUE, FALSE)) { 259s + if (setDimnames) dimnames(x) <- dimnames 259s + else dimnames(x) <- NULL 259s + # Row/column variance 259s + for (na.rm in c(FALSE, TRUE)) { 259s + # Check names attribute 259s + for (useNames in c(TRUE, FALSE)) { 259s + cat("na.rm = ", na.rm, "\n", sep = "") 259s + 259s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 259s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 259s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 259s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 259s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 259s + stopifnot(all.equal(r1, r2)) 259s + stopifnot(all.equal(r1, r0)) 259s + stopifnot(all.equal(r2, r0)) 259s + stopifnot(all.equal(r1b, r2b)) 259s + stopifnot( 259s + !any(is.infinite(r0)), 259s + !any(is.infinite(r1)), 259s + !any(is.infinite(r2)), 259s + !any(is.infinite(r1b)), 259s + !any(is.infinite(r2b)) 259s + ) 259s + } 259s + } 259s + } 259s + } 259s mode: integer 259s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s mode: double 259s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s > 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # A 1x1 matrix 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > x <- matrix(0, nrow = 1L, ncol = 1L) 259s > dimnames <- list("a", "A") 259s > # Test with and without dimnames on x 259s > for (setDimnames in c(TRUE, FALSE)) { 259s + if (setDimnames) dimnames(x) <- dimnames 259s + else dimnames(x) <- NULL 259s + # Row/column variance 259s + for (na.rm in c(FALSE, TRUE)) { 259s + # Check names attribute 259s + for (useNames in c(TRUE, FALSE)) { 259s + cat("na.rm = ", na.rm, "\n", sep = "") 259s + 259s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 259s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 259s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 259s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 259s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 259s + stopifnot(all.equal(r1, r2)) 259s + stopifnot(all.equal(r1, r0)) 259s + stopifnot(all.equal(r2, r0)) 259s + stopifnot(all.equal(r1b, r2b)) 259s + stopifnot( 259s + !any(is.infinite(r0)), 259s + !any(is.infinite(r1)), 259s + !any(is.infinite(r2)), 259s + !any(is.infinite(r1b)), 259s + !any(is.infinite(r2b)) 259s + ) 259s + } 259s + } 259s + } 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s na.rm = FALSE 259s na.rm = FALSE 259s na.rm = TRUE 259s na.rm = TRUE 259s > 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # center and .dim 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 259s > a <- array(m, dim = c(3, 2, 2)) 259s > stopifnot(prod(dim(a)) == prod(dim(m))) 259s > 259s > y0 <- rowVars(m, dim. = dim(m)) 259s > print(y0) 259s [1] 15 15 15 259s > y1 <- rowVars(a, dim. = dim(m)) 259s > print(y1) 259s [1] 15 15 15 259s > stopifnot(identical(y1, y0)) 259s > stopifnot( 259s + !any(is.infinite(y0)), 259s + !any(is.infinite(y1)) 259s + ) 259s > 259s > mu <- rowMeans(m) 259s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 259s > print(y0) 259s [1] 15 15 15 259s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 259s > print(y1) 259s [1] 15 15 15 259s > stopifnot(identical(y1, y0)) 259s > stopifnot( 259s + !any(is.infinite(y0)), 259s + !any(is.infinite(y1)) 259s + ) 259s > 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # Corner cases 259s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 259s > x[1,1] <- NA_real_ 259s > x[1,2] <- Inf 259s > 259s > center <- colMeans2(x, na.rm = TRUE) 259s > y <- colVars(x, center = center, na.rm = TRUE) 259s > stopifnot(!any(is.infinite(y))) 259s > 259s > x <- t(x) 259s > center <- rowMeans2(x, na.rm = TRUE) 259s > y <- rowVars(x, center = center, na.rm = TRUE) 259s > stopifnot(!any(is.infinite(y))) 259s > 259s 259s R version 4.4.3 (2025-02-28) -- "Trophy Case" 259s Copyright (C) 2025 The R Foundation for Statistical Computing 259s Platform: x86_64-pc-linux-gnu 259s 259s R is free software and comes with ABSOLUTELY NO WARRANTY. 259s You are welcome to redistribute it under certain conditions. 259s Type 'license()' or 'licence()' for distribution details. 259s 259s R is a collaborative project with many contributors. 259s Type 'contributors()' for more information and 259s 'citation()' on how to cite R or R packages in publications. 259s 259s Type 'demo()' for some demos, 'help()' for on-line help, or 259s 'help.start()' for an HTML browser interface to help. 259s Type 'q()' to quit R. 259s 259s > library("matrixStats") 259s > 259s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 259s > options(matrixStats.center.onUse = "ignore") 259s > 259s > ## Create isFALSE() if running on an old version of R 259s > if (!exists("isFALSE", mode="function")) { 259s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 259s + } 259s > 259s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 259s + suppressWarnings({ 259s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 259s + }) 259s + stopifnot(!any(is.infinite(res))) 259s + 259s + # Keep naming support consistency same as rowVars() 259s + if (is.null(center) || ncol(x) <= 1L) { 259s + if (isFALSE(useNames)) names(res) <- NULL 259s + } 259s + else if (isFALSE(useNames)) names(res) <- NULL 259s + res 259s + } 259s > 259s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 259s + suppressWarnings({ 259s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 259s + }) 259s + stopifnot(!any(is.infinite(res))) 259s + 259s + # Keep naming support consistency same as colVars() 259s + if (is.null(center) || nrow(x) <= 1L) { 259s + if (isFALSE(useNames)) names(res) <- NULL 259s + } 259s + else if (isFALSE(useNames)) names(res) <- NULL 259s + res 259s + } 259s > 259s > 259s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 259s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 259s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 259s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 259s + stopifnot(!any(is.infinite(res))) 259s + res 259s + } 259s > 259s > 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > # Subsetted tests 259s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 259s > source("utils/validateIndicesFramework.R") 259s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 259s > storage.mode(x) <- "integer" 259s > 259s > # To check names attribute 259s > dimnames <- list(letters[1:6], LETTERS[1:6]) 259s > 259s > # Test with and without dimnames on x 259s > for (setDimnames in c(TRUE, FALSE)) { 259s + if (setDimnames) dimnames(x) <- dimnames 259s + else dimnames(x) <- NULL 259s + 259s + count <- 0L 259s + for (rows in index_cases) { 259s + for (cols in index_cases) { 259s + count <- count + 1L 259s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 259s + useNames <- c(TRUE, FALSE) 259s + useNames <- useNames[count %% length(useNames) + 1] 259s + 259s + validateIndicesTestMatrix(x, rows, cols, 259s + ftest = rowVars, fsure = rowVars_R, 259s + na.rm = na.rm, useNames = useNames) 259s + validateIndicesTestMatrix(x, rows, cols, 259s + ftest = rowVars_center, fsure = rowVars_R, 259s + na.rm = na.rm, center = TRUE, useNames = useNames) 259s + 259s + validateIndicesTestMatrix(x, rows, cols, 259s + fcoltest = colVars, fsure = rowVars_R, 259s + na.rm = na.rm, useNames = useNames) 259s + validateIndicesTestMatrix(x, rows, cols, 259s + fcoltest = colVars_center, fsure = rowVars_R, 259s + na.rm = na.rm, center = TRUE, useNames = useNames) 259s + } 259s + } 259s + } 260s > 260s 260s R version 4.4.3 (2025-02-28) -- "Trophy Case" 260s Copyright (C) 2025 The R Foundation for Statistical Computing 260s Platform: x86_64-pc-linux-gnu 260s 260s R is free software and comes with ABSOLUTELY NO WARRANTY. 260s You are welcome to redistribute it under certain conditions. 260s Type 'license()' or 'licence()' for distribution details. 260s 260s R is a collaborative project with many contributors. 260s Type 'contributors()' for more information and 260s 'citation()' on how to cite R or R packages in publications. 260s 260s Type 'demo()' for some demos, 'help()' for on-line help, or 260s 'help.start()' for an HTML browser interface to help. 260s Type 'q()' to quit R. 260s 260s > library("matrixStats") 260s > 260s > ## Create isFALSE() if running on an old version of R 260s > if (!exists("isFALSE", mode="function")) { 260s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 260s + } 260s > 260s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 260s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 260s + 260s + # Keep naming support consistency same as rowWeightedMeans() 260s + idxs <- which(is.na(w) | w != 0) 260s + nw <- length(idxs) 260s + if (na.rm) na.rm <- anyMissing(x) 260s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 260s + if (!useNames) names(res) <- NULL 260s + } 260s + else if (isFALSE(useNames)) names(res) <- NULL 260s + 260s + res 260s + } 260s > 260s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 260s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 260s + 260s + # Keep naming support consistency same as colWeightedMeans() 260s + idxs <- which(is.na(w) | w != 0) 260s + nw <- length(idxs) 260s + if (!is.null(w) && nw == 0L) { 260s + if (!useNames) names(res) <- NULL 260s + } 260s + else if (isFALSE(useNames)) names(res) <- NULL 260s + 260s + res 260s + } 260s > 260s > set.seed(1) 260s > 260s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 260s > print(x) 260s [,1] [,2] [,3] [,4] 260s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 260s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 260s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 260s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 260s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 260s > 260s > # To check names attribute 260s > dimnames <- list(letters[1:5], LETTERS[1:4]) 260s > 260s > # Non-weighted row averages 260s > x_est0 <- rowMeans(x) 260s > x_est1 <- rowWeightedMeans(x) 260s > print(x_est1) 260s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x)) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Check names attribute 260s > dimnames(x) <- dimnames 260s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 260s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > x_est0 <- rowMeans(x) 260s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 260s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > dimnames(x) <- NULL 260s > 260s > 260s > # Weighted row averages (uniform weights) 260s > w <- rep(2.5, times = ncol(x)) 260s > x_est0 <- rowMeans(x) 260s > x_est1 <- rowWeightedMeans(x, w = w) 260s > print(x_est1) 260s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), w = w) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # Weighted row averages (excluding some columns) 260s > w <- c(1, 1, 0, 1) 260s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 260s > x_est1 <- rowWeightedMeans(x, w = w) 260s > print(x_est1) 260s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), w = w) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # Weighted row averages (excluding some columns) 260s > w <- c(0, 1, 0, 0) 260s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 260s > x_est1 <- rowWeightedMeans(x, w = w) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), w = w) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # Weighted row averages (all zero weights) 260s > w <- c(0, 0, 0, 0) 260s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 260s > x_est1 <- rowWeightedMeans(x, w = w) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), w = w) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # Weighted averages by rows and columns 260s > w <- 1:4 260s > x_est1 <- rowWeightedMeans(x, w = w) 260s > print(x_est1) 260s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 260s > x_est2 <- colWeightedMeans(t(x), w = w) 260s > stopifnot(all.equal(x_est2, x_est1)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > x[sample(length(x), size = 0.3 * length(x))] <- NA 260s > print(x) 260s [,1] [,2] [,3] [,4] 260s [1,] -0.6264538 NA 1.5117812 -0.04493361 260s [2,] 0.1836433 NA NA -0.01619026 260s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 260s [4,] 1.5952808 NA -2.2146999 0.82122120 260s [5,] 0.3295078 NA NA 0.59390132 260s > 260s > # Non-weighted row averages with missing values 260s > x_est0 <- rowMeans(x, na.rm = TRUE) 260s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 260s > print(x_est1) 260s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Check names attribute 260s > dimnames(x) <- dimnames 260s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 260s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > x_est0 <- rowMeans(x, na.rm = TRUE) 260s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 260s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > dimnames(x) <- NULL 260s > 260s > 260s > # Weighted row averages with missing values 260s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 260s > print(x_est0) 260s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 260s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 260s > print(x_est1) 260s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 260s > stopifnot(all.equal(x_est1, x_est0)) 260s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 260s > stopifnot(all.equal(x_est2, x_est0)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # Weighted averages by rows and columns 260s > w <- 1:4 260s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 260s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 260s > stopifnot(all.equal(x_est2, x_est1)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > 260s > # w contains missing value 260s > w[1] <- NA_integer_ 260s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 260s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 260s > stopifnot(all.equal(x_est2, x_est1)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 260s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 260s > stopifnot(all.equal(x_est2, x_est1)) 260s > # Test with and without dimnames on x 260s > for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + # Check names attribute 260s + for (useNames in c(TRUE, FALSE)) { 260s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 260s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 260s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 260s + stopifnot(all.equal(x_est1, x_est0)) 260s + } 260s + } 260s > 260s 260s R version 4.4.3 (2025-02-28) -- "Trophy Case" 260s Copyright (C) 2025 The R Foundation for Statistical Computing 260s Platform: x86_64-pc-linux-gnu 260s 260s R is free software and comes with ABSOLUTELY NO WARRANTY. 260s You are welcome to redistribute it under certain conditions. 260s Type 'license()' or 'licence()' for distribution details. 260s 260s R is a collaborative project with many contributors. 260s Type 'contributors()' for more information and 260s 'citation()' on how to cite R or R packages in publications. 260s 260s Type 'demo()' for some demos, 'help()' for on-line help, or 260s 'help.start()' for an HTML browser interface to help. 260s Type 'q()' to quit R. 260s 260s > library("matrixStats") 260s > 260s > ## Create isFALSE() if running on an old version of R 260s > if (!exists("isFALSE", mode="function")) { 260s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 260s + } 260s > 260s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 260s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 260s + 260s + # Keep naming support consistency same as rowWeightedMeans() 260s + idxs <- which(is.na(w) | w != 0) 260s + nw <- length(idxs) 260s + if (na.rm) na.rm <- anyMissing(x) 260s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 260s + if (!useNames) names(res) <- NULL 260s + } 260s + else if (isFALSE(useNames)) names(res) <- NULL 260s + 260s + res 260s + } 260s > 260s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 260s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 260s + 260s + # Keep naming support consistency same as colWeightedMeans() 260s + idxs <- which(is.na(w) | w != 0) 260s + nw <- length(idxs) 260s + if (!is.null(w) && nw == 0L) { 260s + if (!useNames) names(res) <- NULL 260s + } 260s + else if (isFALSE(useNames)) names(res) <- NULL 260s + 260s + res 260s + } 260s > 260s > 260s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 260s > # Subsetted tests 260s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 260s > source("utils/validateIndicesFramework.R") 260s > # To check names attribute 260s > dimnames <- list(letters[1:6], LETTERS[1:6]) 260s > for (mode in c("numeric", "integer", "logical")) { 260s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 260s + w <- runif(6, min = 0, max = 6) 260s + storage.mode(x) <- mode 260s + storage.mode(w) <- if (mode == "logical") "integer" else mode 260s + if (mode == "numeric") w[1] <- Inf 260s + 260s + # Test with and without dimnames on x 260s + for (setDimnames in c(TRUE, FALSE)) { 260s + if (setDimnames) dimnames(x) <- dimnames 260s + else dimnames(x) <- NULL 260s + 260s + count <- 0L 260s + for (rows in index_cases) { 260s + for (cols in index_cases) { 260s + count <- count + 1L 260s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 260s + useNames <- c(TRUE, FALSE) 260s + useNames <- useNames[count %% length(useNames) + 1] 260s + 260s + validateIndicesTestMatrix_w(x, w, rows, cols, 260s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 260s + na.rm = na.rm, useNames = useNames) 260s + validateIndicesTestMatrix_w(x, w, rows, cols, 260s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 260s + na.rm = na.rm, useNames = useNames) 260s + } 260s + } 260s + } 260s + } 261s > 261s 261s R version 4.4.3 (2025-02-28) -- "Trophy Case" 261s Copyright (C) 2025 The R Foundation for Statistical Computing 261s Platform: x86_64-pc-linux-gnu 261s 261s R is free software and comes with ABSOLUTELY NO WARRANTY. 261s You are welcome to redistribute it under certain conditions. 261s Type 'license()' or 'licence()' for distribution details. 261s 261s R is a collaborative project with many contributors. 261s Type 'contributors()' for more information and 261s 'citation()' on how to cite R or R packages in publications. 261s 261s Type 'demo()' for some demos, 'help()' for on-line help, or 261s 'help.start()' for an HTML browser interface to help. 261s Type 'q()' to quit R. 261s 261s > library("matrixStats") 261s > 261s > ## Create isFALSE() if running on an old version of R 261s > if (!exists("isFALSE", mode="function")) { 261s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 261s + } 261s > 261s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 261s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 261s + 261s + # Keep naming support consistency same as rowWeightedMedians() 261s + if (!is.null(w)) { 261s + if (isFALSE(useNames)) names(res) <- NULL 261s + } 261s + else if (!useNames) names(res) <- NULL 261s + 261s + res 261s + } 261s > 261s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 261s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 261s + 261s + # Keep naming support consistency same as colWeightedMedians() 261s + if (!is.null(w)) { 261s + if (isFALSE(useNames)) names(res) <- NULL 261s + } 261s + else if (!useNames) names(res) <- NULL 261s + 261s + res 261s + } 261s > 261s > set.seed(1) 261s > 261s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 261s > print(x) 261s [,1] [,2] [,3] [,4] 261s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 261s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 261s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 261s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 261s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 261s > 261s > # To check names attribute 261s > dimnames <- list(letters[1:5], LETTERS[1:4]) 261s > 261s > # Non-weighted row medians 261s > x_est0 <- rowMedians(x) 261s > x_est1 <- rowWeightedMedians(x) 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x)) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowMedians(x, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 261s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + stopifnot(all.equal(x_est2, x_est0)) 261s + } 261s + } 261s > 261s > 261s > # Weighted row medians (uniform weights) 261s > w <- rep(2.5, times = ncol(x)) 261s > x_est0 <- rowMedians(x) 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > 261s > # Weighted row medians (excluding some columns) 261s > w <- c(1, 1, 0, 1) 261s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > # Weighted row medians (excluding some columns) 261s > w <- c(0, 1, 0, 0) 261s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > # Weighted row medians (all zero weights) 261s > w <- c(0, 0, 0, 0) 261s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > # Weighted medians by rows and columns 261s > w <- 1:4 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est1)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > 261s > # Weighted row medians with missing values 261s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 261s > print(x_est0) 261s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 261s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 261s > print(x_est1) 261s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 261s > stopifnot(all.equal(x_est1, x_est0)) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(all.equal(x_est2, x_est0)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > # Weighted medians by rows and columns 261s > w <- 1:4 261s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 261s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 261s > stopifnot(all.equal(x_est2, x_est1)) 261s > # Test with and without dimnames on x 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s > 261s > # Inf weight 261s > x <- matrix(1:2, nrow = 1, ncol = 2) 261s > w <- c(7, Inf) 261s > x_est1 <- rowWeightedMedians(x, w = w) 261s > x_est2 <- colWeightedMedians(t(x), w = w) 261s > stopifnot(identical(2, x_est1)) 261s > stopifnot(identical(2, x_est2)) 261s > # Test with and without dimnames on x 261s > dimnames <- list("a", LETTERS[1:2]) 261s > for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + # Check names attribute 261s + for (useNames in c(TRUE, FALSE)) { 261s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 261s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 261s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 261s + stopifnot(all.equal(x_est1, x_est0)) 261s + } 261s + } 261s > 261s 261s R version 4.4.3 (2025-02-28) -- "Trophy Case" 261s Copyright (C) 2025 The R Foundation for Statistical Computing 261s Platform: x86_64-pc-linux-gnu 261s 261s R is free software and comes with ABSOLUTELY NO WARRANTY. 261s You are welcome to redistribute it under certain conditions. 261s Type 'license()' or 'licence()' for distribution details. 261s 261s R is a collaborative project with many contributors. 261s Type 'contributors()' for more information and 261s 'citation()' on how to cite R or R packages in publications. 261s 261s Type 'demo()' for some demos, 'help()' for on-line help, or 261s 'help.start()' for an HTML browser interface to help. 261s Type 'q()' to quit R. 261s 261s > library("matrixStats") 261s > 261s > ## Create isFALSE() if running on an old version of R 261s > if (!exists("isFALSE", mode="function")) { 261s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 261s + } 261s > 261s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 261s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 261s + 261s + # Keep naming support consistency same as rowWeightedMedians() 261s + if (!is.null(w)) { 261s + if (isFALSE(useNames)) names(res) <- NULL 261s + } 261s + else if (!useNames) names(res) <- NULL 261s + 261s + res 261s + } 261s > 261s > 261s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 261s > # Subsetted tests 261s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 261s > source("utils/validateIndicesFramework.R") 261s > # To check names attribute 261s > dimnames <- list(letters[1:6], LETTERS[1:6]) 261s > for (mode in c("numeric", "integer", "logical")) { 261s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 261s + w <- runif(6, min = 0, max = 6) 261s + storage.mode(x) <- mode 261s + storage.mode(w) <- if (mode == "logical") "integer" else mode 261s + if (mode == "numeric") w[1] <- Inf 261s + 261s + # Test with and without dimnames on x 261s + for (setDimnames in c(TRUE, FALSE)) { 261s + if (setDimnames) dimnames(x) <- dimnames 261s + else dimnames(x) <- NULL 261s + 261s + count <- 0L 261s + for (rows in index_cases) { 261s + for (cols in index_cases) { 261s + count <- count + 1L 261s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 261s + useNames <- c(TRUE, FALSE) 261s + useNames <- useNames[count %% length(useNames) + 1] 261s + 261s + validateIndicesTestMatrix_w(x, w, rows, cols, 261s + ftest = rowWeightedMedians, 261s + fsure = rowWeightedMedians_R, 261s + na.rm = na.rm, useNames = useNames) 261s + validateIndicesTestMatrix_w(x, w, rows, cols, 261s + fcoltest = colWeightedMedians, 261s + fsure = rowWeightedMedians_R, 261s + na.rm = na.rm, useNames = useNames) 261s + } 261s + } 261s + } 261s + } 262s > 262s 262s R version 4.4.3 (2025-02-28) -- "Trophy Case" 262s Copyright (C) 2025 The R Foundation for Statistical Computing 262s Platform: x86_64-pc-linux-gnu 262s 262s R is free software and comes with ABSOLUTELY NO WARRANTY. 262s You are welcome to redistribute it under certain conditions. 262s Type 'license()' or 'licence()' for distribution details. 262s 262s R is a collaborative project with many contributors. 262s Type 'contributors()' for more information and 262s 'citation()' on how to cite R or R packages in publications. 262s 262s Type 'demo()' for some demos, 'help()' for on-line help, or 262s 'help.start()' for an HTML browser interface to help. 262s Type 'q()' to quit R. 262s 262s > library("matrixStats") 262s > 262s > set.seed(1) 262s > 262s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 262s > print(x) 262s [,1] [,2] [,3] [,4] 262s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 262s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 262s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 262s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 262s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 262s > 262s > # To check names attribute 262s > dimnames <- list(letters[1:5], LETTERS[1:4]) 262s > 262s > # Weighted row variances (uniform weights - all w = 1) 262s > # Non-weighted row variances 262s > x_est0 <- rowVars(x) 262s > w <- rep(1, times = ncol(x)) 262s > x_est1 <- rowWeightedVars(x, w = w) 262s > print(x_est1) 262s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowVars(x, useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row variances (uniform weights - all w = 3) 262s > x3 <- cbind(x, x, x) 262s > x_est0 <- rowVars(x3) 262s > w <- rep(3, times = ncol(x)) 262s > x_est1 <- rowWeightedVars(x, w = w) 262s > print(x_est1) 262s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x3 <- cbind(x, x, x) 262s > x_est0 <- rowVars(x3, useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row variances (excluding some columns) 262s > w <- c(1, 1, 0, 1) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 262s > x_est1 <- rowWeightedVars(x, w = w) 262s > print(x_est1) 262s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row variances (excluding some columns) 262s > w <- c(0, 1, 0, 0) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 262s > x_est1 <- rowWeightedVars(x, w = w) 262s > #stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est1)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row variances (all zero weights) 262s > w <- c(0, 0, 0, 0) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 262s > x_est1 <- rowWeightedVars(x, w = w) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > # Weighted variances by rows and columns 262s > w <- 1:4 262s > # Test with and without dimnames on x 262s > for (setDimnames in c(TRUE, FALSE)) { 262s + if (setDimnames) dimnames(x) <- dimnames 262s + else dimnames(x) <- NULL 262s + # Check names attribute 262s + for (useNames in c(TRUE, FALSE)) { 262s + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 262s + print(x_est1) 262s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 262s + stopifnot(all.equal(x_est2, x_est1)) 262s + } 262s + } 262s a b c d e 262s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 262s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 262s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 262s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 262s > 262s > 262s > x[sample(length(x), size = 0.3 * length(x))] <- NA 262s > print(x) 262s [,1] [,2] [,3] [,4] 262s [1,] -0.6264538 NA 1.5117812 -0.04493361 262s [2,] 0.1836433 NA NA -0.01619026 262s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 262s [4,] 1.5952808 NA -2.2146999 0.82122120 262s [5,] 0.3295078 NA NA 0.59390132 262s > 262s > # Non-weighted row variances with missing values 262s > x_est0 <- rowVars(x, na.rm = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 262s > print(x_est1) 262s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 262s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 262s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 262s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row variances with missing values 262s > # Test with and without dimnames on x 262s > for (setDimnames in c(TRUE, FALSE)) { 262s + if (setDimnames) dimnames(x) <- dimnames 262s + else dimnames(x) <- NULL 262s + # Check names attribute 262s + for (useNames in c(TRUE, FALSE)) { 262s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 262s + print(x_est1) 262s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 262s + stopifnot(all.equal(x_est2, x_est1)) 262s + } 262s + } 262s a b c d e 262s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s > 262s > 262s > # Weighted variances by rows and columns 262s > w <- 1:4 262s > # Test with and without dimnames on x 262s > for (setDimnames in c(TRUE, FALSE)) { 262s + if (setDimnames) dimnames(x) <- dimnames 262s + else dimnames(x) <- NULL 262s + # Check names attribute 262s + for (useNames in c(TRUE, FALSE)) { 262s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 262s + print(x_est1) 262s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 262s + stopifnot(all.equal(x_est2, x_est1)) 262s + } 262s + } 262s a b c d e 262s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 262s > 262s > 262s > # Weighted row standard deviation (excluding some columns) 262s > w <- c(1, 1, 0, 1) 262s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 262s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 262s > x_est1 <- rowWeightedSds(x, w = w) 262s > print(x_est1) 262s [1] NA NA 0.9734868 NA NA 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 262s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 262s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 262s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 262s > 262s > # Weighted row MADs (excluding some columns) 262s > w <- c(1, 1, 0, 1) 262s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 262s > x_est1 <- rowWeightedMads(x, w = w) 262s > print(x_est1) 262s [1] NA NA 0.3046914 NA NA 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > x_est2 <- colWeightedMads(t(x), w = w) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > # Check names attribute 262s > dimnames(x) <- dimnames 262s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 262s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 262s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 262s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 262s > stopifnot(all.equal(x_est1, x_est0)) 262s > stopifnot(all.equal(x_est2, x_est0)) 262s > dimnames(x) <- NULL 262s > 263s 263s R version 4.4.3 (2025-02-28) -- "Trophy Case" 263s Copyright (C) 2025 The R Foundation for Statistical Computing 263s Platform: x86_64-pc-linux-gnu 263s 263s R is free software and comes with ABSOLUTELY NO WARRANTY. 263s You are welcome to redistribute it under certain conditions. 263s Type 'license()' or 'licence()' for distribution details. 263s 263s R is a collaborative project with many contributors. 263s Type 'contributors()' for more information and 263s 'citation()' on how to cite R or R packages in publications. 263s 263s Type 'demo()' for some demos, 'help()' for on-line help, or 263s 'help.start()' for an HTML browser interface to help. 263s Type 'q()' to quit R. 263s 263s > library("matrixStats") 263s > 263s > fcns <- list( 263s + weightedVar = c(rowWeightedVars, colWeightedVars), 263s + weightedSd = c(rowWeightedSds, colWeightedSds), 263s + weightedMad = c(rowWeightedMads, colWeightedMads) 263s + ) 263s > 263s > 263s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 263s > # Subsetted tests 263s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 263s > source("utils/validateIndicesFramework.R") 263s > # To check names attribute 263s > dimnames <- list(letters[1:6], LETTERS[1:6]) 263s > for (fcn in names(fcns)) { 263s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 263s + row_fcn <- fcns[[fcn]][[1]] 263s + col_fcn <- fcns[[fcn]][[2]] 263s + 263s + for (mode in c("numeric", "integer")) { 263s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 263s + w <- runif(6, min = 0, max = 6) 263s + storage.mode(x) <- mode 263s + storage.mode(w) <- mode 263s + if (mode == "numeric") w[1] <- Inf 263s + 263s + # Test with and without dimnames on x 263s + for (setDimnames in c(TRUE, FALSE)) { 263s + if (setDimnames) dimnames(x) <- dimnames 263s + else dimnames(x) <- NULL 263s + 263s + count <- 0L 263s + for (rows in index_cases) { 263s + for (cols in index_cases) { 263s + count <- count + 1L 263s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 263s + useNames <- c(TRUE, FALSE) 263s + useNames <- useNames[count %% length(useNames) + 1] 263s + 263s + validateIndicesTestMatrix_w(x, w, rows, cols, 263s + ftest = row_fcn, fsure = row_fcn, 263s + na.rm = na.rm, useNames = useNames) 263s + validateIndicesTestMatrix_w(x, w, rows, cols, 263s + fcoltest = col_fcn, fsure = row_fcn, 263s + na.rm = na.rm, useNames = useNames) 263s + } 263s + } 263s + } 263s + } 263s + cat(sprintf("%s()...DONE\n", fcn)) 263s + } 263s subsetted tests on matrix weightedVar()... 263s weightedVar()...DONE 263s subsetted tests on matrix weightedSd()... 264s weightedSd()...DONE 264s subsetted tests on matrix weightedMad()... 265s weightedMad()...DONE 265s > 265s 265s R version 4.4.3 (2025-02-28) -- "Trophy Case" 265s Copyright (C) 2025 The R Foundation for Statistical Computing 265s Platform: x86_64-pc-linux-gnu 265s 265s R is free software and comes with ABSOLUTELY NO WARRANTY. 265s You are welcome to redistribute it under certain conditions. 265s Type 'license()' or 'licence()' for distribution details. 265s 265s R is a collaborative project with many contributors. 265s Type 'contributors()' for more information and 265s 'citation()' on how to cite R or R packages in publications. 265s 265s Type 'demo()' for some demos, 'help()' for on-line help, or 265s 'help.start()' for an HTML browser interface to help. 265s Type 'q()' to quit R. 265s 265s > library("matrixStats") 265s > Doubles: 265s 265s > signTabulate0 <- function(x, ...) { 265s + nneg <- sum(x < 0, na.rm = TRUE) 265s + nzero <- sum(x == 0, na.rm = TRUE) 265s + npos <- sum(x > 0, na.rm = TRUE) 265s + nna <- sum(is.na(x)) 265s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 265s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 265s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 265s + res <- as.double(res) 265s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 265s + if (is.integer(x)) res <- res[1:4] 265s + res 265s + } # signTabulate0() 265s > 265s > 265s > # Simulate data 265s > set.seed(0xBEEF) 265s > n <- 100L 265s > x <- runif(n) 265s > x[sample(n, size = 0.1 * n)] <- 0 265s > x[sample(n, size = 0.1 * n)] <- NA_real_ 265s > x[sample(n, size = 0.1 * n)] <- -Inf 265s > x[sample(n, size = 0.1 * n)] <- +Inf 265s > 265s > # Doubles 265s > message("Doubles:") 265s > counts0 <- signTabulate0(x) 265s > print(counts0) 265s -1 0 +1 NA -Inf +Inf 265s 9 7 77 7 9 10 265s > counts1 <- signTabulate(x) 265s > print(counts1) 265s -1 0 +1 NA -Inf +Inf 265s 9 7 77 7 9 10 265s > stopifnot(identical(counts1, counts0)) 265s > 265s > # Integers 265s > message("Integers:") 265s > x <- suppressWarnings(as.integer(x)) 265s > counts0 <- signTabulate0(x) 265s > print(counts0) 265s -1 0 +1 NA 265s 0 74 0 26 265s > counts1 <- signTabulate(x) 265s > print(counts1) 265s -1 0 +1 NA 265s 0 74 0 26 265s > stopifnot(identical(counts1, counts0)) 265s > 265s Integers: 265s 265s R version 4.4.3 (2025-02-28) -- "Trophy Case" 265s Copyright (C) 2025 The R Foundation for Statistical Computing 265s Platform: x86_64-pc-linux-gnu 265s 265s R is free software and comes with ABSOLUTELY NO WARRANTY. 265s You are welcome to redistribute it under certain conditions. 265s Type 'license()' or 'licence()' for distribution details. 265s 265s R is a collaborative project with many contributors. 265s Type 'contributors()' for more information and 265s 'citation()' on how to cite R or R packages in publications. 265s 265s Type 'demo()' for some demos, 'help()' for on-line help, or 265s 'help.start()' for an HTML browser interface to help. 265s Type 'q()' to quit R. 265s 265s > library("matrixStats") 265s > 265s > signTabulate0 <- function(x, ...) { 265s + nneg <- sum(x < 0, na.rm = TRUE) 265s + nzero <- sum(x == 0, na.rm = TRUE) 265s + npos <- sum(x > 0, na.rm = TRUE) 265s + nna <- sum(is.na(x)) 265s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 265s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 265s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 265s + res <- as.double(res) 265s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 265s + if (is.integer(x)) res <- res[1:4] 265s + res 265s + } # signTabulate0() 265s > 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Subsetted tests 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > source("utils/validateIndicesFramework.R") 265s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 265s > x[2:3, 4:5] <- +Inf 265s > x[4:5, 1:2] <- -Inf 265s > for (idxs in index_cases) { 265s + validateIndicesTestVector(x, idxs, 265s + ftest = signTabulate, fsure = signTabulate0) 265s + } 265s > 265s 265s R version 4.4.3 (2025-02-28) -- "Trophy Case" 265s Copyright (C) 2025 The R Foundation for Statistical Computing 265s Platform: x86_64-pc-linux-gnu 265s 265s R is free software and comes with ABSOLUTELY NO WARRANTY. 265s You are welcome to redistribute it under certain conditions. 265s Type 'license()' or 'licence()' for distribution details. 265s 265s R is a collaborative project with many contributors. 265s Type 'contributors()' for more information and 265s 'citation()' on how to cite R or R packages in publications. 265s 265s Type 'demo()' for some demos, 'help()' for on-line help, or 265s 'help.start()' for an HTML browser interface to help. 265s Type 'q()' to quit R. 265s 265s > library("matrixStats") 265s > options(warn = 1) 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Consistency checks 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > set.seed(1) 265s > 265s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 265s + if (is.null(idxs)) { 265s + sum(x, na.rm = na.rm) 265s + } else { 265s + sum(x[idxs], na.rm = na.rm) 265s + } 265s + } # sum2_R() 265s > 265s > 265s > cat("Consistency checks:\n") 265s Consistency checks: 265s > for (kk in 1:20) { 265s + cat("Random test #", kk, "\n", sep = "") 265s + 265s + # Simulate data in a matrix of any shape 265s + n <- sample(1e3, size = 1L) 265s + x <- rnorm(n, sd = 100) 265s + 265s + # Add NAs? 265s + if ((kk %% 4) %in% c(3, 0)) { 265s + cat("Adding NAs\n") 265s + nna <- sample(n, size = 1L) 265s + na_values <- c(NA_real_, NaN) 265s + t <- sample(na_values, size = nna, replace = TRUE) 265s + x[sample(length(x), size = nna)] <- t 265s + } 265s + 265s + # Integer or double? 265s + if ((kk %% 4) %in% c(2, 0)) { 265s + cat("Coercing to integers\n") 265s + storage.mode(x) <- "integer" 265s + } 265s + 265s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 265s + 265s + # Sum over all 265s + y0 <- sum2_R(x, na.rm = na.rm) 265s + y1 <- sum2(x, na.rm = na.rm) 265s + stopifnot(all.equal(y1, y0)) 265s + 265s + # Sum over subset 265s + nidxs <- sample(n, size = 1L) 265s + idxs <- sample(n, size = nidxs) 265s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 265s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 265s + stopifnot(all.equal(y1, y0)) 265s + 265s + if (storage.mode(x) == "integer") { 265s + storage.mode(x) <- "logical" 265s + 265s + y0 <- sum2_R(x, na.rm = na.rm) 265s + y1 <- sum2(x, na.rm = na.rm) 265s + stopifnot(all.equal(y1, y0)) 265s + 265s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 265s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 265s + stopifnot(all.equal(y1, y0)) 265s + } 265s + } # for (kk ...) 265s Random test #1 265s Random test #2 265s Coercing to integers 265s Random test #3 265s Adding NAs 265s Random test #4 265s Adding NAs 265s Coercing to integers 265s Random test #5 265s Random test #6 265s Coercing to integers 265s Random test #7 265s Adding NAs 265s Random test #8 265s Adding NAs 265s Coercing to integers 265s Random test #9 265s Random test #10 265s Coercing to integers 265s Random test #11 265s Adding NAs 265s Random test #12 265s Adding NAs 265s Coercing to integers 265s Random test #13 265s Random test #14 265s Coercing to integers 265s Random test #15 265s Adding NAs 265s Random test #16 265s Adding NAs 265s Coercing to integers 265s Random test #17 265s Random test #18 265s Coercing to integers 265s Random test #19 265s Adding NAs 265s Random test #20 265s Adding NAs 265s Coercing to integers 265s > 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # All missing values 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > for (n in 0:2) { 265s + for (na.rm in c(FALSE, TRUE)) { 265s + x <- rep(NA_real_, times = n) 265s + y0 <- sum(x, na.rm = na.rm) 265s + y <- sum2(x, na.rm = na.rm) 265s + stopifnot(all.equal(y, y0)) 265s + 265s + x <- rep(NA_integer_, times = n) 265s + y0 <- sum(x, na.rm = na.rm) 265s + y <- sum2(x, na.rm = na.rm) 265s + stopifnot(all.equal(y, y0)) 265s + 265s + x <- rep(NA, times = n) 265s + y0 <- sum(x, na.rm = na.rm) 265s + y <- sum2(x, na.rm = na.rm) 265s + stopifnot(all.equal(y, y0)) 265s + } 265s + } 265s > 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Special cases 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > for (na.rm in c(FALSE, TRUE)) { 265s + # Summing over zero elements (integers) 265s + x <- integer(0) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot(identical(s1, s2)) 265s + 265s + x <- 1:10 265s + idxs <- integer(0) 265s + s1 <- sum(x[idxs], na.rm = na.rm) 265s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 265s + stopifnot(identical(s1, s2)) 265s + 265s + # Summing over NA_integer_:s 265s + x <- rep(NA_integer_, times = 10L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot(identical(s1, s2)) 265s + 265s + x <- rep(NA_integer_, times = 10L) 265s + idxs <- 1:5 265s + s1 <- sum(x[idxs], na.rm = na.rm) 265s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 265s + stopifnot(identical(s1, s2)) 265s + 265s + 265s + # Summing over zero elements (doubles) 265s + x <- double(0) 265s + s1 <- sum(x) 265s + s2 <- sum2(x) 265s + stopifnot( 265s + identical(s1, 0), 265s + identical(s1, s2) 265s + ) 265s + 265s + x <- as.double(1:10) 265s + idxs <- integer(0) 265s + s1 <- sum(x[idxs]) 265s + s2 <- sum2(x, idxs = idxs) 265s + stopifnot( 265s + identical(s1, 0), 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over NA_real_:s 265s + x <- rep(NA_real_, times = 10L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot( 265s + !na.rm || s1 == 0, 265s + identical(s1, s2) 265s + ) 265s + 265s + x <- rep(NA_real_, times = 10L) 265s + idxs <- 1:5 265s + s1 <- sum(x[idxs], na.rm = na.rm) 265s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 265s + stopifnot( 265s + !na.rm || s1 == 0, 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over -Inf:s 265s + x <- rep(-Inf, times = 3L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot( 265s + is.infinite(s1) && s1 < 0, 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over +Inf:s 265s + x <- rep(+Inf, times = 3L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot(identical(s1, s2)) 265s + stopifnot( 265s + is.infinite(s1) && s1 > 0, 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over mix of -Inf:s and +Inf:s 265s + x <- rep(c(-Inf, +Inf), times = 3L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot( 265s + is.nan(s1), 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over mix of -Inf:s and +Inf:s and numerics 265s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + stopifnot( 265s + is.nan(s1), 265s + identical(s1, s2) 265s + ) 265s + 265s + # Summing over mix of NaN, NA, +Inf, and numerics 265s + x <- c(NaN, NA, +Inf, 3.14) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + if (na.rm) { 265s + stopifnot( 265s + is.infinite(s1) && s1 > 0, 265s + identical(s2, s1) 265s + ) 265s + } else { 265s + stopifnot(is.na(s1), is.na(s2)) 265s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 265s + ## returned here (as one would expect). NaN might very well be returned, 265s + ## when both NA and NaN are involved. This is an accepted feature in R, 265s + ## which is documented in help("is.nan"). See also 265s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 265s + ## Thus, we cannot guarantee that s1 is identical to s0. 265s + } 265s + 265s + # Summing over mix of NaN, NA, +Inf, and numerics 265s + x <- c(NA, NaN, +Inf, 3.14) 265s + s1 <- sum(x, na.rm = na.rm) 265s + s2 <- sum2(x, na.rm = na.rm) 265s + if (na.rm) { 265s + stopifnot( 265s + is.infinite(s1) && s1 > 0, 265s + identical(s2, s1) 265s + ) 265s + } else { 265s + stopifnot(is.na(s1), is.na(s2)) 265s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 265s + ## returned here (as one would expect). NaN might very well be returned, 265s + ## when both NA and NaN are involved. This is an accepted feature in R, 265s + ## which is documented in help("is.nan"). See also 265s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 265s + ## Thus, we cannot guarantee that s1 is identical to s0. 265s + } 265s + } 265s Warning in sum2(x[1:2]) :> 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Summing of large integers 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 265s > 265s > # Total gives integer overflow 265s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 265s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 265s 265s Integer overflow. Use sum2(..., mode = "double") to avoid this. 265s > stopifnot( 265s + identical(s2, NA_integer_) 265s + ) 265s > 265s > ## Assert above warning 265s > res <- tryCatch({ 265s + s2 <- sum2(x[1:2]) 265s + }, warning = identity) 265s > stopifnot(inherits(res, "warning")) 265s > 265s > 265s > # Total gives integer overflow (coerce to numeric) 265s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 265s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 265s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 265s > stopifnot( 265s + identical(s1, 2147483648), 265s + identical(s1, s2), 265s + identical(s1, s3) 265s + ) 265s > 265s > # Cumulative sum would give integer overflow but not the total 265s > s1 <- sum(x) # 1L 265s > s2 <- sum2(x) # 1L 265s > stopifnot( 265s + identical(s1, 1L), 265s + identical(s1, s2) 265s + ) 265s > 265s > # Input is double but coercing result to integer 265s > x <- c(1, 2, 3.1) 265s > s1 <- sum2(x) 265s > s2 <- sum2(x, mode = "integer") 265s > stopifnot( 265s + identical(as.integer(s1), s2) 265s + ) 265s > 265s > ## Assert above warning 265s > res <- tryCatch({ 265s + s2 <- sum2(x, mode = "integer") 265s + }, warning = identity) 265s > stopifnot(inherits(res, "warning")) 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Summing of large doubles 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > ## Double overflow 265s > x <- rep(.Machine$double.xmax, times = 2L) 265s > y0 <- sum(x) 265s > print(y0) 265s [1] Inf 265s > y <- sum2(x) 265s > print(y) 265s [1] Inf 265s > stopifnot( 265s + is.infinite(y) && y > 0, 265s + identical(y, y0) 265s + ) 265s > 265s > x <- rep(-.Machine$double.xmax, times = 2L) 265s > y0 <- sum(x) 265s > print(y0) 265s [1] -Inf 265s > y <- sum2(x) 265s > print(y) 265s [1] -Inf 265s > stopifnot( 265s + is.infinite(y) && y < 0, 265s + identical(y, y0) 265s + ) 265s > 265s > 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > # Argument 'idxs' 265s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 265s > x <- 1:10 265s > idxs_list <- list( 265s + integer = 1:5, 265s + double = as.double(1:5), 265s + logical = (x <= 5) 265s + ) 265s > 265s > for (idxs in idxs_list) { 265s + cat("idxs:\n") 265s + str(idxs) 265s + s1 <- sum(x[idxs], na.rm = TRUE) 265s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 265s + stopifnot(identical(s1, s2)) 265s + } 265s Warning in sum2(x, mode = "integer") : 265s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 265s idxs: 265s int [1:5] 1 2 3 4 5 265s idxs: 265s num [1:5] 1 2 3 4 5 265s idxs: 265s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 265s > 265s 265s R version 4.4.3 (2025-02-28) -- "Trophy Case" 265s Copyright (C) 2025 The R Foundation for Statistical Computing 265s Platform: x86_64-pc-linux-gnu 265s 265s R is free software and comes with ABSOLUTELY NO WARRANTY. 265s You are welcome to redistribute it under certain conditions. 265s Type 'license()' or 'licence()' for distribution details. 265s 265s R is a collaborative project with many contributors. 265s Type 'contributors()' for more information and 265s 'citation()' on how to cite R or R packages in publications. 265s 265s Type 'demo()' for some demos, 'help()' for on-line help, or 265s 'help.start()' for an HTML browser interface to help. 265s Type 'q()' to quit R. 265s 266s > library("matrixStats") 266s > 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > # Subsetted tests 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > source("utils/validateIndicesFramework.R") 266s > x <- runif(6, min = -6, max = 6) 266s > storage.mode(x) <- "integer" 266s > for (idxs in index_cases) { 266s + validateIndicesTestVector(x, idxs, 266s + ftest = sum2, fsure = sum, 266s + na.rm = FALSE) 266s + validateIndicesTestVector(x, idxs, 266s + ftest = sum2, fsure = sum, 266s + na.rm = TRUE) 266s + } 266s > 266s 266s R version 4.4.3 (2025-02-28) -- "Trophy Case" 266s Copyright (C) 2025 The R Foundation for Statistical Computing 266s Platform: x86_64-pc-linux-gnu 266s 266s R is free software and comes with ABSOLUTELY NO WARRANTY. 266s You are welcome to redistribute it under certain conditions. 266s Type 'license()' or 'licence()' for distribution details. 266s 266s R is a collaborative project with many contributors. 266s Type 'contributors()' for more information and 266s 'citation()' on how to cite R or R packages in publications. 266s 266s Type 'demo()' for some demos, 'help()' for on-line help, or 266s 'help.start()' for an HTML browser interface to help. 266s Type 'q()' to quit R. 266s 266s > library("matrixStats") 266s > 266s > set.seed(1) 266s > x <- rnorm(1e4) 266s > 266s > 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > # Variance estimators 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > sigma2_a <- var(x) 266s > cat(sprintf("var(x) = %g\n", sigma2_a)) 266s var(x) = 1.02487 266s > 266s > sigma2_b <- varDiff(x) 266s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 266s varDiff(x) = 1.01224 266s > 266s > d <- abs(sigma2_b - sigma2_a) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 0.0126268 266s > stopifnot(d < 0.02) 266s > 266s > 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > # Standard deviation estimators 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > sigma_a <- sd(x) 266s > cat(sprintf("sd(x) = %g\n", sigma_a)) 266s sd(x) = 1.01236 266s > 266s > sigma_b <- sdDiff(x) 266s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 266s sdDiff(x) = 1.0061 266s > 266s > d <- abs(sigma_b - sigma_a) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 0.00625567 266s > stopifnot(d < 0.01) 266s > 266s > # Sanity checks 266s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 266s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 266s > 266s > 266s > sigma_a2 <- mad(x) 266s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 266s mad(x) = 0.998376 266s > 266s > sigma_b2 <- madDiff(x) 266s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 266s madDiff(x) = 1.02513 266s > 266s > d <- abs(sigma_b2 - sigma_a2) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 0.0267497 266s > stopifnot(d < 0.05) 266s > 266s > 266s > sigma_a3 <- IQR(x) 266s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 266s IQR(x) = 1.35105 266s > 266s > sigma_b3 <- iqrDiff(x) 266s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 266s iqrDiff(x) = 1.37797 266s > 266s > d <- abs(sigma_b3 - sigma_a3) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 0.0269152 266s > stopifnot(d < 0.05) 266s > 266s > 266s > 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > # Trimmed estimators 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > y <- x 266s > outliers <- sample(length(x), size = 0.1 * length(x)) 266s > y[outliers] <- 100 * y[outliers] 266s > 266s > sigma_ao <- sd(y[-outliers]) 266s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 266s sd(y) = 1.01166 266s > 266s > sigma_bo <- sdDiff(y[-outliers]) 266s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 266s sdDiff(y) = 1.00743 266s > 266s > d <- abs(sigma_b - sigma_a) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 0.00625567 266s > stopifnot(d < 0.01) 266s > 266s > sigma_bot <- sdDiff(y, trim = 0.05) 266s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 266s sdDiff(y, trim = 0.05) = 7.74327 266s > 266s > d <- abs(sigma_bot - sigma_a) 266s > cat(sprintf("Absolute difference = %g\n", d)) 266s Absolute difference = 6.73091 266s > #stopifnot(d < 1e-3) 266s > 266s > sigma_cot <- madDiff(y, trim = 0.05) 266s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 266s madDiff(y, trim = 0.05) = 1.15278 266s > 266s > sigma_dot <- iqrDiff(y, trim = 0.05) 266s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 266s iqrDiff(y, trim = 0.05) = 1.55762 266s > 266s > 266s > fcns <- list( 266s + varDiff = varDiff, 266s + sdDiff = sdDiff, 266s + madDiff = madDiff, 266s + iqrDiff = iqrDiff 266s + ) 266s > 266s > for (name in names(fcns)) { 266s + cat(sprintf("%s()...\n", name)) 266s + fcn <- fcns[[name]] 266s + 266s + for (mode in c("integer", "double")) { 266s + cat("mode: ", mode, "", sep = "") 266s + for (n in 0:3) { 266s + x <- runif(n, min = -5, max = 5) 266s + storage.mode(x) <- mode 266s + str(x) 266s + 266s + y <- fcn(x) 266s + yt <- fcn(x, trim = 0.1) 266s + str(list("non-trimmed" = y, trimmed = yt)) 266s + } # for (mode ...) 266s + } 266s + 266s + cat(sprintf("%s()...DONE\n", name)) 266s + } # for (name ...) 266s varDiff()... 266s mode: integer int(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int -4 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:2] 3 2 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:3] 1 4 -1 266s List of 2 266s $ non-trimmed: num 16 266s $ trimmed : num 16 266s mode: double num(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num -0.794 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:2] 0.897 -3.728 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:3] 2.07 -1.13 1.94 266s List of 2 266s $ non-trimmed: num 9.83 266s $ trimmed : num 9.83 266s varDiff()...DONE 266s sdDiff()... 266s mode: integer int(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int 2 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:2] -4 1 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:3] -2 1 -1 266s List of 2 266s $ non-trimmed: num 2.5 266s $ trimmed : num 2.5 266s mode: double num(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num -3.78 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:2] -2.04 2.38 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:3] 1.42 -2.14 1.14 266s List of 2 266s $ non-trimmed: num 3.42 266s $ trimmed : num 3.42 266s sdDiff()...DONE 266s madDiff()... 266s mode: integer int(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int -1 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:2] -1 4 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int [1:3] -1 0 -3 266s List of 2 266s $ non-trimmed: num 2.1 266s $ trimmed : num 2.1 266s mode: double num(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num -1.13 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:2] -1.7 -1.21 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num [1:3] -2.39 -0.464 3.086 266s List of 2 266s $ non-trimmed: num 0.851 266s $ trimmed : num 0.851 266s madDiff()...DONE 266s iqrDiff()... 266s mode: integer int(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s int 3 266s List of 2 266s $ non-trimmed: num 0 266s $ trimmed : num 0 266s int [1:2] -3 4 266s List of 2 266s $ non-trimmed: num 0 266s $ trimmed : num 0 266s int [1:3] 0 -2 -2 266s List of 2 266s $ non-trimmed: num 0.707 266s $ trimmed : num 0.707 266s mode: double num(0) 266s List of 2 266s $ non-trimmed: num NA 266s $ trimmed : num NA 266s num -4.46 266s List of 2 266s $ non-trimmed: num 0 266s $ trimmed : num 0 266s num [1:2] 3.67 1.02 266s List of 2 266s $ non-trimmed: num 0 266s $ trimmed : num 0 266s num [1:3] -0.537 -2.733 2.857 266s List of 2 266s $ non-trimmed: num 2.75 266s $ trimmed : num 2.75 266s iqrDiff()...DONE 266s > 266s 266s R version 4.4.3 (2025-02-28) -- "Trophy Case" 266s Copyright (C) 2025 The R Foundation for Statistical Computing 266s Platform: x86_64-pc-linux-gnu 266s 266s R is free software and comes with ABSOLUTELY NO WARRANTY. 266s You are welcome to redistribute it under certain conditions. 266s Type 'license()' or 'licence()' for distribution details. 266s 266s R is a collaborative project with many contributors. 266s Type 'contributors()' for more information and 266s 'citation()' on how to cite R or R packages in publications. 266s 266s Type 'demo()' for some demos, 'help()' for on-line help, or 266s 'help.start()' for an HTML browser interface to help. 266s Type 'q()' to quit R. 266s 266s > library("matrixStats") 266s > 266s > fcns <- list( 266s + varDiff = varDiff, 266s + sdDiff = sdDiff, 266s + madDiff = madDiff, 266s + iqrDiff = iqrDiff 266s + ) 266s > 266s > 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > # Subsetted tests 266s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 266s > source("utils/validateIndicesFramework.R") 266s > for (name in names(fcns)) { 266s + cat(sprintf("subsetted tests on %s()...\n", name)) 266s + fcn <- fcns[[name]] 266s + 266s + for (mode in c("numeric", "integer")) { 266s + x <- runif(6, min = -6, max = 6) 266s + storage.mode(x) <- mode 266s + trim <- runif(1, min = 0, max = 0.5) 266s + if (mode == "numeric") x[1] <- Inf 266s + 266s + for (diff in 1:2) { 266s + for (idxs in index_cases) { 266s + validateIndicesTestVector(x, idxs, 266s + ftest = fcn, fsure = fcn, 266s + na.rm = TRUE, diff = diff, trim = trim) 266s + validateIndicesTestVector(x, idxs, 266s + ftest = fcn, fsure = fcn, 266s + na.rm = FALSE, diff = diff, trim = trim) 266s + } 266s + } 266s + } 266s + cat(sprintf("%s()...DONE\n", name)) 266s + } 266s subsetted tests on varDiff()... 266s varDiff()...DONE 266s subsetted tests on sdDiff()... 266s sdDiff()...DONE 266s subsetted tests on madDiff()... 266s madDiff()...DONE 266s subsetted tests on iqrDiff()... 266s iqrDiff()...DONE 266s > 266s 266s R version 4.4.3 (2025-02-28) -- "Trophy Case" 266s Copyright (C) 2025 The R Foundation for Statistical Computing 266s Platform: x86_64-pc-linux-gnu 266s 266s R is free software and comes with ABSOLUTELY NO WARRANTY. 266s You are welcome to redistribute it under certain conditions. 266s Type 'license()' or 'licence()' for distribution details. 266s 266s R is a collaborative project with many contributors. 266s Type 'contributors()' for more information and 266s 'citation()' on how to cite R or R packages in publications. 266s 266s Type 'demo()' for some demos, 'help()' for on-line help, or 266s 'help.start()' for an HTML browser interface to help. 266s Type 'q()' to quit R. 266s 266s > library("matrixStats") 266s > 266s > for (mode in c("logical", "integer", "double")) { 266s + cat("mode: ", mode, "", sep = "") 266s + n <- 2L 266s + x <- runif(n, min = -5, max = 5) 266s + if (mode == "logical") { 266s + x <- x > 0 266s + } 266s + storage.mode(x) <- mode 266s + str(x) 266s + 266s + cat("All weights are 1\n") 266s + w <- rep(1, times = n) 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + 266s + cat("First weight is 5\n") 266s + # Pull the mean towards zero 266s + w[1] <- 5 266s + str(w) 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + 266s + cat("All weights are 0\n") 266s + # All weights set to zero 266s + w <- rep(0, times = n) 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + 266s + cat("First weight is 8.5\n") 266s + # Put even more weight on the zero 266s + w[1] <- 8.5 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + 266s + cat("First weight is Inf\n") 266s + # All weight on the first value 266s + w[1] <- Inf 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + 266s + cat("Last weight is Inf\n") 266s + # All weight on the last value 266s + w[1] <- 1 266s + w[n] <- Inf 266s + m0 <- weighted.mean(x, w) 266s + m1 <- weightedMean(x, w) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(identical(m1, m0)) 266s + } # for (mode ...) 266s mode: logical logi [1:2] FALSE FALSE 266s All weights are 1 266s List of 2 266s $ m0: num 0 266s $ m1: num 0 266s First weight is 5 266s num [1:2] 5 1 266s List of 2 266s $ m0: num 0 266s $ m1: num 0 266s All weights are 0 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s First weight is 8.5 266s List of 2 266s $ m0: num 0 266s $ m1: num 0 266s First weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s Last weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s mode: integer int [1:2] 0 4 266s All weights are 1 266s List of 2 266s $ m0: num 2 266s $ m1: num 2 266s First weight is 5 266s num [1:2] 5 1 266s List of 2 266s $ m0: num 0.667 266s $ m1: num 0.667 266s All weights are 0 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s First weight is 8.5 266s List of 2 266s $ m0: num 0 266s $ m1: num 0 266s First weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s Last weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s mode: double num [1:2] 3.93 4.12 266s All weights are 1 266s List of 2 266s $ m0: num 4.03 266s $ m1: num 4.03 266s First weight is 5 266s num [1:2] 5 1 266s List of 2 266s $ m0: num 3.97 266s $ m1: num 3.97 266s All weights are 0 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s First weight is 8.5 266s List of 2 266s $ m0: num 3.93 266s $ m1: num 3.93 266s First weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s Last weight is Inf 266s List of 2 266s $ m0: num NaN 266s $ m1: num NaN 266s > 266s > 266s > message("*** Testing for missing values") 266s > # NA tests 266s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 266s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 266s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 266s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 266s > ## is because 'x' is dropped and therefore that first element 266s > ## is skipped in the computation. It basically does 266s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 266s > ## without looking at 'w'. 266s > for (x in xs) { 266s + for (mode in c("logical", "integer", "double")) { 266s + storage.mode(x) <- mode 266s + for (w in ws) { 266s + for (na.rm in c(FALSE, TRUE)) { 266s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 266s + str(list(x = x, w = w)) 266s + m0 <- weighted.mean(x, w, na.rm = na.rm) 266s + m1 <- weightedMean(x, w, na.rm = na.rm) 266s + str(list(m0 = m0, m1 = m1)) 266s + stopifnot(all.equal(m1, m0)) 266s + } 266s + } 266s + } 266s + } 266s *** Testing for missing values 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] TRUE TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] 1 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] 1 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: double, na.rm = FALSE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: double, na.rm = TRUE 266s List of 2 266s $ x: num [1:3] NA 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: logical, na.rm = FALSE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: logical, na.rm = TRUE 266s List of 2 266s $ x: logi [1:3] NA TRUE TRUE 266s $ w: num [1:3] 1 NA 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num NA 266s $ m1: num NA 266s mode: integer, na.rm = TRUE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] NA 1 1 266s List of 2 266s $ m0: num 1 266s $ m1: num 1 266s mode: integer, na.rm = FALSE 266s List of 2 266s $ x: int [1:3] NA 1 1 266s $ w: num [1:3] 1 NA 1 266s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s mode: integer, na.rm = TRUE 267s List of 2 267s $ x: int [1:3] NA 1 1 267s $ w: num [1:3] 1 NA 1 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s mode: double, na.rm = FALSE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] 1 1 1 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s mode: double, na.rm = TRUE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] 1 1 1 267s List of 2 267s $ m0: num 1 267s $ m1: num 1 267s mode: double, na.rm = FALSE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] NA 1 1 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s mode: double, na.rm = TRUE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] NA 1 1 267s List of 2 267s $ m0: num 1 267s $ m1: num 1 267s mode: double, na.rm = FALSE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] 1 NA 1 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s mode: double, na.rm = TRUE 267s List of 2 267s $ x: num [1:3] NA 1 1 267s $ w: num [1:3] 1 NA 1 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s > 267s 267s R version 4.4.3 (2025-02-28) -- "Trophy Case" 267s Copyright (C) 2025 The R Foundation for Statistical Computing 267s Platform: x86_64-pc-linux-gnu 267s 267s R is free software and comes with ABSOLUTELY NO WARRANTY. 267s You are welcome to redistribute it under certain conditions. 267s Type 'license()' or 'licence()' for distribution details. 267s 267s R is a collaborative project with many contributors. 267s Type 'contributors()' for more information and 267s 'citation()' on how to cite R or R packages in publications. 267s 267s Type 'demo()' for some demos, 'help()' for on-line help, or 267s 'help.start()' for an HTML browser interface to help. 267s Type 'q()' to quit R. 267s 267s > library("matrixStats") 267s > 267s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 267s > # Subsetted tests 267s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 267s > source("utils/validateIndicesFramework.R") 267s > for (mode in c("numeric", "integer")) { 267s + x <- runif(6, min = -6, max = 6) 267s + w <- runif(6, min = 0, max = 6) 267s + storage.mode(x) <- mode 267s + storage.mode(w) <- mode 267s + if (mode == "numeric") w[1] <- Inf 267s + 267s + for (idxs in index_cases) { 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMean, fsure = weighted.mean, 267s + na.rm = TRUE, refine = TRUE) 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMean, fsure = weighted.mean, 267s + na.rm = FALSE, refine = TRUE) 267s + } 267s + } 267s > 267s 267s R version 4.4.3 (2025-02-28) -- "Trophy Case" 267s Copyright (C) 2025 The R Foundation for Statistical Computing 267s Platform: x86_64-pc-linux-gnu 267s 267s R is free software and comes with ABSOLUTELY NO WARRANTY. 267s You are welcome to redistribute it under certain conditions. 267s Type 'license()' or 'licence()' for distribution details. 267s 267s R is a collaborative project with many contributors. 267s Type 'contributors()' for more information and 267s 'citation()' on how to cite R or R packages in publications. 267s 267s Type 'demo()' for some demos, 'help()' for on-line help, or 267s 'help.start()' for an HTML browser interface to help. 267s Type 'q()' to quit R. 267s 267s > library("matrixStats") 267s > 267s > x <- 1:5 267s > y <- weightedMedian(x) 267s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 267s > print(y) 267s [1] 3 267s > 267s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 267s > print(y) 267s [1] NA 267s > stopifnot(is.na(y)) 267s > 267s > x <- 1:10 267s > n <- length(x) 267s > 267s > y1 <- median(x) # 5.5 267s > y2 <- weightedMedian(x) # 5.5 267s > stopifnot(all.equal(y1, y2)) 267s > 267s > 267s > w <- rep(1, times = n) 267s > y1 <- weightedMedian(x, w) # 5.5 (default) 267s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 267s > y2b <- weightedMedian(x, ties = "min") # 5 267s > y2c <- weightedMedian(x, ties = "max") # 6 267s > stopifnot(all.equal(y2a, y1)) 267s > 267s > y3 <- weightedMedian(x, w) # 5.5 (default) 267s > 267s > 267s > # Pull the median towards zero 267s > w[1] <- 5 267s > y1 <- weightedMedian(x, w) # 3.5 267s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 267s > y2 <- median(y) # 3.5 267s > stopifnot(all.equal(y1, y2)) 267s > 267s > # Put even more weight on the zero 267s > w[1] <- 8.5 267s > y <- weightedMedian(x, w) # 2 267s > 267s > # All weight on the first value 267s > w[1] <- Inf 267s > y <- weightedMedian(x, w) # 1 267s > 267s > # All weight on the last value 267s > w[1] <- 1 267s > w[n] <- Inf 267s > y <- weightedMedian(x, w) # 10 267s > 267s > # All weights set to zero 267s > w <- rep(0, times = n) 267s > y <- weightedMedian(x, w) # NA 267s > 267s > x <- 1:4 267s > w <- rep(1, times = 4) 267s > for (mode in c("integer", "double")) { 267s + storage.mode(x) <- mode 267s + for (ties in c("weighted", "mean", "min", "max")) { 267s + cat(sprintf("ties = %s\n", ties)) 267s + y <- weightedMedian(x, w, ties = ties) 267s + } 267s + } 267s ties = weighted 267s ties = mean 267s ties = min 267s ties = max 267s ties = weighted 267s ties = mean 267s ties = min 267s ties = max 267s > 267s > set.seed(0x42) 267s > 267s > y <- weightedMedian(x = double(0L)) 267s > print(y) 267s [1] NA 267s > stopifnot(length(y) == 1L) 267s > stopifnot(is.na(y)) 267s > 267s > y <- weightedMedian(x = x[1]) 267s > print(y) 267s [1] 1 267s > stopifnot(length(y) == 1L) 267s > stopifnot(all.equal(y, x[1])) 267s > 267s > 267s > n <- 1e3 267s > x <- runif(n) 267s > w <- runif(n, min = 0, max = 1) 267s > for (mode in c("integer", "double")) { 267s + storage.mode(x) <- mode 267s + for (ties in c("weighted", "mean", "min", "max")) { 267s + y <- weightedMedian(x, w, ties = ties) 267s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 267s + } 267s + } 267s mode = integer, ties = weighted, result = 0 267s mode = integer, ties = mean, result = 0 267s mode = integer, ties = min, result = 0 267s mode = integer, ties = max, result = 0 267s mode = double, ties = weighted, result = 0 267s mode = double, ties = mean, result = 0 267s mode = double, ties = min, result = 0 267s mode = double, ties = max, result = 0 267s > 267s > 267s > # A large vector 267s > n <- 1e5 267s > x <- runif(n) 267s > w <- runif(n, min = 0, max = 1) 267s > y <- weightedMedian(x, w) 267s > 267s > y <- weightedMedian(x, w, ties = "min") 267s > 267s > 267s > # Single Number 267s > xs <- c(1, NA_integer_) 267s > ws <- c(1, NA_integer_) 267s > for (x in xs) { 267s + for (w in ws) { 267s + y <- weightedMedian(x = x, w = w) 267s + if (is.na(w)) z <- NA_real_ 267s + else z <- x[1] 267s + stopifnot(all.equal(y, z)) 267s + } 267s + } 267s > 267s > ## Logical 267s > x1 <- c(TRUE, FALSE, TRUE) 267s > w0 <- c(0, 0, 0) 267s > stopifnot(!is.finite(weightedMedian(x1, w0)), 267s + !is.infinite(weightedMedian(x1, w0))) 267s > 267s > w1 <- c(1, 1, 1) 267s > stopifnot(weightedMedian(x1, w1) == 1) 267s > 267s > w2 <- c(1, 2, 3) 267s > stopifnot(weightedMedian(x1, w2) == 1) 267s > 267s > ### NA 267s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 267s + c(1, 2, 3))), 267s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 267s + c(1, 2, 3), 267s + na.rm = TRUE), 267s + weightedMedian(c(TRUE, FALSE), 267s + c(1, 2)))) 267s > ### Identical to as.integer() 267s > x <- rcauchy(100) 267s > w <- abs(rcauchy(100)) 267s > stopifnot(all.equal(weightedMedian(x > 0, w), 267s + weightedMedian(as.integer(x > 0), w))) 267s > 267s > 267s > 267s 267s R version 4.4.3 (2025-02-28) -- "Trophy Case" 267s Copyright (C) 2025 The R Foundation for Statistical Computing 267s Platform: x86_64-pc-linux-gnu 267s 267s R is free software and comes with ABSOLUTELY NO WARRANTY. 267s You are welcome to redistribute it under certain conditions. 267s Type 'license()' or 'licence()' for distribution details. 267s 267s R is a collaborative project with many contributors. 267s Type 'contributors()' for more information and 267s 'citation()' on how to cite R or R packages in publications. 267s 267s Type 'demo()' for some demos, 'help()' for on-line help, or 267s 'help.start()' for an HTML browser interface to help. 267s Type 'q()' to quit R. 267s 267s > library("matrixStats") 267s > 267s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 267s > # Subsetted tests 267s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 267s > source("utils/validateIndicesFramework.R") 267s > for (mode in c("numeric", "integer")) { 267s + x <- runif(6, min = -6, max = 6) 267s + w <- runif(6, min = 0, max = 6) 267s + storage.mode(x) <- mode 267s + storage.mode(w) <- mode 267s + if (mode == "numeric") w[1] <- Inf 267s + 267s + for (idxs in index_cases) { 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMedian, 267s + fsure = weightedMedian, 267s + na.rm = TRUE) 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMedian, 267s + fsure = weightedMedian, 267s + na.rm = FALSE) 267s + 267s + for (ties in c("weighted", "mean", "min", "max")) { 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMedian, 267s + fsure = weightedMedian, 267s + na.rm = TRUE, ties = ties) 267s + validateIndicesTestVector_w(x, w, idxs, 267s + ftest = weightedMedian, 267s + fsure = weightedMedian, 267s + na.rm = FALSE, ties = ties) 267s + } 267s + } 267s + } 267s > 267s 267s R version 4.4.3 (2025-02-28) -- "Trophy Case" 267s Copyright (C) 2025 The R Foundation for Statistical Computing 267s Platform: x86_64-pc-linux-gnu 267s 267s R is free software and comes with ABSOLUTELY NO WARRANTY. 267s You are welcome to redistribute it under certain conditions. 267s Type 'license()' or 'licence()' for distribution details. 267s 267s R is a collaborative project with many contributors. 267s Type 'contributors()' for more information and 267s 'citation()' on how to cite R or R packages in publications. 267s 267s Type 'demo()' for some demos, 'help()' for on-line help, or 267s 'help.start()' for an HTML browser interface to help. 267s Type 'q()' to quit R. 267s 267s > library("matrixStats") 267s > 267s > weightedVar_R <- function(x, w) { 267s + mu <- weighted.mean(x, w = w) 267s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 267s + } 267s > 267s > 267s > n <- 10 267s > x <- as.double(1:n) 267s > 267s > message("*** weightedVar() ...") 267s > 267s > message("- Zero elements") 267s *** weightedVar() ... 267s > m0 <- var(integer(0)) 267s > m1 <- weightedVar(integer(0), w = integer(0)) 267s - Zero elements 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s - One elements 267s $ m0: num NA 267s $ m1: int NA 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > 267s > message("- One elements") 267s > m0 <- var(1) 267s > m1 <- weightedVar(1) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0:- Uniform weights (all w = 1) 267s num NA 267s $ m1: num NA 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > 267s > message("- Uniform weights (all w = 1)") 267s > m0 <- var(x) 267s > w <- rep(1, times = n) 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num 9.17 267s - Uniform weights (all w = 3) 267s $ m1: num 9.17 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > 267s > message("- Uniform weights (all w = 3)") 267s > m0 <- var(rep(x, each = 3)) 267s - Uniform weights on the first five elements 267s > w <- rep(3, times = n) 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num 8.53 267s $ m1: num 8.53 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > 267s > message("- Uniform weights on the first five elements") 267s > idxs <- 1:5 267s > m0 <- var(x[1:5]) 267s > w <- rep(0, times = n) 267s > w[idxs] <- 1 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num 2.5 267s $ m1: num 2.5 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > 267s - Uniform weights on every second elements 267s > message("- Uniform weights on every second elements") 267s > idxs <- seq(from = 1, to = n, by = 2) 267s > m0 <- var(x[idxs]) 267s > w <- rep(0, times = n) 267s > w[idxs] <- 1 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num 10 267s $ m1: num 10 267s > stopifnot(all.equal(m1, m0)) 267s - All weights are zero 267s > 267s > 267s > message("- All weights are zero") 267s > idxs <- integer(0L) 267s > m0 <- var(x[idxs]) 267s > w <- rep(0, times = n) 267s > w[idxs] <- 1 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num NA 267s $ m1: num NA 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > - Infinite weight on first element 267s message("- Infinite weight on first element") 267s > idxs <- 1L 267s > m0 <- var(x[idxs]) 267s > w <- rep(0, times = n) 267s > w[idxs] <- Inf 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num NA 267s $ m1- Missing-value weight on first element 267s : num NA 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > message("- Missing-value weight on first element") 267s > idxs <- 1L 267s > w <- rep(1, times = n) 267s > w[idxs] <- NA_real_ 267s > m1 <- weightedVar(x, w = w) 267s > str(list(m1 = m1)) 267s List of 1 267s $ m1: num NA 267s > stopifnot(identical(m1, NA_real_)) 267s > 267s > 267s > message("- Frequency weights") 267s - Frequency weights 267s > 267s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 267s > y <- c(2, 2, 4, 5, 5, 5) 267s > x <- unique(y) 267s > w <- table(y) 267s > stopifnot(names(w) == x) 267s > 267s > m0 <- weightedVar(x, w = w) 267s > m1 <- var(y) 267s > stopifnot(all.equal(m1, m0)) 267s > m2 <- weightedVar(x, w = w) 267s > str(list(m0 = m0, m1 = m1, m2 = m2)) 267s List of 3 267s $ m0:*** weightedVar() ... DONE 267s num 2.17 267s $ m1: num 2.17 267s $ m2: num 2.17 267s > stopifnot(all.equal(m2, m0)) 267s > 267s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 267s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 267s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 267s > 267s > m0 <- weightedVar(large, w = years) 267s > m1 <- weightedVar(large, w = years) 267s > str(list(m0 = m0, m1 = m1)) 267s List of 2 267s $ m0: num 899 267s $ m1: num 899 267s > stopifnot(all.equal(m1, m0)) 267s > 267s > message("*** weightedVar() ... DONE") 267s > 267s 267s R version 4.4.3 (2025-02-28) -- "Trophy Case" 267s Copyright (C) 2025 The R Foundation for Statistical Computing 267s Platform: x86_64-pc-linux-gnu 267s 267s R is free software and comes with ABSOLUTELY NO WARRANTY. 267s You are welcome to redistribute it under certain conditions. 267s Type 'license()' or 'licence()' for distribution details. 267s 267s R is a collaborative project with many contributors. 267s Type 'contributors()' for more information and 267s 'citation()' on how to cite R or R packages in publications. 267s 267s Type 'demo()' for some demos, 'help()' for on-line help, or 267s 'help.start()' for an HTML browser interface to help. 267s Type 'q()' to quit R. 267s 268s > library("matrixStats") 268s > 268s > fcns <- list( 268s + weightedVar = weightedVar, 268s + weightedSd = weightedSd, 268s + weightedMad = weightedMad 268s + ) 268s > 268s > for (name in names(fcns)) { 268s + cat(sprintf("%s()...\n", name)) 268s + fcn <- fcns[[name]] 268s + 268s + for (mode in c("integer", "double")) { 268s + cat("mode: ", mode, "\n", sep = "") 268s + n <- 15L 268s + x <- runif(n, min = -5, max = 5) 268s + storage.mode(x) <- mode 268s + str(x) 268s + 268s + for (add_na in c(FALSE, TRUE)) { 268s + cat("add_na: ", add_na, "\n", sep = "") 268s + if (add_na) { 268s + x[c(5, 7)] <- NA 268s + } 268s + str(x) 268s + 268s + for (na.rm in c(FALSE, TRUE)) { 268s + cat("na.rm: ", na.rm, "\n", sep = "") 268s + 268s + cat("Weights are not specified (all are 1)\n") 268s + m1 <- fcn(x, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("All weights are 1\n") 268s + w <- rep(1, times = n) 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("First weight is 5\n") 268s + # Pull the mean towards zero 268s + w[1] <- 5 268s + str(w) 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("All weights are 0\n") 268s + # All weights set to zero 268s + w <- rep(0, times = n) 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("First weight is 8.5\n") 268s + # Put even more weight on the zero 268s + w[1] <- 8.5 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("First weight is Inf\n") 268s + # All weight on the first value 268s + w[1] <- Inf 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("Last weight is Inf\n") 268s + # All weight on the last value 268s + w[1] <- 1 268s + w[n] <- Inf 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + 268s + cat("Last weight is NA\n") 268s + # All weight on the last value 268s + w[1] <- 1 268s + w[n] <- NA_real_ 268s + m1 <- fcn(x, w, na.rm = na.rm) 268s + str(list(m1 = m1)) 268s + } # for (na.rm ...) 268s + } # for (add_na ...) 268s + } # for (mode ...) 268s + 268s + cat(sprintf("%s()...DONE\n", name)) 268s + } # for (name ...) 268s weightedVar()... 268s mode: integer 268s int [1:15] 3 0 2 4 -3 0 -1 -4 2 -3 ... 268s add_na: FALSE 268s int [1:15] 3 0 2 4 -3 0 -1 -4 2 -3 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 6.11 268s All weights are 1 268s List of 1 268s $ m1: num 6.11 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 5.94 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int NA 268s First weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 6.11 268s All weights are 1 268s List of 1 268s $ m1: num 6.11 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 5.94 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int NA 268s First weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s add_na: TRUE 268s int [1:15] 3 0 2 4 NA 0 NA -4 2 -3 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: int NA 268s All weights are 1 268s List of 1 268s $ m1: int NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: int NA 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int NA 268s First weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 5.86 268s All weights are 1 268s List of 1 268s $ m1: num 5.86 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 5.35 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int NA 268s First weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is Inf 268s List of 1 268s $ m1: int NA 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s mode: double 268s num [1:15] -1.811 0.546 3.552 4.84 2.676 ... 268s add_na: FALSE 268s num [1:15] -1.811 0.546 3.552 4.84 2.676 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 7.76 268s All weights are 1 268s List of 1 268s $ m1: num 7.76 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 7.41 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 7.76 268s All weights are 1 268s List of 1 268s $ m1: num 7.76 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 7.41 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s add_na: TRUE 268s num [1:15] -1.811 0.546 3.552 4.84 NA ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num NA 268s All weights are 1 268s List of 1 268s $ m1: num NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num NA 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 8.57 268s All weights are 1 268s List of 1 268s $ m1: num 8.57 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 7.68 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s weightedVar()...DONE 268s weightedSd()... 268s mode: integer 268s int [1:15] -1 3 -2 -2 -1 3 4 -3 -3 -4 ... 268s add_na: FALSE 268s int [1:15] -1 3 -2 -2 -1 3 4 -3 -3 -4 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 2.77 268s All weights are 1 268s List of 1 268s $ m1: num 2.77 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.46 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 2.77 268s All weights are 1 268s List of 1 268s $ m1: num 2.77 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.46 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s add_na: TRUE 268s int [1:15] -1 3 -2 -2 NA 3 NA -3 -3 -4 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num NA 268s All weights are 1 268s List of 1 268s $ m1: num NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num NA 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 2.69 268s All weights are 1 268s List of 1 268s $ m1: num 2.69 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.33 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s mode: double 268s num [1:15] 3.2 -3 -4.05 4.84 -3.02 ... 268s add_na: FALSE 268s num [1:15] 3.2 -3 -4.05 4.84 -3.02 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 3.04 268s All weights are 1 268s List of 1 268s $ m1: num 3.04 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.91 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 3.04 268s All weights are 1 268s List of 1 268s $ m1: num 3.04 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.91 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s add_na: TRUE 268s num [1:15] 3.2 -3 -4.05 4.84 NA ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num NA 268s All weights are 1 268s List of 1 268s $ m1: num NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num NA 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 3.02 268s All weights are 1 268s List of 1 268s $ m1: num 3.02 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.79 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num NA 268s First weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is Inf 268s List of 1 268s $ m1: num NA 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s weightedSd()...DONE 268s weightedMad()... 268s mode: integer 268s int [1:15] -2 3 -4 -4 0 0 0 0 4 -3 ... 268s add_na: FALSE 268s int [1:15] -2 3 -4 -4 0 0 0 0 4 -3 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 1.48 268s All weights are 1 268s List of 1 268s $ m1: num 1.48 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 1.48 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int 0 268s First weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 1.48 268s All weights are 1 268s List of 1 268s $ m1: num 1.48 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 1.48 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int 0 268s First weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s add_na: TRUE 268s int [1:15] -2 3 -4 -4 NA 0 NA 0 4 -3 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num NA 268s All weights are 1 268s List of 1 268s $ m1: int NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: int NA 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int 0 268s First weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 1.48 268s All weights are 1 268s List of 1 268s $ m1: num 1.48 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 1.98 268s All weights are 0 268s List of 1 268s $ m1: int NA 268s First weight is 8.5 268s List of 1 268s $ m1: int 0 268s First weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is Inf 268s List of 1 268s $ m1: int 0 268s Last weight is NA 268s List of 1 268s $ m1: int NA 268s mode: double 268s num [1:15] -1.019 -1.441 -3.137 1.213 -0.731 ... 268s add_na: FALSE 268s num [1:15] -1.019 -1.441 -3.137 1.213 -0.731 ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 2.18 268s All weights are 1 268s List of 1 268s $ m1: num 2.18 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 1.53 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num 0 268s First weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 2.18 268s All weights are 1 268s List of 1 268s $ m1: num 2.18 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 1.53 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num 0 268s First weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s add_na: TRUE 268s num [1:15] -1.02 -1.44 -3.14 1.21 NA ... 268s na.rm: FALSE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num NA 268s All weights are 1 268s List of 1 268s $ m1: num NA 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num NA 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num 0 268s First weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s na.rm: TRUE 268s Weights are not specified (all are 1) 268s List of 1 268s $ m1: num 3.01 268s All weights are 1 268s List of 1 268s $ m1: num 3.01 268s First weight is 5 268s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 268s List of 1 268s $ m1: num 2.09 268s All weights are 0 268s List of 1 268s $ m1: num NA 268s First weight is 8.5 268s List of 1 268s $ m1: num 0 268s First weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is Inf 268s List of 1 268s $ m1: num 0 268s Last weight is NA 268s List of 1 268s $ m1: num NA 268s weightedMad()...DONE 268s > 268s 268s R version 4.4.3 (2025-02-28) -- "Trophy Case" 268s Copyright (C) 2025 The R Foundation for Statistical Computing 268s Platform: x86_64-pc-linux-gnu 268s 268s R is free software and comes with ABSOLUTELY NO WARRANTY. 268s You are welcome to redistribute it under certain conditions. 268s Type 'license()' or 'licence()' for distribution details. 268s 268s R is a collaborative project with many contributors. 268s Type 'contributors()' for more information and 268s 'citation()' on how to cite R or R packages in publications. 268s 268s Type 'demo()' for some demos, 'help()' for on-line help, or 268s 'help.start()' for an HTML browser interface to help. 268s Type 'q()' to quit R. 268s 268s > library("matrixStats") 268s > 268s > fcns <- list( 268s + weightedVar = weightedVar, 268s + weightedSd = weightedSd, 268s + weightedMad = weightedMad 268s + ) 268s > 268s > 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > # Subsetted tests 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > source("utils/validateIndicesFramework.R") 268s > for (name in names(fcns)) { 268s + cat(sprintf("subsetted tests on %s()...\n", name)) 268s + fcn <- fcns[[name]] 268s + 268s + for (mode in c("numeric", "integer")) { 268s + x <- runif(6, min = -6, max = 6) 268s + w <- runif(6, min = 0, max = 6) 268s + storage.mode(x) <- mode 268s + storage.mode(w) <- mode 268s + if (mode == "numeric") w[1] <- Inf 268s + 268s + for (idxs in index_cases) { 268s + validateIndicesTestVector_w(x, w, idxs, 268s + ftest = fcn, fsure = fcn, 268s + na.rm = TRUE) 268s + validateIndicesTestVector_w(x, w, idxs, 268s + ftest = fcn, fsure = fcn, 268s + na.rm = FALSE) 268s + } 268s + } 268s + cat(sprintf("%s()...DONE\n", name)) 268s + } 268s subsetted tests on weightedVar()... 268s weightedVar()...DONE 268s subsetted tests on weightedSd()... 268s weightedSd()...DONE 268s subsetted tests on weightedMad()... 268s weightedMad()...DONE 268s > 268s 268s R version 4.4.3 (2025-02-28) -- "Trophy Case" 268s Copyright (C) 2025 The R Foundation for Statistical Computing 268s Platform: x86_64-pc-linux-gnu 268s 268s R is free software and comes with ABSOLUTELY NO WARRANTY. 268s You are welcome to redistribute it under certain conditions. 268s Type 'license()' or 'licence()' for distribution details. 268s 268s R is a collaborative project with many contributors. 268s Type 'contributors()' for more information and 268s 'citation()' on how to cite R or R packages in publications. 268s 268s Type 'demo()' for some demos, 'help()' for on-line help, or 268s 'help.start()' for an HTML browser interface to help. 268s Type 'q()' to quit R. 268s 268s > library("matrixStats") 268s > 268s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 268s + if (na.rm) { 268s + xnok <- is.na(x) 268s + ynok <- is.na(y) 268s + anok <- xnok & ynok 268s + unit <- switch(OP, 268s + "+" = 0, 268s + "-" = NA_real_, 268s + "*" = 1, 268s + "/" = NA_real_, 268s + stop("Unknown 'OP' operator: ", OP) 268s + ) 268s + x[xnok] <- unit 268s + y[ynok] <- unit 268s + } 268s + 268s + ans <- switch(OP, 268s + "+" = x + y, 268s + "-" = x - y, 268s + "*" = x * y, 268s + "/" = x / y, 268s + stop("Unknown 'OP' operator: ", OP) 268s + ) 268s + 268s + if (na.rm) { 268s + ans[anok] <- NA_real_ 268s + } 268s + 268s + ans 268s + } # x_OP_y_R() 268s > 268s > 268s > 268s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 268s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 268s + } 268s > 268s > 268s > 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > # No missing values 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > x <- matrix(1:16, nrow = 4, ncol = 4) 268s > y <- 1:nrow(x) 268s > storage.mode(y) <- storage.mode(x) 268s > 268s > for (OP in c("+", "-", "*", "/")) { 268s + for (na.rm in c(FALSE, TRUE)) { 268s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 268s + 268s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 268s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 268s + str(a1) 268s + stopifnot(all.equal(a1, a0)) 268s + 268s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 268s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 268s + str(b1) 268s + stopifnot(all.equal(b1, b0)) 268s + } 268s + } 268s OP = '+', na.rm = FALSE 268s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 268s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 268s OP = '+', na.rm = TRUE 268s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 268s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 268s OP = '-', na.rm = FALSE 268s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 268s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 268s OP = '-', na.rm = TRUE 268s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 268s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 268s OP = '*', na.rm = FALSE 268s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 268s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 268s OP = '*', na.rm = TRUE 268s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 268s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 268s OP = '/', na.rm = FALSE 268s num [1:4, 1:4] 1 1 1 1 5 ... 268s num [1:4, 1:4] 1 2 3 4 2.5 ... 268s OP = '/', na.rm = TRUE 268s num [1:4, 1:4] 1 1 1 1 5 ... 268s num [1:4, 1:4] 1 2 3 4 2.5 ... 268s > 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > # Missing values in x, y, or both. 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > for (which in c("x", "y", "both")) { 268s + x <- matrix(1:16, nrow = 4, ncol = 4) 268s + y <- 1:nrow(x) 268s + storage.mode(y) <- storage.mode(x) 268s + 268s + if (which == "x") { 268s + x[3:6] <- NA_real_ 268s + } else if (which == "y") { 268s + y[c(1, 3)] <- NA_real_ 268s + } else if (which == "both") { 268s + x[3:6] <- NA_real_ 268s + y[c(1, 3)] <- NA_real_ 268s + } 268s + 268s + for (OP in c("+", "-", "*", "/")) { 268s + for (na.rm in c(FALSE, TRUE)) { 268s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 268s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 268s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 268s + str(a1) 268s + stopifnot(all.equal(a1, a0)) 268s + 268s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 268s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 268s + str(b1) 268s + stopifnot(all.equal(b1, b0)) 268s + } 268s + } 268s + } 268s OP = '+', na.rm = FALSE 268s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 268s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 268s OP = '+', na.rm = TRUE 268s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 268s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 268s OP = '-', na.rm = FALSE 268s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 268s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 268s OP = '-', na.rm = TRUE 268s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 268s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 268s OP = '*', na.rm = FALSE 268s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 268s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 268s OP = '*', na.rm = TRUE 268s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 268s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 268s OP = '/', na.rm = FALSE 268s num [1:4, 1:4] 1 1 NA NA NA ... 268s num [1:4, 1:4] 1 2 NA NA NA ... 268s OP = '/', na.rm = TRUE 268s num [1:4, 1:4] 1 1 NA NA NA ... 268s num [1:4, 1:4] 1 2 NA NA NA ... 268s OP = '+', na.rm = FALSE 268s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 268s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 268s OP = '+', na.rm = TRUE 268s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 268s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 268s OP = '-', na.rm = FALSE 268s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 268s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 268s OP = '-', na.rm = TRUE 268s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 268s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 268s OP = '*', na.rm = FALSE 268s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 268s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 268s OP = '*', na.rm = TRUE 268s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 268s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 268s OP = '/', na.rm = FALSE 268s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 268s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 268s OP = '/', na.rm = TRUE 268s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 268s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 268s OP = '+', na.rm = FALSE 268s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 268s OP = '+', na.rm = TRUE 268s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 268s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 268s OP = '-', na.rm = FALSE 268s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 268s OP = '-', na.rm = TRUE 268s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 268s OP = '*', na.rm = FALSE 268s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 268s OP = '*', na.rm = TRUE 268s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 268s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 268s OP = '/', na.rm = FALSE 268s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 268s OP = '/', na.rm = TRUE 268s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 268s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 268s > 268s > 268s > 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > # Length differences 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > x <- matrix(1:8, nrow = 2, ncol = 4) 268s > y <- 1:ncol(x) 268s > storage.mode(y) <- storage.mode(x) 268s > 268s > for (OP in c("+", "-", "*", "/")) { 268s + for (na.rm in c(FALSE, TRUE)) { 268s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 268s + 268s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 268s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 268s + str(a1) 268s + stopifnot(all.equal(a1, a0)) 268s + 268s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 268s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 268s + str(b1) 268s + stopifnot(all.equal(b1, b0)) 268s + } 268s + } 268s OP = '+', na.rm = FALSE 268s int [1:2, 1:4] 2 4 6 8 6 8 10 12 268s int [1:2, 1:4] 2 3 5 6 8 9 11 12 268s OP = '+', na.rm = TRUE 268s int [1:2, 1:4] 2 4 6 8 6 8 10 12 268s int [1:2, 1:4] 2 3 5 6 8 9 11 12 268s OP = '-', na.rm = FALSE 268s int [1:2, 1:4] 0 0 0 0 4 4 4 4 268s int [1:2, 1:4] 0 1 1 2 2 3 3 4 268s OP = '-', na.rm = TRUE 268s int [1:2, 1:4] 0 0 0 0 4 4 4 4 268s int [1:2, 1:4] 0 1 1 2 2 3 3 4 268s OP = '*', na.rm = FALSE 268s int [1:2, 1:4] 1 4 9 16 5 12 21 32 268s int [1:2, 1:4] 1 2 6 8 15 18 28 32 268s OP = '*', na.rm = TRUE 268s int [1:2, 1:4] 1 4 9 16 5 12 21 32 268s int [1:2, 1:4] 1 2 6 8 15 18 28 32 268s OP = '/', na.rm = FALSE 268s num [1:2, 1:4] 1 1 1 1 5 ... 268s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 268s OP = '/', na.rm = TRUE 268s num [1:2, 1:4] 1 1 1 1 5 ... 268s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 268s > 268s > 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > # All missing values 268s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 268s > xs <- list( 268s + A = matrix(1:2, nrow = 2, ncol = 2), 268s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 268s + ) 268s > ys <- list( 268s + A = 1L, 268s + B = NA_integer_ 268s + ) 268s > 268s > for (x in xs) { 268s + for (y in ys) { 268s + for (mode in c("logical", "integer", "double")) { 268s + storage.mode(x) <- mode 268s + storage.mode(y) <- mode 268s + str(list(x = x, y = y)) 268s + 268s + for (OP in c("+", "-", "*", "/")) { 268s + for (na.rm in c(FALSE, TRUE)) { 268s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 268s + suppressWarnings({ 268s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 268s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 268s + }) 268s + str(z) 268s + stopifnot(all.equal(z, z0)) 268s + } 268s + } 268s + } # for (mode ...) 268s + } # for (y ...) 268s + } # for (x ...) 268s List of 2 268s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 268s $ y: logi TRUE 268s mode = 'logical', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] 2 2 2 2 268s mode = 'logical', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 2 2 2 2 268s mode = 'logical', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] 0 0 0 0 268s mode = 'logical', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] 0 0 0 0 268s mode = 'logical', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s List of 2 268s $ x: int [1:2, 1:2] 1 1 1 1 268s $ y: int 1 268s mode = 'integer', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] 2 2 2 2 268s mode = 'integer', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 2 2 2 2 268s mode = 'integer', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] 0 0 0 0 268s mode = 'integer', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] 0 0 0 0 268s mode = 'integer', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s List of 2 268s $ x: num [1:2, 1:2] 1 1 1 1 268s $ y: num 1 268s mode = 'double', OP = '+', na.rm = FALSE 268s num [1:2, 1:2] 2 2 2 2 268s mode = 'double', OP = '+', na.rm = TRUE 268s num [1:2, 1:2] 2 2 2 2 268s mode = 'double', OP = '-', na.rm = FALSE 268s num [1:2, 1:2] 0 0 0 0 268s mode = 'double', OP = '-', na.rm = TRUE 268s num [1:2, 1:2] 0 0 0 0 268s mode = 'double', OP = '*', na.rm = FALSE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '*', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s List of 2 268s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 268s $ y: logi NA 268s mode = 'logical', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: int [1:2, 1:2] 1 1 1 1 268s $ y: int NA 268s mode = 'integer', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: num [1:2, 1:2] 1 1 1 1 268s $ y: num NA 268s mode = 'double', OP = '+', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '+', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '-', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '-', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: logi [1:2, 1:2] NA NA NA NA 268s $ y: logi TRUE 268s mode = 'logical', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'logical', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: int [1:2, 1:2] NA NA NA NA 268s $ y: int 1 268s mode = 'integer', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] 1 1 1 1 268s mode = 'integer', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: num [1:2, 1:2] NA NA NA NA 268s $ y: num 1 268s mode = 'double', OP = '+', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '+', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '-', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '-', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = TRUE 268s num [1:2, 1:2] 1 1 1 1 268s mode = 'double', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: logi [1:2, 1:2] NA NA NA NA 268s $ y: logi NA 268s mode = 'logical', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'logical', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: int [1:2, 1:2] NA NA NA NA 268s $ y: int NA 268s mode = 'integer', OP = '+', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '+', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '-', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '-', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = FALSE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '*', na.rm = TRUE 268s int [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'integer', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s List of 2 268s $ x: num [1:2, 1:2] NA NA NA NA 268s $ y: num NA 268s mode = 'double', OP = '+', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '+', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '-', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '-', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '*', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '/', na.rm = FALSE 268s num [1:2, 1:2] NA NA NA NA 268s mode = 'double', OP = '/', na.rm = TRUE 268s num [1:2, 1:2] NA NA NA NA 268s > 268s 268s R version 4.4.3 (2025-02-28) -- "Trophy Case" 268s Copyright (C) 2025 The R Foundation for Statistical Computing 268s Platform: x86_64-pc-linux-gnu 268s 268s R is free software and comes with ABSOLUTELY NO WARRANTY. 268s You are welcome to redistribute it under certain conditions. 268s Type 'license()' or 'licence()' for distribution details. 268s 268s R is a collaborative project with many contributors. 268s Type 'contributors()' for more information and 268s 'citation()' on how to cite R or R packages in publications. 268s 268s Type 'demo()' for some demos, 'help()' for on-line help, or 268s 'help.start()' for an HTML browser interface to help. 268s Type 'q()' to quit R. 268s 269s > library("matrixStats") 269s > 269s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 269s + if (na.rm) { 269s + xnok <- is.na(x) 269s + ynok <- is.na(y) 269s + anok <- xnok & ynok 269s + unit <- switch(OP, 269s + "+" = 0, 269s + "-" = NA_real_, 269s + "*" = 1, 269s + "/" = NA_real_, 269s + stop("Unknown 'OP' operator: ", OP) 269s + ) 269s + x[xnok] <- unit 269s + y[ynok] <- unit 269s + } 269s + 269s + ans <- switch(OP, 269s + "+" = x + y, 269s + "-" = x - y, 269s + "*" = x * y, 269s + "/" = x / y, 269s + stop("Unknown 'OP' operator: ", OP) 269s + ) 269s + 269s + if (na.rm) { 269s + ans[anok] <- NA_real_ 269s + } 269s + 269s + ans 269s + } # x_OP_y_R() 269s > 269s > 269s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 269s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 269s + } 269s > 269s > 269s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 269s > # Subsetted tests 269s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 269s > source("utils/validateIndicesFramework.R") 269s > for (OP in c("+", "-", "*", "/")) { 269s + for (mode in c("numeric", "integer", "logical")) { 269s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 269s + y <- runif(6, min = 0, max = 6) 269s + storage.mode(x) <- mode 269s + storage.mode(y) <- mode 269s + if (mode == "numeric") y[1] <- Inf 269s + 269s + for (xrows in index_cases) { 269s + for (xcols in index_cases) { 269s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 269s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 269s + 269s + for (yidxs in list(xrows, xcols)) { 269s + for (na.rm in c(TRUE, FALSE)) { 269s + 269s + suppressWarnings({ 269s + actual <- tryCatch( 269s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 269s + na.rm = na.rm), 269s + error = function(c) "error" 269s + ) 269s + 269s + expect <- tryCatch( 269s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 269s + na.rm = na.rm), 269s + error = function(c) "error" 269s + ) 269s + }) 269s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 269s + 269s + suppressWarnings({ 269s + actual <- tryCatch( 269s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 269s + na.rm = na.rm), 269s + error = function(c) "error" 269s + ) 269s + 269s + expect <- tryCatch( 269s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 269s + na.rm = na.rm), 269s + error = function(c) "error" 269s + ) 269s + }) 269s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 269s + } 269s + } 269s + } 269s + } 269s + } 269s + } 272s > 272s 272s R version 4.4.3 (2025-02-28) -- "Trophy Case" 272s Copyright (C) 2025 The R Foundation for Statistical Computing 272s Platform: x86_64-pc-linux-gnu 272s 272s R is free software and comes with ABSOLUTELY NO WARRANTY. 272s You are welcome to redistribute it under certain conditions. 272s Type 'license()' or 'licence()' for distribution details. 272s 272s R is a collaborative project with many contributors. 272s Type 'contributors()' for more information and 272s 'citation()' on how to cite R or R packages in publications. 272s 272s Type 'demo()' for some demos, 'help()' for on-line help, or 272s 'help.start()' for an HTML browser interface to help. 272s Type 'q()' to quit R. 272s 272s > ## These tests need to be last of all tests, otherwise 272s > ## covr::package_coverage() gives an error. 272s > cat("1. Loading package\n") 272s 1. Loading package 272s > loadNamespace("matrixStats") 272s 272s > stopifnot("matrixStats" %in% loadedNamespaces()) 272s > 272s > cat("2. Unloading package\n") 272s 2. Unloading package 272s > unloadNamespace("matrixStats") 272s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 272s > 272s > if (FALSE) { 272s + ## 'covr' gives "Error in library("matrixStats") : 272s + ## there is no package called 'matrixStats'" here, cf. 272s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 272s + 272s + cat("3. Attaching package\n") 272s + library("matrixStats") 272s + stopifnot("package:matrixStats" %in% search()) 272s + 272s + cat("4. Detaching package\n") 272s + detach("package:matrixStats") 272s + stopifnot(!"package:matrixStats" %in% search()) 272s + stopifnot("matrixStats" %in% loadedNamespaces()) 272s + 272s + cat("5. Unloading package\n") 272s + unloadNamespace("matrixStats") 272s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 272s + 272s + cat("6. Attaching package (again)\n") 272s + library("matrixStats") 272s + stopifnot("package:matrixStats" %in% search()) 272s + 272s + cat("7. Detaching package (again)\n") 272s + detach("package:matrixStats") 272s + stopifnot(!"package:matrixStats" %in% search()) 272s + stopifnot("matrixStats" %in% loadedNamespaces()) 272s + } 272s > 272s > cat("7. DONE\n") 272s 7. DONE 272s > 272s autopkgtest [23:27:03]: test run-unit-test: -----------------------] 273s autopkgtest [23:27:04]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 273s run-unit-test PASS 273s autopkgtest [23:27:04]: test pkg-r-autopkgtest: preparing testbed 332s autopkgtest [23:28:03]: testbed dpkg architecture: amd64 332s autopkgtest [23:28:03]: testbed apt version: 2.9.31ubuntu1 332s autopkgtest [23:28:03]: @@@@@@@@@@@@@@@@@@@@ test bed setup 332s autopkgtest [23:28:03]: testbed release detected to be: plucky 333s autopkgtest [23:28:04]: updating testbed package index (apt update) 333s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 333s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 333s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 333s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 333s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [44.1 kB] 333s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [369 kB] 333s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [14.5 kB] 333s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main i386 Packages [67.4 kB] 333s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 Packages [85.7 kB] 333s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 c-n-f Metadata [1852 B] 333s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/restricted amd64 c-n-f Metadata [116 B] 333s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 Packages [342 kB] 333s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/universe i386 Packages [174 kB] 333s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 c-n-f Metadata [15.3 kB] 333s Get:15 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 Packages [16.1 kB] 333s Get:16 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse i386 Packages [8544 B] 333s Get:17 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 c-n-f Metadata [628 B] 333s Fetched 1265 kB in 0s (4636 kB/s) 334s Reading package lists... 335s Reading package lists... 335s Building dependency tree... 335s Reading state information... 335s Calculating upgrade... 336s Calculating upgrade... 336s The following package was automatically installed and is no longer required: 336s libnl-genl-3-200 336s Use 'sudo apt autoremove' to remove it. 336s The following NEW packages will be installed: 336s bpftool libdebuginfod-common libdebuginfod1t64 linux-headers-6.14.0-10 336s linux-headers-6.14.0-10-generic linux-image-6.14.0-10-generic 336s linux-modules-6.14.0-10-generic linux-modules-extra-6.14.0-10-generic 336s linux-perf linux-tools-6.14.0-10 linux-tools-6.14.0-10-generic pnp.ids 336s The following packages will be upgraded: 336s apparmor apt apt-utils binutils binutils-common binutils-x86-64-linux-gnu 336s cloud-init cloud-init-base curl dosfstools fwupd gir1.2-girepository-2.0 336s gir1.2-glib-2.0 htop hwdata libapparmor1 libapt-pkg7.0 libaudit-common 336s libaudit1 libbinutils libbrotli1 libcap-ng0 libctf-nobfd0 libctf0 336s libcurl3t64-gnutls libcurl4t64 libestr0 libfwupd3 libgirepository-1.0-1 336s libglib2.0-0t64 libglib2.0-data libgprofng0 libjemalloc2 liblz4-1 liblzma5 336s libmm-glib0 libncurses6 libncursesw6 libnl-3-200 libnl-genl-3-200 336s libnl-route-3-200 libpci3 libpython3-stdlib libpython3.13 336s libpython3.13-minimal libpython3.13-stdlib libselinux1 libsframe1 336s libsqlite3-0 libtinfo6 libxml2 linux-firmware linux-generic 336s linux-headers-generic linux-headers-virtual linux-image-generic 336s linux-image-virtual linux-libc-dev linux-tools-common linux-virtual 336s media-types ncurses-base ncurses-bin ncurses-term pci.ids pciutils 336s pinentry-curses python-apt-common python3 python3-apt python3-cffi-backend 336s python3-dbus python3-gi python3-jinja2 python3-lazr.uri python3-markupsafe 336s python3-minimal python3-systemd python3-yaml python3.13 python3.13-gdbm 336s python3.13-minimal rsync rsyslog strace xz-utils 336s 86 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. 336s Need to get 807 MB of archives. 336s After this operation, 326 MB of additional disk space will be used. 336s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-bin amd64 6.5+20250216-2 [194 kB] 336s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-base all 6.5+20250216-2 [25.9 kB] 336s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 ncurses-term all 6.5+20250216-2 [276 kB] 336s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 liblz4-1 amd64 1.10.0-4 [66.4 kB] 336s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 liblzma5 amd64 5.6.4-1 [157 kB] 336s Get:6 http://ftpmaster.internal/ubuntu plucky/main amd64 libapt-pkg7.0 amd64 2.9.33 [1138 kB] 336s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 apt amd64 2.9.33 [1439 kB] 336s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 apt-utils amd64 2.9.33 [222 kB] 336s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-minimal amd64 3.13.2-2 [27.7 kB] 336s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 python3 amd64 3.13.2-2 [24.0 kB] 336s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13 amd64 3.13.2-2 [2341 kB] 336s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 media-types all 13.0.0 [29.9 kB] 336s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 libncurses6 amd64 6.5+20250216-2 [126 kB] 336s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 libncursesw6 amd64 6.5+20250216-2 [165 kB] 336s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libtinfo6 amd64 6.5+20250216-2 [119 kB] 336s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libsqlite3-0 amd64 3.46.1-2 [715 kB] 336s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13 amd64 3.13.2-2 [735 kB] 336s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-minimal amd64 3.13.2-2 [2365 kB] 337s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-minimal amd64 3.13.2-2 [883 kB] 337s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-stdlib amd64 3.13.2-2 [2066 kB] 337s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3-stdlib amd64 3.13.2-2 [10.4 kB] 337s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 rsync amd64 3.4.1+ds1-3 [482 kB] 337s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 libdebuginfod-common all 0.192-4 [15.4 kB] 337s Get:24 http://ftpmaster.internal/ubuntu plucky/main amd64 libaudit-common all 1:4.0.2-2ubuntu2 [6628 B] 337s Get:25 http://ftpmaster.internal/ubuntu plucky/main amd64 libcap-ng0 amd64 0.8.5-4build1 [15.6 kB] 337s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 libaudit1 amd64 1:4.0.2-2ubuntu2 [54.0 kB] 337s Get:27 http://ftpmaster.internal/ubuntu plucky/main amd64 libselinux1 amd64 3.7-3ubuntu3 [87.3 kB] 337s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 gir1.2-girepository-2.0 amd64 1.83.4-1 [25.3 kB] 337s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 gir1.2-glib-2.0 amd64 2.84.0-1 [184 kB] 337s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 libglib2.0-0t64 amd64 2.84.0-1 [1669 kB] 337s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 libgirepository-1.0-1 amd64 1.83.4-1 [89.5 kB] 337s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 libapparmor1 amd64 4.1.0~beta5-0ubuntu8 [55.0 kB] 337s Get:33 http://ftpmaster.internal/ubuntu plucky/main amd64 libestr0 amd64 0.1.11-2 [8340 B] 337s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 libglib2.0-data all 2.84.0-1 [53.0 kB] 337s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 libxml2 amd64 2.12.7+dfsg+really2.9.14-0.2ubuntu5 [772 kB] 337s Get:36 http://ftpmaster.internal/ubuntu plucky/main amd64 python-apt-common all 2.9.9build1 [21.3 kB] 337s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-apt amd64 2.9.9build1 [172 kB] 337s Get:38 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-cffi-backend amd64 1.17.1-2build2 [96.6 kB] 337s Get:39 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-dbus amd64 1.3.2-5build5 [102 kB] 337s Get:40 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-gi amd64 3.50.0-4build1 [252 kB] 337s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-yaml amd64 6.0.2-1build2 [144 kB] 337s Get:42 http://ftpmaster.internal/ubuntu plucky/main amd64 rsyslog amd64 8.2412.0-2ubuntu2 [555 kB] 337s Get:43 http://ftpmaster.internal/ubuntu plucky/main amd64 apparmor amd64 4.1.0~beta5-0ubuntu8 [701 kB] 337s Get:44 http://ftpmaster.internal/ubuntu plucky/main amd64 dosfstools amd64 4.2-1.2 [95.0 kB] 337s Get:45 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-genl-3-200 amd64 3.7.0-1 [12.2 kB] 337s Get:46 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-route-3-200 amd64 3.7.0-1 [191 kB] 337s Get:47 http://ftpmaster.internal/ubuntu plucky/main amd64 libnl-3-200 amd64 3.7.0-1 [64.9 kB] 337s Get:48 http://ftpmaster.internal/ubuntu plucky/main amd64 pci.ids all 0.0~2025.03.09-1 [285 kB] 337s Get:49 http://ftpmaster.internal/ubuntu plucky/main amd64 pciutils amd64 1:3.13.0-2 [110 kB] 337s Get:50 http://ftpmaster.internal/ubuntu plucky/main amd64 libpci3 amd64 1:3.13.0-2 [39.8 kB] 337s Get:51 http://ftpmaster.internal/ubuntu plucky/main amd64 strace amd64 6.13+ds-1ubuntu1 [622 kB] 337s Get:52 http://ftpmaster.internal/ubuntu plucky/main amd64 xz-utils amd64 5.6.4-1 [278 kB] 337s Get:53 http://ftpmaster.internal/ubuntu plucky/main amd64 libgprofng0 amd64 2.44-3ubuntu1 [886 kB] 337s Get:54 http://ftpmaster.internal/ubuntu plucky/main amd64 libctf0 amd64 2.44-3ubuntu1 [96.5 kB] 337s Get:55 http://ftpmaster.internal/ubuntu plucky/main amd64 libctf-nobfd0 amd64 2.44-3ubuntu1 [98.9 kB] 337s Get:56 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils-x86-64-linux-gnu amd64 2.44-3ubuntu1 [1108 kB] 337s Get:57 http://ftpmaster.internal/ubuntu plucky/main amd64 libbinutils amd64 2.44-3ubuntu1 [585 kB] 337s Get:58 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils amd64 2.44-3ubuntu1 [208 kB] 337s Get:59 http://ftpmaster.internal/ubuntu plucky/main amd64 binutils-common amd64 2.44-3ubuntu1 [215 kB] 337s Get:60 http://ftpmaster.internal/ubuntu plucky/main amd64 libsframe1 amd64 2.44-3ubuntu1 [14.8 kB] 337s Get:61 http://ftpmaster.internal/ubuntu plucky/main amd64 hwdata all 0.393-3 [1562 B] 337s Get:62 http://ftpmaster.internal/ubuntu plucky/main amd64 pnp.ids all 0.393-3 [29.5 kB] 337s Get:63 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-common all 6.14.0-10.10 [295 kB] 337s Get:64 http://ftpmaster.internal/ubuntu plucky/main amd64 bpftool amd64 7.6.0+6.14.0-10.10 [1147 kB] 337s Get:65 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-markupsafe amd64 2.1.5-1build4 [13.4 kB] 337s Get:66 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 337s Get:67 http://ftpmaster.internal/ubuntu plucky/main amd64 cloud-init-base all 25.1-0ubuntu3 [616 kB] 337s Get:68 http://ftpmaster.internal/ubuntu plucky/main amd64 libbrotli1 amd64 1.1.0-2build4 [365 kB] 337s Get:69 http://ftpmaster.internal/ubuntu plucky/main amd64 curl amd64 8.12.1-3ubuntu1 [258 kB] 337s Get:70 http://ftpmaster.internal/ubuntu plucky/main amd64 libcurl4t64 amd64 8.12.1-3ubuntu1 [437 kB] 337s Get:71 http://ftpmaster.internal/ubuntu plucky/main amd64 libcurl3t64-gnutls amd64 8.12.1-3ubuntu1 [432 kB] 337s Get:72 http://ftpmaster.internal/ubuntu plucky/main amd64 fwupd amd64 2.0.6-4 [5408 kB] 337s Get:73 http://ftpmaster.internal/ubuntu plucky/main amd64 libfwupd3 amd64 2.0.6-4 [136 kB] 337s Get:74 http://ftpmaster.internal/ubuntu plucky/main amd64 libmm-glib0 amd64 1.23.4-0ubuntu3 [251 kB] 337s Get:75 http://ftpmaster.internal/ubuntu plucky/main amd64 htop amd64 3.4.0-2 [195 kB] 337s Get:76 http://ftpmaster.internal/ubuntu plucky/main amd64 libdebuginfod1t64 amd64 0.192-4 [21.0 kB] 337s Get:77 http://ftpmaster.internal/ubuntu plucky/main amd64 libjemalloc2 amd64 5.3.0-3 [277 kB] 337s Get:78 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-firmware amd64 20250310.git9e1370d3-0ubuntu1 [571 MB] 348s Get:79 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-modules-6.14.0-10-generic amd64 6.14.0-10.10 [41.2 MB] 349s Get:80 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-6.14.0-10-generic amd64 6.14.0-10.10 [15.3 MB] 349s Get:81 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-modules-extra-6.14.0-10-generic amd64 6.14.0-10.10 [120 MB] 350s Get:82 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-generic amd64 6.14.0-10.10 [1730 B] 350s Get:83 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-generic amd64 6.14.0-10.10 [11.1 kB] 350s Get:84 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-virtual amd64 6.14.0-10.10 [1722 B] 350s Get:85 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-image-virtual amd64 6.14.0-10.10 [11.1 kB] 350s Get:86 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-virtual amd64 6.14.0-10.10 [1642 B] 350s Get:87 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-6.14.0-10 all 6.14.0-10.10 [14.2 MB] 350s Get:88 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-6.14.0-10-generic amd64 6.14.0-10.10 [3915 kB] 350s Get:89 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-headers-generic amd64 6.14.0-10.10 [11.0 kB] 350s Get:90 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-libc-dev amd64 6.14.0-10.10 [1723 kB] 350s Get:91 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-perf amd64 6.14.0-10.10 [4122 kB] 350s Get:92 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-6.14.0-10 amd64 6.14.0-10.10 [1394 kB] 350s Get:93 http://ftpmaster.internal/ubuntu plucky/main amd64 linux-tools-6.14.0-10-generic amd64 6.14.0-10.10 [830 B] 350s Get:94 http://ftpmaster.internal/ubuntu plucky/main amd64 pinentry-curses amd64 1.3.1-2ubuntu3 [42.3 kB] 350s Get:95 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-lazr.uri all 1.0.6-6 [13.7 kB] 350s Get:96 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-systemd amd64 235-1build6 [43.9 kB] 350s Get:97 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-gdbm amd64 3.13.2-2 [31.9 kB] 350s Get:98 http://ftpmaster.internal/ubuntu plucky/main amd64 cloud-init all 25.1-0ubuntu3 [2100 B] 351s Preconfiguring packages ... 351s Fetched 807 MB in 14s (55.7 MB/s) 351s (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 ... 109138 files and directories currently installed.) 351s Preparing to unpack .../ncurses-bin_6.5+20250216-2_amd64.deb ... 351s Unpacking ncurses-bin (6.5+20250216-2) over (6.5+20250216-1) ... 351s Setting up ncurses-bin (6.5+20250216-2) ... 351s (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 ... 109138 files and directories currently installed.) 351s Preparing to unpack .../ncurses-base_6.5+20250216-2_all.deb ... 351s Unpacking ncurses-base (6.5+20250216-2) over (6.5+20250216-1) ... 351s Setting up ncurses-base (6.5+20250216-2) ... 351s (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 ... 109138 files and directories currently installed.) 351s Preparing to unpack .../ncurses-term_6.5+20250216-2_all.deb ... 351s Unpacking ncurses-term (6.5+20250216-2) over (6.5+20250216-1) ... 352s Preparing to unpack .../liblz4-1_1.10.0-4_amd64.deb ... 352s Unpacking liblz4-1:amd64 (1.10.0-4) over (1.10.0-3) ... 352s Setting up liblz4-1:amd64 (1.10.0-4) ... 352s (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 ... 109138 files and directories currently installed.) 352s Preparing to unpack .../liblzma5_5.6.4-1_amd64.deb ... 352s Unpacking liblzma5:amd64 (5.6.4-1) over (5.6.3-1) ... 352s Setting up liblzma5:amd64 (5.6.4-1) ... 352s (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 ... 109138 files and directories currently installed.) 352s Preparing to unpack .../libapt-pkg7.0_2.9.33_amd64.deb ... 352s Unpacking libapt-pkg7.0:amd64 (2.9.33) over (2.9.31ubuntu1) ... 352s Setting up libapt-pkg7.0:amd64 (2.9.33) ... 352s (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 ... 109138 files and directories currently installed.) 352s Preparing to unpack .../archives/apt_2.9.33_amd64.deb ... 352s Unpacking apt (2.9.33) over (2.9.31ubuntu1) ... 353s Setting up apt (2.9.33) ... 353s (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 ... 109138 files and directories currently installed.) 353s Preparing to unpack .../apt-utils_2.9.33_amd64.deb ... 353s Unpacking apt-utils (2.9.33) over (2.9.31ubuntu1) ... 353s Preparing to unpack .../python3-minimal_3.13.2-2_amd64.deb ... 353s Unpacking python3-minimal (3.13.2-2) over (3.13.2-1) ... 353s Setting up python3-minimal (3.13.2-2) ... 354s (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 ... 109138 files and directories currently installed.) 354s Preparing to unpack .../0-python3_3.13.2-2_amd64.deb ... 354s Unpacking python3 (3.13.2-2) over (3.13.2-1) ... 354s Preparing to unpack .../1-libpython3.13_3.13.2-2_amd64.deb ... 354s Unpacking libpython3.13:amd64 (3.13.2-2) over (3.13.2-1) ... 354s Preparing to unpack .../2-media-types_13.0.0_all.deb ... 354s Unpacking media-types (13.0.0) over (12.0.0) ... 354s Preparing to unpack .../3-libncurses6_6.5+20250216-2_amd64.deb ... 354s Unpacking libncurses6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 354s Preparing to unpack .../4-libncursesw6_6.5+20250216-2_amd64.deb ... 354s Unpacking libncursesw6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 354s Preparing to unpack .../5-libtinfo6_6.5+20250216-2_amd64.deb ... 354s Unpacking libtinfo6:amd64 (6.5+20250216-2) over (6.5+20250216-1) ... 354s Setting up libtinfo6:amd64 (6.5+20250216-2) ... 354s (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 ... 109138 files and directories currently installed.) 354s Preparing to unpack .../0-libsqlite3-0_3.46.1-2_amd64.deb ... 354s Unpacking libsqlite3-0:amd64 (3.46.1-2) over (3.46.1-1) ... 354s Preparing to unpack .../1-python3.13_3.13.2-2_amd64.deb ... 354s Unpacking python3.13 (3.13.2-2) over (3.13.2-1) ... 354s Preparing to unpack .../2-python3.13-minimal_3.13.2-2_amd64.deb ... 354s Unpacking python3.13-minimal (3.13.2-2) over (3.13.2-1) ... 354s Preparing to unpack .../3-libpython3.13-minimal_3.13.2-2_amd64.deb ... 354s Unpacking libpython3.13-minimal:amd64 (3.13.2-2) over (3.13.2-1) ... 354s Preparing to unpack .../4-libpython3.13-stdlib_3.13.2-2_amd64.deb ... 354s Unpacking libpython3.13-stdlib:amd64 (3.13.2-2) over (3.13.2-1) ... 355s Preparing to unpack .../5-libpython3-stdlib_3.13.2-2_amd64.deb ... 355s Unpacking libpython3-stdlib:amd64 (3.13.2-2) over (3.13.2-1) ... 355s Preparing to unpack .../6-rsync_3.4.1+ds1-3_amd64.deb ... 355s Unpacking rsync (3.4.1+ds1-3) over (3.4.1-0syncable1) ... 355s Selecting previously unselected package libdebuginfod-common. 355s Preparing to unpack .../7-libdebuginfod-common_0.192-4_all.deb ... 355s Unpacking libdebuginfod-common (0.192-4) ... 355s Preparing to unpack .../8-libaudit-common_1%3a4.0.2-2ubuntu2_all.deb ... 355s Unpacking libaudit-common (1:4.0.2-2ubuntu2) over (1:4.0.2-2ubuntu1) ... 355s Setting up libaudit-common (1:4.0.2-2ubuntu2) ... 355s (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 ... 109147 files and directories currently installed.) 355s Preparing to unpack .../libcap-ng0_0.8.5-4build1_amd64.deb ... 355s Unpacking libcap-ng0:amd64 (0.8.5-4build1) over (0.8.5-4) ... 355s Setting up libcap-ng0:amd64 (0.8.5-4build1) ... 355s (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 ... 109147 files and directories currently installed.) 355s Preparing to unpack .../libaudit1_1%3a4.0.2-2ubuntu2_amd64.deb ... 355s Unpacking libaudit1:amd64 (1:4.0.2-2ubuntu2) over (1:4.0.2-2ubuntu1) ... 355s Setting up libaudit1:amd64 (1:4.0.2-2ubuntu2) ... 355s (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 ... 109147 files and directories currently installed.) 355s Preparing to unpack .../libselinux1_3.7-3ubuntu3_amd64.deb ... 355s Unpacking libselinux1:amd64 (3.7-3ubuntu3) over (3.7-3ubuntu2) ... 355s Setting up libselinux1:amd64 (3.7-3ubuntu3) ... 355s (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 ... 109147 files and directories currently installed.) 355s Preparing to unpack .../00-gir1.2-girepository-2.0_1.83.4-1_amd64.deb ... 355s Unpacking gir1.2-girepository-2.0:amd64 (1.83.4-1) over (1.82.0-4) ... 355s Preparing to unpack .../01-gir1.2-glib-2.0_2.84.0-1_amd64.deb ... 355s Unpacking gir1.2-glib-2.0:amd64 (2.84.0-1) over (2.83.5-1) ... 355s Preparing to unpack .../02-libglib2.0-0t64_2.84.0-1_amd64.deb ... 355s Unpacking libglib2.0-0t64:amd64 (2.84.0-1) over (2.83.5-1) ... 355s Preparing to unpack .../03-libgirepository-1.0-1_1.83.4-1_amd64.deb ... 355s Unpacking libgirepository-1.0-1:amd64 (1.83.4-1) over (1.82.0-4) ... 355s Preparing to unpack .../04-libapparmor1_4.1.0~beta5-0ubuntu8_amd64.deb ... 355s Unpacking libapparmor1:amd64 (4.1.0~beta5-0ubuntu8) over (4.1.0~beta5-0ubuntu6) ... 355s Preparing to unpack .../05-libestr0_0.1.11-2_amd64.deb ... 355s Unpacking libestr0:amd64 (0.1.11-2) over (0.1.11-1build1) ... 355s Preparing to unpack .../06-libglib2.0-data_2.84.0-1_all.deb ... 355s Unpacking libglib2.0-data (2.84.0-1) over (2.83.5-1) ... 355s Preparing to unpack .../07-libxml2_2.12.7+dfsg+really2.9.14-0.2ubuntu5_amd64.deb ... 355s Unpacking libxml2:amd64 (2.12.7+dfsg+really2.9.14-0.2ubuntu5) over (2.12.7+dfsg+really2.9.14-0.2ubuntu4) ... 356s Preparing to unpack .../08-python-apt-common_2.9.9build1_all.deb ... 356s Unpacking python-apt-common (2.9.9build1) over (2.9.9) ... 356s Preparing to unpack .../09-python3-apt_2.9.9build1_amd64.deb ... 356s Unpacking python3-apt (2.9.9build1) over (2.9.9) ... 356s Preparing to unpack .../10-python3-cffi-backend_1.17.1-2build2_amd64.deb ... 356s Unpacking python3-cffi-backend:amd64 (1.17.1-2build2) over (1.17.1-2build1) ... 356s Preparing to unpack .../11-python3-dbus_1.3.2-5build5_amd64.deb ... 356s Unpacking python3-dbus (1.3.2-5build5) over (1.3.2-5build4) ... 356s Preparing to unpack .../12-python3-gi_3.50.0-4build1_amd64.deb ... 356s Unpacking python3-gi (3.50.0-4build1) over (3.50.0-4) ... 356s Preparing to unpack .../13-python3-yaml_6.0.2-1build2_amd64.deb ... 356s Unpacking python3-yaml (6.0.2-1build2) over (6.0.2-1build1) ... 356s Preparing to unpack .../14-rsyslog_8.2412.0-2ubuntu2_amd64.deb ... 356s Unpacking rsyslog (8.2412.0-2ubuntu2) over (8.2412.0-2ubuntu1) ... 356s Preparing to unpack .../15-apparmor_4.1.0~beta5-0ubuntu8_amd64.deb ... 357s Unpacking apparmor (4.1.0~beta5-0ubuntu8) over (4.1.0~beta5-0ubuntu6) ... 358s Preparing to unpack .../16-dosfstools_4.2-1.2_amd64.deb ... 358s Unpacking dosfstools (4.2-1.2) over (4.2-1.1build1) ... 358s Preparing to unpack .../17-libnl-genl-3-200_3.7.0-1_amd64.deb ... 358s Unpacking libnl-genl-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 358s Preparing to unpack .../18-libnl-route-3-200_3.7.0-1_amd64.deb ... 358s Unpacking libnl-route-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 358s Preparing to unpack .../19-libnl-3-200_3.7.0-1_amd64.deb ... 358s Unpacking libnl-3-200:amd64 (3.7.0-1) over (3.7.0-0.3build2) ... 358s Preparing to unpack .../20-pci.ids_0.0~2025.03.09-1_all.deb ... 358s Unpacking pci.ids (0.0~2025.03.09-1) over (0.0~2025.02.12-1) ... 358s Preparing to unpack .../21-pciutils_1%3a3.13.0-2_amd64.deb ... 358s Unpacking pciutils (1:3.13.0-2) over (1:3.13.0-1) ... 358s Preparing to unpack .../22-libpci3_1%3a3.13.0-2_amd64.deb ... 358s Unpacking libpci3:amd64 (1:3.13.0-2) over (1:3.13.0-1) ... 358s Preparing to unpack .../23-strace_6.13+ds-1ubuntu1_amd64.deb ... 358s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 358s Preparing to unpack .../24-xz-utils_5.6.4-1_amd64.deb ... 358s Unpacking xz-utils (5.6.4-1) over (5.6.3-1) ... 358s Preparing to unpack .../25-libgprofng0_2.44-3ubuntu1_amd64.deb ... 358s Unpacking libgprofng0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 358s Preparing to unpack .../26-libctf0_2.44-3ubuntu1_amd64.deb ... 358s Unpacking libctf0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 358s Preparing to unpack .../27-libctf-nobfd0_2.44-3ubuntu1_amd64.deb ... 358s Unpacking libctf-nobfd0:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 358s Preparing to unpack .../28-binutils-x86-64-linux-gnu_2.44-3ubuntu1_amd64.deb ... 358s Unpacking binutils-x86-64-linux-gnu (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 358s Preparing to unpack .../29-libbinutils_2.44-3ubuntu1_amd64.deb ... 358s Unpacking libbinutils:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 359s Preparing to unpack .../30-binutils_2.44-3ubuntu1_amd64.deb ... 359s Unpacking binutils (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 359s Preparing to unpack .../31-binutils-common_2.44-3ubuntu1_amd64.deb ... 359s Unpacking binutils-common:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 359s Preparing to unpack .../32-libsframe1_2.44-3ubuntu1_amd64.deb ... 359s Unpacking libsframe1:amd64 (2.44-3ubuntu1) over (2.44-2ubuntu1) ... 359s Preparing to unpack .../33-hwdata_0.393-3_all.deb ... 359s Unpacking hwdata (0.393-3) over (0.393-1) ... 359s Selecting previously unselected package pnp.ids. 359s Preparing to unpack .../34-pnp.ids_0.393-3_all.deb ... 359s Unpacking pnp.ids (0.393-3) ... 359s Preparing to unpack .../35-linux-tools-common_6.14.0-10.10_all.deb ... 359s Unpacking linux-tools-common (6.14.0-10.10) over (6.12.0-16.16) ... 359s Selecting previously unselected package bpftool. 359s Preparing to unpack .../36-bpftool_7.6.0+6.14.0-10.10_amd64.deb ... 359s Unpacking bpftool (7.6.0+6.14.0-10.10) ... 359s Preparing to unpack .../37-python3-markupsafe_2.1.5-1build4_amd64.deb ... 359s Unpacking python3-markupsafe (2.1.5-1build4) over (2.1.5-1build3) ... 359s Preparing to unpack .../38-python3-jinja2_3.1.5-2ubuntu1_all.deb ... 359s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 359s Preparing to unpack .../39-cloud-init-base_25.1-0ubuntu3_all.deb ... 359s Unpacking cloud-init-base (25.1-0ubuntu3) over (25.1-0ubuntu2) ... 360s Preparing to unpack .../40-libbrotli1_1.1.0-2build4_amd64.deb ... 360s Unpacking libbrotli1:amd64 (1.1.0-2build4) over (1.1.0-2build3) ... 360s Preparing to unpack .../41-curl_8.12.1-3ubuntu1_amd64.deb ... 360s Unpacking curl (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 360s Preparing to unpack .../42-libcurl4t64_8.12.1-3ubuntu1_amd64.deb ... 360s Unpacking libcurl4t64:amd64 (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 360s Preparing to unpack .../43-libcurl3t64-gnutls_8.12.1-3ubuntu1_amd64.deb ... 360s Unpacking libcurl3t64-gnutls:amd64 (8.12.1-3ubuntu1) over (8.12.1-2ubuntu1) ... 360s Preparing to unpack .../44-fwupd_2.0.6-4_amd64.deb ... 360s Unpacking fwupd (2.0.6-4) over (2.0.6-3) ... 360s Preparing to unpack .../45-libfwupd3_2.0.6-4_amd64.deb ... 360s Unpacking libfwupd3:amd64 (2.0.6-4) over (2.0.6-3) ... 360s Preparing to unpack .../46-libmm-glib0_1.23.4-0ubuntu3_amd64.deb ... 360s Unpacking libmm-glib0:amd64 (1.23.4-0ubuntu3) over (1.23.4-0ubuntu2) ... 360s Preparing to unpack .../47-htop_3.4.0-2_amd64.deb ... 360s Unpacking htop (3.4.0-2) over (3.3.0-5) ... 360s Selecting previously unselected package libdebuginfod1t64:amd64. 360s Preparing to unpack .../48-libdebuginfod1t64_0.192-4_amd64.deb ... 360s Unpacking libdebuginfod1t64:amd64 (0.192-4) ... 360s Preparing to unpack .../49-libjemalloc2_5.3.0-3_amd64.deb ... 360s Unpacking libjemalloc2:amd64 (5.3.0-3) over (5.3.0-2build1) ... 360s Preparing to unpack .../50-linux-firmware_20250310.git9e1370d3-0ubuntu1_amd64.deb ... 360s Unpacking linux-firmware (20250310.git9e1370d3-0ubuntu1) over (20250204.git0fd450ee-0ubuntu1) ... 364s Selecting previously unselected package linux-modules-6.14.0-10-generic. 364s Preparing to unpack .../51-linux-modules-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 364s Unpacking linux-modules-6.14.0-10-generic (6.14.0-10.10) ... 364s Selecting previously unselected package linux-image-6.14.0-10-generic. 364s Preparing to unpack .../52-linux-image-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 364s Unpacking linux-image-6.14.0-10-generic (6.14.0-10.10) ... 364s Selecting previously unselected package linux-modules-extra-6.14.0-10-generic. 364s Preparing to unpack .../53-linux-modules-extra-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 364s Unpacking linux-modules-extra-6.14.0-10-generic (6.14.0-10.10) ... 365s Preparing to unpack .../54-linux-generic_6.14.0-10.10_amd64.deb ... 365s Unpacking linux-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 365s Preparing to unpack .../55-linux-image-generic_6.14.0-10.10_amd64.deb ... 365s Unpacking linux-image-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 365s Preparing to unpack .../56-linux-virtual_6.14.0-10.10_amd64.deb ... 365s Unpacking linux-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 365s Preparing to unpack .../57-linux-image-virtual_6.14.0-10.10_amd64.deb ... 365s Unpacking linux-image-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 365s Preparing to unpack .../58-linux-headers-virtual_6.14.0-10.10_amd64.deb ... 365s Unpacking linux-headers-virtual (6.14.0-10.10) over (6.12.0-16.16+2) ... 365s Selecting previously unselected package linux-headers-6.14.0-10. 365s Preparing to unpack .../59-linux-headers-6.14.0-10_6.14.0-10.10_all.deb ... 365s Unpacking linux-headers-6.14.0-10 (6.14.0-10.10) ... 368s Selecting previously unselected package linux-headers-6.14.0-10-generic. 368s Preparing to unpack .../60-linux-headers-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 368s Unpacking linux-headers-6.14.0-10-generic (6.14.0-10.10) ... 369s Preparing to unpack .../61-linux-headers-generic_6.14.0-10.10_amd64.deb ... 369s Unpacking linux-headers-generic (6.14.0-10.10) over (6.12.0-16.16+2) ... 369s Preparing to unpack .../62-linux-libc-dev_6.14.0-10.10_amd64.deb ... 369s Unpacking linux-libc-dev:amd64 (6.14.0-10.10) over (6.12.0-16.16) ... 370s Selecting previously unselected package linux-perf. 370s Preparing to unpack .../63-linux-perf_6.14.0-10.10_amd64.deb ... 370s Unpacking linux-perf (6.14.0-10.10) ... 370s Selecting previously unselected package linux-tools-6.14.0-10. 370s Preparing to unpack .../64-linux-tools-6.14.0-10_6.14.0-10.10_amd64.deb ... 370s Unpacking linux-tools-6.14.0-10 (6.14.0-10.10) ... 370s Selecting previously unselected package linux-tools-6.14.0-10-generic. 370s Preparing to unpack .../65-linux-tools-6.14.0-10-generic_6.14.0-10.10_amd64.deb ... 370s Unpacking linux-tools-6.14.0-10-generic (6.14.0-10.10) ... 370s Preparing to unpack .../66-pinentry-curses_1.3.1-2ubuntu3_amd64.deb ... 370s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 370s Preparing to unpack .../67-python3-lazr.uri_1.0.6-6_all.deb ... 370s Unpacking python3-lazr.uri (1.0.6-6) over (1.0.6-5) ... 370s Preparing to unpack .../68-python3-systemd_235-1build6_amd64.deb ... 370s Unpacking python3-systemd (235-1build6) over (235-1build5) ... 370s Preparing to unpack .../69-python3.13-gdbm_3.13.2-2_amd64.deb ... 370s Unpacking python3.13-gdbm (3.13.2-2) over (3.13.2-1) ... 370s Preparing to unpack .../70-cloud-init_25.1-0ubuntu3_all.deb ... 370s Unpacking cloud-init (25.1-0ubuntu3) over (25.1-0ubuntu2) ... 370s Setting up linux-headers-6.14.0-10 (6.14.0-10.10) ... 370s Setting up media-types (13.0.0) ... 370s Installing new version of config file /etc/mime.types ... 370s Setting up linux-headers-6.14.0-10-generic (6.14.0-10.10) ... 370s Setting up libapparmor1:amd64 (4.1.0~beta5-0ubuntu8) ... 370s Setting up pci.ids (0.0~2025.03.09-1) ... 370s Setting up apt-utils (2.9.33) ... 370s Setting up libdebuginfod-common (0.192-4) ... 370s Setting up linux-firmware (20250310.git9e1370d3-0ubuntu1) ... 370s Setting up bpftool (7.6.0+6.14.0-10.10) ... 370s Setting up libestr0:amd64 (0.1.11-2) ... 370s Setting up libbrotli1:amd64 (1.1.0-2build4) ... 370s Setting up libsqlite3-0:amd64 (3.46.1-2) ... 370s Setting up dosfstools (4.2-1.2) ... 370s Setting up rsyslog (8.2412.0-2ubuntu2) ... 371s info: The user `syslog' is already a member of `adm'. 372s Setting up binutils-common:amd64 (2.44-3ubuntu1) ... 372s Setting up libcurl3t64-gnutls:amd64 (8.12.1-3ubuntu1) ... 372s Setting up linux-libc-dev:amd64 (6.14.0-10.10) ... 372s Setting up libctf-nobfd0:amd64 (2.44-3ubuntu1) ... 372s Setting up linux-headers-generic (6.14.0-10.10) ... 372s Setting up libjemalloc2:amd64 (5.3.0-3) ... 372s Setting up libsframe1:amd64 (2.44-3ubuntu1) ... 372s Setting up libpython3.13-minimal:amd64 (3.13.2-2) ... 372s Setting up apparmor (4.1.0~beta5-0ubuntu8) ... 372s Installing new version of config file /etc/apparmor.d/openvpn ... 373s Reloading AppArmor profiles 374s Setting up libglib2.0-0t64:amd64 (2.84.0-1) ... 374s No schema files found: doing nothing. 374s Setting up libglib2.0-data (2.84.0-1) ... 374s Setting up libncurses6:amd64 (6.5+20250216-2) ... 374s Setting up strace (6.13+ds-1ubuntu1) ... 374s Setting up xz-utils (5.6.4-1) ... 374s Setting up gir1.2-glib-2.0:amd64 (2.84.0-1) ... 374s Setting up linux-modules-6.14.0-10-generic (6.14.0-10.10) ... 376s Setting up libncursesw6:amd64 (6.5+20250216-2) ... 376s Setting up libpci3:amd64 (1:3.13.0-2) ... 376s Setting up python-apt-common (2.9.9build1) ... 376s Setting up libmm-glib0:amd64 (1.23.4-0ubuntu3) ... 376s Setting up pnp.ids (0.393-3) ... 376s Setting up libnl-3-200:amd64 (3.7.0-1) ... 376s Setting up python3.13-minimal (3.13.2-2) ... 377s Setting up libgirepository-1.0-1:amd64 (1.83.4-1) ... 377s Setting up libbinutils:amd64 (2.44-3ubuntu1) ... 377s Setting up libpython3.13-stdlib:amd64 (3.13.2-2) ... 377s Setting up libxml2:amd64 (2.12.7+dfsg+really2.9.14-0.2ubuntu5) ... 377s Setting up rsync (3.4.1+ds1-3) ... 378s rsync.service is a disabled or a static unit not running, not starting it. 378s Setting up python3.13-gdbm (3.13.2-2) ... 378s Setting up libpython3-stdlib:amd64 (3.13.2-2) ... 378s Setting up ncurses-term (6.5+20250216-2) ... 378s Setting up libctf0:amd64 (2.44-3ubuntu1) ... 378s Setting up libpython3.13:amd64 (3.13.2-2) ... 378s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 378s Setting up libdebuginfod1t64:amd64 (0.192-4) ... 378s Setting up linux-headers-virtual (6.14.0-10.10) ... 378s Setting up libcurl4t64:amd64 (8.12.1-3ubuntu1) ... 378s Setting up python3.13 (3.13.2-2) ... 379s Setting up htop (3.4.0-2) ... 379s Setting up linux-image-6.14.0-10-generic (6.14.0-10.10) ... 381s I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.12.0-16-generic 381s I: /boot/initrd.img.old is now a symlink to initrd.img-6.12.0-16-generic 381s I: /boot/vmlinuz is now a symlink to vmlinuz-6.14.0-10-generic 381s I: /boot/initrd.img is now a symlink to initrd.img-6.14.0-10-generic 381s Setting up libfwupd3:amd64 (2.0.6-4) ... 381s Setting up python3 (3.13.2-2) ... 381s Setting up python3-markupsafe (2.1.5-1build4) ... 381s Setting up linux-modules-extra-6.14.0-10-generic (6.14.0-10.10) ... 383s Setting up libnl-route-3-200:amd64 (3.7.0-1) ... 383s Setting up hwdata (0.393-3) ... 383s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 384s Setting up libgprofng0:amd64 (2.44-3ubuntu1) ... 384s Setting up linux-perf (6.14.0-10.10) ... 384s Setting up gir1.2-girepository-2.0:amd64 (1.83.4-1) ... 384s Setting up python3-gi (3.50.0-4build1) ... 384s Setting up pciutils (1:3.13.0-2) ... 384s Setting up libnl-genl-3-200:amd64 (3.7.0-1) ... 384s Setting up curl (8.12.1-3ubuntu1) ... 384s Setting up linux-image-virtual (6.14.0-10.10) ... 384s Setting up linux-tools-common (6.14.0-10.10) ... 384s Setting up fwupd (2.0.6-4) ... 384s fwupd-refresh.service is a disabled or a static unit not running, not starting it. 384s fwupd.service is a disabled or a static unit not running, not starting it. 384s Setting up python3-systemd (235-1build6) ... 384s Setting up python3-cffi-backend:amd64 (1.17.1-2build2) ... 384s Setting up binutils-x86-64-linux-gnu (2.44-3ubuntu1) ... 384s Setting up linux-image-generic (6.14.0-10.10) ... 384s Setting up python3-dbus (1.3.2-5build5) ... 385s Setting up linux-tools-6.14.0-10 (6.14.0-10.10) ... 385s Setting up linux-generic (6.14.0-10.10) ... 385s Setting up python3-apt (2.9.9build1) ... 385s Setting up python3-yaml (6.0.2-1build2) ... 385s Setting up python3-lazr.uri (1.0.6-6) ... 385s Setting up binutils (2.44-3ubuntu1) ... 385s Setting up cloud-init-base (25.1-0ubuntu3) ... 386s Setting up linux-virtual (6.14.0-10.10) ... 386s Setting up linux-tools-6.14.0-10-generic (6.14.0-10.10) ... 386s Setting up cloud-init (25.1-0ubuntu3) ... 386s Processing triggers for systemd (257.3-1ubuntu3) ... 387s Processing triggers for man-db (2.13.0-1) ... 388s Processing triggers for dbus (1.16.2-1ubuntu1) ... 388s Processing triggers for libc-bin (2.41-1ubuntu1) ... 388s Processing triggers for initramfs-tools (0.146ubuntu1) ... 388s update-initramfs: Generating /boot/initrd.img-6.12.0-16-generic 388s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 399s Processing triggers for linux-image-6.14.0-10-generic (6.14.0-10.10) ... 399s /etc/kernel/postinst.d/initramfs-tools: 399s update-initramfs: Generating /boot/initrd.img-6.14.0-10-generic 399s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 410s /etc/kernel/postinst.d/zz-update-grub: 410s Sourcing file `/etc/default/grub' 410s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 410s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 410s Generating grub configuration file ... 410s Found linux image: /boot/vmlinuz-6.14.0-10-generic 410s Found initrd image: /boot/initrd.img-6.14.0-10-generic 410s Found linux image: /boot/vmlinuz-6.12.0-16-generic 410s Found initrd image: /boot/initrd.img-6.12.0-16-generic 410s Found linux image: /boot/vmlinuz-6.11.0-8-generic 410s Found initrd image: /boot/initrd.img-6.11.0-8-generic 411s Warning: os-prober will not be executed to detect other bootable partitions. 411s Systems on them will not be added to the GRUB boot configuration. 411s Check GRUB_DISABLE_OS_PROBER documentation entry. 411s Adding boot menu entry for UEFI Firmware Settings ... 411s done 412s Reading package lists... 412s Building dependency tree... 412s Reading state information... 413s Solving dependencies... 413s The following packages will be REMOVED: 413s libnl-genl-3-200* libnsl2* libpython3.12-minimal* libpython3.12-stdlib* 413s libpython3.12t64* linux-headers-6.11.0-8* linux-headers-6.11.0-8-generic* 413s linux-headers-6.12.0-16* linux-headers-6.12.0-16-generic* 413s linux-image-6.11.0-8-generic* linux-image-6.12.0-16-generic* 413s linux-modules-6.11.0-8-generic* linux-modules-6.12.0-16-generic* 413s linux-modules-extra-6.12.0-16-generic* linux-tools-6.11.0-8* 413s linux-tools-6.11.0-8-generic* linux-tools-6.12.0-16* 413s linux-tools-6.12.0-16-generic* 413s 0 upgraded, 0 newly installed, 18 to remove and 5 not upgraded. 413s After this operation, 545 MB disk space will be freed. 413s (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 ... 148643 files and directories currently installed.) 413s Removing libnl-genl-3-200:amd64 (3.7.0-1) ... 413s Removing linux-tools-6.11.0-8-generic (6.11.0-8.8) ... 413s Removing linux-tools-6.11.0-8 (6.11.0-8.8) ... 413s Removing libpython3.12t64:amd64 (3.12.9-1) ... 413s Removing libpython3.12-stdlib:amd64 (3.12.9-1) ... 414s Removing libnsl2:amd64 (1.3.0-3build3) ... 414s Removing libpython3.12-minimal:amd64 (3.12.9-1) ... 414s Removing linux-headers-6.11.0-8-generic (6.11.0-8.8) ... 414s Removing linux-headers-6.11.0-8 (6.11.0-8.8) ... 416s Removing linux-headers-6.12.0-16-generic (6.12.0-16.16) ... 417s Removing linux-headers-6.12.0-16 (6.12.0-16.16) ... 419s Removing linux-image-6.11.0-8-generic (6.11.0-8.8) ... 419s /etc/kernel/postrm.d/initramfs-tools: 419s update-initramfs: Deleting /boot/initrd.img-6.11.0-8-generic 419s /etc/kernel/postrm.d/zz-update-grub: 419s Sourcing file `/etc/default/grub' 419s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 419s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 419s Generating grub configuration file ... 420s Found linux image: /boot/vmlinuz-6.14.0-10-generic 420s Found initrd image: /boot/initrd.img-6.14.0-10-generic 420s Found linux image: /boot/vmlinuz-6.12.0-16-generic 420s Found initrd image: /boot/initrd.img-6.12.0-16-generic 420s Warning: os-prober will not be executed to detect other bootable partitions. 420s Systems on them will not be added to the GRUB boot configuration. 420s Check GRUB_DISABLE_OS_PROBER documentation entry. 420s Adding boot menu entry for UEFI Firmware Settings ... 420s done 420s Removing linux-image-6.12.0-16-generic (6.12.0-16.16) ... 420s W: Removing the running kernel 420s I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.14.0-10-generic 420s I: /boot/initrd.img.old is now a symlink to initrd.img-6.14.0-10-generic 420s /etc/kernel/postrm.d/initramfs-tools: 420s update-initramfs: Deleting /boot/initrd.img-6.12.0-16-generic 420s /etc/kernel/postrm.d/zz-update-grub: 420s Sourcing file `/etc/default/grub' 420s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 420s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 420s Generating grub configuration file ... 420s Found linux image: /boot/vmlinuz-6.14.0-10-generic 420s Found initrd image: /boot/initrd.img-6.14.0-10-generic 421s Warning: os-prober will not be executed to detect other bootable partitions. 421s Systems on them will not be added to the GRUB boot configuration. 421s Check GRUB_DISABLE_OS_PROBER documentation entry. 421s Adding boot menu entry for UEFI Firmware Settings ... 421s done 421s Removing linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 421s Removing linux-modules-extra-6.12.0-16-generic (6.12.0-16.16) ... 422s Removing linux-modules-6.12.0-16-generic (6.12.0-16.16) ... 422s Removing linux-tools-6.12.0-16-generic (6.12.0-16.16) ... 423s Removing linux-tools-6.12.0-16 (6.12.0-16.16) ... 423s Processing triggers for libc-bin (2.41-1ubuntu1) ... 423s (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 ... 76972 files and directories currently installed.) 423s Purging configuration files for linux-image-6.11.0-8-generic (6.11.0-8.8) ... 423s Purging configuration files for libpython3.12-minimal:amd64 (3.12.9-1) ... 423s Purging configuration files for linux-modules-extra-6.12.0-16-generic (6.12.0-16.16) ... 423s Purging configuration files for linux-modules-6.12.0-16-generic (6.12.0-16.16) ... 423s dpkg: warning: while removing linux-modules-6.12.0-16-generic, directory '/lib/modules/6.12.0-16-generic' not empty so not removed 423s Purging configuration files for linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 423s Purging configuration files for linux-image-6.12.0-16-generic (6.12.0-16.16) ... 423s rmdir: failed to remove '/lib/modules/6.12.0-16-generic': Directory not empty 423s autopkgtest [23:29:34]: upgrading testbed (apt dist-upgrade and autopurge) 423s Reading package lists... 423s Building dependency tree... 423s Reading state information... 424s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 424s Starting 2 pkgProblemResolver with broken count: 0 424s Done 424s Entering ResolveByKeep 425s 425s Calculating upgrade... 425s The following packages will be upgraded: 425s libc-bin libc-dev-bin libc6 libc6-dev locales 425s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 425s Need to get 10.5 MB of archives. 425s After this operation, 1024 B of additional disk space will be used. 425s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc6-dev amd64 2.41-1ubuntu2 [2183 kB] 425s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc-dev-bin amd64 2.41-1ubuntu2 [24.7 kB] 425s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc6 amd64 2.41-1ubuntu2 [3327 kB] 425s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libc-bin amd64 2.41-1ubuntu2 [700 kB] 425s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 locales all 2.41-1ubuntu2 [4246 kB] 426s Preconfiguring packages ... 426s Fetched 10.5 MB in 0s (29.6 MB/s) 426s (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 ... 76968 files and directories currently installed.) 426s Preparing to unpack .../libc6-dev_2.41-1ubuntu2_amd64.deb ... 426s Unpacking libc6-dev:amd64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 426s Preparing to unpack .../libc-dev-bin_2.41-1ubuntu2_amd64.deb ... 426s Unpacking libc-dev-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 426s Preparing to unpack .../libc6_2.41-1ubuntu2_amd64.deb ... 426s Unpacking libc6:amd64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 426s Setting up libc6:amd64 (2.41-1ubuntu2) ... 427s (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 ... 76968 files and directories currently installed.) 427s Preparing to unpack .../libc-bin_2.41-1ubuntu2_amd64.deb ... 427s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 427s Setting up libc-bin (2.41-1ubuntu2) ... 427s (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 ... 76968 files and directories currently installed.) 427s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 427s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 427s Setting up locales (2.41-1ubuntu2) ... 428s Generating locales (this might take a while)... 429s en_US.UTF-8... done 429s Generation complete. 429s Setting up libc-dev-bin (2.41-1ubuntu2) ... 429s Setting up libc6-dev:amd64 (2.41-1ubuntu2) ... 429s Processing triggers for man-db (2.13.0-1) ... 430s Processing triggers for systemd (257.3-1ubuntu3) ... 431s Reading package lists... 431s Building dependency tree... 431s Reading state information... 431s Starting pkgProblemResolver with broken count: 0 431s Starting 2 pkgProblemResolver with broken count: 0 431s Done 432s Solving dependencies... 432s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 432s autopkgtest [23:29:43]: rebooting testbed after setup commands that affected boot 436s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 448s Reading package lists... 449s Building dependency tree... 449s Reading state information... 449s Starting pkgProblemResolver with broken count: 0 449s Starting 2 pkgProblemResolver with broken count: 0 449s Done 450s The following NEW packages will be installed: 450s build-essential cpp cpp-14 cpp-14-x86-64-linux-gnu cpp-x86-64-linux-gnu 450s dctrl-tools fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 450s fonts-glyphicons-halflings fonts-mathjax g++ g++-14 g++-14-x86-64-linux-gnu 450s g++-x86-64-linux-gnu gcc gcc-14 gcc-14-x86-64-linux-gnu gcc-x86-64-linux-gnu 450s gfortran gfortran-14 gfortran-14-x86-64-linux-gnu gfortran-x86-64-linux-gnu 450s icu-devtools libasan8 libblas-dev libblas3 libbz2-dev libcairo2 libcc1-0 450s libdatrie1 libdeflate-dev libdeflate0 libfontconfig1 libgcc-14-dev 450s libgfortran-14-dev libgfortran5 libgomp1 libgraphite2-3 libharfbuzz0b 450s libhwasan0 libice6 libicu-dev libisl23 libitm1 libjbig0 libjpeg-dev 450s libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjs-bootstrap 450s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 450s liblapack-dev liblapack3 liblerc4 liblsan0 liblzma-dev libmpc3 450s libncurses-dev libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 450s libpaper-utils libpaper2 libpcre2-16-0 libpcre2-32-0 libpcre2-dev 450s libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev libquadmath0 450s libreadline-dev libsharpyuv0 libsm6 libstdc++-14-dev libtcl8.6 libthai-data 450s libthai0 libtiff6 libtirpc-dev libtk8.6 libtsan2 libubsan1 libwebp7 450s libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 450s node-normalize.css pkg-r-autopkgtest pkgconf pkgconf-bin r-base-core 450s r-base-dev r-cran-base64enc r-cran-cli r-cran-colorspace r-cran-commonmark 450s r-cran-evaluate r-cran-fansi r-cran-farver r-cran-ggplot2 r-cran-glue 450s r-cran-gtable r-cran-highr r-cran-isoband r-cran-knitr r-cran-labeling 450s r-cran-lattice r-cran-lifecycle r-cran-magrittr r-cran-markdown r-cran-mass 450s r-cran-matrix r-cran-matrixstats r-cran-mgcv r-cran-munsell r-cran-nlme 450s r-cran-pillar r-cran-pkgconfig r-cran-r6 r-cran-rcolorbrewer r-cran-rlang 450s r-cran-scales r-cran-tibble r-cran-utf8 r-cran-vctrs r-cran-viridislite 450s r-cran-withr r-cran-xfun r-cran-yaml unzip x11-common xdg-utils zip 450s zlib1g-dev 450s 0 upgraded, 144 newly installed, 0 to remove and 0 not upgraded. 450s Need to get 186 MB of archives. 450s After this operation, 554 MB of additional disk space will be used. 450s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 libisl23 amd64 0.27-1 [685 kB] 450s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 libmpc3 amd64 1.3.1-1build2 [55.3 kB] 450s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14-x86-64-linux-gnu amd64 14.2.0-17ubuntu3 [11.9 MB] 450s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14 amd64 14.2.0-17ubuntu3 [1030 B] 450s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-x86-64-linux-gnu amd64 4:14.2.0-1ubuntu1 [5586 B] 450s Get:6 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp amd64 4:14.2.0-1ubuntu1 [22.4 kB] 450s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 libcc1-0 amd64 15-20250222-0ubuntu1 [47.0 kB] 450s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 libgomp1 amd64 15-20250222-0ubuntu1 [148 kB] 450s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 libitm1 amd64 15-20250222-0ubuntu1 [28.6 kB] 450s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 libasan8 amd64 15-20250222-0ubuntu1 [3055 kB] 450s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 liblsan0 amd64 15-20250222-0ubuntu1 [1355 kB] 450s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 libtsan2 amd64 15-20250222-0ubuntu1 [2756 kB] 450s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 libubsan1 amd64 15-20250222-0ubuntu1 [1205 kB] 450s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 libhwasan0 amd64 15-20250222-0ubuntu1 [1677 kB] 450s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libquadmath0 amd64 15-20250222-0ubuntu1 [152 kB] 450s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libgcc-14-dev amd64 14.2.0-17ubuntu3 [2816 kB] 450s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14-x86-64-linux-gnu amd64 14.2.0-17ubuntu3 [23.3 MB] 450s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14 amd64 14.2.0-17ubuntu3 [536 kB] 450s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-x86-64-linux-gnu amd64 4:14.2.0-1ubuntu1 [1208 B] 450s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc amd64 4:14.2.0-1ubuntu1 [5004 B] 450s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 libstdc++-14-dev amd64 14.2.0-17ubuntu3 [2486 kB] 450s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14-x86-64-linux-gnu amd64 14.2.0-17ubuntu3 [13.4 MB] 450s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14 amd64 14.2.0-17ubuntu3 [21.8 kB] 450s Get:24 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-x86-64-linux-gnu amd64 4:14.2.0-1ubuntu1 [968 B] 450s Get:25 http://ftpmaster.internal/ubuntu plucky/main amd64 g++ amd64 4:14.2.0-1ubuntu1 [1100 B] 450s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 build-essential amd64 12.10ubuntu1 [4928 B] 450s Get:27 http://ftpmaster.internal/ubuntu plucky/main amd64 dctrl-tools amd64 2.24-3build3 [106 kB] 450s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-dejavu-mono all 2.37-8 [502 kB] 450s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-dejavu-core all 2.37-8 [835 kB] 450s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 fontconfig-config amd64 2.15.0-2ubuntu1 [37.4 kB] 450s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 libfontconfig1 amd64 2.15.0-2ubuntu1 [164 kB] 450s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 fontconfig amd64 2.15.0-2ubuntu1 [180 kB] 450s Get:33 http://ftpmaster.internal/ubuntu plucky/universe amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-3 [118 kB] 450s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 450s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 libgfortran5 amd64 15-20250222-0ubuntu1 [919 kB] 450s Get:36 http://ftpmaster.internal/ubuntu plucky/main amd64 libgfortran-14-dev amd64 14.2.0-17ubuntu3 [966 kB] 450s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 gfortran-14-x86-64-linux-gnu amd64 14.2.0-17ubuntu3 [12.6 MB] 451s Get:38 http://ftpmaster.internal/ubuntu plucky/main amd64 gfortran-14 amd64 14.2.0-17ubuntu3 [13.6 kB] 451s Get:39 http://ftpmaster.internal/ubuntu plucky/main amd64 gfortran-x86-64-linux-gnu amd64 4:14.2.0-1ubuntu1 [1022 B] 451s Get:40 http://ftpmaster.internal/ubuntu plucky/main amd64 gfortran amd64 4:14.2.0-1ubuntu1 [1174 B] 451s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 icu-devtools amd64 76.1-1ubuntu2 [237 kB] 451s Get:42 http://ftpmaster.internal/ubuntu plucky/main amd64 libblas3 amd64 3.12.1-2 [359 kB] 451s Get:43 http://ftpmaster.internal/ubuntu plucky/main amd64 libblas-dev amd64 3.12.1-2 [338 kB] 451s Get:44 http://ftpmaster.internal/ubuntu plucky/main amd64 libbz2-dev amd64 1.0.8-6 [33.8 kB] 451s Get:45 http://ftpmaster.internal/ubuntu plucky/main amd64 libpixman-1-0 amd64 0.44.0-3 [427 kB] 451s Get:46 http://ftpmaster.internal/ubuntu plucky/main amd64 libxcb-render0 amd64 1.17.0-2 [16.2 kB] 451s Get:47 http://ftpmaster.internal/ubuntu plucky/main amd64 libxcb-shm0 amd64 1.17.0-2 [5758 B] 451s Get:48 http://ftpmaster.internal/ubuntu plucky/main amd64 libxrender1 amd64 1:0.9.10-1.1build1 [19.0 kB] 451s Get:49 http://ftpmaster.internal/ubuntu plucky/main amd64 libcairo2 amd64 1.18.2-2 [569 kB] 451s Get:50 http://ftpmaster.internal/ubuntu plucky/main amd64 libdatrie1 amd64 0.2.13-3build1 [19.0 kB] 451s Get:51 http://ftpmaster.internal/ubuntu plucky/main amd64 libdeflate0 amd64 1.23-1 [64.1 kB] 451s Get:52 http://ftpmaster.internal/ubuntu plucky/main amd64 libdeflate-dev amd64 1.23-1 [71.7 kB] 451s Get:53 http://ftpmaster.internal/ubuntu plucky/main amd64 libgraphite2-3 amd64 1.3.14-2ubuntu1 [73.1 kB] 451s Get:54 http://ftpmaster.internal/ubuntu plucky/main amd64 libharfbuzz0b amd64 10.2.0-1 [543 kB] 451s Get:55 http://ftpmaster.internal/ubuntu plucky/main amd64 x11-common all 1:7.7+23ubuntu3 [21.7 kB] 451s Get:56 http://ftpmaster.internal/ubuntu plucky/main amd64 libice6 amd64 2:1.1.1-1 [44.1 kB] 451s Get:57 http://ftpmaster.internal/ubuntu plucky/main amd64 libicu-dev amd64 76.1-1ubuntu2 [12.6 MB] 451s Get:58 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg-turbo8 amd64 2.1.5-3ubuntu2 [179 kB] 451s Get:59 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg-turbo8-dev amd64 2.1.5-3ubuntu2 [324 kB] 451s Get:60 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg8 amd64 8c-2ubuntu11 [2148 B] 451s Get:61 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg8-dev amd64 8c-2ubuntu11 [1484 B] 451s Get:62 http://ftpmaster.internal/ubuntu plucky/main amd64 libjpeg-dev amd64 8c-2ubuntu11 [1482 B] 451s Get:63 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-bootstrap all 3.4.1+dfsg-3 [129 kB] 451s Get:64 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-highlight.js all 9.18.5+dfsg1-2 [385 kB] 451s Get:65 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 451s Get:66 http://ftpmaster.internal/ubuntu plucky/universe amd64 libjs-jquery-datatables all 1.11.5+dfsg-2 [146 kB] 451s Get:67 http://ftpmaster.internal/ubuntu plucky/main amd64 liblapack3 amd64 3.12.1-2 [3179 kB] 451s Get:68 http://ftpmaster.internal/ubuntu plucky/main amd64 liblapack-dev amd64 3.12.1-2 [6489 kB] 451s Get:69 http://ftpmaster.internal/ubuntu plucky/main amd64 liblerc4 amd64 4.0.0+ds-5ubuntu1 [271 kB] 451s Get:70 http://ftpmaster.internal/ubuntu plucky/main amd64 libncurses-dev amd64 6.5+20250216-2 [424 kB] 451s Get:71 http://ftpmaster.internal/ubuntu plucky/main amd64 libthai-data all 0.1.29-2build1 [158 kB] 451s Get:72 http://ftpmaster.internal/ubuntu plucky/main amd64 libthai0 amd64 0.1.29-2build1 [18.9 kB] 451s Get:73 http://ftpmaster.internal/ubuntu plucky/main amd64 libpango-1.0-0 amd64 1.56.2-1 [255 kB] 451s Get:74 http://ftpmaster.internal/ubuntu plucky/main amd64 libpangoft2-1.0-0 amd64 1.56.2-1 [52.6 kB] 451s Get:75 http://ftpmaster.internal/ubuntu plucky/main amd64 libpangocairo-1.0-0 amd64 1.56.2-1 [29.1 kB] 451s Get:76 http://ftpmaster.internal/ubuntu plucky/main amd64 libpaper2 amd64 2.2.5-0.3 [17.4 kB] 451s Get:77 http://ftpmaster.internal/ubuntu plucky/main amd64 libpaper-utils amd64 2.2.5-0.3 [15.5 kB] 451s Get:78 http://ftpmaster.internal/ubuntu plucky/main amd64 libpcre2-16-0 amd64 10.45-1 [268 kB] 451s Get:79 http://ftpmaster.internal/ubuntu plucky/main amd64 libpcre2-32-0 amd64 10.45-1 [251 kB] 451s Get:80 http://ftpmaster.internal/ubuntu plucky/main amd64 libpcre2-posix3 amd64 10.45-1 [7204 B] 451s Get:81 http://ftpmaster.internal/ubuntu plucky/main amd64 libpcre2-dev amd64 10.45-1 [908 kB] 451s Get:82 http://ftpmaster.internal/ubuntu plucky/main amd64 libpkgconf3 amd64 1.8.1-4 [32.3 kB] 451s Get:83 http://ftpmaster.internal/ubuntu plucky/main amd64 zlib1g-dev amd64 1:1.3.dfsg+really1.3.1-1ubuntu1 [895 kB] 451s Get:84 http://ftpmaster.internal/ubuntu plucky/main amd64 libpng-dev amd64 1.6.47-1 [298 kB] 451s Get:85 http://ftpmaster.internal/ubuntu plucky/main amd64 libreadline-dev amd64 8.2-6 [184 kB] 451s Get:86 http://ftpmaster.internal/ubuntu plucky/main amd64 libsharpyuv0 amd64 1.5.0-0.1 [25.9 kB] 451s Get:87 http://ftpmaster.internal/ubuntu plucky/main amd64 libsm6 amd64 2:1.2.4-1 [17.4 kB] 451s Get:88 http://ftpmaster.internal/ubuntu plucky/main amd64 libtcl8.6 amd64 8.6.16+dfsg-1 [1086 kB] 451s Get:89 http://ftpmaster.internal/ubuntu plucky/main amd64 libjbig0 amd64 2.1-6.1ubuntu2 [29.7 kB] 451s Get:90 http://ftpmaster.internal/ubuntu plucky/main amd64 libwebp7 amd64 1.5.0-0.1 [378 kB] 451s Get:91 http://ftpmaster.internal/ubuntu plucky/main amd64 libtiff6 amd64 4.5.1+git230720-4ubuntu4 [200 kB] 451s Get:92 http://ftpmaster.internal/ubuntu plucky/main amd64 libxft2 amd64 2.3.6-1build1 [45.3 kB] 451s Get:93 http://ftpmaster.internal/ubuntu plucky/main amd64 libxss1 amd64 1:1.2.3-1build3 [7204 B] 451s Get:94 http://ftpmaster.internal/ubuntu plucky/main amd64 libtk8.6 amd64 8.6.16-1 [868 kB] 451s Get:95 http://ftpmaster.internal/ubuntu plucky/main amd64 libxt6t64 amd64 1:1.2.1-1.2build1 [171 kB] 451s Get:96 http://ftpmaster.internal/ubuntu plucky/universe amd64 node-normalize.css all 8.0.1-5 [10.8 kB] 451s Get:97 http://ftpmaster.internal/ubuntu plucky/main amd64 zip amd64 3.0-14ubuntu2 [185 kB] 451s Get:98 http://ftpmaster.internal/ubuntu plucky/main amd64 unzip amd64 6.0-28ubuntu6 [181 kB] 451s Get:99 http://ftpmaster.internal/ubuntu plucky/main amd64 xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 451s Get:100 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-base-core amd64 4.4.3-1 [28.9 MB] 452s Get:101 http://ftpmaster.internal/ubuntu plucky/main amd64 liblzma-dev amd64 5.6.4-1 [189 kB] 452s Get:102 http://ftpmaster.internal/ubuntu plucky/main amd64 pkgconf-bin amd64 1.8.1-4 [21.6 kB] 452s Get:103 http://ftpmaster.internal/ubuntu plucky/main amd64 pkgconf amd64 1.8.1-4 [16.8 kB] 452s Get:104 http://ftpmaster.internal/ubuntu plucky/main amd64 libtirpc-dev amd64 1.3.4+ds-1.3 [193 kB] 452s Get:105 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-base-dev all 4.4.3-1 [4176 B] 452s Get:106 http://ftpmaster.internal/ubuntu plucky/universe amd64 pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 452s Get:107 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-base64enc amd64 0.1-3-3 [27.6 kB] 452s Get:108 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-cli amd64 3.6.4-1 [1394 kB] 452s Get:109 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-colorspace amd64 2.1-1+dfsg-1 [1563 kB] 452s Get:110 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-commonmark amd64 1.9.2-2 [137 kB] 452s Get:111 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-evaluate all 1.0.3-1 [114 kB] 452s Get:112 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-fansi amd64 1.0.5-1 [619 kB] 452s Get:113 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-farver amd64 2.1.2-1 [1355 kB] 452s Get:114 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-glue amd64 1.8.0-1 [164 kB] 452s Get:115 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-rlang amd64 1.1.5-1 [1719 kB] 452s Get:116 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-lifecycle all 1.0.4+dfsg-1 [110 kB] 452s Get:117 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 452s Get:118 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-isoband amd64 0.2.7-1 [1481 kB] 452s Get:119 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-mass amd64 7.3-64-1 [1114 kB] 452s Get:120 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-lattice amd64 0.22-6-1 [1340 kB] 452s Get:121 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-nlme amd64 3.1.167-1 [2320 kB] 452s Get:122 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-matrix amd64 1.7-3-1 [4349 kB] 452s Get:123 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-mgcv amd64 1.9-1-1 [3252 kB] 452s Get:124 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-labeling all 0.4.3-1 [62.1 kB] 452s Get:125 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-munsell all 0.5.1-1 [213 kB] 452s Get:126 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-r6 all 2.6.1-1 [101 kB] 452s Get:127 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-rcolorbrewer all 1.1-3-1build1 [55.4 kB] 452s Get:128 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-viridislite all 0.4.2-2 [1088 kB] 452s Get:129 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-scales all 1.3.0-1 [603 kB] 452s Get:130 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-magrittr amd64 2.0.3-1 [154 kB] 452s Get:131 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-utf8 amd64 1.2.4-1 [140 kB] 452s Get:132 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-vctrs amd64 0.6.5-1 [1335 kB] 452s Get:133 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-pillar all 1.10.1+dfsg-1 [453 kB] 452s Get:134 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-pkgconfig all 2.0.3-2build1 [19.7 kB] 452s Get:135 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-tibble amd64 3.2.1+dfsg-3 [419 kB] 452s Get:136 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 452s Get:137 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-ggplot2 all 3.5.1+dfsg-1 [3940 kB] 452s Get:138 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-xfun amd64 0.51+dfsg-1 [574 kB] 452s Get:139 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 452s Get:140 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-yaml amd64 2.3.10-1 [109 kB] 452s Get:141 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 452s Get:142 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-knitr all 1.49+dfsg-1 [859 kB] 452s Get:143 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-markdown all 1.13-1 [162 kB] 452s Get:144 http://ftpmaster.internal/ubuntu plucky/universe amd64 r-cran-matrixstats amd64 1.5.0-1 [542 kB] 453s Preconfiguring packages ... 453s Fetched 186 MB in 2s (76.6 MB/s) 453s Selecting previously unselected package libisl23:amd64. 453s (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 ... 76968 files and directories currently installed.) 453s Preparing to unpack .../000-libisl23_0.27-1_amd64.deb ... 453s Unpacking libisl23:amd64 (0.27-1) ... 453s Selecting previously unselected package libmpc3:amd64. 453s Preparing to unpack .../001-libmpc3_1.3.1-1build2_amd64.deb ... 453s Unpacking libmpc3:amd64 (1.3.1-1build2) ... 453s Selecting previously unselected package cpp-14-x86-64-linux-gnu. 453s Preparing to unpack .../002-cpp-14-x86-64-linux-gnu_14.2.0-17ubuntu3_amd64.deb ... 453s Unpacking cpp-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 453s Selecting previously unselected package cpp-14. 453s Preparing to unpack .../003-cpp-14_14.2.0-17ubuntu3_amd64.deb ... 453s Unpacking cpp-14 (14.2.0-17ubuntu3) ... 453s Selecting previously unselected package cpp-x86-64-linux-gnu. 453s Preparing to unpack .../004-cpp-x86-64-linux-gnu_4%3a14.2.0-1ubuntu1_amd64.deb ... 453s Unpacking cpp-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 453s Selecting previously unselected package cpp. 453s Preparing to unpack .../005-cpp_4%3a14.2.0-1ubuntu1_amd64.deb ... 453s Unpacking cpp (4:14.2.0-1ubuntu1) ... 453s Selecting previously unselected package libcc1-0:amd64. 453s Preparing to unpack .../006-libcc1-0_15-20250222-0ubuntu1_amd64.deb ... 453s Unpacking libcc1-0:amd64 (15-20250222-0ubuntu1) ... 453s Selecting previously unselected package libgomp1:amd64. 453s Preparing to unpack .../007-libgomp1_15-20250222-0ubuntu1_amd64.deb ... 453s Unpacking libgomp1:amd64 (15-20250222-0ubuntu1) ... 453s Selecting previously unselected package libitm1:amd64. 453s Preparing to unpack .../008-libitm1_15-20250222-0ubuntu1_amd64.deb ... 453s Unpacking libitm1:amd64 (15-20250222-0ubuntu1) ... 453s Selecting previously unselected package libasan8:amd64. 453s Preparing to unpack .../009-libasan8_15-20250222-0ubuntu1_amd64.deb ... 453s Unpacking libasan8:amd64 (15-20250222-0ubuntu1) ... 453s Selecting previously unselected package liblsan0:amd64. 454s Preparing to unpack .../010-liblsan0_15-20250222-0ubuntu1_amd64.deb ... 454s Unpacking liblsan0:amd64 (15-20250222-0ubuntu1) ... 454s Selecting previously unselected package libtsan2:amd64. 454s Preparing to unpack .../011-libtsan2_15-20250222-0ubuntu1_amd64.deb ... 454s Unpacking libtsan2:amd64 (15-20250222-0ubuntu1) ... 454s Selecting previously unselected package libubsan1:amd64. 454s Preparing to unpack .../012-libubsan1_15-20250222-0ubuntu1_amd64.deb ... 454s Unpacking libubsan1:amd64 (15-20250222-0ubuntu1) ... 454s Selecting previously unselected package libhwasan0:amd64. 454s Preparing to unpack .../013-libhwasan0_15-20250222-0ubuntu1_amd64.deb ... 454s Unpacking libhwasan0:amd64 (15-20250222-0ubuntu1) ... 454s Selecting previously unselected package libquadmath0:amd64. 454s Preparing to unpack .../014-libquadmath0_15-20250222-0ubuntu1_amd64.deb ... 454s Unpacking libquadmath0:amd64 (15-20250222-0ubuntu1) ... 454s Selecting previously unselected package libgcc-14-dev:amd64. 454s Preparing to unpack .../015-libgcc-14-dev_14.2.0-17ubuntu3_amd64.deb ... 454s Unpacking libgcc-14-dev:amd64 (14.2.0-17ubuntu3) ... 454s Selecting previously unselected package gcc-14-x86-64-linux-gnu. 454s Preparing to unpack .../016-gcc-14-x86-64-linux-gnu_14.2.0-17ubuntu3_amd64.deb ... 454s Unpacking gcc-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 454s Selecting previously unselected package gcc-14. 454s Preparing to unpack .../017-gcc-14_14.2.0-17ubuntu3_amd64.deb ... 454s Unpacking gcc-14 (14.2.0-17ubuntu3) ... 454s Selecting previously unselected package gcc-x86-64-linux-gnu. 454s Preparing to unpack .../018-gcc-x86-64-linux-gnu_4%3a14.2.0-1ubuntu1_amd64.deb ... 454s Unpacking gcc-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 454s Selecting previously unselected package gcc. 454s Preparing to unpack .../019-gcc_4%3a14.2.0-1ubuntu1_amd64.deb ... 454s Unpacking gcc (4:14.2.0-1ubuntu1) ... 454s Selecting previously unselected package libstdc++-14-dev:amd64. 454s Preparing to unpack .../020-libstdc++-14-dev_14.2.0-17ubuntu3_amd64.deb ... 454s Unpacking libstdc++-14-dev:amd64 (14.2.0-17ubuntu3) ... 455s Selecting previously unselected package g++-14-x86-64-linux-gnu. 455s Preparing to unpack .../021-g++-14-x86-64-linux-gnu_14.2.0-17ubuntu3_amd64.deb ... 455s Unpacking g++-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 455s Selecting previously unselected package g++-14. 455s Preparing to unpack .../022-g++-14_14.2.0-17ubuntu3_amd64.deb ... 455s Unpacking g++-14 (14.2.0-17ubuntu3) ... 455s Selecting previously unselected package g++-x86-64-linux-gnu. 455s Preparing to unpack .../023-g++-x86-64-linux-gnu_4%3a14.2.0-1ubuntu1_amd64.deb ... 455s Unpacking g++-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 455s Selecting previously unselected package g++. 455s Preparing to unpack .../024-g++_4%3a14.2.0-1ubuntu1_amd64.deb ... 455s Unpacking g++ (4:14.2.0-1ubuntu1) ... 455s Selecting previously unselected package build-essential. 455s Preparing to unpack .../025-build-essential_12.10ubuntu1_amd64.deb ... 455s Unpacking build-essential (12.10ubuntu1) ... 455s Selecting previously unselected package dctrl-tools. 455s Preparing to unpack .../026-dctrl-tools_2.24-3build3_amd64.deb ... 455s Unpacking dctrl-tools (2.24-3build3) ... 455s Selecting previously unselected package fonts-dejavu-mono. 455s Preparing to unpack .../027-fonts-dejavu-mono_2.37-8_all.deb ... 455s Unpacking fonts-dejavu-mono (2.37-8) ... 455s Selecting previously unselected package fonts-dejavu-core. 455s Preparing to unpack .../028-fonts-dejavu-core_2.37-8_all.deb ... 455s Unpacking fonts-dejavu-core (2.37-8) ... 455s Selecting previously unselected package fontconfig-config. 455s Preparing to unpack .../029-fontconfig-config_2.15.0-2ubuntu1_amd64.deb ... 455s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 455s Selecting previously unselected package libfontconfig1:amd64. 455s Preparing to unpack .../030-libfontconfig1_2.15.0-2ubuntu1_amd64.deb ... 455s Unpacking libfontconfig1:amd64 (2.15.0-2ubuntu1) ... 455s Selecting previously unselected package fontconfig. 455s Preparing to unpack .../031-fontconfig_2.15.0-2ubuntu1_amd64.deb ... 455s Unpacking fontconfig (2.15.0-2ubuntu1) ... 455s Selecting previously unselected package fonts-glyphicons-halflings. 455s Preparing to unpack .../032-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-3_all.deb ... 455s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 455s Selecting previously unselected package fonts-mathjax. 455s Preparing to unpack .../033-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 455s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 455s Selecting previously unselected package libgfortran5:amd64. 455s Preparing to unpack .../034-libgfortran5_15-20250222-0ubuntu1_amd64.deb ... 455s Unpacking libgfortran5:amd64 (15-20250222-0ubuntu1) ... 455s Selecting previously unselected package libgfortran-14-dev:amd64. 455s Preparing to unpack .../035-libgfortran-14-dev_14.2.0-17ubuntu3_amd64.deb ... 455s Unpacking libgfortran-14-dev:amd64 (14.2.0-17ubuntu3) ... 456s Selecting previously unselected package gfortran-14-x86-64-linux-gnu. 456s Preparing to unpack .../036-gfortran-14-x86-64-linux-gnu_14.2.0-17ubuntu3_amd64.deb ... 456s Unpacking gfortran-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 456s Selecting previously unselected package gfortran-14. 456s Preparing to unpack .../037-gfortran-14_14.2.0-17ubuntu3_amd64.deb ... 456s Unpacking gfortran-14 (14.2.0-17ubuntu3) ... 456s Selecting previously unselected package gfortran-x86-64-linux-gnu. 456s Preparing to unpack .../038-gfortran-x86-64-linux-gnu_4%3a14.2.0-1ubuntu1_amd64.deb ... 456s Unpacking gfortran-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 456s Selecting previously unselected package gfortran. 456s Preparing to unpack .../039-gfortran_4%3a14.2.0-1ubuntu1_amd64.deb ... 456s Unpacking gfortran (4:14.2.0-1ubuntu1) ... 456s Selecting previously unselected package icu-devtools. 456s Preparing to unpack .../040-icu-devtools_76.1-1ubuntu2_amd64.deb ... 456s Unpacking icu-devtools (76.1-1ubuntu2) ... 456s Selecting previously unselected package libblas3:amd64. 456s Preparing to unpack .../041-libblas3_3.12.1-2_amd64.deb ... 456s Unpacking libblas3:amd64 (3.12.1-2) ... 456s Selecting previously unselected package libblas-dev:amd64. 456s Preparing to unpack .../042-libblas-dev_3.12.1-2_amd64.deb ... 456s Unpacking libblas-dev:amd64 (3.12.1-2) ... 456s Selecting previously unselected package libbz2-dev:amd64. 456s Preparing to unpack .../043-libbz2-dev_1.0.8-6_amd64.deb ... 456s Unpacking libbz2-dev:amd64 (1.0.8-6) ... 456s Selecting previously unselected package libpixman-1-0:amd64. 456s Preparing to unpack .../044-libpixman-1-0_0.44.0-3_amd64.deb ... 456s Unpacking libpixman-1-0:amd64 (0.44.0-3) ... 456s Selecting previously unselected package libxcb-render0:amd64. 456s Preparing to unpack .../045-libxcb-render0_1.17.0-2_amd64.deb ... 456s Unpacking libxcb-render0:amd64 (1.17.0-2) ... 456s Selecting previously unselected package libxcb-shm0:amd64. 456s Preparing to unpack .../046-libxcb-shm0_1.17.0-2_amd64.deb ... 456s Unpacking libxcb-shm0:amd64 (1.17.0-2) ... 456s Selecting previously unselected package libxrender1:amd64. 456s Preparing to unpack .../047-libxrender1_1%3a0.9.10-1.1build1_amd64.deb ... 456s Unpacking libxrender1:amd64 (1:0.9.10-1.1build1) ... 456s Selecting previously unselected package libcairo2:amd64. 456s Preparing to unpack .../048-libcairo2_1.18.2-2_amd64.deb ... 456s Unpacking libcairo2:amd64 (1.18.2-2) ... 456s Selecting previously unselected package libdatrie1:amd64. 456s Preparing to unpack .../049-libdatrie1_0.2.13-3build1_amd64.deb ... 456s Unpacking libdatrie1:amd64 (0.2.13-3build1) ... 456s Selecting previously unselected package libdeflate0:amd64. 456s Preparing to unpack .../050-libdeflate0_1.23-1_amd64.deb ... 456s Unpacking libdeflate0:amd64 (1.23-1) ... 456s Selecting previously unselected package libdeflate-dev:amd64. 456s Preparing to unpack .../051-libdeflate-dev_1.23-1_amd64.deb ... 456s Unpacking libdeflate-dev:amd64 (1.23-1) ... 456s Selecting previously unselected package libgraphite2-3:amd64. 456s Preparing to unpack .../052-libgraphite2-3_1.3.14-2ubuntu1_amd64.deb ... 456s Unpacking libgraphite2-3:amd64 (1.3.14-2ubuntu1) ... 456s Selecting previously unselected package libharfbuzz0b:amd64. 456s Preparing to unpack .../053-libharfbuzz0b_10.2.0-1_amd64.deb ... 456s Unpacking libharfbuzz0b:amd64 (10.2.0-1) ... 456s Selecting previously unselected package x11-common. 456s Preparing to unpack .../054-x11-common_1%3a7.7+23ubuntu3_all.deb ... 456s Unpacking x11-common (1:7.7+23ubuntu3) ... 456s Selecting previously unselected package libice6:amd64. 456s Preparing to unpack .../055-libice6_2%3a1.1.1-1_amd64.deb ... 456s Unpacking libice6:amd64 (2:1.1.1-1) ... 456s Selecting previously unselected package libicu-dev:amd64. 456s Preparing to unpack .../056-libicu-dev_76.1-1ubuntu2_amd64.deb ... 456s Unpacking libicu-dev:amd64 (76.1-1ubuntu2) ... 457s Selecting previously unselected package libjpeg-turbo8:amd64. 457s Preparing to unpack .../057-libjpeg-turbo8_2.1.5-3ubuntu2_amd64.deb ... 457s Unpacking libjpeg-turbo8:amd64 (2.1.5-3ubuntu2) ... 457s Selecting previously unselected package libjpeg-turbo8-dev:amd64. 457s Preparing to unpack .../058-libjpeg-turbo8-dev_2.1.5-3ubuntu2_amd64.deb ... 457s Unpacking libjpeg-turbo8-dev:amd64 (2.1.5-3ubuntu2) ... 457s Selecting previously unselected package libjpeg8:amd64. 457s Preparing to unpack .../059-libjpeg8_8c-2ubuntu11_amd64.deb ... 457s Unpacking libjpeg8:amd64 (8c-2ubuntu11) ... 457s Selecting previously unselected package libjpeg8-dev:amd64. 457s Preparing to unpack .../060-libjpeg8-dev_8c-2ubuntu11_amd64.deb ... 457s Unpacking libjpeg8-dev:amd64 (8c-2ubuntu11) ... 457s Selecting previously unselected package libjpeg-dev:amd64. 457s Preparing to unpack .../061-libjpeg-dev_8c-2ubuntu11_amd64.deb ... 457s Unpacking libjpeg-dev:amd64 (8c-2ubuntu11) ... 457s Selecting previously unselected package libjs-bootstrap. 457s Preparing to unpack .../062-libjs-bootstrap_3.4.1+dfsg-3_all.deb ... 457s Unpacking libjs-bootstrap (3.4.1+dfsg-3) ... 457s Selecting previously unselected package libjs-highlight.js. 457s Preparing to unpack .../063-libjs-highlight.js_9.18.5+dfsg1-2_all.deb ... 457s Unpacking libjs-highlight.js (9.18.5+dfsg1-2) ... 457s Selecting previously unselected package libjs-jquery. 457s Preparing to unpack .../064-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 457s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 457s Selecting previously unselected package libjs-jquery-datatables. 457s Preparing to unpack .../065-libjs-jquery-datatables_1.11.5+dfsg-2_all.deb ... 457s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2) ... 457s Selecting previously unselected package liblapack3:amd64. 457s Preparing to unpack .../066-liblapack3_3.12.1-2_amd64.deb ... 457s Unpacking liblapack3:amd64 (3.12.1-2) ... 457s Selecting previously unselected package liblapack-dev:amd64. 457s Preparing to unpack .../067-liblapack-dev_3.12.1-2_amd64.deb ... 457s Unpacking liblapack-dev:amd64 (3.12.1-2) ... 457s Selecting previously unselected package liblerc4:amd64. 457s Preparing to unpack .../068-liblerc4_4.0.0+ds-5ubuntu1_amd64.deb ... 457s Unpacking liblerc4:amd64 (4.0.0+ds-5ubuntu1) ... 457s Selecting previously unselected package libncurses-dev:amd64. 457s Preparing to unpack .../069-libncurses-dev_6.5+20250216-2_amd64.deb ... 457s Unpacking libncurses-dev:amd64 (6.5+20250216-2) ... 457s Selecting previously unselected package libthai-data. 457s Preparing to unpack .../070-libthai-data_0.1.29-2build1_all.deb ... 457s Unpacking libthai-data (0.1.29-2build1) ... 457s Selecting previously unselected package libthai0:amd64. 457s Preparing to unpack .../071-libthai0_0.1.29-2build1_amd64.deb ... 457s Unpacking libthai0:amd64 (0.1.29-2build1) ... 457s Selecting previously unselected package libpango-1.0-0:amd64. 457s Preparing to unpack .../072-libpango-1.0-0_1.56.2-1_amd64.deb ... 457s Unpacking libpango-1.0-0:amd64 (1.56.2-1) ... 457s Selecting previously unselected package libpangoft2-1.0-0:amd64. 457s Preparing to unpack .../073-libpangoft2-1.0-0_1.56.2-1_amd64.deb ... 457s Unpacking libpangoft2-1.0-0:amd64 (1.56.2-1) ... 457s Selecting previously unselected package libpangocairo-1.0-0:amd64. 457s Preparing to unpack .../074-libpangocairo-1.0-0_1.56.2-1_amd64.deb ... 457s Unpacking libpangocairo-1.0-0:amd64 (1.56.2-1) ... 458s Selecting previously unselected package libpaper2:amd64. 458s Preparing to unpack .../075-libpaper2_2.2.5-0.3_amd64.deb ... 458s Unpacking libpaper2:amd64 (2.2.5-0.3) ... 458s Selecting previously unselected package libpaper-utils. 458s Preparing to unpack .../076-libpaper-utils_2.2.5-0.3_amd64.deb ... 458s Unpacking libpaper-utils (2.2.5-0.3) ... 458s Selecting previously unselected package libpcre2-16-0:amd64. 458s Preparing to unpack .../077-libpcre2-16-0_10.45-1_amd64.deb ... 458s Unpacking libpcre2-16-0:amd64 (10.45-1) ... 458s Selecting previously unselected package libpcre2-32-0:amd64. 458s Preparing to unpack .../078-libpcre2-32-0_10.45-1_amd64.deb ... 458s Unpacking libpcre2-32-0:amd64 (10.45-1) ... 458s Selecting previously unselected package libpcre2-posix3:amd64. 458s Preparing to unpack .../079-libpcre2-posix3_10.45-1_amd64.deb ... 458s Unpacking libpcre2-posix3:amd64 (10.45-1) ... 458s Selecting previously unselected package libpcre2-dev:amd64. 458s Preparing to unpack .../080-libpcre2-dev_10.45-1_amd64.deb ... 458s Unpacking libpcre2-dev:amd64 (10.45-1) ... 458s Selecting previously unselected package libpkgconf3:amd64. 458s Preparing to unpack .../081-libpkgconf3_1.8.1-4_amd64.deb ... 458s Unpacking libpkgconf3:amd64 (1.8.1-4) ... 458s Selecting previously unselected package zlib1g-dev:amd64. 458s Preparing to unpack .../082-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_amd64.deb ... 458s Unpacking zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 458s Selecting previously unselected package libpng-dev:amd64. 458s Preparing to unpack .../083-libpng-dev_1.6.47-1_amd64.deb ... 458s Unpacking libpng-dev:amd64 (1.6.47-1) ... 458s Selecting previously unselected package libreadline-dev:amd64. 458s Preparing to unpack .../084-libreadline-dev_8.2-6_amd64.deb ... 458s Unpacking libreadline-dev:amd64 (8.2-6) ... 458s Selecting previously unselected package libsharpyuv0:amd64. 458s Preparing to unpack .../085-libsharpyuv0_1.5.0-0.1_amd64.deb ... 458s Unpacking libsharpyuv0:amd64 (1.5.0-0.1) ... 458s Selecting previously unselected package libsm6:amd64. 458s Preparing to unpack .../086-libsm6_2%3a1.2.4-1_amd64.deb ... 458s Unpacking libsm6:amd64 (2:1.2.4-1) ... 458s Selecting previously unselected package libtcl8.6:amd64. 458s Preparing to unpack .../087-libtcl8.6_8.6.16+dfsg-1_amd64.deb ... 458s Unpacking libtcl8.6:amd64 (8.6.16+dfsg-1) ... 458s Selecting previously unselected package libjbig0:amd64. 458s Preparing to unpack .../088-libjbig0_2.1-6.1ubuntu2_amd64.deb ... 458s Unpacking libjbig0:amd64 (2.1-6.1ubuntu2) ... 458s Selecting previously unselected package libwebp7:amd64. 458s Preparing to unpack .../089-libwebp7_1.5.0-0.1_amd64.deb ... 458s Unpacking libwebp7:amd64 (1.5.0-0.1) ... 458s Selecting previously unselected package libtiff6:amd64. 458s Preparing to unpack .../090-libtiff6_4.5.1+git230720-4ubuntu4_amd64.deb ... 458s Unpacking libtiff6:amd64 (4.5.1+git230720-4ubuntu4) ... 458s Selecting previously unselected package libxft2:amd64. 458s Preparing to unpack .../091-libxft2_2.3.6-1build1_amd64.deb ... 458s Unpacking libxft2:amd64 (2.3.6-1build1) ... 458s Selecting previously unselected package libxss1:amd64. 458s Preparing to unpack .../092-libxss1_1%3a1.2.3-1build3_amd64.deb ... 458s Unpacking libxss1:amd64 (1:1.2.3-1build3) ... 458s Selecting previously unselected package libtk8.6:amd64. 458s Preparing to unpack .../093-libtk8.6_8.6.16-1_amd64.deb ... 458s Unpacking libtk8.6:amd64 (8.6.16-1) ... 458s Selecting previously unselected package libxt6t64:amd64. 458s Preparing to unpack .../094-libxt6t64_1%3a1.2.1-1.2build1_amd64.deb ... 458s Unpacking libxt6t64:amd64 (1:1.2.1-1.2build1) ... 458s Selecting previously unselected package node-normalize.css. 458s Preparing to unpack .../095-node-normalize.css_8.0.1-5_all.deb ... 458s Unpacking node-normalize.css (8.0.1-5) ... 458s Selecting previously unselected package zip. 458s Preparing to unpack .../096-zip_3.0-14ubuntu2_amd64.deb ... 458s Unpacking zip (3.0-14ubuntu2) ... 458s Selecting previously unselected package unzip. 458s Preparing to unpack .../097-unzip_6.0-28ubuntu6_amd64.deb ... 458s Unpacking unzip (6.0-28ubuntu6) ... 458s Selecting previously unselected package xdg-utils. 458s Preparing to unpack .../098-xdg-utils_1.2.1-2ubuntu1_all.deb ... 458s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 458s Selecting previously unselected package r-base-core. 458s Preparing to unpack .../099-r-base-core_4.4.3-1_amd64.deb ... 458s Unpacking r-base-core (4.4.3-1) ... 459s Selecting previously unselected package liblzma-dev:amd64. 459s Preparing to unpack .../100-liblzma-dev_5.6.4-1_amd64.deb ... 459s Unpacking liblzma-dev:amd64 (5.6.4-1) ... 459s Selecting previously unselected package pkgconf-bin. 459s Preparing to unpack .../101-pkgconf-bin_1.8.1-4_amd64.deb ... 459s Unpacking pkgconf-bin (1.8.1-4) ... 459s Selecting previously unselected package pkgconf:amd64. 459s Preparing to unpack .../102-pkgconf_1.8.1-4_amd64.deb ... 459s Unpacking pkgconf:amd64 (1.8.1-4) ... 459s Selecting previously unselected package libtirpc-dev:amd64. 459s Preparing to unpack .../103-libtirpc-dev_1.3.4+ds-1.3_amd64.deb ... 459s Unpacking libtirpc-dev:amd64 (1.3.4+ds-1.3) ... 459s Selecting previously unselected package r-base-dev. 459s Preparing to unpack .../104-r-base-dev_4.4.3-1_all.deb ... 459s Unpacking r-base-dev (4.4.3-1) ... 459s Selecting previously unselected package pkg-r-autopkgtest. 459s Preparing to unpack .../105-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 459s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 459s Selecting previously unselected package r-cran-base64enc. 459s Preparing to unpack .../106-r-cran-base64enc_0.1-3-3_amd64.deb ... 459s Unpacking r-cran-base64enc (0.1-3-3) ... 459s Selecting previously unselected package r-cran-cli. 459s Preparing to unpack .../107-r-cran-cli_3.6.4-1_amd64.deb ... 459s Unpacking r-cran-cli (3.6.4-1) ... 459s Selecting previously unselected package r-cran-colorspace. 459s Preparing to unpack .../108-r-cran-colorspace_2.1-1+dfsg-1_amd64.deb ... 459s Unpacking r-cran-colorspace (2.1-1+dfsg-1) ... 459s Selecting previously unselected package r-cran-commonmark. 459s Preparing to unpack .../109-r-cran-commonmark_1.9.2-2_amd64.deb ... 459s Unpacking r-cran-commonmark (1.9.2-2) ... 459s Selecting previously unselected package r-cran-evaluate. 459s Preparing to unpack .../110-r-cran-evaluate_1.0.3-1_all.deb ... 459s Unpacking r-cran-evaluate (1.0.3-1) ... 459s Selecting previously unselected package r-cran-fansi. 459s Preparing to unpack .../111-r-cran-fansi_1.0.5-1_amd64.deb ... 459s Unpacking r-cran-fansi (1.0.5-1) ... 459s Selecting previously unselected package r-cran-farver. 459s Preparing to unpack .../112-r-cran-farver_2.1.2-1_amd64.deb ... 459s Unpacking r-cran-farver (2.1.2-1) ... 459s Selecting previously unselected package r-cran-glue. 459s Preparing to unpack .../113-r-cran-glue_1.8.0-1_amd64.deb ... 459s Unpacking r-cran-glue (1.8.0-1) ... 459s Selecting previously unselected package r-cran-rlang. 459s Preparing to unpack .../114-r-cran-rlang_1.1.5-1_amd64.deb ... 459s Unpacking r-cran-rlang (1.1.5-1) ... 459s Selecting previously unselected package r-cran-lifecycle. 459s Preparing to unpack .../115-r-cran-lifecycle_1.0.4+dfsg-1_all.deb ... 459s Unpacking r-cran-lifecycle (1.0.4+dfsg-1) ... 459s Selecting previously unselected package r-cran-gtable. 459s Preparing to unpack .../116-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 459s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 459s Selecting previously unselected package r-cran-isoband. 459s Preparing to unpack .../117-r-cran-isoband_0.2.7-1_amd64.deb ... 459s Unpacking r-cran-isoband (0.2.7-1) ... 459s Selecting previously unselected package r-cran-mass. 459s Preparing to unpack .../118-r-cran-mass_7.3-64-1_amd64.deb ... 459s Unpacking r-cran-mass (7.3-64-1) ... 459s Selecting previously unselected package r-cran-lattice. 459s Preparing to unpack .../119-r-cran-lattice_0.22-6-1_amd64.deb ... 459s Unpacking r-cran-lattice (0.22-6-1) ... 460s Selecting previously unselected package r-cran-nlme. 460s Preparing to unpack .../120-r-cran-nlme_3.1.167-1_amd64.deb ... 460s Unpacking r-cran-nlme (3.1.167-1) ... 460s Selecting previously unselected package r-cran-matrix. 460s Preparing to unpack .../121-r-cran-matrix_1.7-3-1_amd64.deb ... 460s Unpacking r-cran-matrix (1.7-3-1) ... 460s Selecting previously unselected package r-cran-mgcv. 460s Preparing to unpack .../122-r-cran-mgcv_1.9-1-1_amd64.deb ... 460s Unpacking r-cran-mgcv (1.9-1-1) ... 460s Selecting previously unselected package r-cran-labeling. 460s Preparing to unpack .../123-r-cran-labeling_0.4.3-1_all.deb ... 460s Unpacking r-cran-labeling (0.4.3-1) ... 460s Selecting previously unselected package r-cran-munsell. 460s Preparing to unpack .../124-r-cran-munsell_0.5.1-1_all.deb ... 460s Unpacking r-cran-munsell (0.5.1-1) ... 460s Selecting previously unselected package r-cran-r6. 460s Preparing to unpack .../125-r-cran-r6_2.6.1-1_all.deb ... 460s Unpacking r-cran-r6 (2.6.1-1) ... 460s Selecting previously unselected package r-cran-rcolorbrewer. 460s Preparing to unpack .../126-r-cran-rcolorbrewer_1.1-3-1build1_all.deb ... 460s Unpacking r-cran-rcolorbrewer (1.1-3-1build1) ... 460s Selecting previously unselected package r-cran-viridislite. 460s Preparing to unpack .../127-r-cran-viridislite_0.4.2-2_all.deb ... 460s Unpacking r-cran-viridislite (0.4.2-2) ... 460s Selecting previously unselected package r-cran-scales. 460s Preparing to unpack .../128-r-cran-scales_1.3.0-1_all.deb ... 460s Unpacking r-cran-scales (1.3.0-1) ... 460s Selecting previously unselected package r-cran-magrittr. 460s Preparing to unpack .../129-r-cran-magrittr_2.0.3-1_amd64.deb ... 460s Unpacking r-cran-magrittr (2.0.3-1) ... 460s Selecting previously unselected package r-cran-utf8. 460s Preparing to unpack .../130-r-cran-utf8_1.2.4-1_amd64.deb ... 460s Unpacking r-cran-utf8 (1.2.4-1) ... 460s Selecting previously unselected package r-cran-vctrs. 460s Preparing to unpack .../131-r-cran-vctrs_0.6.5-1_amd64.deb ... 460s Unpacking r-cran-vctrs (0.6.5-1) ... 460s Selecting previously unselected package r-cran-pillar. 460s Preparing to unpack .../132-r-cran-pillar_1.10.1+dfsg-1_all.deb ... 460s Unpacking r-cran-pillar (1.10.1+dfsg-1) ... 460s Selecting previously unselected package r-cran-pkgconfig. 460s Preparing to unpack .../133-r-cran-pkgconfig_2.0.3-2build1_all.deb ... 460s Unpacking r-cran-pkgconfig (2.0.3-2build1) ... 460s Selecting previously unselected package r-cran-tibble. 460s Preparing to unpack .../134-r-cran-tibble_3.2.1+dfsg-3_amd64.deb ... 460s Unpacking r-cran-tibble (3.2.1+dfsg-3) ... 460s Selecting previously unselected package r-cran-withr. 460s Preparing to unpack .../135-r-cran-withr_3.0.2+dfsg-1_all.deb ... 460s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 460s Selecting previously unselected package r-cran-ggplot2. 460s Preparing to unpack .../136-r-cran-ggplot2_3.5.1+dfsg-1_all.deb ... 460s Unpacking r-cran-ggplot2 (3.5.1+dfsg-1) ... 460s Selecting previously unselected package r-cran-xfun. 460s Preparing to unpack .../137-r-cran-xfun_0.51+dfsg-1_amd64.deb ... 460s Unpacking r-cran-xfun (0.51+dfsg-1) ... 460s Selecting previously unselected package r-cran-highr. 460s Preparing to unpack .../138-r-cran-highr_0.11+dfsg-1_all.deb ... 460s Unpacking r-cran-highr (0.11+dfsg-1) ... 460s Selecting previously unselected package r-cran-yaml. 460s Preparing to unpack .../139-r-cran-yaml_2.3.10-1_amd64.deb ... 460s Unpacking r-cran-yaml (2.3.10-1) ... 460s Selecting previously unselected package libjs-mathjax. 460s Preparing to unpack .../140-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 460s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 461s Selecting previously unselected package r-cran-knitr. 461s Preparing to unpack .../141-r-cran-knitr_1.49+dfsg-1_all.deb ... 461s Unpacking r-cran-knitr (1.49+dfsg-1) ... 461s Selecting previously unselected package r-cran-markdown. 461s Preparing to unpack .../142-r-cran-markdown_1.13-1_all.deb ... 461s Unpacking r-cran-markdown (1.13-1) ... 461s Selecting previously unselected package r-cran-matrixstats. 461s Preparing to unpack .../143-r-cran-matrixstats_1.5.0-1_amd64.deb ... 461s Unpacking r-cran-matrixstats (1.5.0-1) ... 461s Setting up libgraphite2-3:amd64 (1.3.14-2ubuntu1) ... 461s Setting up libpixman-1-0:amd64 (0.44.0-3) ... 461s Setting up libsharpyuv0:amd64 (1.5.0-0.1) ... 461s Setting up libncurses-dev:amd64 (6.5+20250216-2) ... 461s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 461s Setting up liblerc4:amd64 (4.0.0+ds-5ubuntu1) ... 461s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 461s Setting up libxrender1:amd64 (1:0.9.10-1.1build1) ... 461s Setting up libdatrie1:amd64 (0.2.13-3build1) ... 461s Setting up libxcb-render0:amd64 (1.17.0-2) ... 461s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 461s Setting up unzip (6.0-28ubuntu6) ... 461s Setting up x11-common (1:7.7+23ubuntu3) ... 462s Setting up libdeflate0:amd64 (1.23-1) ... 462s Setting up libxcb-shm0:amd64 (1.17.0-2) ... 462s Setting up libreadline-dev:amd64 (8.2-6) ... 462s Setting up libgomp1:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libjbig0:amd64 (2.1-6.1ubuntu2) ... 462s Setting up libpcre2-16-0:amd64 (10.45-1) ... 462s Setting up zip (3.0-14ubuntu2) ... 462s Setting up libpcre2-32-0:amd64 (10.45-1) ... 462s Setting up libblas3:amd64 (3.12.1-2) ... 462s update-alternatives: using /usr/lib/x86_64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/x86_64-linux-gnu/libblas.so.3 (libblas.so.3-x86_64-linux-gnu) in auto mode 462s Setting up libtirpc-dev:amd64 (1.3.4+ds-1.3) ... 462s Setting up libpkgconf3:amd64 (1.8.1-4) ... 462s Setting up libquadmath0:amd64 (15-20250222-0ubuntu1) ... 462s Setting up fonts-dejavu-mono (2.37-8) ... 462s Setting up libmpc3:amd64 (1.3.1-1build2) ... 462s Setting up libtcl8.6:amd64 (8.6.16+dfsg-1) ... 462s Setting up icu-devtools (76.1-1ubuntu2) ... 462s Setting up fonts-dejavu-core (2.37-8) ... 462s Setting up pkgconf-bin (1.8.1-4) ... 462s Setting up libjpeg-turbo8:amd64 (2.1.5-3ubuntu2) ... 462s Setting up libgfortran5:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libwebp7:amd64 (1.5.0-0.1) ... 462s Setting up liblzma-dev:amd64 (5.6.4-1) ... 462s Setting up libubsan1:amd64 (15-20250222-0ubuntu1) ... 462s Setting up zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 462s Setting up libpcre2-posix3:amd64 (10.45-1) ... 462s Setting up libjs-highlight.js (9.18.5+dfsg1-2) ... 462s Setting up libhwasan0:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libasan8:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libharfbuzz0b:amd64 (10.2.0-1) ... 462s Setting up libthai-data (0.1.29-2build1) ... 462s Setting up libxss1:amd64 (1:1.2.3-1build3) ... 462s Setting up libpaper2:amd64 (2.2.5-0.3) ... 462s Setting up libtsan2:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 462s Setting up libisl23:amd64 (0.27-1) ... 462s Setting up libdeflate-dev:amd64 (1.23-1) ... 462s Setting up node-normalize.css (8.0.1-5) ... 462s Setting up libicu-dev:amd64 (76.1-1ubuntu2) ... 462s Setting up xdg-utils (1.2.1-2ubuntu1) ... 462s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 462s Setting up libcc1-0:amd64 (15-20250222-0ubuntu1) ... 462s Setting up liblsan0:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libblas-dev:amd64 (3.12.1-2) ... 462s update-alternatives: using /usr/lib/x86_64-linux-gnu/blas/libblas.so to provide /usr/lib/x86_64-linux-gnu/libblas.so (libblas.so-x86_64-linux-gnu) in auto mode 462s Setting up dctrl-tools (2.24-3build3) ... 462s Setting up libjs-bootstrap (3.4.1+dfsg-3) ... 462s Setting up libitm1:amd64 (15-20250222-0ubuntu1) ... 462s Setting up libbz2-dev:amd64 (1.0.8-6) ... 462s Setting up libjpeg8:amd64 (8c-2ubuntu11) ... 462s Setting up libice6:amd64 (2:1.1.1-1) ... 462s Setting up libjpeg-turbo8-dev:amd64 (2.1.5-3ubuntu2) ... 462s Setting up liblapack3:amd64 (3.12.1-2) ... 462s update-alternatives: using /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/x86_64-linux-gnu/liblapack.so.3 (liblapack.so.3-x86_64-linux-gnu) in auto mode 462s Setting up libpcre2-dev:amd64 (10.45-1) ... 462s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 462s Setting up libpng-dev:amd64 (1.6.47-1) ... 462s Setting up libpaper-utils (2.2.5-0.3) ... 462s Setting up libjs-jquery-datatables (1.11.5+dfsg-2) ... 462s Setting up pkgconf:amd64 (1.8.1-4) ... 462s Setting up libthai0:amd64 (0.1.29-2build1) ... 462s Setting up liblapack-dev:amd64 (3.12.1-2) ... 462s update-alternatives: using /usr/lib/x86_64-linux-gnu/lapack/liblapack.so to provide /usr/lib/x86_64-linux-gnu/liblapack.so (liblapack.so-x86_64-linux-gnu) in auto mode 462s Setting up cpp-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 462s Setting up cpp-14 (14.2.0-17ubuntu3) ... 462s Setting up libtiff6:amd64 (4.5.1+git230720-4ubuntu4) ... 462s Setting up libfontconfig1:amd64 (2.15.0-2ubuntu1) ... 462s Setting up libgcc-14-dev:amd64 (14.2.0-17ubuntu3) ... 462s Setting up libjpeg8-dev:amd64 (8c-2ubuntu11) ... 462s Setting up libstdc++-14-dev:amd64 (14.2.0-17ubuntu3) ... 462s Setting up libsm6:amd64 (2:1.2.4-1) ... 462s Setting up cpp-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 462s Setting up libgfortran-14-dev:amd64 (14.2.0-17ubuntu3) ... 462s Setting up fontconfig (2.15.0-2ubuntu1) ... 464s Regenerating fonts cache... done. 464s Setting up libxft2:amd64 (2.3.6-1build1) ... 464s Setting up libtk8.6:amd64 (8.6.16-1) ... 464s Setting up libpango-1.0-0:amd64 (1.56.2-1) ... 464s Setting up libjpeg-dev:amd64 (8c-2ubuntu11) ... 464s Setting up libcairo2:amd64 (1.18.2-2) ... 464s Setting up libxt6t64:amd64 (1:1.2.1-1.2build1) ... 464s Setting up cpp (4:14.2.0-1ubuntu1) ... 464s Setting up gcc-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 464s Setting up libpangoft2-1.0-0:amd64 (1.56.2-1) ... 464s Setting up libpangocairo-1.0-0:amd64 (1.56.2-1) ... 464s Setting up gcc-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 464s Setting up gcc-14 (14.2.0-17ubuntu3) ... 464s Setting up gfortran-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 464s Setting up r-base-core (4.4.3-1) ... 464s Creating config file /etc/R/Renviron with new version 464s Setting up r-cran-labeling (0.4.3-1) ... 464s Setting up r-cran-lattice (0.22-6-1) ... 464s Setting up r-cran-nlme (3.1.167-1) ... 464s Setting up r-cran-farver (2.1.2-1) ... 464s Setting up g++-14-x86-64-linux-gnu (14.2.0-17ubuntu3) ... 464s Setting up r-cran-viridislite (0.4.2-2) ... 464s Setting up g++-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 464s Setting up r-cran-commonmark (1.9.2-2) ... 464s Setting up g++-14 (14.2.0-17ubuntu3) ... 464s Setting up r-cran-r6 (2.6.1-1) ... 464s Setting up gfortran-14 (14.2.0-17ubuntu3) ... 464s Setting up r-cran-magrittr (2.0.3-1) ... 464s Setting up r-cran-rlang (1.1.5-1) ... 464s Setting up r-cran-matrixstats (1.5.0-1) ... 464s Setting up r-cran-xfun (0.51+dfsg-1) ... 464s Setting up r-cran-withr (3.0.2+dfsg-1) ... 464s Setting up r-cran-base64enc (0.1-3-3) ... 464s Setting up r-cran-yaml (2.3.10-1) ... 464s Setting up r-cran-evaluate (1.0.3-1) ... 464s Setting up r-cran-highr (0.11+dfsg-1) ... 464s Setting up r-cran-fansi (1.0.5-1) ... 464s Setting up r-cran-mass (7.3-64-1) ... 464s Setting up r-cran-glue (1.8.0-1) ... 464s Setting up gfortran-x86-64-linux-gnu (4:14.2.0-1ubuntu1) ... 464s Setting up r-cran-cli (3.6.4-1) ... 464s Setting up r-cran-lifecycle (1.0.4+dfsg-1) ... 464s Setting up gcc (4:14.2.0-1ubuntu1) ... 464s Setting up r-cran-pkgconfig (2.0.3-2build1) ... 464s Setting up r-cran-utf8 (1.2.4-1) ... 464s Setting up r-cran-colorspace (2.1-1+dfsg-1) ... 464s Setting up r-cran-markdown (1.13-1) ... 464s Setting up r-cran-rcolorbrewer (1.1-3-1build1) ... 464s Setting up r-cran-isoband (0.2.7-1) ... 464s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 464s Setting up r-cran-matrix (1.7-3-1) ... 464s Setting up r-cran-knitr (1.49+dfsg-1) ... 464s Setting up r-cran-mgcv (1.9-1-1) ... 464s Setting up g++ (4:14.2.0-1ubuntu1) ... 464s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 464s Setting up build-essential (12.10ubuntu1) ... 464s Setting up r-cran-vctrs (0.6.5-1) ... 464s Setting up r-cran-pillar (1.10.1+dfsg-1) ... 464s Setting up r-cran-munsell (0.5.1-1) ... 464s Setting up r-cran-tibble (3.2.1+dfsg-3) ... 464s Setting up gfortran (4:14.2.0-1ubuntu1) ... 464s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 464s 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 464s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 464s 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 464s Setting up r-cran-scales (1.3.0-1) ... 464s Setting up r-base-dev (4.4.3-1) ... 464s Setting up r-cran-ggplot2 (3.5.1+dfsg-1) ... 464s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 464s Processing triggers for libc-bin (2.41-1ubuntu2) ... 465s Processing triggers for man-db (2.13.0-1) ... 466s Processing triggers for install-info (7.1.1-1) ... 468s autopkgtest [23:30:19]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 468s autopkgtest [23:30:19]: test pkg-r-autopkgtest: [----------------------- 468s Test: Try to load the R library matrixStats 468s 468s R version 4.4.3 (2025-02-28) -- "Trophy Case" 468s Copyright (C) 2025 The R Foundation for Statistical Computing 468s Platform: x86_64-pc-linux-gnu 468s 468s R is free software and comes with ABSOLUTELY NO WARRANTY. 468s You are welcome to redistribute it under certain conditions. 468s Type 'license()' or 'licence()' for distribution details. 468s 468s R is a collaborative project with many contributors. 468s Type 'contributors()' for more information and 468s 'citation()' on how to cite R or R packages in publications. 468s 468s Type 'demo()' for some demos, 'help()' for on-line help, or 468s 'help.start()' for an HTML browser interface to help. 468s Type 'q()' to quit R. 468s 468s > library('matrixStats') 468s > 468s > 468s Other tests are currently unsupported! 468s They will be progressively added. 469s autopkgtest [23:30:20]: test pkg-r-autopkgtest: -----------------------] 469s autopkgtest [23:30:20]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 469s pkg-r-autopkgtest PASS 469s autopkgtest [23:30:20]: @@@@@@@@@@@@@@@@@@@@ summary 469s run-unit-test PASS 469s pkg-r-autopkgtest PASS 489s nova [W] Skipping flock for amd64 489s Creating nova instance adt-plucky-amd64-r-cran-matrixstats-20250315-221624-juju-7f2275-prod-proposed-migration-environment-2-60d380cd-cf86-4ec4-aecf-599a8c4120c8 from image adt/ubuntu-plucky-amd64-server-20250306.img (UUID 60d877d7-b74c-4f24-920d-f4570db0a338)... 489s nova [W] Timed out waiting for 57459513-f7e1-4dca-9d95-17b591f7bb95 to get deleted. 489s nova [W] Skipping flock for amd64 489s Creating nova instance adt-plucky-amd64-r-cran-matrixstats-20250315-221624-juju-7f2275-prod-proposed-migration-environment-2-60d380cd-cf86-4ec4-aecf-599a8c4120c8 from image adt/ubuntu-plucky-amd64-server-20250306.img (UUID 60d877d7-b74c-4f24-920d-f4570db0a338)... 489s nova [W] Timed out waiting for 72dfa628-389c-44b9-b4f0-f3585e7fc7d8 to get deleted.