0s autopkgtest [05:26:29]: starting date and time: 2026-02-10 05:26:29+0000 0s autopkgtest [05:26:29]: git checkout: 4b346b80 nova: make wait_reboot return success even when a no-op 0s autopkgtest [05:26:29]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.alncvhkh/out --timeout-copy=6000 --needs-internet=try --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:r-cran-ggplot2 --apt-upgrade r-cran-matrixstats --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=r-cran-ggplot2/4.0.2+dfsg-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-cpu2-ram4-disk20-amd64 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@sto01-10.secgroup --name adt-resolute-amd64-r-cran-matrixstats-20260210-052629-juju-7f2275-prod-proposed-migration-environment-2-bcb2911b-cc5a-4553-b510-6a8e48ee2fa6 --image adt/ubuntu-resolute-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-autopkgtest-workers-amd64 -e TERM=linux --mirror=http://ftpmaster.internal/ubuntu/ 4s Creating nova instance adt-resolute-amd64-r-cran-matrixstats-20260210-052629-juju-7f2275-prod-proposed-migration-environment-2-bcb2911b-cc5a-4553-b510-6a8e48ee2fa6 from image adt/ubuntu-resolute-amd64-server-20260204.img (UUID fedf54b4-458b-493e-8072-6425c19717b4)... 74s autopkgtest [05:27:43]: testbed dpkg architecture: amd64 74s autopkgtest [05:27:43]: testbed apt version: 3.1.14 74s autopkgtest [05:27:43]: @@@@@@@@@@@@@@@@@@@@ test bed setup 74s autopkgtest [05:27:43]: testbed release detected to be: None 75s autopkgtest [05:27:44]: updating testbed package index (apt update) 75s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 75s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 75s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 75s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 75s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [31.1 kB] 75s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1727 kB] 76s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [178 kB] 76s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main i386 Packages [219 kB] 76s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main amd64 Packages [266 kB] 76s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/main amd64 c-n-f Metadata [6184 B] 76s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/restricted amd64 c-n-f Metadata [120 B] 76s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 Packages [1787 kB] 76s Get:13 http://ftpmaster.internal/ubuntu resolute-proposed/universe i386 Packages [792 kB] 76s Get:14 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 c-n-f Metadata [32.5 kB] 76s Get:15 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse i386 Packages [5020 B] 76s Get:16 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse amd64 Packages [26.4 kB] 76s Get:17 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse amd64 c-n-f Metadata [996 B] 77s Fetched 5197 kB in 1s (4917 kB/s) 77s Reading package lists... 78s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 78s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 78s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 78s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 79s Reading package lists... 79s Reading package lists... 79s Building dependency tree... 79s Reading state information... 79s Calculating upgrade... 79s The following package was automatically installed and is no longer required: 79s libpython3.13 79s Use 'sudo apt autoremove' to remove it. 79s The following NEW packages will be installed: 79s gcc-16-base libpython3.14 libpython3.14-minimal libpython3.14-stdlib 79s linux-headers-6.19.0-3 linux-headers-6.19.0-3-generic 79s linux-image-6.19.0-3-generic linux-modules-6.19.0-3-generic 79s linux-tools-6.19.0-3 linux-tools-6.19.0-3-generic 79s The following packages will be upgraded: 79s 3cpio amd64-microcode apt bpftool busybox-initramfs busybox-static 79s cryptsetup-bin dash dbus dbus-bin dbus-daemon dbus-session-bus-common 79s dbus-system-bus-common dbus-user-session debianutils dmsetup dracut-install 79s ethtool findutils gir1.2-girepository-3.0 gir1.2-glib-2.0 hwdata iproute2 79s iptables less libapt-pkg7.0 libatomic1 libattr1 libbpf1 libbrotli1 libbsd0 79s libcryptsetup12 libdbus-1-3 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common 79s libdrm2 libevent-core-2.1-7t64 libgcc-s1 libgdbm-compat4t64 libgdbm6t64 79s libgirepository-2.0-0 libglib2.0-0t64 libglib2.0-data libgpm2 libgudev-1.0-0 79s libidn2-0 libip4tc2 libip6tc2 libjansson4 libkeyutils1 liblsof0 79s libmaxminddb0 libnetfilter-conntrack3 libnpth0t64 libonig5 libpcap0.8t64 79s libpci3 libsensors-config libsensors5 libstdc++6 libusb-1.0-0 libwrap0 79s libxau6 libxkbcommon0 libxtables12 linux-generic linux-headers-generic 79s linux-headers-virtual linux-image-generic linux-image-virtual linux-perf 79s linux-tools-common linux-virtual lsof man-db mawk patch pciutils pnp.ids 79s pollinate python3-linkify-it python3-markdown-it python3-referencing sed 79s shared-mime-info tar tcpdump ubuntu-kernel-accessories ubuntu-standard wget 79s 91 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. 79s Need to get 237 MB of archives. 79s After this operation, 339 MB of additional disk space will be used. 79s Get:1 http://ftpmaster.internal/ubuntu resolute/main amd64 debianutils amd64 5.23.2build1 [93.3 kB] 79s Get:2 http://ftpmaster.internal/ubuntu resolute/main amd64 dash amd64 0.5.12-12ubuntu3 [96.0 kB] 79s Get:3 http://ftpmaster.internal/ubuntu resolute/main amd64 findutils amd64 4.10.0-3build2 [307 kB] 79s Get:4 http://ftpmaster.internal/ubuntu resolute/main amd64 sed amd64 4.9-2build3 [195 kB] 79s Get:5 http://ftpmaster.internal/ubuntu resolute/main amd64 tar amd64 1.35+dfsg-3.1build2 [257 kB] 79s Get:6 http://ftpmaster.internal/ubuntu resolute/main amd64 libattr1 amd64 1:2.5.2-3build2 [11.4 kB] 79s Get:7 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc-16-base amd64 16-20260208-1ubuntu1 [59.7 kB] 79s Get:8 http://ftpmaster.internal/ubuntu resolute/main amd64 libgcc-s1 amd64 16-20260208-1ubuntu1 [80.3 kB] 79s Get:9 http://ftpmaster.internal/ubuntu resolute/main amd64 libbsd0 amd64 0.12.2-2build2 [42.3 kB] 79s Get:10 http://ftpmaster.internal/ubuntu resolute/main amd64 mawk amd64 1.3.4.20260129-1 [133 kB] 79s Get:11 http://ftpmaster.internal/ubuntu resolute/main amd64 libstdc++6 amd64 16-20260208-1ubuntu1 [844 kB] 79s Get:12 http://ftpmaster.internal/ubuntu resolute/main amd64 libapt-pkg7.0 amd64 3.1.15 [1151 kB] 79s Get:13 http://ftpmaster.internal/ubuntu resolute/main amd64 apt amd64 3.1.15 [1479 kB] 80s Get:14 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-system-bus-common all 1.16.2-2ubuntu3 [55.8 kB] 80s Get:15 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-session-bus-common all 1.16.2-2ubuntu3 [54.4 kB] 80s Get:16 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-user-session amd64 1.16.2-2ubuntu3 [9696 B] 80s Get:17 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-daemon amd64 1.16.2-2ubuntu3 [119 kB] 80s Get:18 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-bin amd64 1.16.2-2ubuntu3 [40.1 kB] 80s Get:19 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus amd64 1.16.2-2ubuntu3 [24.2 kB] 80s Get:20 http://ftpmaster.internal/ubuntu resolute/main amd64 libdbus-1-3 amd64 1.16.2-2ubuntu3 [185 kB] 80s Get:21 http://ftpmaster.internal/ubuntu resolute/main amd64 libdevmapper1.02.1 amd64 2:1.02.205-2ubuntu3 [142 kB] 80s Get:22 http://ftpmaster.internal/ubuntu resolute/main amd64 dmsetup amd64 2:1.02.205-2ubuntu3 [79.4 kB] 80s Get:23 http://ftpmaster.internal/ubuntu resolute/main amd64 ethtool amd64 1:6.15-3build1 [318 kB] 80s Get:24 http://ftpmaster.internal/ubuntu resolute/main amd64 gir1.2-girepository-3.0 amd64 2.87.2-2 [25.2 kB] 80s Get:25 http://ftpmaster.internal/ubuntu resolute/main amd64 libgirepository-2.0-0 amd64 2.87.2-2 [76.1 kB] 80s Get:26 http://ftpmaster.internal/ubuntu resolute/main amd64 libatomic1 amd64 16-20260208-1ubuntu1 [11.4 kB] 80s Get:27 http://ftpmaster.internal/ubuntu resolute/main amd64 gir1.2-glib-2.0 amd64 2.87.2-2 [182 kB] 80s Get:28 http://ftpmaster.internal/ubuntu resolute/main amd64 libglib2.0-0t64 amd64 2.87.2-2 [1613 kB] 80s Get:29 http://ftpmaster.internal/ubuntu resolute/main amd64 libbpf1 amd64 1:1.6.2-1build1 [184 kB] 80s Get:30 http://ftpmaster.internal/ubuntu resolute/main amd64 iptables amd64 1.8.11-2ubuntu3 [381 kB] 80s Get:31 http://ftpmaster.internal/ubuntu resolute/main amd64 libip4tc2 amd64 1.8.11-2ubuntu3 [24.2 kB] 80s Get:32 http://ftpmaster.internal/ubuntu resolute/main amd64 libip6tc2 amd64 1.8.11-2ubuntu3 [24.4 kB] 80s Get:33 http://ftpmaster.internal/ubuntu resolute/main amd64 libnetfilter-conntrack3 amd64 1.1.1-1 [47.5 kB] 80s Get:34 http://ftpmaster.internal/ubuntu resolute/main amd64 libxtables12 amd64 1.8.11-2ubuntu3 [36.6 kB] 80s Get:35 http://ftpmaster.internal/ubuntu resolute/main amd64 iproute2 amd64 6.18.0-1ubuntu1 [1178 kB] 80s Get:36 http://ftpmaster.internal/ubuntu resolute/main amd64 less amd64 668-1build1 [172 kB] 80s Get:37 http://ftpmaster.internal/ubuntu resolute/main amd64 libcryptsetup12 amd64 2:2.8.0-1ubuntu3 [283 kB] 80s Get:38 http://ftpmaster.internal/ubuntu resolute/main amd64 libglib2.0-data all 2.87.2-2 [58.2 kB] 80s Get:39 http://ftpmaster.internal/ubuntu resolute/main amd64 libidn2-0 amd64 2.3.8-4build1 [67.6 kB] 80s Get:40 http://ftpmaster.internal/ubuntu resolute/main amd64 libkeyutils1 amd64 1.6.3-6ubuntu3 [10.6 kB] 80s Get:41 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-linkify-it all 2.0.3-1ubuntu3 [19.4 kB] 80s Get:42 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-markdown-it all 3.0.0-3build1 [54.4 kB] 80s Get:43 http://ftpmaster.internal/ubuntu resolute/main amd64 shared-mime-info amd64 2.4-5build3 [476 kB] 80s Get:44 http://ftpmaster.internal/ubuntu resolute/main amd64 busybox-static amd64 1:1.37.0-7ubuntu1 [1034 kB] 80s Get:45 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm-common all 2.4.131-1 [9774 B] 80s Get:46 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm2 amd64 2.4.131-1 [42.3 kB] 80s Get:47 http://ftpmaster.internal/ubuntu resolute/main amd64 libgdbm6t64 amd64 1.26-1build1 [36.5 kB] 80s Get:48 http://ftpmaster.internal/ubuntu resolute/main amd64 libgpm2 amd64 1.20.7-12build1 [14.4 kB] 80s Get:49 http://ftpmaster.internal/ubuntu resolute/main amd64 libjansson4 amd64 2.14-2build4 [33.2 kB] 80s Get:50 http://ftpmaster.internal/ubuntu resolute/main amd64 lsof amd64 4.99.4+dfsg-2build2 [239 kB] 80s Get:51 http://ftpmaster.internal/ubuntu resolute/main amd64 liblsof0 amd64 4.99.4+dfsg-2build2 [56.5 kB] 80s Get:52 http://ftpmaster.internal/ubuntu resolute/main amd64 libmaxminddb0 amd64 1.12.2-1build2 [18.9 kB] 80s Get:53 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcap0.8t64 amd64 1.10.5-2ubuntu3 [154 kB] 80s Get:54 http://ftpmaster.internal/ubuntu resolute/main amd64 pciutils amd64 1:3.14.0-1build2 [95.5 kB] 80s Get:55 http://ftpmaster.internal/ubuntu resolute/main amd64 libpci3 amd64 1:3.14.0-1build2 [38.1 kB] 80s Get:56 http://ftpmaster.internal/ubuntu resolute/main amd64 libsensors-config all 1:3.6.2-2build1 [6862 B] 80s Get:57 http://ftpmaster.internal/ubuntu resolute/main amd64 libsensors5 amd64 1:3.6.2-2build1 [28.9 kB] 80s Get:58 http://ftpmaster.internal/ubuntu resolute/main amd64 libusb-1.0-0 amd64 2:1.0.29-2build1 [56.9 kB] 80s Get:59 http://ftpmaster.internal/ubuntu resolute/main amd64 libxau6 amd64 1:1.0.11-1build2 [7502 B] 80s Get:60 http://ftpmaster.internal/ubuntu resolute/main amd64 libxkbcommon0 amd64 1.13.1-1 [159 kB] 80s Get:61 http://ftpmaster.internal/ubuntu resolute/main amd64 man-db amd64 2.13.1-1build1 [1392 kB] 80s Get:62 http://ftpmaster.internal/ubuntu resolute/main amd64 tcpdump amd64 4.99.5-2ubuntu3 [477 kB] 80s Get:63 http://ftpmaster.internal/ubuntu resolute/main amd64 wget amd64 1.25.0-2ubuntu4 [353 kB] 80s Get:64 http://ftpmaster.internal/ubuntu resolute/main amd64 ubuntu-standard amd64 1.564 [13.3 kB] 80s Get:65 http://ftpmaster.internal/ubuntu resolute/main amd64 3cpio amd64 0.14.0-1ubuntu1 [285 kB] 80s Get:66 http://ftpmaster.internal/ubuntu resolute/main amd64 bpftool amd64 7.7.0+6.19.0-3.3 [1229 kB] 80s Get:67 http://ftpmaster.internal/ubuntu resolute/main amd64 busybox-initramfs amd64 1:1.37.0-7ubuntu1 [191 kB] 80s Get:68 http://ftpmaster.internal/ubuntu resolute/main amd64 cryptsetup-bin amd64 2:2.8.0-1ubuntu3 [228 kB] 80s Get:69 http://ftpmaster.internal/ubuntu resolute/main amd64 dracut-install amd64 109-11ubuntu1 [45.8 kB] 80s Get:70 http://ftpmaster.internal/ubuntu resolute/main amd64 hwdata all 0.394-1build1 [1566 B] 80s Get:71 http://ftpmaster.internal/ubuntu resolute/main amd64 pnp.ids all 0.394-1build1 [29.6 kB] 80s Get:72 http://ftpmaster.internal/ubuntu resolute/main amd64 libbrotli1 amd64 1.2.0-3 [343 kB] 80s Get:73 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm-amdgpu1 amd64 2.4.131-1 [23.2 kB] 80s Get:74 http://ftpmaster.internal/ubuntu resolute/main amd64 libevent-core-2.1-7t64 amd64 2.1.12-stable-10build2 [93.1 kB] 80s Get:75 http://ftpmaster.internal/ubuntu resolute/main amd64 libgdbm-compat4t64 amd64 1.26-1build1 [6796 B] 80s Get:76 http://ftpmaster.internal/ubuntu resolute/main amd64 libgudev-1.0-0 amd64 1:238-7build1 [15.9 kB] 80s Get:77 http://ftpmaster.internal/ubuntu resolute/main amd64 libnpth0t64 amd64 1.8-3build1 [9302 B] 80s Get:78 http://ftpmaster.internal/ubuntu resolute/main amd64 libonig5 amd64 6.9.10-1build1 [174 kB] 80s Get:79 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14-minimal amd64 3.14.2-1 [920 kB] 81s Get:80 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14-stdlib amd64 3.14.2-1 [2398 kB] 81s Get:81 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14 amd64 3.14.2-1 [2568 kB] 81s Get:82 http://ftpmaster.internal/ubuntu resolute/main amd64 libwrap0 amd64 7.6.q-36build2 [48.5 kB] 81s Get:83 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-modules-6.19.0-3-generic amd64 6.19.0-3.3 [171 MB] 87s Get:84 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-6.19.0-3-generic amd64 6.19.0-3.3+1 [16.8 MB] 87s Get:85 http://ftpmaster.internal/ubuntu resolute/main amd64 amd64-microcode amd64 3.20251202.1ubuntu1 [459 kB] 87s Get:86 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-generic amd64 6.19.0-3.3 [1698 B] 87s Get:87 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-generic amd64 6.19.0-3.3 [12.2 kB] 87s Get:88 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-virtual amd64 6.19.0-3.3 [1700 B] 87s Get:89 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-virtual amd64 6.19.0-3.3 [12.1 kB] 87s Get:90 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-virtual amd64 6.19.0-3.3 [1646 B] 87s Get:91 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-6.19.0-3 all 6.19.0-3.3 [14.9 MB] 87s Get:92 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-6.19.0-3-generic amd64 6.19.0-3.3 [4330 kB] 88s Get:93 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-generic amd64 6.19.0-3.3 [12.0 kB] 88s Get:94 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-perf amd64 6.19.0-3.3 [4480 kB] 88s Get:95 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-common all 6.19.0-3.3 [345 kB] 88s Get:96 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-6.19.0-3 amd64 6.19.0-3.3 [1455 kB] 88s Get:97 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-6.19.0-3-generic amd64 6.19.0-3.3 [1612 B] 88s Get:98 http://ftpmaster.internal/ubuntu resolute/main amd64 patch amd64 2.8-2build1 [95.7 kB] 88s Get:99 http://ftpmaster.internal/ubuntu resolute/main amd64 pollinate all 4.33-4ubuntu5 [14.0 kB] 88s Get:100 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-referencing all 0.36.2-1ubuntu2 [22.2 kB] 88s Get:101 http://ftpmaster.internal/ubuntu resolute/main amd64 ubuntu-kernel-accessories amd64 1.564 [13.1 kB] 88s dpkg-preconfigure: unable to re-open stdin: No such file or directory 88s Fetched 237 MB in 9s (27.5 MB/s) 88s (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 ... 83957 files and directories currently installed.) 88s Preparing to unpack .../debianutils_5.23.2build1_amd64.deb ... 88s Unpacking debianutils (5.23.2build1) over (5.23.2) ... 88s Setting up debianutils (5.23.2build1) ... 88s (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 ... 83957 files and directories currently installed.) 88s Preparing to unpack .../dash_0.5.12-12ubuntu3_amd64.deb ... 88s Unpacking dash (0.5.12-12ubuntu3) over (0.5.12-12ubuntu2) ... 88s Setting up dash (0.5.12-12ubuntu3) ... 88s (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 ... 83957 files and directories currently installed.) 88s Preparing to unpack .../findutils_4.10.0-3build2_amd64.deb ... 88s Unpacking findutils (4.10.0-3build2) over (4.10.0-3build1) ... 88s Setting up findutils (4.10.0-3build2) ... 88s (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 ... 83957 files and directories currently installed.) 88s Preparing to unpack .../sed_4.9-2build3_amd64.deb ... 88s Unpacking sed (4.9-2build3) over (4.9-2build2) ... 88s Setting up sed (4.9-2build3) ... 89s (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 ... 83957 files and directories currently installed.) 89s Preparing to unpack .../tar_1.35+dfsg-3.1build2_amd64.deb ... 89s Unpacking tar (1.35+dfsg-3.1build2) over (1.35+dfsg-3.1build1) ... 89s Setting up tar (1.35+dfsg-3.1build2) ... 89s (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 ... 83957 files and directories currently installed.) 89s Preparing to unpack .../libattr1_1%3a2.5.2-3build2_amd64.deb ... 89s Unpacking libattr1:amd64 (1:2.5.2-3build2) over (1:2.5.2-3build1) ... 89s Setting up libattr1:amd64 (1:2.5.2-3build2) ... 89s Selecting previously unselected package gcc-16-base:amd64. 89s (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 ... 83957 files and directories currently installed.) 89s Preparing to unpack .../gcc-16-base_16-20260208-1ubuntu1_amd64.deb ... 89s Unpacking gcc-16-base:amd64 (16-20260208-1ubuntu1) ... 89s Setting up gcc-16-base:amd64 (16-20260208-1ubuntu1) ... 89s (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 ... 83962 files and directories currently installed.) 89s Preparing to unpack .../libgcc-s1_16-20260208-1ubuntu1_amd64.deb ... 89s Unpacking libgcc-s1:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 89s Setting up libgcc-s1:amd64 (16-20260208-1ubuntu1) ... 89s (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 ... 83962 files and directories currently installed.) 89s Preparing to unpack .../00-libbsd0_0.12.2-2build2_amd64.deb ... 89s Unpacking libbsd0:amd64 (0.12.2-2build2) over (0.12.2-2build1) ... 89s Preparing to unpack .../01-mawk_1.3.4.20260129-1_amd64.deb ... 89s Unpacking mawk (1.3.4.20260129-1) over (1.3.4.20250131-2) ... 89s Preparing to unpack .../02-libstdc++6_16-20260208-1ubuntu1_amd64.deb ... 89s Unpacking libstdc++6:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 89s Preparing to unpack .../03-libapt-pkg7.0_3.1.15_amd64.deb ... 89s Unpacking libapt-pkg7.0:amd64 (3.1.15) over (3.1.14) ... 89s Preparing to unpack .../04-apt_3.1.15_amd64.deb ... 89s Unpacking apt (3.1.15) over (3.1.14) ... 89s Preparing to unpack .../05-dbus-system-bus-common_1.16.2-2ubuntu3_all.deb ... 89s Unpacking dbus-system-bus-common (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../06-dbus-session-bus-common_1.16.2-2ubuntu3_all.deb ... 89s Unpacking dbus-session-bus-common (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../07-dbus-user-session_1.16.2-2ubuntu3_amd64.deb ... 89s Unpacking dbus-user-session (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../08-dbus-daemon_1.16.2-2ubuntu3_amd64.deb ... 89s Unpacking dbus-daemon (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../09-dbus-bin_1.16.2-2ubuntu3_amd64.deb ... 89s Unpacking dbus-bin (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../10-dbus_1.16.2-2ubuntu3_amd64.deb ... 89s Unpacking dbus (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../11-libdbus-1-3_1.16.2-2ubuntu3_amd64.deb ... 89s Unpacking libdbus-1-3:amd64 (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 89s Preparing to unpack .../12-libdevmapper1.02.1_2%3a1.02.205-2ubuntu3_amd64.deb ... 89s Unpacking libdevmapper1.02.1:amd64 (2:1.02.205-2ubuntu3) over (2:1.02.205-2ubuntu2) ... 89s Preparing to unpack .../13-dmsetup_2%3a1.02.205-2ubuntu3_amd64.deb ... 89s Unpacking dmsetup (2:1.02.205-2ubuntu3) over (2:1.02.205-2ubuntu2) ... 89s Preparing to unpack .../14-ethtool_1%3a6.15-3build1_amd64.deb ... 89s Unpacking ethtool (1:6.15-3build1) over (1:6.15-3) ... 89s Preparing to unpack .../15-gir1.2-girepository-3.0_2.87.2-2_amd64.deb ... 89s Unpacking gir1.2-girepository-3.0:amd64 (2.87.2-2) over (2.86.3-4) ... 89s Preparing to unpack .../16-libgirepository-2.0-0_2.87.2-2_amd64.deb ... 89s Unpacking libgirepository-2.0-0:amd64 (2.87.2-2) over (2.86.3-4) ... 89s Preparing to unpack .../17-libatomic1_16-20260208-1ubuntu1_amd64.deb ... 89s Unpacking libatomic1:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 89s Preparing to unpack .../18-gir1.2-glib-2.0_2.87.2-2_amd64.deb ... 89s Unpacking gir1.2-glib-2.0:amd64 (2.87.2-2) over (2.86.3-4) ... 90s Preparing to unpack .../19-libglib2.0-0t64_2.87.2-2_amd64.deb ... 90s Unpacking libglib2.0-0t64:amd64 (2.87.2-2) over (2.86.3-4) ... 90s Preparing to unpack .../20-libbpf1_1%3a1.6.2-1build1_amd64.deb ... 90s Unpacking libbpf1:amd64 (1:1.6.2-1build1) over (1:1.6.2-1) ... 90s Preparing to unpack .../21-iptables_1.8.11-2ubuntu3_amd64.deb ... 90s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 90s Preparing to unpack .../22-libip4tc2_1.8.11-2ubuntu3_amd64.deb ... 90s Unpacking libip4tc2:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 90s Preparing to unpack .../23-libip6tc2_1.8.11-2ubuntu3_amd64.deb ... 90s Unpacking libip6tc2:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 90s Preparing to unpack .../24-libnetfilter-conntrack3_1.1.1-1_amd64.deb ... 90s Unpacking libnetfilter-conntrack3:amd64 (1.1.1-1) over (1.1.0-1build1) ... 90s Preparing to unpack .../25-libxtables12_1.8.11-2ubuntu3_amd64.deb ... 90s Unpacking libxtables12:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 90s Preparing to unpack .../26-iproute2_6.18.0-1ubuntu1_amd64.deb ... 90s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 90s Preparing to unpack .../27-less_668-1build1_amd64.deb ... 90s Unpacking less (668-1build1) over (668-1) ... 90s Preparing to unpack .../28-libcryptsetup12_2%3a2.8.0-1ubuntu3_amd64.deb ... 90s Unpacking libcryptsetup12:amd64 (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 90s Preparing to unpack .../29-libglib2.0-data_2.87.2-2_all.deb ... 90s Unpacking libglib2.0-data (2.87.2-2) over (2.86.3-4) ... 90s Preparing to unpack .../30-libidn2-0_2.3.8-4build1_amd64.deb ... 90s Unpacking libidn2-0:amd64 (2.3.8-4build1) over (2.3.8-4) ... 90s Preparing to unpack .../31-libkeyutils1_1.6.3-6ubuntu3_amd64.deb ... 90s Unpacking libkeyutils1:amd64 (1.6.3-6ubuntu3) over (1.6.3-6ubuntu2) ... 90s Preparing to unpack .../32-python3-linkify-it_2.0.3-1ubuntu3_all.deb ... 90s Unpacking python3-linkify-it (2.0.3-1ubuntu3) over (2.0.3-1ubuntu2) ... 90s Preparing to unpack .../33-python3-markdown-it_3.0.0-3build1_all.deb ... 90s Unpacking python3-markdown-it (3.0.0-3build1) over (3.0.0-3) ... 90s Preparing to unpack .../34-shared-mime-info_2.4-5build3_amd64.deb ... 90s Unpacking shared-mime-info (2.4-5build3) over (2.4-5build2) ... 90s Preparing to unpack .../35-busybox-static_1%3a1.37.0-7ubuntu1_amd64.deb ... 90s Unpacking busybox-static (1:1.37.0-7ubuntu1) over (1:1.37.0-4ubuntu1) ... 90s Preparing to unpack .../36-libdrm-common_2.4.131-1_all.deb ... 90s Unpacking libdrm-common (2.4.131-1) over (2.4.129-1) ... 90s Preparing to unpack .../37-libdrm2_2.4.131-1_amd64.deb ... 90s Unpacking libdrm2:amd64 (2.4.131-1) over (2.4.129-1) ... 90s Preparing to unpack .../38-libgdbm6t64_1.26-1build1_amd64.deb ... 90s Unpacking libgdbm6t64:amd64 (1.26-1build1) over (1.26-1) ... 90s Preparing to unpack .../39-libgpm2_1.20.7-12build1_amd64.deb ... 90s Unpacking libgpm2:amd64 (1.20.7-12build1) over (1.20.7-12) ... 90s Preparing to unpack .../40-libjansson4_2.14-2build4_amd64.deb ... 90s Unpacking libjansson4:amd64 (2.14-2build4) over (2.14-2build3) ... 90s Preparing to unpack .../41-lsof_4.99.4+dfsg-2build2_amd64.deb ... 90s Unpacking lsof (4.99.4+dfsg-2build2) over (4.99.4+dfsg-2build1) ... 91s Preparing to unpack .../42-liblsof0_4.99.4+dfsg-2build2_amd64.deb ... 91s Unpacking liblsof0 (4.99.4+dfsg-2build2) over (4.99.4+dfsg-2build1) ... 91s Preparing to unpack .../43-libmaxminddb0_1.12.2-1build2_amd64.deb ... 91s Unpacking libmaxminddb0:amd64 (1.12.2-1build2) over (1.12.2-1build1) ... 91s Preparing to unpack .../44-libpcap0.8t64_1.10.5-2ubuntu3_amd64.deb ... 91s Unpacking libpcap0.8t64:amd64 (1.10.5-2ubuntu3) over (1.10.5-2ubuntu2) ... 91s Preparing to unpack .../45-pciutils_1%3a3.14.0-1build2_amd64.deb ... 91s Unpacking pciutils (1:3.14.0-1build2) over (1:3.14.0-1build1) ... 91s Preparing to unpack .../46-libpci3_1%3a3.14.0-1build2_amd64.deb ... 91s Unpacking libpci3:amd64 (1:3.14.0-1build2) over (1:3.14.0-1build1) ... 91s Preparing to unpack .../47-libsensors-config_1%3a3.6.2-2build1_all.deb ... 91s Unpacking libsensors-config (1:3.6.2-2build1) over (1:3.6.2-2) ... 91s Preparing to unpack .../48-libsensors5_1%3a3.6.2-2build1_amd64.deb ... 91s Unpacking libsensors5:amd64 (1:3.6.2-2build1) over (1:3.6.2-2) ... 91s Preparing to unpack .../49-libusb-1.0-0_2%3a1.0.29-2build1_amd64.deb ... 91s Unpacking libusb-1.0-0:amd64 (2:1.0.29-2build1) over (2:1.0.29-2) ... 91s Preparing to unpack .../50-libxau6_1%3a1.0.11-1build2_amd64.deb ... 91s Unpacking libxau6:amd64 (1:1.0.11-1build2) over (1:1.0.11-1build1) ... 91s Preparing to unpack .../51-libxkbcommon0_1.13.1-1_amd64.deb ... 91s Unpacking libxkbcommon0:amd64 (1.13.1-1) over (1.12.3-1) ... 91s Preparing to unpack .../52-man-db_2.13.1-1build1_amd64.deb ... 91s Unpacking man-db (2.13.1-1build1) over (2.13.1-1) ... 91s Preparing to unpack .../53-tcpdump_4.99.5-2ubuntu3_amd64.deb ... 91s Unpacking tcpdump (4.99.5-2ubuntu3) over (4.99.5-2ubuntu2) ... 91s Preparing to unpack .../54-wget_1.25.0-2ubuntu4_amd64.deb ... 91s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 91s Preparing to unpack .../55-ubuntu-standard_1.564_amd64.deb ... 91s Unpacking ubuntu-standard (1.564) over (1.563) ... 91s Preparing to unpack .../56-3cpio_0.14.0-1ubuntu1_amd64.deb ... 91s Unpacking 3cpio (0.14.0-1ubuntu1) over (0.13.1-1ubuntu1) ... 91s Preparing to unpack .../57-bpftool_7.7.0+6.19.0-3.3_amd64.deb ... 91s Unpacking bpftool (7.7.0+6.19.0-3.3) over (7.7.0+6.18.0-9.9) ... 91s Preparing to unpack .../58-busybox-initramfs_1%3a1.37.0-7ubuntu1_amd64.deb ... 91s Unpacking busybox-initramfs (1:1.37.0-7ubuntu1) over (1:1.37.0-4ubuntu1) ... 91s Preparing to unpack .../59-cryptsetup-bin_2%3a2.8.0-1ubuntu3_amd64.deb ... 91s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 91s Preparing to unpack .../60-dracut-install_109-11ubuntu1_amd64.deb ... 91s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 91s Preparing to unpack .../61-hwdata_0.394-1build1_all.deb ... 91s Unpacking hwdata (0.394-1build1) over (0.394-1) ... 91s Preparing to unpack .../62-pnp.ids_0.394-1build1_all.deb ... 91s Unpacking pnp.ids (0.394-1build1) over (0.394-1) ... 91s Preparing to unpack .../63-libbrotli1_1.2.0-3_amd64.deb ... 91s Unpacking libbrotli1:amd64 (1.2.0-3) over (1.1.0-2build6) ... 91s Preparing to unpack .../64-libdrm-amdgpu1_2.4.131-1_amd64.deb ... 91s Unpacking libdrm-amdgpu1:amd64 (2.4.131-1) over (2.4.129-1) ... 91s Preparing to unpack .../65-libevent-core-2.1-7t64_2.1.12-stable-10build2_amd64.deb ... 91s Unpacking libevent-core-2.1-7t64:amd64 (2.1.12-stable-10build2) over (2.1.12-stable-10build1) ... 91s Preparing to unpack .../66-libgdbm-compat4t64_1.26-1build1_amd64.deb ... 91s Unpacking libgdbm-compat4t64:amd64 (1.26-1build1) over (1.26-1) ... 91s Preparing to unpack .../67-libgudev-1.0-0_1%3a238-7build1_amd64.deb ... 91s Unpacking libgudev-1.0-0:amd64 (1:238-7build1) over (1:238-7) ... 91s Preparing to unpack .../68-libnpth0t64_1.8-3build1_amd64.deb ... 91s Unpacking libnpth0t64:amd64 (1.8-3build1) over (1.8-3) ... 91s Preparing to unpack .../69-libonig5_6.9.10-1build1_amd64.deb ... 91s Unpacking libonig5:amd64 (6.9.10-1build1) over (6.9.10-1) ... 91s Selecting previously unselected package libpython3.14-minimal:amd64. 91s Preparing to unpack .../70-libpython3.14-minimal_3.14.2-1_amd64.deb ... 91s Unpacking libpython3.14-minimal:amd64 (3.14.2-1) ... 91s Selecting previously unselected package libpython3.14-stdlib:amd64. 91s Preparing to unpack .../71-libpython3.14-stdlib_3.14.2-1_amd64.deb ... 91s Unpacking libpython3.14-stdlib:amd64 (3.14.2-1) ... 91s Selecting previously unselected package libpython3.14:amd64. 91s Preparing to unpack .../72-libpython3.14_3.14.2-1_amd64.deb ... 91s Unpacking libpython3.14:amd64 (3.14.2-1) ... 92s Preparing to unpack .../73-libwrap0_7.6.q-36build2_amd64.deb ... 92s Unpacking libwrap0:amd64 (7.6.q-36build2) over (7.6.q-36build1) ... 92s Selecting previously unselected package linux-modules-6.19.0-3-generic. 92s Preparing to unpack .../74-linux-modules-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 92s Unpacking linux-modules-6.19.0-3-generic (6.19.0-3.3) ... 92s Selecting previously unselected package linux-image-6.19.0-3-generic. 92s Preparing to unpack .../75-linux-image-6.19.0-3-generic_6.19.0-3.3+1_amd64.deb ... 92s Unpacking linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 92s Preparing to unpack .../76-amd64-microcode_3.20251202.1ubuntu1_amd64.deb ... 92s Unpacking amd64-microcode (3.20251202.1ubuntu1) over (3.20250708.1ubuntu1) ... 92s Preparing to unpack .../77-linux-generic_6.19.0-3.3_amd64.deb ... 92s Unpacking linux-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 92s Preparing to unpack .../78-linux-image-generic_6.19.0-3.3_amd64.deb ... 92s Unpacking linux-image-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 93s Preparing to unpack .../79-linux-virtual_6.19.0-3.3_amd64.deb ... 93s Unpacking linux-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 93s Preparing to unpack .../80-linux-image-virtual_6.19.0-3.3_amd64.deb ... 93s Unpacking linux-image-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 93s Preparing to unpack .../81-linux-headers-virtual_6.19.0-3.3_amd64.deb ... 93s Unpacking linux-headers-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 93s Selecting previously unselected package linux-headers-6.19.0-3. 93s Preparing to unpack .../82-linux-headers-6.19.0-3_6.19.0-3.3_all.deb ... 93s Unpacking linux-headers-6.19.0-3 (6.19.0-3.3) ... 94s Selecting previously unselected package linux-headers-6.19.0-3-generic. 94s Preparing to unpack .../83-linux-headers-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 94s Unpacking linux-headers-6.19.0-3-generic (6.19.0-3.3) ... 94s Preparing to unpack .../84-linux-headers-generic_6.19.0-3.3_amd64.deb ... 94s Unpacking linux-headers-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 94s Preparing to unpack .../85-linux-perf_6.19.0-3.3_amd64.deb ... 94s Unpacking linux-perf (6.19.0-3.3) over (6.18.0-9.9) ... 94s Preparing to unpack .../86-linux-tools-common_6.19.0-3.3_all.deb ... 94s Unpacking linux-tools-common (6.19.0-3.3) over (6.18.0-9.9) ... 94s Selecting previously unselected package linux-tools-6.19.0-3. 94s Preparing to unpack .../87-linux-tools-6.19.0-3_6.19.0-3.3_amd64.deb ... 94s Unpacking linux-tools-6.19.0-3 (6.19.0-3.3) ... 95s Selecting previously unselected package linux-tools-6.19.0-3-generic. 95s Preparing to unpack .../88-linux-tools-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 95s Unpacking linux-tools-6.19.0-3-generic (6.19.0-3.3) ... 95s Preparing to unpack .../89-patch_2.8-2build1_amd64.deb ... 95s Unpacking patch (2.8-2build1) over (2.8-2) ... 95s Preparing to unpack .../90-pollinate_4.33-4ubuntu5_all.deb ... 95s Unpacking pollinate (4.33-4ubuntu5) over (4.33-4ubuntu4) ... 95s Preparing to unpack .../91-python3-referencing_0.36.2-1ubuntu2_all.deb ... 95s Unpacking python3-referencing (0.36.2-1ubuntu2) over (0.36.2-1ubuntu1) ... 95s Preparing to unpack .../92-ubuntu-kernel-accessories_1.564_amd64.deb ... 95s Unpacking ubuntu-kernel-accessories (1.564) over (1.563) ... 95s Setting up libip4tc2:amd64 (1.8.11-2ubuntu3) ... 95s Setting up 3cpio (0.14.0-1ubuntu1) ... 95s Setting up libxau6:amd64 (1:1.0.11-1build2) ... 95s Setting up libnpth0t64:amd64 (1.8-3build1) ... 95s Setting up libkeyutils1:amd64 (1.6.3-6ubuntu3) ... 95s Setting up ubuntu-kernel-accessories (1.564) ... 95s Setting up libgpm2:amd64 (1.20.7-12build1) ... 95s Setting up libgdbm6t64:amd64 (1.26-1build1) ... 95s Setting up linux-modules-6.19.0-3-generic (6.19.0-3.3) ... 96s Setting up libgdbm-compat4t64:amd64 (1.26-1build1) ... 96s Setting up bpftool (7.7.0+6.19.0-3.3) ... 96s Setting up libip6tc2:amd64 (1.8.11-2ubuntu3) ... 96s Setting up liblsof0 (4.99.4+dfsg-2build2) ... 96s Setting up libmaxminddb0:amd64 (1.12.2-1build2) ... 96s Setting up libbrotli1:amd64 (1.2.0-3) ... 96s Setting up libpython3.14-minimal:amd64 (3.14.2-1) ... 96s Setting up libsensors-config (1:3.6.2-2build1) ... 96s Setting up less (668-1build1) ... 96s Setting up linux-headers-6.19.0-3 (6.19.0-3.3) ... 96s Setting up libidn2-0:amd64 (2.3.8-4build1) ... 96s Setting up amd64-microcode (3.20251202.1ubuntu1) ... 96s amd64-microcode: microcode will be updated at next boot 96s Setting up man-db (2.13.1-1build1) ... 96s Updating database of manual pages ... 98s man-db.service is a disabled or a static unit not running, not starting it. 98s Setting up libjansson4:amd64 (2.14-2build4) ... 98s Setting up libglib2.0-data (2.87.2-2) ... 98s Setting up pollinate (4.33-4ubuntu5) ... 108s Setting up busybox-static (1:1.37.0-7ubuntu1) ... 108s Setting up libwrap0:amd64 (7.6.q-36build2) ... 108s Setting up linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 109s I: /boot/vmlinuz is now a symlink to vmlinuz-6.19.0-3-generic 109s I: /boot/initrd.img is now a symlink to initrd.img-6.19.0-3-generic 109s Setting up libdbus-1-3:amd64 (1.16.2-2ubuntu3) ... 109s Setting up libatomic1:amd64 (16-20260208-1ubuntu1) ... 109s Setting up patch (2.8-2build1) ... 109s Setting up libsensors5:amd64 (1:3.6.2-2build1) ... 109s Setting up busybox-initramfs (1:1.37.0-7ubuntu1) ... 109s Setting up libxtables12:amd64 (1.8.11-2ubuntu3) ... 109s Setting up lsof (4.99.4+dfsg-2build2) ... 109s Setting up libpci3:amd64 (1:3.14.0-1build2) ... 109s Setting up libdevmapper1.02.1:amd64 (2:1.02.205-2ubuntu3) ... 109s Setting up dracut-install (109-11ubuntu1) ... 109s Setting up dmsetup (2:1.02.205-2ubuntu3) ... 109s Setting up libnetfilter-conntrack3:amd64 (1.1.1-1) ... 109s Setting up pnp.ids (0.394-1build1) ... 109s Setting up dbus-session-bus-common (1.16.2-2ubuntu3) ... 109s Setting up python3-linkify-it (2.0.3-1ubuntu3) ... 109s Setting up libpcap0.8t64:amd64 (1.10.5-2ubuntu3) ... 109s Setting up libcryptsetup12:amd64 (2:2.8.0-1ubuntu3) ... 109s Setting up mawk (1.3.4.20260129-1) ... 109s Setting up libevent-core-2.1-7t64:amd64 (2.1.12-stable-10build2) ... 109s Setting up libusb-1.0-0:amd64 (2:1.0.29-2build1) ... 109s Setting up linux-image-virtual (6.19.0-3.3) ... 109s Setting up dbus-system-bus-common (1.16.2-2ubuntu3) ... 109s Setting up libbsd0:amd64 (0.12.2-2build2) ... 109s Setting up libdrm-common (2.4.131-1) ... 109s Setting up libstdc++6:amd64 (16-20260208-1ubuntu1) ... 109s Setting up dbus-bin (1.16.2-2ubuntu3) ... 109s Setting up libonig5:amd64 (6.9.10-1build1) ... 109s Setting up libbpf1:amd64 (1:1.6.2-1build1) ... 109s Setting up ethtool (1:6.15-3build1) ... 109s Setting up python3-referencing (0.36.2-1ubuntu2) ... 110s Setting up libxkbcommon0:amd64 (1.13.1-1) ... 110s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 110s Setting up linux-headers-6.19.0-3-generic (6.19.0-3.3) ... 110s Setting up tcpdump (4.99.5-2ubuntu3) ... 110s Setting up linux-image-generic (6.19.0-3.3) ... 110s Setting up wget (1.25.0-2ubuntu4) ... 110s Setting up libpython3.14-stdlib:amd64 (3.14.2-1) ... 110s Setting up iptables (1.8.11-2ubuntu3) ... 110s Setting up iproute2 (6.18.0-1ubuntu1) ... 110s Setting up linux-headers-generic (6.19.0-3.3) ... 110s Setting up dbus-daemon (1.16.2-2ubuntu3) ... 110s Setting up hwdata (0.394-1build1) ... 110s Setting up dbus-user-session (1.16.2-2ubuntu3) ... 110s Setting up libglib2.0-0t64:amd64 (2.87.2-2) ... 110s No schema files found: doing nothing. 110s Setting up dbus (1.16.2-2ubuntu3) ... 110s A reboot is required to replace the running dbus-daemon. 110s Please reboot the system when convenient. 110s Setting up shared-mime-info (2.4-5build3) ... 111s Setting up gir1.2-glib-2.0:amd64 (2.87.2-2) ... 111s Setting up pciutils (1:3.14.0-1build2) ... 111s Setting up python3-markdown-it (3.0.0-3build1) ... 111s Setting up libdrm2:amd64 (2.4.131-1) ... 111s Setting up libpython3.14:amd64 (3.14.2-1) ... 111s Setting up libapt-pkg7.0:amd64 (3.1.15) ... 111s Setting up linux-tools-common (6.19.0-3.3) ... 111s Setting up libgudev-1.0-0:amd64 (1:238-7build1) ... 111s Setting up libdrm-amdgpu1:amd64 (2.4.131-1) ... 111s Setting up apt (3.1.15) ... 111s Setting up linux-headers-virtual (6.19.0-3.3) ... 111s Setting up linux-generic (6.19.0-3.3) ... 111s Setting up libgirepository-2.0-0:amd64 (2.87.2-2) ... 111s Setting up linux-tools-6.19.0-3 (6.19.0-3.3) ... 111s Setting up ubuntu-standard (1.564) ... 111s Setting up gir1.2-girepository-3.0:amd64 (2.87.2-2) ... 111s Setting up linux-virtual (6.19.0-3.3) ... 111s Setting up linux-perf (6.19.0-3.3) ... 111s Setting up linux-tools-6.19.0-3-generic (6.19.0-3.3) ... 111s Processing triggers for debianutils (5.23.2build1) ... 111s Processing triggers for install-info (7.2-5) ... 111s Processing triggers for initramfs-tools (0.150ubuntu7) ... 111s update-initramfs: Generating /boot/initrd.img-6.18.0-9-generic 116s Processing triggers for libc-bin (2.42-2ubuntu4) ... 116s Processing triggers for linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 116s /etc/kernel/postinst.d/initramfs-tools: 116s update-initramfs: Generating /boot/initrd.img-6.19.0-3-generic 120s /etc/kernel/postinst.d/zz-update-grub: 120s Sourcing file `/etc/default/grub' 120s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 120s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 120s Generating grub configuration file ... 120s Found linux image: /boot/vmlinuz-6.19.0-3-generic 120s Found initrd image: /boot/initrd.img-6.19.0-3-generic 120s Found linux image: /boot/vmlinuz-6.18.0-9-generic 120s Found initrd image: /boot/initrd.img-6.18.0-9-generic 120s Warning: os-prober will not be executed to detect other bootable partitions. 120s Systems on them will not be added to the GRUB boot configuration. 120s Check GRUB_DISABLE_OS_PROBER documentation entry. 120s Adding boot menu entry for UEFI Firmware Settings ... 120s done 120s autopkgtest [05:28:29]: upgrading testbed (apt dist-upgrade and autopurge) 121s Reading package lists... 121s Building dependency tree... 121s Reading state information... 121s Calculating upgrade... 121s The following package was automatically installed and is no longer required: 121s libpython3.13 121s Use 'sudo apt autoremove' to remove it. 121s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 122s Reading package lists... 122s Building dependency tree... 122s Reading state information... 122s Solving dependencies... 122s The following packages will be REMOVED: 122s libpython3.13* 122s 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 122s After this operation, 7599 kB disk space will be freed. 122s (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 ... 125273 files and directories currently installed.) 122s Removing libpython3.13:amd64 (3.13.11-1) ... 122s Processing triggers for libc-bin (2.42-2ubuntu4) ... 122s autopkgtest [05:28:31]: rebooting testbed after setup commands that affected boot 150s autopkgtest [05:28:59]: testbed running kernel: Linux 6.19.0-3-generic #3-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 23 20:01:24 UTC 2026 152s autopkgtest [05:29:01]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 153s Get:1 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (dsc) [2228 B] 153s Get:2 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (tar) [212 kB] 153s Get:3 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (diff) [4864 B] 153s gpgv: Signature made Sat Jan 18 11:46:01 2025 UTC 153s gpgv: using RSA key 724D609337113C710550D7473C26763F6C67E6E2 153s gpgv: Can't check signature: No public key 153s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.5.0-1.dsc: no acceptable signature found 153s autopkgtest [05:29:02]: testing package r-cran-matrixstats version 1.5.0-1 154s autopkgtest [05:29:03]: build not needed 155s autopkgtest [05:29:04]: test run-unit-test: preparing testbed 155s Reading package lists... 156s Building dependency tree... 156s Reading state information... 156s Solving dependencies... 156s The following NEW packages will be installed: 156s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 156s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libdatrie1 156s libdeflate0 libfontconfig1 libgfortran5 libgomp1 libgraphite2-3 156s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 156s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 156s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 156s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 156s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 156s libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 156s r-cran-base64enc r-cran-cli r-cran-commonmark r-cran-digest r-cran-evaluate 156s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 156s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle r-cran-markdown 156s r-cran-matrixstats r-cran-microbenchmark r-cran-r.cache r-cran-r.devices 156s r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils r-cran-r6 156s r-cran-rcolorbrewer r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs 156s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml tcl tcl8.6 unzip 156s x11-common xdg-utils zip 156s 0 upgraded, 87 newly installed, 0 to remove and 0 not upgraded. 156s Need to get 71.9 MB of archives. 156s After this operation, 171 MB of additional disk space will be used. 156s Get:1 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-dejavu-mono all 2.37-8build1 [502 kB] 156s Get:2 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-dejavu-core all 2.37-8build1 [834 kB] 156s Get:3 http://ftpmaster.internal/ubuntu resolute/main amd64 fontconfig-config amd64 2.17.1-3ubuntu1 [38.5 kB] 156s Get:4 http://ftpmaster.internal/ubuntu resolute/main amd64 libfontconfig1 amd64 2.17.1-3ubuntu1 [144 kB] 156s Get:5 http://ftpmaster.internal/ubuntu resolute/main amd64 fontconfig amd64 2.17.1-3ubuntu1 [180 kB] 156s Get:6 http://ftpmaster.internal/ubuntu resolute/universe amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 156s Get:7 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 156s Get:8 http://ftpmaster.internal/ubuntu resolute/main amd64 libblas3 amd64 3.12.1-7ubuntu1 [260 kB] 156s Get:9 http://ftpmaster.internal/ubuntu resolute/main amd64 libpixman-1-0 amd64 0.46.4-1 [287 kB] 156s Get:10 http://ftpmaster.internal/ubuntu resolute/main amd64 libxcb-render0 amd64 1.17.0-2ubuntu1 [16.2 kB] 156s Get:11 http://ftpmaster.internal/ubuntu resolute/main amd64 libxcb-shm0 amd64 1.17.0-2ubuntu1 [5808 B] 156s Get:12 http://ftpmaster.internal/ubuntu resolute/main amd64 libxrender1 amd64 1:0.9.12-1 [19.8 kB] 156s Get:13 http://ftpmaster.internal/ubuntu resolute/main amd64 libcairo2 amd64 1.18.4-3 [579 kB] 156s Get:14 http://ftpmaster.internal/ubuntu resolute/main amd64 libdatrie1 amd64 0.2.14-1 [19.8 kB] 156s Get:15 http://ftpmaster.internal/ubuntu resolute/main amd64 libdeflate0 amd64 1.23-2build1 [51.6 kB] 156s Get:16 http://ftpmaster.internal/ubuntu resolute/main amd64 libgfortran5 amd64 16-20260208-1ubuntu1 [957 kB] 156s Get:17 http://ftpmaster.internal/ubuntu resolute/main amd64 libgomp1 amd64 16-20260208-1ubuntu1 [162 kB] 156s Get:18 http://ftpmaster.internal/ubuntu resolute/main amd64 libgraphite2-3 amd64 1.3.14-11ubuntu1 [73.7 kB] 156s Get:19 http://ftpmaster.internal/ubuntu resolute/main amd64 libharfbuzz0b amd64 12.3.2-1 [519 kB] 156s Get:20 http://ftpmaster.internal/ubuntu resolute/main amd64 x11-common all 1:7.7+24ubuntu1 [22.4 kB] 156s Get:21 http://ftpmaster.internal/ubuntu resolute/main amd64 libice6 amd64 2:1.1.1-1build1 [44.0 kB] 156s Get:22 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg-turbo8 amd64 2.1.5-4ubuntu3 [156 kB] 156s Get:23 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg8 amd64 8c-2ubuntu12 [2142 B] 156s Get:24 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 156s Get:25 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 156s Get:26 http://ftpmaster.internal/ubuntu resolute/main amd64 libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 156s Get:27 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 156s Get:28 http://ftpmaster.internal/ubuntu resolute/main amd64 liblapack3 amd64 3.12.1-7ubuntu1 [2739 kB] 157s Get:29 http://ftpmaster.internal/ubuntu resolute/main amd64 liblerc4 amd64 4.0.0+ds-5ubuntu2 [207 kB] 157s Get:30 http://ftpmaster.internal/ubuntu resolute/main amd64 libthai-data all 0.1.30-1 [155 kB] 157s Get:31 http://ftpmaster.internal/ubuntu resolute/main amd64 libthai0 amd64 0.1.30-1 [19.2 kB] 157s Get:32 http://ftpmaster.internal/ubuntu resolute/main amd64 libpango-1.0-0 amd64 1.57.0-1 [241 kB] 157s Get:33 http://ftpmaster.internal/ubuntu resolute/main amd64 libpangoft2-1.0-0 amd64 1.57.0-1 [53.3 kB] 157s Get:34 http://ftpmaster.internal/ubuntu resolute/main amd64 libpangocairo-1.0-0 amd64 1.57.0-1 [29.0 kB] 157s Get:35 http://ftpmaster.internal/ubuntu resolute/main amd64 libpaper2 amd64 2.2.5-0.3build1 [17.3 kB] 157s Get:36 http://ftpmaster.internal/ubuntu resolute/main amd64 libpaper-utils amd64 2.2.5-0.3build1 [15.6 kB] 157s Get:37 http://ftpmaster.internal/ubuntu resolute/main amd64 libsharpyuv0 amd64 1.5.0-0.1build1 [17.6 kB] 157s Get:38 http://ftpmaster.internal/ubuntu resolute/main amd64 libsm6 amd64 2:1.2.6-1build1 [16.9 kB] 157s Get:39 http://ftpmaster.internal/ubuntu resolute/main amd64 libtcl8.6 amd64 8.6.17+dfsg-1build1 [1003 kB] 157s Get:40 http://ftpmaster.internal/ubuntu resolute/main amd64 libjbig0 amd64 2.1-6.1ubuntu3 [30.0 kB] 157s Get:41 http://ftpmaster.internal/ubuntu resolute/main amd64 libwebp7 amd64 1.5.0-0.1build1 [264 kB] 157s Get:42 http://ftpmaster.internal/ubuntu resolute/main amd64 libtiff6 amd64 4.7.0-3ubuntu3 [209 kB] 157s Get:43 http://ftpmaster.internal/ubuntu resolute/main amd64 libxft2 amd64 2.3.6-1build2 [45.1 kB] 157s Get:44 http://ftpmaster.internal/ubuntu resolute/main amd64 libxss1 amd64 1:1.2.3-1build4 [7084 B] 157s Get:45 http://ftpmaster.internal/ubuntu resolute/main amd64 libtk8.6 amd64 8.6.17-1 [823 kB] 157s Get:46 http://ftpmaster.internal/ubuntu resolute/main amd64 libxt6t64 amd64 1:1.2.1-1.3 [173 kB] 157s Get:47 http://ftpmaster.internal/ubuntu resolute/universe amd64 node-normalize.css all 8.0.1-5.1 [10.4 kB] 157s Get:48 http://ftpmaster.internal/ubuntu resolute/main amd64 zip amd64 3.0-15ubuntu3 [175 kB] 157s Get:49 http://ftpmaster.internal/ubuntu resolute/main amd64 unzip amd64 6.0-29ubuntu1 [180 kB] 157s Get:50 http://ftpmaster.internal/ubuntu resolute/main amd64 xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 157s Get:51 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-base-core amd64 4.5.2-1ubuntu2 [28.8 MB] 158s Get:52 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-base64enc amd64 0.1-3-3build1 [28.5 kB] 158s Get:53 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-cli amd64 3.6.4-1 [1394 kB] 158s Get:54 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-commonmark amd64 1.9.5-1 [138 kB] 158s Get:55 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-digest amd64 0.6.39-1 [203 kB] 158s Get:56 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-evaluate all 1.0.5-1 [117 kB] 158s Get:57 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-farver amd64 2.1.2-1 [1355 kB] 158s Get:58 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-glue amd64 1.8.0-1 [164 kB] 158s Get:59 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-rlang amd64 1.1.5-3 [1721 kB] 158s Get:60 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 158s Get:61 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 158s Get:62 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-isoband amd64 0.2.7-1 [1481 kB] 158s Get:63 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-s7 amd64 0.2.0-1 [328 kB] 158s Get:64 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-labeling all 0.4.3-1 [62.1 kB] 158s Get:65 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r6 all 2.6.1-1 [101 kB] 158s Get:66 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 158s Get:67 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-viridislite all 0.4.3-1 [1088 kB] 158s Get:68 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-scales all 1.4.0-1 [725 kB] 159s Get:69 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-vctrs amd64 0.6.5-1 [1335 kB] 159s Get:70 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 159s Get:71 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 159s Get:72 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-xfun amd64 0.55+dfsg-1 [587 kB] 159s Get:73 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 159s Get:74 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-yaml amd64 2.3.10-1 [109 kB] 159s Get:75 http://ftpmaster.internal/ubuntu resolute/main amd64 libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 159s Get:76 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-knitr all 1.51+dfsg-1 [847 kB] 159s Get:77 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-markdown all 1.13-1 [162 kB] 159s Get:78 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-matrixstats amd64 1.5.0-1 [542 kB] 159s Get:79 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-microbenchmark amd64 1.5.0-1 [67.4 kB] 159s Get:80 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 160s Get:81 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.oo all 1.27.1-1 [978 kB] 160s Get:82 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.utils all 2.13.0-1 [1423 kB] 160s Get:83 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.cache all 0.17.0-1 [117 kB] 160s Get:84 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.devices all 2.17.3+ds-1 [400 kB] 160s Get:85 http://ftpmaster.internal/ubuntu resolute/main amd64 tcl8.6 amd64 8.6.17+dfsg-1build1 [14.9 kB] 160s Get:86 http://ftpmaster.internal/ubuntu resolute/main amd64 tcl amd64 8.6.16build1 [4200 B] 160s Get:87 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 160s Preconfiguring packages ... 160s Fetched 71.9 MB in 4s (17.9 MB/s) 160s Selecting previously unselected package fonts-dejavu-mono. 160s (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 ... 125269 files and directories currently installed.) 160s Preparing to unpack .../00-fonts-dejavu-mono_2.37-8build1_all.deb ... 160s Unpacking fonts-dejavu-mono (2.37-8build1) ... 160s Selecting previously unselected package fonts-dejavu-core. 160s Preparing to unpack .../01-fonts-dejavu-core_2.37-8build1_all.deb ... 160s Unpacking fonts-dejavu-core (2.37-8build1) ... 160s Selecting previously unselected package fontconfig-config. 160s Preparing to unpack .../02-fontconfig-config_2.17.1-3ubuntu1_amd64.deb ... 160s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 160s Selecting previously unselected package libfontconfig1:amd64. 160s Preparing to unpack .../03-libfontconfig1_2.17.1-3ubuntu1_amd64.deb ... 160s Unpacking libfontconfig1:amd64 (2.17.1-3ubuntu1) ... 160s Selecting previously unselected package fontconfig. 160s Preparing to unpack .../04-fontconfig_2.17.1-3ubuntu1_amd64.deb ... 160s Unpacking fontconfig (2.17.1-3ubuntu1) ... 160s Selecting previously unselected package fonts-glyphicons-halflings. 160s Preparing to unpack .../05-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 160s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 160s Selecting previously unselected package fonts-mathjax. 160s Preparing to unpack .../06-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 160s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 160s Selecting previously unselected package libblas3:amd64. 160s Preparing to unpack .../07-libblas3_3.12.1-7ubuntu1_amd64.deb ... 160s Unpacking libblas3:amd64 (3.12.1-7ubuntu1) ... 160s Selecting previously unselected package libpixman-1-0:amd64. 160s Preparing to unpack .../08-libpixman-1-0_0.46.4-1_amd64.deb ... 160s Unpacking libpixman-1-0:amd64 (0.46.4-1) ... 160s Selecting previously unselected package libxcb-render0:amd64. 160s Preparing to unpack .../09-libxcb-render0_1.17.0-2ubuntu1_amd64.deb ... 160s Unpacking libxcb-render0:amd64 (1.17.0-2ubuntu1) ... 160s Selecting previously unselected package libxcb-shm0:amd64. 160s Preparing to unpack .../10-libxcb-shm0_1.17.0-2ubuntu1_amd64.deb ... 160s Unpacking libxcb-shm0:amd64 (1.17.0-2ubuntu1) ... 160s Selecting previously unselected package libxrender1:amd64. 160s Preparing to unpack .../11-libxrender1_1%3a0.9.12-1_amd64.deb ... 160s Unpacking libxrender1:amd64 (1:0.9.12-1) ... 160s Selecting previously unselected package libcairo2:amd64. 160s Preparing to unpack .../12-libcairo2_1.18.4-3_amd64.deb ... 160s Unpacking libcairo2:amd64 (1.18.4-3) ... 161s Selecting previously unselected package libdatrie1:amd64. 161s Preparing to unpack .../13-libdatrie1_0.2.14-1_amd64.deb ... 161s Unpacking libdatrie1:amd64 (0.2.14-1) ... 161s Selecting previously unselected package libdeflate0:amd64. 161s Preparing to unpack .../14-libdeflate0_1.23-2build1_amd64.deb ... 161s Unpacking libdeflate0:amd64 (1.23-2build1) ... 161s Selecting previously unselected package libgfortran5:amd64. 161s Preparing to unpack .../15-libgfortran5_16-20260208-1ubuntu1_amd64.deb ... 161s Unpacking libgfortran5:amd64 (16-20260208-1ubuntu1) ... 161s Selecting previously unselected package libgomp1:amd64. 161s Preparing to unpack .../16-libgomp1_16-20260208-1ubuntu1_amd64.deb ... 161s Unpacking libgomp1:amd64 (16-20260208-1ubuntu1) ... 161s Selecting previously unselected package libgraphite2-3:amd64. 161s Preparing to unpack .../17-libgraphite2-3_1.3.14-11ubuntu1_amd64.deb ... 161s Unpacking libgraphite2-3:amd64 (1.3.14-11ubuntu1) ... 161s Selecting previously unselected package libharfbuzz0b:amd64. 161s Preparing to unpack .../18-libharfbuzz0b_12.3.2-1_amd64.deb ... 161s Unpacking libharfbuzz0b:amd64 (12.3.2-1) ... 161s Selecting previously unselected package x11-common. 161s Preparing to unpack .../19-x11-common_1%3a7.7+24ubuntu1_all.deb ... 161s Unpacking x11-common (1:7.7+24ubuntu1) ... 161s Selecting previously unselected package libice6:amd64. 161s Preparing to unpack .../20-libice6_2%3a1.1.1-1build1_amd64.deb ... 161s Unpacking libice6:amd64 (2:1.1.1-1build1) ... 161s Selecting previously unselected package libjpeg-turbo8:amd64. 161s Preparing to unpack .../21-libjpeg-turbo8_2.1.5-4ubuntu3_amd64.deb ... 161s Unpacking libjpeg-turbo8:amd64 (2.1.5-4ubuntu3) ... 161s Selecting previously unselected package libjpeg8:amd64. 161s Preparing to unpack .../22-libjpeg8_8c-2ubuntu12_amd64.deb ... 161s Unpacking libjpeg8:amd64 (8c-2ubuntu12) ... 161s Selecting previously unselected package libjs-bootstrap. 161s Preparing to unpack .../23-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 161s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 161s Selecting previously unselected package libjs-highlight.js. 161s Preparing to unpack .../24-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 161s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 161s Selecting previously unselected package libjs-jquery. 161s Preparing to unpack .../25-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 161s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 161s Selecting previously unselected package libjs-jquery-datatables. 161s Preparing to unpack .../26-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 161s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 161s Selecting previously unselected package liblapack3:amd64. 161s Preparing to unpack .../27-liblapack3_3.12.1-7ubuntu1_amd64.deb ... 161s Unpacking liblapack3:amd64 (3.12.1-7ubuntu1) ... 161s Selecting previously unselected package liblerc4:amd64. 161s Preparing to unpack .../28-liblerc4_4.0.0+ds-5ubuntu2_amd64.deb ... 161s Unpacking liblerc4:amd64 (4.0.0+ds-5ubuntu2) ... 161s Selecting previously unselected package libthai-data. 161s Preparing to unpack .../29-libthai-data_0.1.30-1_all.deb ... 161s Unpacking libthai-data (0.1.30-1) ... 161s Selecting previously unselected package libthai0:amd64. 161s Preparing to unpack .../30-libthai0_0.1.30-1_amd64.deb ... 161s Unpacking libthai0:amd64 (0.1.30-1) ... 161s Selecting previously unselected package libpango-1.0-0:amd64. 161s Preparing to unpack .../31-libpango-1.0-0_1.57.0-1_amd64.deb ... 161s Unpacking libpango-1.0-0:amd64 (1.57.0-1) ... 161s Selecting previously unselected package libpangoft2-1.0-0:amd64. 161s Preparing to unpack .../32-libpangoft2-1.0-0_1.57.0-1_amd64.deb ... 161s Unpacking libpangoft2-1.0-0:amd64 (1.57.0-1) ... 161s Selecting previously unselected package libpangocairo-1.0-0:amd64. 161s Preparing to unpack .../33-libpangocairo-1.0-0_1.57.0-1_amd64.deb ... 161s Unpacking libpangocairo-1.0-0:amd64 (1.57.0-1) ... 161s Selecting previously unselected package libpaper2:amd64. 161s Preparing to unpack .../34-libpaper2_2.2.5-0.3build1_amd64.deb ... 161s Unpacking libpaper2:amd64 (2.2.5-0.3build1) ... 161s Selecting previously unselected package libpaper-utils. 161s Preparing to unpack .../35-libpaper-utils_2.2.5-0.3build1_amd64.deb ... 161s Unpacking libpaper-utils (2.2.5-0.3build1) ... 161s Selecting previously unselected package libsharpyuv0:amd64. 161s Preparing to unpack .../36-libsharpyuv0_1.5.0-0.1build1_amd64.deb ... 161s Unpacking libsharpyuv0:amd64 (1.5.0-0.1build1) ... 161s Selecting previously unselected package libsm6:amd64. 161s Preparing to unpack .../37-libsm6_2%3a1.2.6-1build1_amd64.deb ... 161s Unpacking libsm6:amd64 (2:1.2.6-1build1) ... 161s Selecting previously unselected package libtcl8.6:amd64. 161s Preparing to unpack .../38-libtcl8.6_8.6.17+dfsg-1build1_amd64.deb ... 161s Unpacking libtcl8.6:amd64 (8.6.17+dfsg-1build1) ... 161s Selecting previously unselected package libjbig0:amd64. 161s Preparing to unpack .../39-libjbig0_2.1-6.1ubuntu3_amd64.deb ... 161s Unpacking libjbig0:amd64 (2.1-6.1ubuntu3) ... 161s Selecting previously unselected package libwebp7:amd64. 161s Preparing to unpack .../40-libwebp7_1.5.0-0.1build1_amd64.deb ... 161s Unpacking libwebp7:amd64 (1.5.0-0.1build1) ... 161s Selecting previously unselected package libtiff6:amd64. 161s Preparing to unpack .../41-libtiff6_4.7.0-3ubuntu3_amd64.deb ... 161s Unpacking libtiff6:amd64 (4.7.0-3ubuntu3) ... 161s Selecting previously unselected package libxft2:amd64. 161s Preparing to unpack .../42-libxft2_2.3.6-1build2_amd64.deb ... 161s Unpacking libxft2:amd64 (2.3.6-1build2) ... 161s Selecting previously unselected package libxss1:amd64. 161s Preparing to unpack .../43-libxss1_1%3a1.2.3-1build4_amd64.deb ... 161s Unpacking libxss1:amd64 (1:1.2.3-1build4) ... 161s Selecting previously unselected package libtk8.6:amd64. 161s Preparing to unpack .../44-libtk8.6_8.6.17-1_amd64.deb ... 161s Unpacking libtk8.6:amd64 (8.6.17-1) ... 161s Selecting previously unselected package libxt6t64:amd64. 161s Preparing to unpack .../45-libxt6t64_1%3a1.2.1-1.3_amd64.deb ... 161s Unpacking libxt6t64:amd64 (1:1.2.1-1.3) ... 161s Selecting previously unselected package node-normalize.css. 161s Preparing to unpack .../46-node-normalize.css_8.0.1-5.1_all.deb ... 161s Unpacking node-normalize.css (8.0.1-5.1) ... 161s Selecting previously unselected package zip. 161s Preparing to unpack .../47-zip_3.0-15ubuntu3_amd64.deb ... 161s Unpacking zip (3.0-15ubuntu3) ... 161s Selecting previously unselected package unzip. 161s Preparing to unpack .../48-unzip_6.0-29ubuntu1_amd64.deb ... 161s Unpacking unzip (6.0-29ubuntu1) ... 161s Selecting previously unselected package xdg-utils. 161s Preparing to unpack .../49-xdg-utils_1.2.1-2ubuntu2_all.deb ... 161s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 161s Selecting previously unselected package r-base-core. 161s Preparing to unpack .../50-r-base-core_4.5.2-1ubuntu2_amd64.deb ... 161s Unpacking r-base-core (4.5.2-1ubuntu2) ... 161s Selecting previously unselected package r-cran-base64enc. 161s Preparing to unpack .../51-r-cran-base64enc_0.1-3-3build1_amd64.deb ... 161s Unpacking r-cran-base64enc (0.1-3-3build1) ... 161s Selecting previously unselected package r-cran-cli. 161s Preparing to unpack .../52-r-cran-cli_3.6.4-1_amd64.deb ... 161s Unpacking r-cran-cli (3.6.4-1) ... 161s Selecting previously unselected package r-cran-commonmark. 161s Preparing to unpack .../53-r-cran-commonmark_1.9.5-1_amd64.deb ... 161s Unpacking r-cran-commonmark (1.9.5-1) ... 161s Selecting previously unselected package r-cran-digest. 161s Preparing to unpack .../54-r-cran-digest_0.6.39-1_amd64.deb ... 161s Unpacking r-cran-digest (0.6.39-1) ... 161s Selecting previously unselected package r-cran-evaluate. 161s Preparing to unpack .../55-r-cran-evaluate_1.0.5-1_all.deb ... 161s Unpacking r-cran-evaluate (1.0.5-1) ... 161s Selecting previously unselected package r-cran-farver. 161s Preparing to unpack .../56-r-cran-farver_2.1.2-1_amd64.deb ... 161s Unpacking r-cran-farver (2.1.2-1) ... 161s Selecting previously unselected package r-cran-glue. 161s Preparing to unpack .../57-r-cran-glue_1.8.0-1_amd64.deb ... 161s Unpacking r-cran-glue (1.8.0-1) ... 161s Selecting previously unselected package r-cran-rlang. 161s Preparing to unpack .../58-r-cran-rlang_1.1.5-3_amd64.deb ... 161s Unpacking r-cran-rlang (1.1.5-3) ... 161s Selecting previously unselected package r-cran-lifecycle. 161s Preparing to unpack .../59-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 161s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 161s Selecting previously unselected package r-cran-gtable. 161s Preparing to unpack .../60-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 161s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 161s Selecting previously unselected package r-cran-isoband. 161s Preparing to unpack .../61-r-cran-isoband_0.2.7-1_amd64.deb ... 161s Unpacking r-cran-isoband (0.2.7-1) ... 161s Selecting previously unselected package r-cran-s7. 161s Preparing to unpack .../62-r-cran-s7_0.2.0-1_amd64.deb ... 161s Unpacking r-cran-s7 (0.2.0-1) ... 161s Selecting previously unselected package r-cran-labeling. 161s Preparing to unpack .../63-r-cran-labeling_0.4.3-1_all.deb ... 161s Unpacking r-cran-labeling (0.4.3-1) ... 162s Selecting previously unselected package r-cran-r6. 162s Preparing to unpack .../64-r-cran-r6_2.6.1-1_all.deb ... 162s Unpacking r-cran-r6 (2.6.1-1) ... 162s Selecting previously unselected package r-cran-rcolorbrewer. 162s Preparing to unpack .../65-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 162s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 162s Selecting previously unselected package r-cran-viridislite. 162s Preparing to unpack .../66-r-cran-viridislite_0.4.3-1_all.deb ... 162s Unpacking r-cran-viridislite (0.4.3-1) ... 162s Selecting previously unselected package r-cran-scales. 162s Preparing to unpack .../67-r-cran-scales_1.4.0-1_all.deb ... 162s Unpacking r-cran-scales (1.4.0-1) ... 162s Selecting previously unselected package r-cran-vctrs. 162s Preparing to unpack .../68-r-cran-vctrs_0.6.5-1_amd64.deb ... 162s Unpacking r-cran-vctrs (0.6.5-1) ... 162s Selecting previously unselected package r-cran-withr. 162s Preparing to unpack .../69-r-cran-withr_3.0.2+dfsg-1_all.deb ... 162s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 162s Selecting previously unselected package r-cran-ggplot2. 162s Preparing to unpack .../70-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 162s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 162s Selecting previously unselected package r-cran-xfun. 162s Preparing to unpack .../71-r-cran-xfun_0.55+dfsg-1_amd64.deb ... 162s Unpacking r-cran-xfun (0.55+dfsg-1) ... 162s Selecting previously unselected package r-cran-highr. 162s Preparing to unpack .../72-r-cran-highr_0.11+dfsg-1_all.deb ... 162s Unpacking r-cran-highr (0.11+dfsg-1) ... 162s Selecting previously unselected package r-cran-yaml. 162s Preparing to unpack .../73-r-cran-yaml_2.3.10-1_amd64.deb ... 162s Unpacking r-cran-yaml (2.3.10-1) ... 162s Selecting previously unselected package libjs-mathjax. 162s Preparing to unpack .../74-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 162s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 162s Selecting previously unselected package r-cran-knitr. 162s Preparing to unpack .../75-r-cran-knitr_1.51+dfsg-1_all.deb ... 162s Unpacking r-cran-knitr (1.51+dfsg-1) ... 162s Selecting previously unselected package r-cran-markdown. 162s Preparing to unpack .../76-r-cran-markdown_1.13-1_all.deb ... 162s Unpacking r-cran-markdown (1.13-1) ... 162s Selecting previously unselected package r-cran-matrixstats. 162s Preparing to unpack .../77-r-cran-matrixstats_1.5.0-1_amd64.deb ... 162s Unpacking r-cran-matrixstats (1.5.0-1) ... 162s Selecting previously unselected package r-cran-microbenchmark. 162s Preparing to unpack .../78-r-cran-microbenchmark_1.5.0-1_amd64.deb ... 162s Unpacking r-cran-microbenchmark (1.5.0-1) ... 162s Selecting previously unselected package r-cran-r.methodss3. 162s Preparing to unpack .../79-r-cran-r.methodss3_1.8.2-1_all.deb ... 162s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 162s Selecting previously unselected package r-cran-r.oo. 162s Preparing to unpack .../80-r-cran-r.oo_1.27.1-1_all.deb ... 162s Unpacking r-cran-r.oo (1.27.1-1) ... 162s Selecting previously unselected package r-cran-r.utils. 162s Preparing to unpack .../81-r-cran-r.utils_2.13.0-1_all.deb ... 162s Unpacking r-cran-r.utils (2.13.0-1) ... 162s Selecting previously unselected package r-cran-r.cache. 162s Preparing to unpack .../82-r-cran-r.cache_0.17.0-1_all.deb ... 162s Unpacking r-cran-r.cache (0.17.0-1) ... 162s Selecting previously unselected package r-cran-r.devices. 162s Preparing to unpack .../83-r-cran-r.devices_2.17.3+ds-1_all.deb ... 162s Unpacking r-cran-r.devices (2.17.3+ds-1) ... 162s Selecting previously unselected package tcl8.6. 162s Preparing to unpack .../84-tcl8.6_8.6.17+dfsg-1build1_amd64.deb ... 162s Unpacking tcl8.6 (8.6.17+dfsg-1build1) ... 162s Selecting previously unselected package tcl. 162s Preparing to unpack .../85-tcl_8.6.16build1_amd64.deb ... 162s Unpacking tcl (8.6.16build1) ... 162s Selecting previously unselected package r-cran-r.rsp. 162s Preparing to unpack .../86-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 162s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 162s Setting up libgraphite2-3:amd64 (1.3.14-11ubuntu1) ... 162s Setting up libpixman-1-0:amd64 (0.46.4-1) ... 162s Setting up libsharpyuv0:amd64 (1.5.0-0.1build1) ... 162s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 162s Setting up liblerc4:amd64 (4.0.0+ds-5ubuntu2) ... 162s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 162s Setting up libxrender1:amd64 (1:0.9.12-1) ... 162s Setting up libdatrie1:amd64 (0.2.14-1) ... 162s Setting up libxcb-render0:amd64 (1.17.0-2ubuntu1) ... 162s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 162s Setting up unzip (6.0-29ubuntu1) ... 162s Setting up x11-common (1:7.7+24ubuntu1) ... 162s Setting up libdeflate0:amd64 (1.23-2build1) ... 162s Setting up libxcb-shm0:amd64 (1.17.0-2ubuntu1) ... 162s Setting up libgomp1:amd64 (16-20260208-1ubuntu1) ... 162s Setting up libjbig0:amd64 (2.1-6.1ubuntu3) ... 162s Setting up zip (3.0-15ubuntu3) ... 162s Setting up libblas3:amd64 (3.12.1-7ubuntu1) ... 162s 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 162s Setting up fonts-dejavu-mono (2.37-8build1) ... 162s Setting up libtcl8.6:amd64 (8.6.17+dfsg-1build1) ... 162s Setting up fonts-dejavu-core (2.37-8build1) ... 162s Setting up libjpeg-turbo8:amd64 (2.1.5-4ubuntu3) ... 162s Setting up libgfortran5:amd64 (16-20260208-1ubuntu1) ... 162s Setting up libwebp7:amd64 (1.5.0-0.1build1) ... 162s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 162s Setting up libharfbuzz0b:amd64 (12.3.2-1) ... 162s Setting up libthai-data (0.1.30-1) ... 162s Setting up libxss1:amd64 (1:1.2.3-1build4) ... 162s Setting up libpaper2:amd64 (2.2.5-0.3build1) ... 162s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 162s Setting up node-normalize.css (8.0.1-5.1) ... 162s Setting up xdg-utils (1.2.1-2ubuntu2) ... 162s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 162s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 162s Setting up libjpeg8:amd64 (8c-2ubuntu12) ... 162s Setting up libice6:amd64 (2:1.1.1-1build1) ... 162s Setting up tcl8.6 (8.6.17+dfsg-1build1) ... 162s Setting up liblapack3:amd64 (3.12.1-7ubuntu1) ... 162s 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 163s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 163s Setting up libpaper-utils (2.2.5-0.3build1) ... 163s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 163s Setting up libthai0:amd64 (0.1.30-1) ... 163s Setting up libtiff6:amd64 (4.7.0-3ubuntu3) ... 163s Setting up tcl (8.6.16build1) ... 163s Setting up libfontconfig1:amd64 (2.17.1-3ubuntu1) ... 163s Setting up libsm6:amd64 (2:1.2.6-1build1) ... 163s Setting up fontconfig (2.17.1-3ubuntu1) ... 165s Regenerating fonts cache... done. 165s Setting up libxft2:amd64 (2.3.6-1build2) ... 165s Setting up libtk8.6:amd64 (8.6.17-1) ... 165s Setting up libpango-1.0-0:amd64 (1.57.0-1) ... 165s Setting up libcairo2:amd64 (1.18.4-3) ... 165s Setting up libxt6t64:amd64 (1:1.2.1-1.3) ... 165s Setting up libpangoft2-1.0-0:amd64 (1.57.0-1) ... 165s Setting up libpangocairo-1.0-0:amd64 (1.57.0-1) ... 165s Setting up r-base-core (4.5.2-1ubuntu2) ... 165s Creating config file /etc/R/Renviron with new version 165s Setting up r-cran-labeling (0.4.3-1) ... 165s Setting up r-cran-farver (2.1.2-1) ... 165s Setting up r-cran-viridislite (0.4.3-1) ... 165s Setting up r-cran-commonmark (1.9.5-1) ... 165s Setting up r-cran-r6 (2.6.1-1) ... 165s Setting up r-cran-microbenchmark (1.5.0-1) ... 165s Setting up r-cran-rlang (1.1.5-3) ... 165s Setting up r-cran-matrixstats (1.5.0-1) ... 165s Setting up r-cran-xfun (0.55+dfsg-1) ... 165s Setting up r-cran-withr (3.0.2+dfsg-1) ... 165s Setting up r-cran-base64enc (0.1-3-3build1) ... 165s Setting up r-cran-digest (0.6.39-1) ... 165s Setting up r-cran-yaml (2.3.10-1) ... 165s Setting up r-cran-evaluate (1.0.5-1) ... 165s Setting up r-cran-highr (0.11+dfsg-1) ... 165s Setting up r-cran-glue (1.8.0-1) ... 165s Setting up r-cran-cli (3.6.4-1) ... 165s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 165s Setting up r-cran-r.methodss3 (1.8.2-1) ... 165s Setting up r-cran-markdown (1.13-1) ... 165s Setting up r-cran-s7 (0.2.0-1) ... 165s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 165s Setting up r-cran-isoband (0.2.7-1) ... 165s Setting up r-cran-scales (1.4.0-1) ... 165s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 165s Setting up r-cran-knitr (1.51+dfsg-1) ... 165s Setting up r-cran-vctrs (0.6.5-1) ... 165s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 165s Setting up r-cran-r.oo (1.27.1-1) ... 165s Setting up r-cran-r.utils (2.13.0-1) ... 165s Setting up r-cran-r.devices (2.17.3+ds-1) ... 165s Setting up r-cran-r.cache (0.17.0-1) ... 165s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 165s Processing triggers for libc-bin (2.42-2ubuntu4) ... 165s Processing triggers for man-db (2.13.1-1build1) ... 166s Processing triggers for install-info (7.2-5) ... 166s autopkgtest [05:29:15]: test run-unit-test: [----------------------- 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s > library("matrixStats") 167s > 167s > allocArray_R <- function(nrow, ncol, value = NA) { 167s + array(data = value, dim = dim) 167s + } 167s > 167s > values <- list( 167s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 167s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 167s + .Machine$double.xmin, .Machine$double.xmax, 167s + .Machine$double.eps, .Machine$double.neg.eps, 167s + FALSE, TRUE, NA 167s + ) 167s > 167s > dim <- c(2L, 4L, 3L) 167s > for (value in values) { 167s + x0 <- allocArray_R(dim, value = value) 167s + x <- allocArray(dim, value = value) 167s + if (!identical(x, x0)) { 167s + str(list(dim = dim, value = value, x = x, x0 = x0)) 167s + stopifnot(identical(x, x0)) 167s + } 167s + } 167s > 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s > library("matrixStats") 167s > 167s > allocMatrix_R <- function(nrow, ncol, value = NA) { 167s + matrix(data = value, nrow = nrow, ncol = ncol) 167s + } 167s > 167s > values <- list( 167s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 167s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 167s + .Machine$double.xmin, .Machine$double.xmax, 167s + .Machine$double.eps, .Machine$double.neg.eps, 167s + FALSE, TRUE, NA 167s + ) 167s > 167s > nrow <- 2L 167s > ncol <- 3L 167s > for (value in values) { 167s + x0 <- allocMatrix_R(nrow, ncol, value = value) 167s + x <- allocMatrix(nrow, ncol, value = value) 167s + if (!identical(x, x0)) { 167s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 167s + stopifnot(identical(x, x0)) 167s + } 167s + } 167s > 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s > library("matrixStats") 167s > 167s > allocVector_R <- function(length, value = NA) { 167s + x <- vector(mode = typeof(value), length = length) 167s + if (!is.finite(value) || value != 0) x[] <- value 167s + x 167s + } 167s > 167s > values <- list( 167s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 167s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 167s + .Machine$double.xmin, .Machine$double.xmax, 167s + .Machine$double.eps, .Machine$double.neg.eps, 167s + FALSE, TRUE, NA 167s + ) 167s > 167s > n <- 10L 167s > for (value in values) { 167s + x0 <- allocVector_R(n, value = value) 167s + x <- allocVector(n, value = value) 167s + if (!identical(x, x0)) { 167s + str(list(n = n, value = value, x = x, x0 = x0)) 167s + stopifnot(identical(x, x0)) 167s + } 167s + } 167s > 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s > library("matrixStats") 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Setup 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > data <- data.frame( 167s + logical = c(TRUE, FALSE, TRUE), 167s + integer = 1:3, 167s + double = seq(from = 1.0, to = 3.0, by = 1.0), 167s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 167s + character = letters[1:3], 167s + stringsAsFactors = FALSE 167s + ) 167s > 167s > modes <- names(data) 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Special cases 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > cat("NULL...\n") 167s NULL... 167s > stopifnot(identical(anyMissing(NULL), FALSE)) 167s > cat("NULL...done\n") 167s NULL...done 167s > 167s > cat("raw...\n") 167s raw... 167s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 167s > cat("raw...done\n") 167s raw...done 167s > 167s > cat("list(NULL)...\n") 167s list(NULL)... 167s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 167s > cat("list(NULL)...done\n") 167s list(NULL)...done 167s > 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Scalars, vectors, and matrices of various modes 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > for (mode in modes) { 167s + cat(sprintf("Mode: %s...\n", mode)) 167s + values <- data[[mode]] 167s + 167s + # Scalars 167s + cat(" scalar\n") 167s + x <- values[1L] 167s + print(x) 167s + stopifnot(identical(anyMissing(x), FALSE)) 167s + is.na(x) <- TRUE 167s + print(x) 167s + stopifnot(identical(anyMissing(x), TRUE)) 167s + 167s + # Vectors 167s + cat(" vector\n") 167s + x <- values 167s + print(x) 167s + stopifnot(identical(anyMissing(x), FALSE)) 167s + is.na(x)[2L] <- TRUE 167s + print(x) 167s + stopifnot(identical(anyMissing(x), TRUE)) 167s + 167s + # Matrices 167s + cat(" matrix\n") 167s + x <- matrix(c(values, values), ncol = 2L) 167s + print(x) 167s + stopifnot(identical(anyMissing(x), FALSE)) 167s + is.na(x)[2L] <- TRUE 167s + print(x) 167s + stopifnot(identical(anyMissing(x), TRUE)) 167s + 167s + cat(sprintf("Mode: %s...done\n", mode)) 167s + } # for (mode ...) 167s Mode: logical... 167s scalar 167s [1] TRUE 167s [1] NA 167s vector 167s [1] TRUE FALSE TRUE 167s [1] TRUE NA TRUE 167s matrix 167s [,1] [,2] 167s [1,] TRUE TRUE 167s [2,] FALSE FALSE 167s [3,] TRUE TRUE 167s [,1] [,2] 167s [1,] TRUE TRUE 167s [2,] NA FALSE 167s [3,] TRUE TRUE 167s Mode: logical...done 167s Mode: integer... 167s scalar 167s [1] 1 167s [1] NA 167s vector 167s [1] 1 2 3 167s [1] 1 NA 3 167s matrix 167s [,1] [,2] 167s [1,] 1 1 167s [2,] 2 2 167s [3,] 3 3 167s [,1] [,2] 167s [1,] 1 1 167s [2,] NA 2 167s [3,] 3 3 167s Mode: integer...done 167s Mode: double... 167s scalar 167s [1] 1 167s [1] NA 167s vector 167s [1] 1 2 3 167s [1] 1 NA 3 167s matrix 167s [,1] [,2] 167s [1,] 1 1 167s [2,] 2 2 167s [3,] 3 3 167s [,1] [,2] 167s [1,] 1 1 167s [2,] NA 2 167s [3,] 3 3 167s Mode: double...done 167s Mode: complex... 167s scalar 167s [1] 1+1i 167s [1] NA 167s vector 167s [1] 1+1i 2+1i 3+1i 167s [1] 1+1i NA 3+1i 167s matrix 167s [,1] [,2] 167s [1,] 1+1i 1+1i 167s [2,] 2+1i 2+1i 167s [3,] 3+1i 3+1i 167s [,1] [,2] 167s [1,] 1+1i 1+1i 167s [2,] NA 2+1i 167s [3,] 3+1i 3+1i 167s Mode: complex...done 167s Mode: character... 167s scalar 167s [1] "a" 167s [1] NA 167s vector 167s [1] "a" "b" "c" 167s [1] "a" NA "c" 167s matrix 167s [,1] [,2] 167s [1,] "a" "a" 167s [2,] "b" "b" 167s [3,] "c" "c" 167s [,1] [,2] 167s [1,] "a" "a" 167s [2,] NA "b" 167s [3,] "c" "c" 167s Mode: character...done 167s > 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Data frames 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > cat("data.frame...\n") 167s data.frame... 167s > x <- data 167s > stopifnot(identical(anyMissing(x), FALSE)) 167s > for (mode in modes) { 167s + x <- data 167s + is.na(x[[mode]])[2L] <- TRUE 167s + print(x) 167s + stopifnot(identical(anyMissing(x), TRUE)) 167s + } # for (mode ...) 167s logical integer double complex character 167s 1 TRUE 1 1 1+1i a 167s 2 NA 2 2 2+1i b 167s 3 TRUE 3 3 3+1i c 167s logical integer double complex character 167s 1 TRUE 1 1 1+1i a 167s 2 FALSE NA 2 2+1i b 167s 3 TRUE 3 3 3+1i c 167s logical integer double complex character 167s 1 TRUE 1 1 1+1i a 167s 2 FALSE 2 NA 2+1i b 167s 3 TRUE 3 3 3+1i c 167s logical integer double complex character 167s 1 TRUE 1 1 1+1i a 167s 2 FALSE 2 2 NA b 167s 3 TRUE 3 3 3+1i c 167s logical integer double complex character 167s 1 TRUE 1 1 1+1i a 167s 2 FALSE 2 2 2+1i 167s 3 TRUE 3 3 3+1i c 167s > cat("data.frame...done\n") 167s data.frame...done 167s > 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Lists 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > cat("list...\n") 167s list... 167s > x <- as.list(data) 167s > stopifnot(identical(anyMissing(x), FALSE)) 167s > for (mode in modes) { 167s + x <- as.list(data) 167s + is.na(x[[mode]])[2L] <- TRUE 167s + print(x) 167s + stopifnot(identical(anyMissing(x), TRUE)) 167s + } # for (mode ...) 167s $logical 167s [1] TRUE NA TRUE 167s 167s $integer 167s [1] 1 2 3 167s 167s $double 167s [1] 1 2 3 167s 167s $complex 167s [1] 1+1i 2+1i 3+1i 167s 167s $character 167s [1] "a" "b" "c" 167s 167s $logical 167s [1] TRUE FALSE TRUE 167s 167s $integer 167s [1] 1 NA 3 167s 167s $double 167s [1] 1 2 3 167s 167s $complex 167s [1] 1+1i 2+1i 3+1i 167s 167s $character 167s [1] "a" "b" "c" 167s 167s $logical 167s [1] TRUE FALSE TRUE 167s 167s $integer 167s [1] 1 2 3 167s 167s $double 167s [1] 1 NA 3 167s 167s $complex 167s [1] 1+1i 2+1i 3+1i 167s 167s $character 167s [1] "a" "b" "c" 167s 167s $logical 167s [1] TRUE FALSE TRUE 167s 167s $integer 167s [1] 1 2 3 167s 167s $double 167s [1] 1 2 3 167s 167s $complex 167s [1] 1+1i NA 3+1i 167s 167s $character 167s [1] "a" "b" "c" 167s 167s $logical 167s [1] TRUE FALSE TRUE 167s 167s $integer 167s [1] 1 2 3 167s 167s $double 167s [1] 1 2 3 167s 167s $complex 167s [1] 1+1i 2+1i 3+1i 167s 167s $character 167s [1] "a" NA "c" 167s 167s > cat("list...done\n") 167s list...done 167s > 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s > library("matrixStats") 167s > 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > # Subsetted tests 167s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167s > source("utils/validateIndicesFramework.R") 167s > x <- runif(4, min = -3, max = 3) 167s > x[2] <- NA 167s > for (mode in c("integer", "numeric")) { 167s + storage.mode(x) <- mode 167s + for (idxs in index_cases) { 167s + validateIndicesTestVector(x, idxs, 167s + ftest = anyMissing, fsure = function(x, ...) { 167s + anyValue(x, value = NA) 167s + }) 167s + } 167s + } 167s > 167s 167s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 167s Copyright (C) 2025 The R Foundation for Statistical Computing 167s Platform: x86_64-pc-linux-gnu 167s 167s R is free software and comes with ABSOLUTELY NO WARRANTY. 167s You are welcome to redistribute it under certain conditions. 167s Type 'license()' or 'licence()' for distribution details. 167s 167s R is a collaborative project with many contributors. 167s Type 'contributors()' for more information and 167s 'citation()' on how to cite R or R packages in publications. 167s 167s Type 'demo()' for some demos, 'help()' for on-line help, or 167s 'help.start()' for an HTML browser interface to help. 167s Type 'q()' to quit R. 167s 167s Loading required namespace: base64enc 167s > ## Don't test with valgrind 167s > if (Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 167s + 167s + ## 3. Make sure all suggested packages are installed / can be loaded 167s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 167s + "R.devices", "R.rsp") 167s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 167s + html <- matrixStats:::benchmark("binCounts") 167s + print(html) 167s + } 167s + 167s + rm(list = "pkgs") 167s + 167s + } 167s Loading required namespace: ggplot2 168s Loading required namespace: knitr 168s Loading required namespace: markdown 168s Loading required namespace: microbenchmark 168s Loading required namespace: R.devices 168s Loading required namespace: R.rsp 168s integer: unsorted 170s integer: sorted 171s double: unsorted 173s double: sorted 174s RspFileProduct: 174s Pathname: /tmp/autopkgtest.gRqc2u/autopkgtest_tmp/reports/binCounts.html 174s File size: 71.45 kB (73163 bytes) 174s Content type: text/html 174s Metadata 'author': 'Henrik Bengtsson' 174s Metadata 'title': 'binCounts() benchmarks' 174s Metadata 'date': '2014-05-25' 174s Has processor: FALSE 174s > 174s Warning message: 174s In par(parT) : argument 1 does not name a graphical parameter 174s 174s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 174s Copyright (C) 2025 The R Foundation for Statistical Computing 174s Platform: x86_64-pc-linux-gnu 174s 174s R is free software and comes with ABSOLUTELY NO WARRANTY. 174s You are welcome to redistribute it under certain conditions. 174s Type 'license()' or 'licence()' for distribution details. 174s 174s R is a collaborative project with many contributors. 174s Type 'contributors()' for more information and 174s 'citation()' on how to cite R or R packages in publications. 174s 174s Type 'demo()' for some demos, 'help()' for on-line help, or 174s 'help.start()' for an HTML browser interface to help. 174s Type 'q()' to quit R. 174s 174s > library("matrixStats") 174s > library("stats") 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Local functions 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 174s + n0 <- graphics::hist(x, breaks = bx, right = right, 174s + include.lowest = TRUE, plot = FALSE)$counts 174s + } 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Non-sorted and sorted positions 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > nx <- 1000L # Number of data points 174s > nb <- 200L # Number of bins 174s > 174s > # Uniformely distributed bins 174s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 174s > bx <- c(-1, bx, 2) 174s > 174s > # Sample data points 174s > set.seed(0xBEEF) 174s > x <- runif(nx, min = 0, max = 1) 174s > 174s > for (kk in 1:2) { 174s + n0 <- binCounts_hist(x, bx = bx) 174s + n1 <- binCounts(x, bx = bx) 174s + # Sanity check 174s + stopifnot(identical(n1, n0)) 174s + 174s + # Check reversed 174s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 174s + stopifnot(identical(n1r, n1)) 174s + 174s + # Retry with a sorted vector 174s + x <- sort(x) 174s + } # for (kk in 1:2) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Missing values 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > x <- 1:40 174s > x[20] <- NA_integer_ 174s > nx <- length(x) 174s > 174s > # Bins 174s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 174s > 174s > y_smooth0 <- binCounts_hist(x, bx = bx) 174s > y_smooth <- binCounts(x, bx = bx) 174s > # Sanity check 174s > stopifnot(all.equal(y_smooth, y_smooth0)) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Border cases 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > x <- 1:10 174s > bx <- min(x) - c(10, 1) 174s > y_smooth <- binCounts(x, bx = bx) 174s > stopifnot(all.equal(y_smooth, 0L)) 174s > bx <- range(x) 174s > y_smooth <- binCounts(x, bx = bx) 174s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 174s > bx <- max(x) + c(1, 10) 174s > y_smooth <- binCounts(x, bx = bx) 174s > stopifnot(all.equal(y_smooth, 0L)) 174s > 174s > # Every second empty 174s > x <- 1:10 174s > bx <- rep(x, each = 2L) 174s > y_smooth <- binCounts(x, bx = bx) 174s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 174s > ## NOTE: binCounts_hist() does not give the same last bin count 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Exception handling 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Zero bin boundaries (invalid bin definition) 174s > bx <- double(0L) 174s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 174s > stopifnot(inherits(res, "try-error")) 174s > 174s > # One bin boundary (invalid bin definition) 174s > bx <- double(1L) 174s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 174s > stopifnot(inherits(res, "try-error")) 174s > 174s 174s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 174s Copyright (C) 2025 The R Foundation for Statistical Computing 174s Platform: x86_64-pc-linux-gnu 174s 174s R is free software and comes with ABSOLUTELY NO WARRANTY. 174s You are welcome to redistribute it under certain conditions. 174s Type 'license()' or 'licence()' for distribution details. 174s 174s R is a collaborative project with many contributors. 174s Type 'contributors()' for more information and 174s 'citation()' on how to cite R or R packages in publications. 174s 174s Type 'demo()' for some demos, 'help()' for on-line help, or 174s 'help.start()' for an HTML browser interface to help. 174s Type 'q()' to quit R. 174s 174s > library("matrixStats") 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Local functions 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 174s + n0 <- graphics::hist(x, breaks = bx, right = right, 174s + include.lowest = TRUE, plot = FALSE)$counts 174s + } 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Subsetted tests 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > source("utils/validateIndicesFramework.R") 174s > x <- runif(6, min = -6, max = 6) 174s > storage.mode(x) <- "integer" 174s > bx <- c(-6, 0, 3, 4, 10) 174s > for (idxs in index_cases) { 174s + validateIndicesTestVector(x, idxs, 174s + ftest = binCounts, fsure = binCounts_hist, 174s + bx = bx, right = FALSE) 174s + validateIndicesTestVector(x, idxs, 174s + ftest = binCounts, fsure = binCounts_hist, 174s + bx = bx, right = TRUE) 174s + } 174s > 174s 174s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 174s Copyright (C) 2025 The R Foundation for Statistical Computing 174s Platform: x86_64-pc-linux-gnu 174s 174s R is free software and comes with ABSOLUTELY NO WARRANTY. 174s You are welcome to redistribute it under certain conditions. 174s Type 'license()' or 'licence()' for distribution details. 174s 174s R is a collaborative project with many contributors. 174s Type 'contributors()' for more information and 174s 'citation()' on how to cite R or R packages in publications. 174s 174s Type 'demo()' for some demos, 'help()' for on-line help, or 174s 'help.start()' for an HTML browser interface to help. 174s Type 'q()' to quit R. 174s 174s > library("matrixStats") 174s > library("stats") 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Naive R implementation of binMeans() 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 174s + n_smooth <- length(bx) - 1L 174s + res <- double(n_smooth) 174s + counts <- rep(NaN, times = n_smooth) 174s + 174s + if (na.rm) { 174s + keep <- !is.na(x) & !is.na(y) 174s + x <- x[keep] 174s + y <- y[keep] 174s + } 174s + 174s + # For each bin... 174s + for (kk in seq_len(n_smooth)) { 174s + if (right) { 174s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 174s + } else { 174s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 174s + } 174s + y_kk <- y[idxs] 174s + res[kk] <- mean(y_kk) 174s + counts[kk] <- length(idxs) 174s + } # for (kk ...) 174s + 174s + if (count) attr(res, "count") <- counts 174s + res 174s + } 174s > 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Case #1 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > x <- 1:100 174s > nx <- length(x) 174s > y <- double(nx) 174s > y[1:25] <- 5 174s > y[51:75] <- -5 174s > y <- y + rnorm(nx) 174s > 174s > # Bins 174s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 174s > 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 174s > y_smooth <- binMeans(y, x = x, bx = bx) 174s > n_smooth <- binCounts(x, bx = bx) 174s > # Sanity check 174s > stopifnot(all.equal(y_smooth, y_smooth0)) 174s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 174s > 174s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 174s + count = FALSE, right = TRUE)) 174s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 174s + count = FALSE, right = TRUE)) 174s > # Sanity check 174s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 174s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 174s > 174s > 174s > # Integer input 174s > y <- as.integer(y) 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 174s > y_smooth <- binMeans(y, x = x, bx = bx) 174s > n_smooth <- binCounts(x, bx = bx) 174s > # Sanity check 174s > stopifnot(is.integer(y), 174s + all.equal(y_smooth, y_smooth0), 174s + all.equal(attr(y_smooth, "count"), n_smooth)) 174s > 174s > # Logical input 174s > y <- as.logical(y) 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 174s > y_smooth <- binMeans(y, x = x, bx = bx) 174s > n_smooth <- binCounts(x, bx = bx) 174s > # Sanity check 174s > stopifnot(is.logical(y), 174s + all.equal(y_smooth, y_smooth0), 174s + all.equal(attr(y_smooth, "count"), n_smooth)) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Case #2 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > nx <- 1e3 174s > x <- runif(nx) 174s > y <- runif(nx) 174s > 174s > nb <- 10 174s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 174s > bx1 <- c(bx[-1], bx[nb] + 1) 174s > 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 174s > y_smooth <- binMeans(y, x = x, bx = bx1) 174s > n_smooth <- binCounts(x, bx = bx1) 174s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 174s > 174s > # Sanity check 174s > stopifnot(all.equal(y_smooth, y_smooth0)) 174s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 174s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Empty bins 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > x <- c(6:8, 16:19) 174s > nx <- length(x) 174s > y <- runif(nx) 174s > bx <- c(0, 5, 10, 15, 20, 25) 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 174s > y_smooth <- binMeans(y, x = x, bx = bx) 174s > n_smooth <- binCounts(x, bx = bx) 174s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 174s > stopifnot(all.equal(y_smooth, y_smooth0)) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Missing values 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > x <- 1:100 174s > x[50] <- NA_integer_ 174s > nx <- length(x) 174s > y <- double(nx) 174s > y[1:25] <- 5 174s > y[51:75] <- -5 174s > y[82:92] <- NA_real_ 174s > y <- y + rnorm(nx) 174s > 174s > # Bins 174s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 174s > 174s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 174s > y_smooth <- binMeans(y, x = x, bx = bx) 174s > # Sanity check 174s > stopifnot(all.equal(y_smooth, y_smooth0)) 174s > 174s > 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Exception handling 174s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174s > # Zero bin boundaries (invalid bin definition) 174s > bx <- double(0L) 174s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 174s > stopifnot(inherits(res, "try-error")) 174s > 174s > # One bin boundary (invalid bin definition) 174s > bx <- double(1L) 174s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 174s > stopifnot(inherits(res, "try-error")) 174s > 174s 174s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 174s Copyright (C) 2025 The R Foundation for Statistical Computing 174s Platform: x86_64-pc-linux-gnu 174s 174s R is free software and comes with ABSOLUTELY NO WARRANTY. 174s You are welcome to redistribute it under certain conditions. 174s Type 'license()' or 'licence()' for distribution details. 174s 174s R is a collaborative project with many contributors. 174s Type 'contributors()' for more information and 174s 'citation()' on how to cite R or R packages in publications. 174s 174s Type 'demo()' for some demos, 'help()' for on-line help, or 174s 'help.start()' for an HTML browser interface to help. 174s Type 'q()' to quit R. 174s 175s > library("matrixStats") 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Naive R implementation of binMeans() 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 175s + n_smooth <- length(bx) - 1L 175s + res <- double(n_smooth) 175s + counts <- rep(NaN, times = n_smooth) 175s + 175s + if (na.rm) { 175s + keep <- !is.na(x) & !is.na(y) 175s + x <- x[keep] 175s + y <- y[keep] 175s + } 175s + 175s + # For each bin... 175s + for (kk in seq_len(n_smooth)) { 175s + if (right) { 175s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 175s + } else { 175s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 175s + } 175s + y_kk <- y[idxs] 175s + res[kk] <- mean(y_kk) 175s + counts[kk] <- length(idxs) 175s + } # for (kk ...) 175s + 175s + if (count) attr(res, "count") <- counts 175s + res 175s + } 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Subsetted tests 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > source("utils/validateIndicesFramework.R") 175s > y <- runif(6, min = -6, max = 6) 175s > x <- runif(6, min = -6, max = 6) 175s > storage.mode(x) <- "integer" 175s > bx <- c(-6, 0, 3, 4, 10) 175s > for (idxs in index_cases) { 175s + for (na.rm in c(TRUE, FALSE)) { 175s + validateIndicesTestVector_w(y, x, idxs, 175s + ftest = binMeans, fsure = binMeans0, 175s + bx = bx, na.rm = na.rm, 175s + count = TRUE, right = FALSE) 175s + validateIndicesTestVector_w(y, x, idxs, 175s + ftest = binMeans, fsure = binMeans0, 175s + bx = bx, na.rm = na.rm, 175s + count = TRUE, right = TRUE) 175s + } 175s + } 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > 175s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 175s + if (is.na(value)) { 175s + counts <- sum(is.na(x)) 175s + } else { 175s + counts <- sum(x == value, na.rm = na.rm) 175s + } 175s + as.integer(counts) 175s + } 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Data type: integer and numeric 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > for (mode in c("integer", "double")) { 175s + x <- runif(20 * 5, min = -3, max = 3) 175s + x[sample.int(length(x), size = 7)] <- 0 175s + storage.mode(x) <- mode 175s + 175s + for (na.rm in c(FALSE, TRUE)) { 175s + # Count zeros 175s + n0 <- count_R(x, value = 0, na.rm = na.rm) 175s + n1 <- count(x, value = 0, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + all <- allValue(x, value = 0, na.rm = na.rm) 175s + any <- anyValue(x, value = 0, na.rm = na.rm) 175s + 175s + # Count NAs 175s + n0 <- count_R(x, value = NA, na.rm = na.rm) 175s + n1 <- count(x, value = NA, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + all <- allValue(x, value = NA, na.rm = na.rm) 175s + any <- anyValue(x, value = NA, na.rm = na.rm) 175s + 175s + if (mode == "integer") { 175s + ux <- unique(as.vector(x)) 175s + n0 <- n1 <- integer(length(x)) 175s + for (value in ux) { 175s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 175s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + } 175s + stopifnot(all(n0 == ncol(x))) 175s + } # if (mode == "integer") 175s + 175s + } # for (na.rm ...) 175s + } # for (mode ...) 175s > 175s > # All NAs 175s > na_list <- list(NA_integer_, NA_real_, NaN) 175s > for (na_value in na_list) { 175s + x <- rep(na_value, times = 10L) 175s + for (na.rm in c(FALSE, TRUE)) { 175s + n0 <- count_R(x, na.rm = na.rm) 175s + n1 <- count(x, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + 175s + # Count NAs 175s + n0 <- count_R(x, value = NA, na.rm = na.rm) 175s + n1 <- count(x, value = NA, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + any <- anyValue(x, value = NA, na.rm = na.rm) 175s + all <- allValue(x, value = NA, na.rm = na.rm) 175s + stopifnot(any) 175s + stopifnot(all) 175s + } 175s + } # for (na_value ...) 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Data type: logical 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > x <- logical(length = 10L) 175s > x[3:7] <- TRUE 175s > 175s > # Row/column counts 175s > for (na.rm in c(FALSE, TRUE)) { 175s + n0 <- count_R(x, na.rm = na.rm) 175s + n1 <- count(x, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + 175s + n_true <- count(x, value = TRUE, na.rm = na.rm) 175s + n_false <- count(x, value = FALSE, na.rm = na.rm) 175s + stopifnot(n_true + n_false == ncol(x)) 175s + 175s + # Count NAs 175s + n0 <- count_R(x, value = NA, na.rm = na.rm) 175s + n1 <- count(x, value = NA, na.rm = na.rm) 175s + stopifnot(identical(n1, n0)) 175s + } 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > 175s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 175s + if (is.na(value)) { 175s + counts <- sum(is.na(x)) 175s + } else { 175s + counts <- sum(x == value, na.rm = na.rm) 175s + } 175s + as.integer(counts) 175s + } 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Subsetted tests 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > source("utils/validateIndicesFramework.R") 175s > x <- runif(6, min = -3, max = 3) 175s > storage.mode(x) <- "integer" 175s > for (idxs in index_cases) { 175s + validateIndicesTestVector(x, idxs, 175s + ftest = count, fsure = count_R, 175s + value = 0, na.rm = TRUE) 175s + validateIndicesTestVector(x, idxs, 175s + ftest = count, fsure = count_R, 175s + value = 0, na.rm = FALSE) 175s + validateIndicesTestVector(x, idxs, 175s + ftest = count, fsure = count_R, 175s + value = NA_integer_) 175s + } 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > 175s > diff2_R <- function(..., useNames = TRUE){ 175s + res <- diff(...) 175s + if (!useNames) names(res) <- NULL 175s + res 175s + } 175s > 175s > set.seed(0x42) 175s > 175s > for (mode in c("integer", "double")) { 175s + x <- rnorm(10, sd = 5) 175s + storage.mode(x) <- mode 175s + str(x) 175s + 175s + for (has_na in c(FALSE, TRUE)) { 175s + for (setNames in c(TRUE, FALSE)) { 175s + for (useNames in c(TRUE, FALSE)) { 175s + if (has_na) { 175s + x[sample(1:10, size = 3)] <- NA 175s + } 175s + if (setNames) { 175s + names(x) <- LETTERS[1:10] 175s + } 175s + for (l in 1:3) { 175s + for (d in 1:4) { 175s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 175s + mode, has_na, l, d, setNames, useNames)) 175s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 175s + str(y0) 175s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 175s + str(y1) 175s + stopifnot(identical(y1, y0)) 175s + } 175s + } 175s + } 175s + } 175s + } # for (has_na ...) 175s + } 175s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 175s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 175s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 175s Named int [1:8] 11 -3 1 -1 2 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] 11 -3 1 -1 2 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 175s Named int [1:7] -14 4 -2 3 7 -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] -14 4 -2 3 7 -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 175s Named int [1:6] 18 -6 5 4 -31 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] 18 -6 5 4 -31 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 175s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 175s Named int [1:6] 6 -2 1 12 5 -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] 6 -2 1 12 5 -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 175s Named int [1:4] -5 14 4 -27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] -5 14 4 -27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 175s Named int [1:2] 9 -41 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named int [1:2] 9 -41 175s - attr(*, "names")= chr [1:2] "I" "J" 175s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 175s Named int [1:7] -11 -2 -5 -3 7 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] -11 -2 -5 -3 7 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 175s Named int [1:4] 8 9 8 6 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] 8 9 8 6 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 175s Named int -2 175s - attr(*, "names")= chr "J" 175s Named int -2 175s - attr(*, "names")= chr "J" 175s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 175s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 175s int [1:8] 11 -3 1 -1 2 9 -15 6 175s int [1:8] 11 -3 1 -1 2 9 -15 6 175s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 175s int [1:7] -14 4 -2 3 7 -24 21 175s int [1:7] -14 4 -2 3 7 -24 21 175s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 175s int [1:6] 18 -6 5 4 -31 45 175s int [1:6] 18 -6 5 4 -31 45 175s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 175s int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 175s int [1:6] 6 -2 1 12 5 -15 175s int [1:6] 6 -2 1 12 5 -15 175s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 175s int [1:4] -5 14 4 -27 175s int [1:4] -5 14 4 -27 175s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 175s int [1:2] 9 -41 175s int [1:2] 9 -41 175s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 175s int [1:7] -11 -2 -5 -3 7 3 3 175s int [1:7] -11 -2 -5 -3 7 3 3 175s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 175s int [1:4] 8 9 8 6 175s int [1:4] 8 9 8 6 175s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 175s int -2 175s int -2 175s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 175s int(0) 175s int(0) 175s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 175s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 175s Named int [1:8] 11 -3 1 -1 2 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] 11 -3 1 -1 2 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 175s Named int [1:7] -14 4 -2 3 7 -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] -14 4 -2 3 7 -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 175s Named int [1:6] 18 -6 5 4 -31 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] 18 -6 5 4 -31 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 175s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 175s Named int [1:6] 6 -2 1 12 5 -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] 6 -2 1 12 5 -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 175s Named int [1:4] -5 14 4 -27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] -5 14 4 -27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 175s Named int [1:2] 9 -41 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named int [1:2] 9 -41 175s - attr(*, "names")= chr [1:2] "I" "J" 175s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 175s Named int [1:7] -11 -2 -5 -3 7 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] -11 -2 -5 -3 7 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 175s Named int [1:4] 8 9 8 6 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] 8 9 8 6 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 175s Named int -2 175s - attr(*, "names")= chr "J" 175s Named int -2 175s - attr(*, "names")= chr "J" 175s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 175s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 175s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 175s int [1:8] 11 -3 1 -1 2 9 -15 6 175s int [1:8] 11 -3 1 -1 2 9 -15 6 175s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 175s int [1:7] -14 4 -2 3 7 -24 21 175s int [1:7] -14 4 -2 3 7 -24 21 175s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 175s int [1:6] 18 -6 5 4 -31 45 175s int [1:6] 18 -6 5 4 -31 45 175s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 175s int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s int [1:8] -9 -1 -3 -3 -2 9 3 -6 175s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 175s int [1:6] 6 -2 1 12 5 -15 175s int [1:6] 6 -2 1 12 5 -15 175s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 175s int [1:4] -5 14 4 -27 175s int [1:4] -5 14 4 -27 175s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 175s int [1:2] 9 -41 175s int [1:2] 9 -41 175s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 175s int [1:7] -11 -2 -5 -3 7 3 3 175s int [1:7] -11 -2 -5 -3 7 3 3 175s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 175s int [1:4] 8 9 8 6 175s int [1:4] 8 9 8 6 175s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 175s int -2 175s int -2 175s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 175s int(0) 175s int(0) 175s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 175s Named int [1:9] NA NA NA NA NA 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named int [1:9] NA NA NA NA NA 0 9 -6 0 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 175s Named int [1:8] NA NA NA NA NA 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] NA NA NA NA NA 9 -15 6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 175s Named int [1:7] NA NA NA NA NA -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] NA NA NA NA NA -24 21 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 175s Named int [1:6] NA NA NA NA NA 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] NA NA NA NA NA 45 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 175s Named int [1:8] -9 NA NA NA NA 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] -9 NA NA NA NA 9 3 -6 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 175s Named int [1:6] NA NA NA NA NA -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] NA NA NA NA NA -15 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 175s Named int [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named int [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 175s Named int [1:7] NA NA -5 NA NA 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] NA NA -5 NA NA 3 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 175s Named int [1:4] NA NA 8 NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] NA NA 8 NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 175s Named int NA 175s - attr(*, "names")= chr "J" 175s Named int NA 175s - attr(*, "names")= chr "J" 175s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 175s int [1:9] NA NA NA NA NA 0 9 NA NA 175s int [1:9] NA NA NA NA NA 0 9 NA NA 175s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 175s int [1:8] NA NA NA NA NA 9 NA NA 175s int [1:8] NA NA NA NA NA 9 NA NA 175s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 175s int [1:7] NA NA NA NA NA NA NA 175s int [1:7] NA NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 175s int [1:6] NA NA NA NA NA NA 175s int [1:6] NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 175s int [1:8] NA NA NA NA NA 9 NA -6 175s int [1:8] NA NA NA NA NA 9 NA -6 175s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 175s int [1:6] NA NA NA NA NA -15 175s int [1:6] NA NA NA NA NA -15 175s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 175s int [1:4] NA NA NA NA 175s int [1:4] NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 175s int [1:2] NA NA 175s int [1:2] NA NA 175s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 175s int [1:7] NA NA NA NA NA NA 3 175s int [1:7] NA NA NA NA NA NA 3 175s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 175s int [1:4] NA NA NA NA 175s int [1:4] NA NA NA NA 175s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 175s int NA 175s int NA 175s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 175s int(0) 175s int(0) 175s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 175s Named int [1:9] NA NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named int [1:9] NA NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 175s Named int [1:8] NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 175s Named int [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 175s Named int [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 175s Named int [1:8] NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named int [1:8] NA NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 175s Named int [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named int [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 175s Named int [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named int [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 175s Named int [1:7] NA NA NA NA NA NA 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named int [1:7] NA NA NA NA NA NA 3 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named int [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 175s Named int NA 175s - attr(*, "names")= chr "J" 175s Named int NA 175s - attr(*, "names")= chr "J" 175s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s Named int(0) 175s - attr(*, "names")= chr(0) 175s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 175s int [1:9] NA NA NA NA NA NA NA NA NA 175s int [1:9] NA NA NA NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 175s int [1:8] NA NA NA NA NA NA NA NA 175s int [1:8] NA NA NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 175s int [1:7] NA NA NA NA NA NA NA 175s int [1:7] NA NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 175s int [1:6] NA NA NA NA NA NA 175s int [1:6] NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 175s int [1:8] NA NA NA NA NA NA NA NA 175s int [1:8] NA NA NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 175s int [1:6] NA NA NA NA NA NA 175s int [1:6] NA NA NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 175s int [1:4] NA NA NA NA 175s int [1:4] NA NA NA NA 175s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 175s int [1:2] NA NA 175s int [1:2] NA NA 175s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 175s int [1:7] NA NA NA NA NA NA 3 175s int [1:7] NA NA NA NA NA NA 3 175s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 175s int [1:4] NA NA NA NA 175s int [1:4] NA NA NA NA 175s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 175s int NA 175s int NA 175s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 175s int(0) 175s int(0) 175s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 175s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 175s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 175s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 175s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 175s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 175s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 175s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 175s Named num [1:4] 0.368 42.988 15.396 -29.313 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] 0.368 42.988 15.396 -29.313 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 175s Named num [1:2] 15 -72.3 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named num [1:2] 15 -72.3 175s - attr(*, "names")= chr [1:2] "I" "J" 175s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 175s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 175s Named num [1:4] -23.52 7.92 11.38 23.27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] -23.52 7.92 11.38 23.27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 175s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 175s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 175s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 175s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 175s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 175s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 175s num [1:4] 0.368 42.988 15.396 -29.313 175s num [1:4] 0.368 42.988 15.396 -29.313 175s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 175s num [1:2] 15 -72.3 175s num [1:2] 15 -72.3 175s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 175s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 175s num [1:4] -23.52 7.92 11.38 23.27 175s num [1:4] -23.52 7.92 11.38 23.27 175s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 175s num 46.8 175s num 46.8 175s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 175s num(0) 175s num(0) 175s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 175s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 175s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 175s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 175s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 175s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 175s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 175s Named num [1:4] 0.368 42.988 15.396 -29.313 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] 0.368 42.988 15.396 -29.313 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 175s Named num [1:2] 15 -72.3 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named num [1:2] 15 -72.3 175s - attr(*, "names")= chr [1:2] "I" "J" 175s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 175s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 175s Named num [1:4] -23.52 7.92 11.38 23.27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] -23.52 7.92 11.38 23.27 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 175s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 175s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 175s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 175s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 175s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 175s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 175s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 175s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 175s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 175s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 175s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 175s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 175s num [1:4] 0.368 42.988 15.396 -29.313 175s num [1:4] 0.368 42.988 15.396 -29.313 175s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 175s num [1:2] 15 -72.3 175s num [1:2] 15 -72.3 175s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 175s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 175s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 175s num [1:4] -23.52 7.92 11.38 23.27 175s num [1:4] -23.52 7.92 11.38 23.27 175s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 175s num 46.8 175s num 46.8 175s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 175s num(0) 175s num(0) 175s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 175s Named num [1:9] -2.929 0.673 8.826 NA NA ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named num [1:9] -2.929 0.673 8.826 NA NA ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 175s Named num [1:8] 3.6 8.15 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] 3.6 8.15 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 175s Named num [1:7] 4.55 NA NA NA NA ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 4.55 NA NA NA NA ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 175s Named num [1:8] -2.26 9.5 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] -2.26 9.5 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 175s Named num [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named num [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 175s Named num [1:7] 6.57 NA NA -16.95 NA ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] 6.57 NA NA -16.95 NA ... 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 175s Named num [1:4] -23.5 NA NA 23.3 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] -23.5 NA NA 23.3 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s Named num 46.8 175s - attr(*, "names")= chr "J" 175s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 175s num [1:9] NA 0.673 8.826 NA NA ... 175s num [1:9] NA 0.673 8.826 NA NA ... 175s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 175s num [1:8] NA 8.15 NA NA NA ... 175s num [1:8] NA 8.15 NA NA NA ... 175s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 175s num [1:7] NA NA NA NA NA NA NA 175s num [1:7] NA NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 175s num [1:6] NA NA NA NA NA NA 175s num [1:6] NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 175s num [1:8] NA 9.5 NA NA NA ... 175s num [1:8] NA 9.5 NA NA NA ... 175s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 175s num [1:6] NA NA NA NA NA NA 175s num [1:6] NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 175s num [1:4] NA NA NA NA 175s num [1:4] NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 175s num [1:2] NA NA 175s num [1:2] NA NA 175s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 175s num [1:7] NA NA NA NA NA NA NA 175s num [1:7] NA NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 175s num [1:4] NA NA NA NA 175s num [1:4] NA NA NA NA 175s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 175s num NA 175s num NA 175s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 175s num(0) 175s num(0) 175s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 175s Named num [1:9] NA 0.673 8.826 NA NA ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s Named num [1:9] NA 0.673 8.826 NA NA ... 175s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 175s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 175s Named num [1:8] NA 8.15 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] NA 8.15 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 175s Named num [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 175s Named num [1:8] NA 9.5 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s Named num [1:8] NA 9.5 NA NA NA ... 175s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 175s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s Named num [1:6] NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 175s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 175s Named num [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s Named num [1:2] NA NA 175s - attr(*, "names")= chr [1:2] "I" "J" 175s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 175s Named num [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s Named num [1:7] NA NA NA NA NA NA NA 175s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 175s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s Named num [1:4] NA NA NA NA 175s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 175s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 175s Named num NA 175s - attr(*, "names")= chr "J" 175s Named num NA 175s - attr(*, "names")= chr "J" 175s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s Named num(0) 175s - attr(*, "names")= chr(0) 175s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 175s num [1:9] NA 0.673 8.826 NA NA ... 175s num [1:9] NA 0.673 8.826 NA NA ... 175s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 175s num [1:8] NA 8.15 NA NA NA ... 175s num [1:8] NA 8.15 NA NA NA ... 175s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 175s num [1:7] NA NA NA NA NA NA NA 175s num [1:7] NA NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 175s num [1:6] NA NA NA NA NA NA 175s num [1:6] NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 175s num [1:8] NA 9.5 NA NA NA ... 175s num [1:8] NA 9.5 NA NA NA ... 175s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 175s num [1:6] NA NA NA NA NA NA 175s num [1:6] NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 175s num [1:4] NA NA NA NA 175s num [1:4] NA NA NA NA 175s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 175s num [1:2] NA NA 175s num [1:2] NA NA 175s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 175s num [1:7] NA NA NA NA NA NA NA 175s num [1:7] NA NA NA NA NA NA NA 175s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 175s num [1:4] NA NA NA NA 175s num [1:4] NA NA NA NA 175s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 175s num NA 175s num NA 175s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 175s num(0) 175s num(0) 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > 175s > diff2_R <- function(..., useNames=NA){ 175s + res <- diff(...) 175s + if (!useNames) names(res) <- NULL 175s + res 175s + } 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Subsetted tests 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > source("utils/validateIndicesFramework.R") 175s > x <- runif(6, min = -6, max = 6) 175s > for (setNames in c(TRUE, FALSE)) { 175s + if (setNames) names(x) <- LETTERS[1:6] 175s + else names(x) <- NULL 175s + for (l in 1:2) { 175s + for (d in 1:2) { 175s + for (idxs in index_cases) { 175s + for (useNames in c(TRUE, FALSE)) { 175s + validateIndicesTestVector(x, idxs, 175s + ftest = diff2, fsure = diff2_R, 175s + lag = l, differences = d, useNames = useNames) 175s + } 175s + } 175s + } 175s + } 175s + } 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > 175s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 175s + n <- prod(dim) 175s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 175s + if (!is.null(idxs)) 175s + x <- x[idxs] 175s + as.vector(x) 175s + } 175s > 175s > 175s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 175s + n <- prod(dim) 175s + if (is.null(idxs)) { 175s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 175s + as.vector(x) 175s + } else { 175s + idxs <- idxs - 1L 175s + cols <- idxs %/% dim[2L] 175s + rows <- idxs %% dim[2L] 175s + cols + dim[1L] * rows + 1L 175s + } 175s + } 175s > 175s > 175s > dim <- c(5L, 4L) 175s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 175s > y <- t(x) 175s > idxs_by_cols <- seq_along(x) 175s > 175s > # Assign by columns 175s > x[idxs_by_cols] <- idxs_by_cols 175s > print(x) 175s [,1] [,2] [,3] [,4] 175s [1,] 1 6 11 16 175s [2,] 2 7 12 17 175s [3,] 3 8 13 18 175s [4,] 4 9 14 19 175s [5,] 5 10 15 20 175s > 175s > # Truth 175s > y0 <- t(x) 175s > idxs_by_rows <- as.vector(y0) 175s > 175s > # Assert 175s > idxs <- indexByRow(dim) 175s > stopifnot(all.equal(idxs, idxs_by_rows)) 175s > y <- x 175s > y[idxs_by_rows] <- idxs 175s > print(y) 175s [,1] [,2] [,3] [,4] 175s [1,] 1 6 11 16 175s [2,] 2 7 12 17 175s [3,] 3 8 13 18 175s [4,] 4 9 14 19 175s [5,] 5 10 15 20 175s > stopifnot(all(as.vector(y) == as.vector(x))) 175s > 175s > idxs_R1 <- indexByRow_R1(dim) 175s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 175s > 175s > idxs_R2 <- indexByRow_R2(dim) 175s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 175s > 175s > # Assert 175s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 175s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 175s > 175s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 175s > stopifnot(all(idxs == idxs_by_rows)) 175s > 175s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 175s > stopifnot(all(idxs_R1 == idxs_by_rows)) 175s > 175s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 175s > stopifnot(all(idxs_R2 == idxs_by_rows)) 175s > 175s > 175s > ## DEFUNCT: Backward compatibility 175s > res <- tryCatch({ 175s + idxs1 <- indexByRow(x) 175s + }, error = identity) 175s > stopifnot(inherits(res, "error")) 175s > 175s > 175s > ## Exceptions: 175s > ## Too large matrices are not supported, which happens 175s > ## when prod(dim) > .Machine$integer.max 175s > dim_too_large <- c(.Machine$integer.max, 2L) 175s > res <- tryCatch({ 175s + idxs <- indexByRow(dim_too_large, idxs = 1L) 175s + }, error = identity) 175s > stopifnot(inherits(res, "error")) 175s > 175s > ## Non-positive indices are not supported 175s > res <- tryCatch({ 175s + idxs <- indexByRow(c(1,1), idxs = 0L) 175s + }, error = identity) 175s > stopifnot(inherits(res, "error")) 175s > 175s > res <- tryCatch({ 175s + idxs <- indexByRow(c(1,1), idxs = -1L) 175s + }, error = identity) 175s > stopifnot(inherits(res, "error")) 175s > 175s 175s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 175s Copyright (C) 2025 The R Foundation for Statistical Computing 175s Platform: x86_64-pc-linux-gnu 175s 175s R is free software and comes with ABSOLUTELY NO WARRANTY. 175s You are welcome to redistribute it under certain conditions. 175s Type 'license()' or 'licence()' for distribution details. 175s 175s R is a collaborative project with many contributors. 175s Type 'contributors()' for more information and 175s 'citation()' on how to cite R or R packages in publications. 175s 175s Type 'demo()' for some demos, 'help()' for on-line help, or 175s 'help.start()' for an HTML browser interface to help. 175s Type 'q()' to quit R. 175s 175s > library("matrixStats") 175s > library("stats") 175s > 175s > logSumExp_R <- function(lx, na.rm = FALSE) { 175s + log(sum(exp(lx), na.rm = na.rm)) 175s + } 175s > 175s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 175s > 175s > for (mode in c("integer", "double")) { 175s + cat("mode: ", mode, "\n", sep = "") 175s + 175s + set.seed(1) 175s + x <- runif(20, min = 1.0, max = 3.0) 175s + storage.mode(x) <- mode 175s + str(x) 175s + 175s + ## The logarithm of the harmonic mean 175s + y0 <- log(1 / mean(1 / x)) 175s + print(y0) ## -1.600885 175s + 175s + lx <- log(x) 175s + y1 <- log(length(x)) - logSumExp(-lx) 175s + print(y1) ## [1] -1.600885 175s + 175s + # Sanity check 175s + stopifnot(all.equal(y1, y0)) 175s + 175s + y2 <- log(length(x)) - logSumExp_R(-lx) 175s + # Sanity check 175s + stopifnot(all.equal(y2, y0)) 175s + } # for (mode ...) 175s mode: integer 175s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 175s [1] 0.3215836 175s [1] 0.3215836 175s mode: double 175s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 175s [1] 0.6673156 175s [1] 0.6673156 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Missing values 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > ## NA values 175s > lx <- c(1, 2, 3) 175s > lx[2] <- NA_real_ 175s > y0 <- logSumExp_R(lx, na.rm = FALSE) 175s > y <- logSumExp(lx, na.rm = FALSE) 175s > print(y) 175s [1] NA 175s > stopifnot(identical(y, NA_real_)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > y0 <- logSumExp_R(lx, na.rm = TRUE) 175s > y <- logSumExp(lx, na.rm = TRUE) 175s > print(y) 175s [1] 3.126928 175s > stopifnot(all.equal(y, y0)) 175s > 175s > ## NaN values 175s > lx <- c(1, 2, 3) 175s > lx[2] <- NaN 175s > y0 <- logSumExp_R(lx, na.rm = FALSE) 175s > y <- logSumExp(lx, na.rm = FALSE) 175s > print(y) 175s [1] NA 175s > stopifnot(identical(y, NA_real_)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > y0 <- logSumExp_R(lx, na.rm = TRUE) 175s > y <- logSumExp(lx, na.rm = TRUE) 175s > print(y) 175s [1] 3.126928 175s > stopifnot(all.equal(y, y0)) 175s > 175s > 175s > 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > # Corner cases 175s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175s > ## Zero-length vectors 175s > lx <- numeric(0L) 175s > y0 <- logSumExp_R(lx) 175s > y <- logSumExp(lx) 175s > print(y) 175s [1] -Inf 175s > stopifnot(identical(y, -Inf)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > ## Vectors of length one 175s > lx <- 1.0 175s > y0 <- logSumExp_R(lx) 175s > y <- logSumExp(lx) 175s > print(y) 175s [1] 1 175s > stopifnot(identical(y, lx)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > lx <- NA_real_ 175s > y0 <- logSumExp_R(lx, na.rm = TRUE) 175s > y <- logSumExp(lx, na.rm = TRUE) 175s > print(y) 175s [1] -Inf 175s > stopifnot(identical(y, -Inf)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > ## All missing values 175s > lx <- c(NA_real_, NA_real_) 175s > y0 <- logSumExp_R(lx, na.rm = TRUE) 175s > y <- logSumExp(lx, na.rm = TRUE) 175s > print(y) 175s [1] -Inf 175s > stopifnot(identical(y, -Inf)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > lx <- c(NA_real_, NA_real_) 175s > y0 <- logSumExp_R(lx, na.rm = FALSE) 175s > y <- logSumExp(lx, na.rm = FALSE) 175s > print(y) 175s [1] NA 175s > stopifnot(identical(y, NA_real_)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > 175s > ## +Inf values 175s > lx <- c(1, 2, +Inf) 175s > y0 <- logSumExp_R(lx) 175s > y <- logSumExp(lx) 175s > print(y) 175s [1] Inf 175s > stopifnot(identical(y, +Inf)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > ## First element is a missing value, cf. PR #33 175s > lx <- c(NA_real_, 1) 175s > y0 <- logSumExp_R(lx) 175s > print(y0) 175s [1] NA 175s > y <- logSumExp(lx, na.rm = FALSE) 175s > print(y) 175s [1] NA 175s > stopifnot(identical(y, NA_real_)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > y0 <- logSumExp_R(lx, na.rm = TRUE) 175s > print(y0) 175s [1] 1 175s > y <- logSumExp(lx, na.rm = TRUE) 175s > print(y) 175s [1] 1 175s > stopifnot(identical(y, 1)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > ## Multiple -Inf values, cf. issue #84 175s > lx <- c(-Inf, -Inf) 175s > y0 <- logSumExp_R(lx) 175s > y <- logSumExp(lx) 175s > print(y) 175s [1] -Inf 175s > stopifnot(identical(y, -Inf)) 175s > stopifnot(all.equal(y, y0)) 175s > 175s > lx <- c(-Inf, 5, -Inf) 175s > y0 <- logSumExp_R(lx) 175s > y <- logSumExp(lx) 175s > print(y) 175s [1] 5 175s > stopifnot(identical(y, 5)) 175s > stopifnot(all.equal(y, y0)) 175s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > logSumExp_R <- function(lx, na.rm = FALSE) { 176s + log(sum(exp(lx), na.rm = na.rm)) 176s + } 176s > 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Subsetted tests 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > source("utils/validateIndicesFramework.R") 176s > x <- runif(6, min = -6, max = 6) 176s > for (idxs in index_cases) { 176s + validateIndicesTestVector(x, idxs, 176s + ftest = logSumExp, fsure = logSumExp_R, 176s + na.rm = FALSE) 176s + validateIndicesTestVector(x, idxs, 176s + ftest = logSumExp, fsure = logSumExp_R, 176s + na.rm = TRUE) 176s + } 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Consistency checks 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > set.seed(1) 176s > 176s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 176s + if (is.null(idxs)) { 176s + mean(x, na.rm = na.rm) 176s + } else { 176s + mean(x[idxs], na.rm = na.rm) 176s + } 176s + } # mean2_R() 176s > 176s > 176s > cat("Consistency checks:\n") 176s Consistency checks: 176s > for (kk in 1:20) { 176s + cat("Random test #", kk, "\n", sep = "") 176s + 176s + # Simulate data in a matrix of any shape 176s + n <- sample(100L, size = 1L) 176s + x <- rnorm(n, sd = 100) 176s + 176s + # Add NAs? 176s + if ((kk %% 4) %in% c(3, 0)) { 176s + cat("Adding NAs\n") 176s + nna <- sample(n, size = 1L) 176s + na_values <- c(NA_real_, NaN) 176s + t <- sample(na_values, size = nna, replace = TRUE) 176s + x[sample(length(x), size = nna)] <- t 176s + } 176s + 176s + # Integer or double? 176s + if ((kk %% 4) %in% c(2, 0)) { 176s + cat("Coercing to integers\n") 176s + storage.mode(x) <- "integer" 176s + } 176s + 176s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 176s + 176s + # Sum over all 176s + y0 <- mean2_R(x, na.rm = na.rm) 176s + y1 <- mean2(x, na.rm = na.rm) 176s + stopifnot(all.equal(y1, y0)) 176s + 176s + # Sum over subset 176s + nidxs <- sample(n, size = 1L) 176s + idxs <- sample(n, size = nidxs) 176s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 176s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 176s + stopifnot(all.equal(y1, y0)) 176s + 176s + if (storage.mode(x) == "integer") { 176s + storage.mode(x) <- "logical" 176s + 176s + y0 <- mean2_R(x, na.rm = na.rm) 176s + y1 <- mean2(x, na.rm = na.rm) 176s + stopifnot(all.equal(y1, y0)) 176s + 176s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 176s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 176s + stopifnot(all.equal(y1, y0)) 176s + } 176s + } # for (kk ...) 176s Random test #1 176s Random test #2 176s Coercing to integers 176s Random test #3 176s Adding NAs 176s Random test #4 176s Adding NAs 176s Coercing to integers 176s Random test #5 176s Random test #6 176s Coercing to integers 176s Random test #7 176s Adding NAs 176s Random test #8 176s Adding NAs 176s Coercing to integers 176s Random test #9 176s Random test #10 176s Coercing to integers 176s Random test #11 176s Adding NAs 176s Random test #12 176s Adding NAs 176s Coercing to integers 176s Random test #13 176s Random test #14 176s Coercing to integers 176s Random test #15 176s Adding NAs 176s Random test #16 176s Adding NAs 176s Coercing to integers 176s Random test #17 176s Random test #18 176s Coercing to integers 176s Random test #19 176s Adding NAs 176s Random test #20 176s Adding NAs 176s Coercing to integers 176s > 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Special cases 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > for (na.rm in c(FALSE, TRUE)) { 176s + # Averaging over zero elements (integers) 176s + x <- integer(0) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + x <- 1:5 176s + idxs <- integer(0) 176s + s1 <- mean(x[idxs], na.rm = na.rm) 176s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over NA_integer_:s 176s + x <- rep(NA_integer_, times = 5L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + x <- rep(NA_integer_, times = 5L) 176s + idxs <- 1:3 176s + s1 <- mean(x[idxs], na.rm = na.rm) 176s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + 176s + # Averaging over zero elements (doubles) 176s + x <- double(0) 176s + s1 <- mean(x) 176s + s2 <- mean2(x) 176s + stopifnot(identical(s1, s2)) 176s + 176s + x <- as.double(1:10) 176s + idxs <- integer(0) 176s + s1 <- mean(x[idxs]) 176s + s2 <- mean2(x, idxs = idxs) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over NA_real_:s 176s + x <- rep(NA_real_, times = 5L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + x <- rep(NA_real_, times = 5L) 176s + idxs <- 1:3 176s + s1 <- mean(x[idxs], na.rm = na.rm) 176s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over -Inf:s 176s + x <- rep(-Inf, times = 3L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over +Inf:s 176s + x <- rep(+Inf, times = 3L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over mix of -Inf:s and +Inf:s 176s + x <- rep(c(-Inf, +Inf), times = 3L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over mix of -Inf:s and +Inf:s and numerics 176s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + stopifnot(identical(s1, s2)) 176s + 176s + # Averaging over mix of NaN, NA, +Inf, and numerics 176s + x <- c(NaN, NA, +Inf, 3.14) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + if (na.rm) { 176s + stopifnot(identical(s2, s1)) 176s + } else { 176s + stopifnot(is.na(s1), is.na(s2)) 176s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 176s + ## returned here (as one would expect). NaN might very well be returned, 176s + ## when both NA and NaN are involved. This is an accepted feature in R, 176s + ## which is documented in help("is.nan"). See also 176s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 176s + ## Thus, we cannot guarantee that s1 is identical to s0. 176s + } 176s + 176s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 176s + x <- c(NA_real_, NaN, +Inf, 3.14) 176s + s1 <- mean(x, na.rm = na.rm) 176s + s2 <- mean2(x, na.rm = na.rm) 176s + if (na.rm) { 176s + stopifnot(identical(s2, s1)) 176s + } else { 176s + stopifnot(is.na(s1), is.na(s2)) 176s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 176s + ## returned here (as one would expect). NaN might very well be returned, 176s + ## when both NA and NaN are involved. This is an accepted feature in R, 176s + ## which is documented in help("is.nan"). See also 176s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 176s + ## Thus, we cannot guarantee that s1 is identical to s0. 176s + } 176s + } 176s > 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Argument 'idxs' 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > x <- 1:5 176s > idxs_list <- list( 176s + integer = 1:3, 176s + double = as.double(1:3), 176s + logical = (x <= 3) 176s + ) 176s > 176s > for (idxs in idxs_list) { 176s + cat("idxs:\n") 176s + str(idxs) 176s + s1 <- mean(x[idxs], na.rm = TRUE) 176s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 176s + stopifnot(identical(s1, s2)) 176s + } 176s idxs: 176s int [1:3] 1 2 3 176s idxs: 176s num [1:3] 1 2 3 176s idxs: 176s logi [1:5] TRUE TRUE TRUE FALSE FALSE 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Subsetted tests 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > source("utils/validateIndicesFramework.R") 176s > x <- runif(6, min = -6, max = 6) 176s > storage.mode(x) <- "integer" 176s > for (idxs in index_cases) { 176s + validateIndicesTestVector(x, idxs, 176s + ftest = mean2, fsure = mean, 176s + na.rm = FALSE) 176s + validateIndicesTestVector(x, idxs, 176s + ftest = mean2, fsure = mean, 176s + na.rm = TRUE) 176s + } 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > for (mode in c("integer", "double")) { 176s + cat("mode: ", mode, "\n", sep = "") 176s + 176s + # Empty vector 176s + x <- 0 176s + storage.mode(x) <- mode 176s + y <- prod(x, na.rm = TRUE) 176s + print(y) 176s + z <- product(x, na.rm = TRUE) 176s + print(z) 176s + stopifnot(all.equal(z, y)) 176s + 176s + # Test negative values 176s + x <- c(1, -4, 2) 176s + storage.mode(x) <- mode 176s + y <- prod(x, na.rm = TRUE) 176s + print(y) 176s + z <- product(x, na.rm = TRUE) 176s + print(z) 176s + stopifnot(all.equal(z, y)) 176s + 176s + # Test missing values 176s + x <- c(1, NA, NaN, 2) 176s + storage.mode(x) <- mode 176s + y <- prod(x, na.rm = TRUE) 176s + print(y) 176s + z <- product(x, na.rm = TRUE) 176s + print(z) 176s + stopifnot(all.equal(z, y)) 176s + 176s + x <- c(1, NA, NaN, 2) 176s + storage.mode(x) <- mode 176s + y <- prod(x, na.rm = FALSE) 176s + print(y) 176s + z <- product(x, na.rm = FALSE) 176s + print(z) 176s + stopifnot(all(is.na(z), is.na(y))) 176s + 176s + x <- c(1, NaN, 2) 176s + storage.mode(x) <- mode 176s + y <- prod(x, na.rm = FALSE) 176s + print(y) 176s + stopifnot(is.na(y)) 176s + z <- product(x, na.rm = FALSE) 176s + print(z) 176s + stopifnot(is.na(z)) 176s + 176s + } # for (mode ...) 176s mode: integer 176s [1] 0 176s [1] 0 176s [1] -8 176s [1] -8 176s [1] 2 176s [1] 2 176s [1] NA 176s [1] NA 176s [1] NA 176s [1] NA 176s mode: double 176s [1] 0 176s [1] 0 176s [1] -8 176s [1] -8 176s [1] 2 176s [1] 2 176s [1] NA 176s [1] NA 176s [1] NaN 176s [1] NA 176s > 176s > 176s > # NAs following 0s 176s > x <- c(0L, NA_integer_) 176s > y <- prod(x, na.rm = FALSE) 176s > print(y) 176s [1] NA 176s > z <- product(x, na.rm = FALSE) 176s > print(z) 176s [1] NA 176s > stopifnot(identical(z, y)) 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Subsetted tests 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > source("utils/validateIndicesFramework.R") 176s > x <- runif(6, min = -6, max = 6) 176s > storage.mode(x) <- "integer" 176s > for (idxs in index_cases) { 176s + validateIndicesTestVector(x, idxs, 176s + ftest = product, fsure = prod, 176s + na.rm = TRUE) 176s + validateIndicesTestVector(x, idxs, 176s + ftest = product, fsure = prod, 176s + na.rm = FALSE) 176s + } 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > library("utils") ## utils::str 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Local functions 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > psortKM_R <- function(x, k, m) { 176s + x <- sort(x) 176s + x[(k - m + 1):k] 176s + } 176s > 176s > psortKM_R2 <- function(x, k, m) { 176s + partial <- (k - m + 1):k 176s + x <- sort.int(x, partial = partial) 176s + x[partial] 176s + } 176s > 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Consistency checks 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > set.seed(1) 176s > 176s > cat("Consistency checks:\n") 176s Consistency checks: 176s > x <- 1:30 176s > x[18:20] <- 20 176s > y <- sample(x) 176s > cat("x:\n") 176s x: 176s > str(x) 176s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 176s > cat("sample(x):\n") 176s sample(x): 176s > str(y) 176s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 176s > 176s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 176s + for (m in 1:min(5L, k)) { 176s + px0 <- psortKM_R(x, k = k, m = m) 176s + px0b <- psortKM_R2(x, k = k, m = m) 176s + stopifnot(identical(px0b, px0)) 176s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 176s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 176s + print(px1) 176s + stopifnot(identical(px1, px0)) 176s + 176s + py0 <- psortKM_R(y, k = k, m = m) 176s + py0b <- psortKM_R2(y, k = k, m = m) 176s + stopifnot(identical(py0b, py0)) 176s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 176s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 176s + print(py1) 176s + stopifnot(identical(py1, py0)) 176s + stopifnot(identical(py1, px1)) 176s + } # for (m ...) 176s + } # for (k ...) 176s .psortKM(x, k = 1, m = 1): 176s [1] 1 176s .psortKM(y, k = 1, m = 1): 176s [1] 1 176s .psortKM(x, k = 2, m = 1): 176s [1] 2 176s .psortKM(y, k = 2, m = 1): 176s [1] 2 176s .psortKM(x, k = 2, m = 2): 176s [1] 1 2 176s .psortKM(y, k = 2, m = 2): 176s [1] 1 2 176s .psortKM(x, k = 20, m = 1): 176s [1] 20 176s .psortKM(y, k = 20, m = 1): 176s [1] 20 176s .psortKM(x, k = 20, m = 2): 176s [1] 20 20 176s .psortKM(y, k = 20, m = 2): 176s [1] 20 20 176s .psortKM(x, k = 20, m = 3): 176s [1] 20 20 20 176s .psortKM(y, k = 20, m = 3): 176s [1] 20 20 20 176s .psortKM(x, k = 20, m = 4): 176s [1] 17 20 20 20 176s .psortKM(y, k = 20, m = 4): 176s [1] 17 20 20 20 176s .psortKM(x, k = 20, m = 5): 176s [1] 16 17 20 20 20 176s .psortKM(y, k = 20, m = 5): 176s [1] 16 17 20 20 20 176s .psortKM(x, k = 21, m = 1): 176s [1] 21 176s .psortKM(y, k = 21, m = 1): 176s [1] 21 176s .psortKM(x, k = 21, m = 2): 176s [1] 20 21 176s .psortKM(y, k = 21, m = 2): 176s [1] 20 21 176s .psortKM(x, k = 21, m = 3): 176s [1] 20 20 21 176s .psortKM(y, k = 21, m = 3): 176s [1] 20 20 21 176s .psortKM(x, k = 21, m = 4): 176s [1] 20 20 20 21 176s .psortKM(y, k = 21, m = 4): 176s [1] 20 20 20 21 176s .psortKM(x, k = 21, m = 5): 176s [1] 17 20 20 20 21 176s .psortKM(y, k = 21, m = 5): 176s [1] 17 20 20 20 21 176s .psortKM(x, k = 30, m = 1): 176s [1] 30 176s .psortKM(y, k = 30, m = 1): 176s [1] 30 176s .psortKM(x, k = 30, m = 2): 176s [1] 29 30 176s .psortKM(y, k = 30, m = 2): 176s [1] 29 30 176s .psortKM(x, k = 30, m = 3): 176s [1] 28 29 30 176s .psortKM(y, k = 30, m = 3): 176s [1] 28 29 30 176s .psortKM(x, k = 30, m = 4): 176s [1] 27 28 29 30 176s .psortKM(y, k = 30, m = 4): 176s [1] 27 28 29 30 176s .psortKM(x, k = 30, m = 5): 176s [1] 26 27 28 29 30 176s .psortKM(y, k = 30, m = 5): 176s [1] 26 27 28 29 30 176s > 176s 176s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 176s Copyright (C) 2025 The R Foundation for Statistical Computing 176s Platform: x86_64-pc-linux-gnu 176s 176s R is free software and comes with ABSOLUTELY NO WARRANTY. 176s You are welcome to redistribute it under certain conditions. 176s Type 'license()' or 'licence()' for distribution details. 176s 176s R is a collaborative project with many contributors. 176s Type 'contributors()' for more information and 176s 'citation()' on how to cite R or R packages in publications. 176s 176s Type 'demo()' for some demos, 'help()' for on-line help, or 176s 'help.start()' for an HTML browser interface to help. 176s Type 'q()' to quit R. 176s 176s > library("matrixStats") 176s > 176s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 176s + if (is.na(value)) { 176s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 176s + } else { 176s + y <- x == value 176s + 176s + # Preserve dimnames attribute 176s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 176s + if (!isTRUE(all.equal(dim(y), dim))) { 176s + dim(y) <- dim 176s + dimnames(y) <- dimnames(x) 176s + } 176s + 176s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 176s + } 176s + if (!useNames) names(res) <- NULL 176s + res 176s + } 176s > 176s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 176s + if (is.na(value)) { 176s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 176s + } else { 176s + y <- x == value 176s + 176s + # Preserve dimnames attribute 176s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 176s + if (!isTRUE(all.equal(dim(y), dim))) { 176s + dim(y) <- dim 176s + dimnames(y) <- dimnames(x) 176s + } 176s + 176s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 176s + } 176s + if (!useNames) names(res) <- NULL 176s + res 176s + } 176s > 176s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 176s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 176s + if (!useNames) names(res) <- NULL 176s + res 176s + } 176s > 176s > 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > # Data type: logical 176s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 176s > x[7:8, 2:3] <- TRUE 176s > x[1:3, ] <- TRUE 176s > x[, 1] <- TRUE 176s > x[4, ] <- FALSE 176s > x[, 4] <- FALSE 176s > x[2, ] <- FALSE 176s > x[3, ] <- TRUE 176s > 176s > # To check names attribute 176s > dimnames <- list(letters[1:10], LETTERS[1:4]) 176s > 176s > for (kk in 1:3) { 176s + if (kk == 2) { 176s + x[2, 2] <- NA 176s + } else if (kk == 3) { 176s + x[, 2] <- NA 176s + x[2, ] <- NA 176s + } 176s + 176s + # Test with and without dimnames on x 176s + for (setDimnames in c(TRUE, FALSE)) { 176s + dimnames(x) <- if (setDimnames) dimnames else NULL 176s + 176s + for (na.rm in c(FALSE, TRUE)) { 176s + # Check names attribute 176s + for (useNames in c(TRUE, FALSE)) { 176s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 176s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 176s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 176s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 176s + stopifnot(identical(m1, m0)) 176s + stopifnot(identical(m2, m0)) 176s + 176s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 176s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 176s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 176s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 176s + stopifnot(identical(m1, m0)) 176s + stopifnot(identical(m2, m0)) 176s + 176s + m0 <- rowAnyMissings_R(x, useNames = useNames) 176s + m1 <- rowAnyMissings(x, useNames = useNames) 176s + m2 <- colAnyMissings(t(x), useNames = useNames) 176s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 176s + stopifnot(identical(m1, m0)) 176s + stopifnot(identical(m2, m0)) 176s + } 176s + } 176s + } 176s + } # for (kk ...) 176s List of 4 176s $ : chr "all()" 176s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "any()" 176s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "any()" 176s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "any()" 176s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "any()" 176s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "all()" 176s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 176s List of 4 176s $ : chr "any()" 176s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 176s List of 4 176s $ : chr "anyMissing()" 176s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 176s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "any()" 177s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "any()" 177s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s List of 4 177s $ : chr "all()" 177s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 177s List of 4 177s $ : chr "any()" 177s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 177s List of 4 177s $ : chr "anyMissing()" 177s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 177s > 177s > 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > # Data type: integer 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 177s > x[2, ] <- 7L 177s > x[3, 1] <- 7L 177s > x[2:3, 3:4] <- NA_integer_ 177s > 177s > # To check names attribute 177s > dimnames <- list(letters[1:4], LETTERS[1:5]) 177s > 177s > # Row/column counts 177s > value <- 7L 177s > 177s > # Test with and without dimnames on x 177s > for (setDimnames in c(TRUE, FALSE)) { 177s + dimnames(x) <- if (setDimnames) dimnames else NULL 177s + for (na.rm in c(FALSE, TRUE)) { 177s + # Check names attribute 177s + for (useNames in c(TRUE, FALSE)) { 177s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 177s + stopifnot(identical(r1, r0)) 177s + stopifnot(identical(r2, r1)) 177s + if (!useNames && !setDimnames) { 177s + for (rr in seq_len(nrow(x))) { 177s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, r1[rr])) 177s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, r1[rr])) 177s + } 177s + } 177s + 177s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 177s + stopifnot(identical(r1, r0)) 177s + stopifnot(identical(r2, r1)) 177s + if (!useNames && !setDimnames) { 177s + for (rr in seq_len(nrow(x))) { 177s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, r1[rr])) 177s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, r1[rr])) 177s + } 177s + } 177s + } 177s + } 177s + } 177s > 177s > 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > x <- matrix(0, nrow = 4L, ncol = 5L) 177s > x[2:4, 2] <- (1:3) / 4 177s > x[2, 2:4] <- (1:3) / 4 177s > x[3:4, 3] <- (3:4) / 4 177s > x[3, 3:4] <- (3:4) / 4 177s > x[1:4, 5] <- (1:4) / 5 177s > x[4, 4] <- NA_real_ 177s > 177s > # To check names attribute 177s > dimnames <- list(letters[1:4], LETTERS[1:5]) 177s > 177s > for (value in c(TRUE, FALSE)) { 177s + for (na.rm in c(FALSE, TRUE)) { 177s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 177s + y <- rowAnys(x, na.rm = na.rm, value = value) 177s + stopifnot(identical(y, y0)) 177s + # Check names attribute 177s + dimnames(x) <- dimnames 177s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 177s + stopifnot(all.equal(y, y0)) 177s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 177s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 177s + stopifnot(all.equal(y, y0)) 177s + dimnames(x) <- NULL 177s + 177s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 177s + y <- colAnys(x, na.rm = na.rm, value = value) 177s + stopifnot(identical(y, y0)) 177s + # Check names attribute 177s + dimnames(x) <- dimnames 177s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 177s + stopifnot(all.equal(y, y0)) 177s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 177s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 177s + stopifnot(all.equal(y, y0)) 177s + dimnames(x) <- NULL 177s + 177s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 177s + y <- rowAlls(x, na.rm = na.rm, value = value) 177s + stopifnot(identical(y, y0)) 177s + # Check names attribute 177s + dimnames(x) <- dimnames 177s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 177s + stopifnot(all.equal(y, y0)) 177s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 177s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 177s + stopifnot(all.equal(y, y0)) 177s + dimnames(x) <- NULL 177s + 177s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 177s + y <- colAlls(x, na.rm = na.rm, value = value) 177s + stopifnot(identical(y, y0)) 177s + print(y0) 177s + # Check names attribute 177s + dimnames(x) <- dimnames 177s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 177s + stopifnot(all.equal(y, y0)) 177s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 177s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 177s + stopifnot(all.equal(y, y0)) 177s + dimnames(x) <- NULL 177s + } ## for (na.rm ...) 177s + } ## for(value ...) 177s [1] FALSE FALSE FALSE FALSE TRUE 177s [1] FALSE FALSE FALSE FALSE TRUE 177s [1] TRUE FALSE FALSE FALSE FALSE 177s [1] TRUE FALSE FALSE FALSE FALSE 177s > 177s > 177s > 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > # Data type: character (not sure if this should be supported) 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > all_R <- function(x, value = TRUE, ...) { 177s + if (is.na(value)) { 177s + all(is.na(x), ...) 177s + } else { 177s + all(x == value, ...) 177s + } 177s + } 177s > 177s > any_R <- function(x, value = TRUE, ...) { 177s + if (is.na(value)) { 177s + any(is.na(x), ...) 177s + } else { 177s + any(x == value, ...) 177s + } 177s + } 177s > 177s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 177s > x[2, ] <- "g" 177s > x[2:4, 3:4] <- NA_character_ 177s > 177s > # To check names attribute 177s > dimnames <- list(letters[1:10], LETTERS[1:5]) 177s > 177s > # Test with and without dimnames on x 177s > for (setDimnames in c(TRUE, FALSE)) { 177s + dimnames(x) <- if (setDimnames) dimnames else NULL 177s + 177s + # Row/column counts 177s + for (value in c("g", NA_character_)) { 177s + for (na.rm in c(FALSE, TRUE)) { 177s + # Check names attribute 177s + for (useNames in c(TRUE, FALSE)) { 177s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 177s + stopifnot(identical(r1, r0)) 177s + stopifnot(identical(r2, r1)) 177s + if (!useNames && !setDimnames) { 177s + for (rr in seq_len(nrow(x))) { 177s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 177s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, r1[rr])) 177s + stopifnot(identical(c, c0)) 177s + } 177s + } 177s + 177s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 177s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 177s + stopifnot(identical(r1, r0)) 177s + stopifnot(identical(r2, r1)) 177s + if (!useNames && !setDimnames) { 177s + for (rr in seq_len(nrow(x))) { 177s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 177s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 177s + stopifnot(identical(c, c0)) 177s + stopifnot(identical(c, r1[rr])) 177s + } 177s + } 177s + } 177s + } 177s + } 177s + } 177s > 177s > 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > # NA 0 test 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > x <- matrix(0, nrow = 3L, ncol = 3L) 177s > x[1, ] <- c(NA_real_, NA_real_, 0) 177s > x[3, ] <- c(1, 0, 1) 177s > 177s > dimnames <- list(letters[1:3], LETTERS[1:3]) 177s > 177s > # Test with and without dimnames on x 177s > for (setDimnames in c(TRUE, FALSE)) { 177s + dimnames(x) <- if (setDimnames) dimnames else NULL 177s + # Check names attribute 177s + for (useNames in c(TRUE, FALSE)) { 177s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 177s + r1 <- rowAnys(x, value = 0, useNames = useNames) 177s + stopifnot(identical(r0, r1)) 177s + } 177s + } 177s > 177s 177s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 177s Copyright (C) 2025 The R Foundation for Statistical Computing 177s Platform: x86_64-pc-linux-gnu 177s 177s R is free software and comes with ABSOLUTELY NO WARRANTY. 177s You are welcome to redistribute it under certain conditions. 177s Type 'license()' or 'licence()' for distribution details. 177s 177s R is a collaborative project with many contributors. 177s Type 'contributors()' for more information and 177s 'citation()' on how to cite R or R packages in publications. 177s 177s Type 'demo()' for some demos, 'help()' for on-line help, or 177s 'help.start()' for an HTML browser interface to help. 177s Type 'q()' to quit R. 177s 177s > library("matrixStats") 177s > 177s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 177s + if (is.na(value)) { 177s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 177s + } else { 177s + y <- x == value 177s + 177s + # Preserve dimnames attribute 177s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 177s + if (!isTRUE(all.equal(dim(y), dim))) { 177s + dim(y) <- dim 177s + dimnames(y) <- dimnames(x) 177s + } 177s + 177s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 177s + } 177s + if (!useNames) names(res) <- NULL 177s + res 177s + } 177s > 177s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 177s + if (is.na(value)) { 177s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 177s + } else { 177s + y <- x == value 177s + 177s + # Preserve dimnames attribute 177s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 177s + if (!isTRUE(all.equal(dim(y), dim))) { 177s + dim(y) <- dim 177s + dimnames(y) <- dimnames(x) 177s + } 177s + 177s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 177s + } 177s + if (!useNames) names(res) <- NULL 177s + res 177s + } 177s > 177s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 177s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 177s + if (!useNames) names(res) <- NULL 177s + res 177s + } 177s > 177s > 177s > all_R <- function(x, value = TRUE, ...) { 177s + if (is.na(value)) { 177s + all(is.na(x), ...) 177s + } else { 177s + all(x == value, ...) 177s + } 177s + } 177s > 177s > any_R <- function(x, value = TRUE, ...) { 177s + if (is.na(value)) { 177s + any(is.na(x), ...) 177s + } else { 177s + any(x == value, ...) 177s + } 177s + } 177s > 177s > 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > # Subsetted tests 177s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 177s > source("utils/validateIndicesFramework.R") 177s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 177s > storage.mode(x) <- "integer" 177s > x[2:3, ] <- NA_integer_ 177s > x[2, 1] <- 0L 177s > x[4:5, ] <- 0L 177s > x[4, 6] <- NA_integer_ 177s > 177s > # To check names attribute 177s > dimnames <- list(letters[1:6], LETTERS[1:6]) 177s > 177s > # Test with and without dimnames on x 177s > for (setDimnames in c(TRUE, FALSE)) { 177s + if (setDimnames) dimnames(x) <- dimnames 177s + else dimnames(x) <- NULL 177s + 177s + count <- 0L 177s + for (rows in index_cases) { 177s + for (cols in index_cases) { 177s + count <- count + 1L 177s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 177s + useNames <- c(TRUE, FALSE) 177s + useNames <- useNames[count %% length(useNames) + 1] 177s + 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAlls, fsure = rowAlls_R, 177s + value = 0, na.rm = TRUE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAlls, fsure = rowAlls_R, 177s + value = 0, na.rm = FALSE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAlls, fsure = rowAlls_R, 177s + value = NA_integer_, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAlls, fsure = rowAlls_R, 177s + value = 0, na.rm = TRUE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAlls, fsure = rowAlls_R, 177s + value = 0, na.rm = FALSE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAlls, fsure = rowAlls_R, 177s + value = NA_integer_, useNames = useNames) 177s + 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAnys, fsure = rowAnys_R, 177s + value = 0, na.rm = TRUE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAnys, fsure = rowAnys_R, 177s + value = 0, na.rm = FALSE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAnys, fsure = rowAnys_R, 177s + value = NA_integer_, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAnys, fsure = rowAnys_R, 177s + value = 0, na.rm = TRUE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAnys, fsure = rowAnys_R, 177s + value = 0, na.rm = FALSE, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAnys, fsure = rowAnys_R, 177s + value = NA_integer_, useNames = useNames) 177s + 177s + validateIndicesTestMatrix(x, rows, cols, 177s + ftest = rowAnyMissings, 177s + fsure = rowAnyMissings_R, useNames = useNames) 177s + validateIndicesTestMatrix(x, rows, cols, 177s + fcoltest = colAnyMissings, 177s + fsure = rowAnyMissings_R, useNames = useNames) 177s + } 177s + } 177s + } 177s > 177s > for (rr in seq_len(nrow(x))) { 177s + for (idxs in index_cases) { 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = allValue, fsure = all_R, 177s + value = 0, na.rm = TRUE) 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = allValue, fsure = all_R, 177s + value = 0, na.rm = FALSE) 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = allValue, fsure = all_R, 177s + value = NA_integer_) 177s + 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = anyValue, fsure = any_R, 177s + value = 0, na.rm = TRUE) 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = anyValue, fsure = any_R, 177s + value = 0, na.rm = FALSE) 177s + validateIndicesTestVector(x[rr, ], idxs, 177s + ftest = anyValue, fsure = any_R, 177s + value = NA_integer_) 177s + } 177s + } 178s > 178s > 178s > storage.mode(x) <- "character" 178s > # Test with and without dimnames on x 178s > for (setDimnames in c(TRUE, FALSE)) { 178s + if (setDimnames) dimnames(x) <- dimnames 178s + else dimnames(x) <- NULL 178s + for (rows in index_cases) { 178s + for (cols in index_cases) { 178s + # Check names attribute 178s + for (useNames in c(TRUE, FALSE)) { 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAlls, fsure = rowAlls_R, 178s + value = "0", na.rm = TRUE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAlls, fsure = rowAlls_R, 178s + value = "0", na.rm = FALSE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAlls, fsure = rowAlls_R, 178s + value = NA_character_, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAlls, fsure = rowAlls_R, 178s + value = "0", na.rm = TRUE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAlls, fsure = rowAlls_R, 178s + value = "0", na.rm = FALSE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAlls, fsure = rowAlls_R, 178s + value = NA_character_, useNames = useNames) 178s + 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAnys, fsure = rowAnys_R, 178s + value = "0", na.rm = TRUE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAnys, fsure = rowAnys_R, 178s + value = "0", na.rm = FALSE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAnys, fsure = rowAnys_R, 178s + value = NA_character_, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAnys, fsure = rowAnys_R, 178s + value = "0", na.rm = TRUE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAnys, fsure = rowAnys_R, 178s + value = "0", na.rm = FALSE, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAnys, fsure = rowAnys_R, 178s + value = NA_character_, useNames = useNames) 178s + 178s + validateIndicesTestMatrix(x, rows, cols, 178s + ftest = rowAnyMissings, 178s + fsure = rowAnyMissings_R, useNames = useNames) 178s + validateIndicesTestMatrix(x, rows, cols, 178s + fcoltest = colAnyMissings, 178s + fsure = rowAnyMissings_R, useNames = useNames) 178s + } 178s + } 178s + } 178s + } 179s > 179s > for (rr in seq_len(nrow(x))) { 179s + for (idxs in index_cases) { 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = allValue, fsure = all_R, 179s + value = "0", na.rm = TRUE) 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = allValue, fsure = all_R, 179s + value = "0", na.rm = FALSE) 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = allValue, fsure = all_R, 179s + value = NA_integer_) 179s + 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = anyValue, fsure = any_R, 179s + value = "0", na.rm = TRUE) 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = anyValue, fsure = any_R, 179s + value = "0", na.rm = FALSE) 179s + validateIndicesTestVector(x[rr, ], idxs, 179s + ftest = anyValue, fsure = any_R, 179s + value = NA_integer_) 179s + } 179s + } 179s > 179s 179s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 179s Copyright (C) 2025 The R Foundation for Statistical Computing 179s Platform: x86_64-pc-linux-gnu 179s 179s R is free software and comes with ABSOLUTELY NO WARRANTY. 179s You are welcome to redistribute it under certain conditions. 179s Type 'license()' or 'licence()' for distribution details. 179s 179s R is a collaborative project with many contributors. 179s Type 'contributors()' for more information and 179s 'citation()' on how to cite R or R packages in publications. 179s 179s Type 'demo()' for some demos, 'help()' for on-line help, or 179s 'help.start()' for an HTML browser interface to help. 179s Type 'q()' to quit R. 179s 179s > library("matrixStats") 179s > 179s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 179s > rownames(X) <- LETTERS[1:nrow(X)] 179s > colnames(X) <- letters[1:ncol(X)] 179s > print(X) 179s a b c d e f 179s A 1.94584219 -1.603263553 -0.47979506 -0.7857903 -1.533983897 -0.93402043 179s B 0.70371354 -1.427618969 -1.04834507 0.2982445 -0.634595990 -0.14915733 179s C 1.35379266 -0.071805725 1.72135876 -1.3222530 -0.204011435 -0.24725248 179s D -1.62345950 0.083092047 0.33365884 -1.1718180 0.996811550 0.07601603 179s E 0.71973880 -0.788777707 -0.81815514 0.1652880 -1.120576833 1.34501152 179s F -2.16926799 -0.658771575 0.66657093 0.2746164 0.980405290 0.05342237 179s G 0.33952349 0.688110667 -0.17095846 0.1562647 0.632853395 1.69089988 179s H -1.17006069 1.323064011 0.60501914 -0.1720869 -1.408427388 -0.24538536 179s I 0.82384135 -0.320121268 -0.34840534 0.3885500 0.896246225 1.75460287 179s J -0.28124988 0.091220776 -0.47243215 0.7959029 0.003845496 0.30551558 179s K 0.01365748 -1.212228712 -1.73389374 -1.1119543 1.291546194 0.71617370 179s L -0.75271535 1.167948850 1.02773463 0.1261911 -0.715329612 1.18077428 179s M -0.81571773 0.494045857 0.38001746 -0.1460559 -0.477668518 0.06176001 179s N -1.07405293 -1.158730906 -0.04506403 -1.4658833 -0.160116717 -2.63949344 179s O -0.45323462 0.054818027 0.46290093 0.2924028 -1.243104812 -1.47923557 179s P 0.88250577 -0.247671235 0.32019341 -1.7806172 0.334743963 0.41319157 179s Q 0.28673726 0.044767011 -1.06995236 0.6408858 -2.531381088 0.34480331 179s R 0.26732366 1.303772498 1.15976451 -0.8895742 0.437345510 0.86987340 179s S -1.68909109 -1.566845836 0.60388267 1.7785579 0.326685509 -0.20401089 179s T -0.16832667 -0.009105228 0.96529033 -0.9077198 -0.365388512 1.91621014 179s > 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Apply rowMeans() for 3 sets of 2 columns 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > nbr_of_sets <- 3L 179s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 179s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 179s > print(S) 179s s1 s2 s3 179s [1,] 1 3 5 179s [2,] 2 4 6 179s > 179s > Z <- rowAvgsPerColSet(X, S = S) 179s > print(Z) 179s s1 s2 s3 179s A 0.17128932 -0.63279267 -1.23400216 179s B -0.36195271 -0.37505030 -0.39187666 179s C 0.64099347 0.19955288 -0.22563196 179s D -0.77018373 -0.41907960 0.53641379 179s E -0.03451945 -0.32643356 0.11221734 179s F -1.41401978 0.47059365 0.51691383 179s G 0.51381708 -0.00734686 1.16187664 179s H 0.07650166 0.21646610 -0.82690638 179s I 0.25186004 0.02007235 1.32542455 179s J -0.09501455 0.16173536 0.15468054 179s K -0.59928562 -1.42292402 1.00385995 179s L 0.20761675 0.57696288 0.23272233 179s M -0.16083594 0.11698078 -0.20795425 179s N -1.11639192 -0.75547366 -1.39980508 179s O -0.19920830 0.37765185 -1.36117019 179s P 0.31741727 -0.73021188 0.37396776 179s Q 0.16575213 -0.21453328 -1.09328889 179s R 0.78554808 0.13509517 0.65360946 179s S -1.62796847 1.19122028 0.06133731 179s T -0.08871595 0.02878527 0.77541081 179s > 179s > # Validation 179s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 179s + s3 = rowMeans(X[, 5:6])) 179s > stopifnot(identical(drop(Z), Z0)) 179s > 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Apply colMeans() for 5 sets of 4 rows 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > nbr_of_sets <- 5L 179s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 179s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 179s > print(S) 179s s1 s2 s3 s4 s5 179s [1,] 1 5 9 13 17 179s [2,] 2 6 10 14 18 179s [3,] 3 7 11 15 19 179s [4,] 4 8 12 16 20 179s > 179s > Z <- colAvgsPerRowSet(X, S = S) 179s > print(Z) 179s a b c d e f 179s s1 0.5949722 -0.75489905 0.13171937 -0.74540421 -0.3439449 -0.3136036 179s s2 -0.5700166 0.14090635 0.07061912 0.10602055 -0.2289364 0.7109871 179s s3 -0.0491166 -0.06829509 -0.38174915 0.04967244 0.3690771 0.9892666 179s s4 -0.3651249 -0.21438456 0.27951194 -0.77503840 -0.3865365 -0.9109444 179s s5 -0.3258392 -0.05685289 0.41474629 0.15553743 -0.5331846 0.7317190 179s > 179s > # Validation 179s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 179s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 179s + s5 = colMeans(X[17:20, ])) 179s > stopifnot(identical(drop(Z), Z0)) 179s > 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # When there is only one "complete" set 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > nbr_of_sets <- 1L 179s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 179s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 179s > print(S) 179s s1 179s [1,] 1 179s [2,] 2 179s [3,] 3 179s [4,] 4 179s [5,] 5 179s [6,] 6 179s > 179s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 179s > print(Z) 179s s1 179s A -0.56516851 179s B -0.37629322 179s C 0.20497146 179s D -0.21761651 179s E -0.08291189 179s F -0.14217077 179s G 0.55611562 179s H -0.17797954 179s I 0.53245231 179s J 0.07380045 179s K -0.33944990 179s L 0.33910066 179s M -0.08393647 179s N -1.09055689 179s O -0.39424221 179s P -0.01294228 179s Q -0.38069001 179s R 0.52475090 179s S -0.12513696 179s T 0.23849338 179s > 179s > Z0 <- rowMeans(X) 179s > stopifnot(identical(drop(Z), Z0)) 179s > 179s > 179s > nbr_of_sets <- 1L 179s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 179s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 179s > print(S) 179s s1 179s [1,] 1 179s [2,] 2 179s [3,] 3 179s [4,] 4 179s [5,] 5 179s [6,] 6 179s [7,] 7 179s [8,] 8 179s [9,] 9 179s [10,] 10 179s [11,] 11 179s [12,] 12 179s [13,] 13 179s [14,] 14 179s [15,] 15 179s [16,] 16 179s [17,] 17 179s [18,] 18 179s [19,] 19 179s [20,] 20 179s > 179s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 179s > print(Z) 179s a b c d e f 179s s1 -0.143025 -0.190705 0.1029695 -0.2418424 -0.2247051 0.241485 179s > 179s > Z0 <- colMeans(X) 179s > stopifnot(identical(drop(Z), Z0)) 179s > 179s > 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Use weights 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > nbr_of_sets <- 3L 179s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 179s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 179s > print(S) 179s s1 s2 s3 179s [1,] 1 3 5 179s [2,] 2 4 6 179s > 179s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 179s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 179s > print(Z1) 179s s1 s2 s3 179s A 0.17128932 -0.63279267 -1.23400216 179s B -0.36195271 -0.37505030 -0.39187666 179s C 0.64099347 0.19955288 -0.22563196 179s D -0.77018373 -0.41907960 0.53641379 179s E -0.03451945 -0.32643356 0.11221734 179s F -1.41401978 0.47059365 0.51691383 179s G 0.51381708 -0.00734686 1.16187664 179s H 0.07650166 0.21646610 -0.82690638 179s I 0.25186004 0.02007235 1.32542455 179s J -0.09501455 0.16173536 0.15468054 179s K -0.59928562 -1.42292402 1.00385995 179s L 0.20761675 0.57696288 0.23272233 179s M -0.16083594 0.11698078 -0.20795425 179s N -1.11639192 -0.75547366 -1.39980508 179s O -0.19920830 0.37765185 -1.36117019 179s P 0.31741727 -0.73021188 0.37396776 179s Q 0.16575213 -0.21453328 -1.09328889 179s R 0.78554808 0.13509517 0.65360946 179s S -1.62796847 1.19122028 0.06133731 179s T -0.08871595 0.02878527 0.77541081 179s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 179s > print(Z2) 179s a b c d e f 179s s1 1.3247779 -1.515441261 -0.76407006 -0.2437729 -1.08428994 -0.54158888 179s s2 -0.1348334 0.005643161 1.02750880 -1.2470355 0.39640006 -0.08561823 179s s3 -0.7247646 -0.723774641 -0.07579211 0.2199522 -0.07008577 0.69921695 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Result should always be a matrix, including when nrow(X) <= 1 179s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 179s > S <- matrix(1, nrow = 1L, ncol = 1L) 179s > Z1 <- rowAvgsPerColSet(X, S = S) 179s > stopifnot(is.matrix(Z1)) 179s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 179s > stopifnot(is.matrix(Z2)) 179s > 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Works with many, one or zero columns / rows 179s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > S <- cbind(1:2, 3:4, 5:6) 179s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 179s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 179s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 179s + colSums2(X[S[,2], ,drop=FALSE]), 179s + colSums2(X[S[,3], ,drop=FALSE])) 179s > stopifnot(identical(Z2, Z2_ref)) 179s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 179s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 179s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 179s + colSums2(X[S[,2], ,drop=FALSE]), 179s + colSums2(X[S[,3], ,drop=FALSE])) 179s > stopifnot(identical(Z1, Z1_ref)) 179s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 179s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 179s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 179s > stopifnot(identical(Z0, unname(Z0_ref))) 179s > 179s > 179s > S <- rbind(1:4, 5:8) 179s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 179s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 179s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 179s + rowMeans2(X[,S[,2],drop=FALSE]), 179s + rowMeans2(X[,S[,3],drop=FALSE]), 179s + rowMeans2(X[,S[,4],drop=FALSE])) 179s > stopifnot(identical(Z2, Z2_ref)) 179s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 179s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 179s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 179s + rowMeans2(X[,S[,2],drop=FALSE]), 179s + rowMeans2(X[,S[,3],drop=FALSE]), 179s + rowMeans2(X[,S[,4],drop=FALSE])) 179s > stopifnot(identical(Z1, Z1_ref)) 179s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 179s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 179s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 179s > stopifnot(identical(Z0, Z0_ref)) 179s > 179s 179s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 179s Copyright (C) 2025 The R Foundation for Statistical Computing 179s Platform: x86_64-pc-linux-gnu 179s 179s R is free software and comes with ABSOLUTELY NO WARRANTY. 179s You are welcome to redistribute it under certain conditions. 179s Type 'license()' or 'licence()' for distribution details. 179s 179s R is a collaborative project with many contributors. 179s Type 'contributors()' for more information and 179s 'citation()' on how to cite R or R packages in publications. 179s 179s Type 'demo()' for some demos, 'help()' for on-line help, or 179s 'help.start()' for an HTML browser interface to help. 179s Type 'q()' to quit R. 179s 179s > library("matrixStats") 179s > 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > # Subsetted tests 179s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 179s > source("utils/validateIndicesFramework.R") 179s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 179s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 179s > for (rows in index_cases) { 179s + for (cols in index_cases) { 179s + if (is.null(rows)) { 179s + rows <- seq_len(nrow(x)) 179s + rows_finite <- rows 179s + } else { 179s + rows_finite <- rows[is.finite(rows)] 179s + } 179s + 179s + if (is.null(cols)) { 179s + cols <- seq_len(ncol(x)) 179s + cols_finite <- cols 179s + } else { 179s + cols_finite <- cols[is.finite(cols)] 179s + } 179s + 179s + suppressWarnings({ 179s + actual <- tryCatch({ 179s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 179s + FUN = rowMeans) 179s + }, error = function(c) "error") 179s + expect <- tryCatch({ 179s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 179s + }, error = function(c) "error") 179s + }) 179s + stopifnot(all.equal(as.vector(actual), expect)) 179s + 179s + suppressWarnings({ 179s + actual <- tryCatch({ 179s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 179s + FUN = colMeans) 179s + }, error = function(c) "error") 179s + expect <- tryCatch({ 179s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 179s + }, error = function(c) "error") 179s + }) 179s + stopifnot(all.equal(as.vector(actual), expect)) 179s + } 179s + } 179s > 179s 179s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 179s Copyright (C) 2025 The R Foundation for Statistical Computing 179s Platform: x86_64-pc-linux-gnu 179s 179s R is free software and comes with ABSOLUTELY NO WARRANTY. 179s You are welcome to redistribute it under certain conditions. 179s Type 'license()' or 'licence()' for distribution details. 179s 179s R is a collaborative project with many contributors. 179s Type 'contributors()' for more information and 179s 'citation()' on how to cite R or R packages in publications. 179s 179s Type 'demo()' for some demos, 'help()' for on-line help, or 179s 'help.start()' for an HTML browser interface to help. 179s Type 'q()' to quit R. 179s 179s > library("matrixStats") 179s > 179s > x <- matrix(1:27, ncol = 3) 179s > 179s > # To check names attribute 179s > dimnames <- list(letters[1:9], LETTERS[1:3]) 179s > 179s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 179s + res <- x[, idxs] 179s + # Preserve names attribute? 179s + if (!useNames) names(res) <- NULL 179s + res 179s + } 179s > 179s > idxs <- 1L 179s > # Test with and without dimnames on x 179s > for (setDimnames in c(TRUE, FALSE)) { 179s + if (setDimnames) dimnames(x) <- dimnames 179s + else dimnames(x) <- NULL 179s + # Check names attribute 179s + for (useNames in c(TRUE, FALSE)) { 179s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 179s + y <- rowCollapse(x, idxs, useNames = useNames) 179s + stopifnot(identical(y, y_truth)) 179s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 179s + stopifnot(identical(y2, y)) 179s + } 179s + } 179s > 179s > idxs <- 2L 179s > # Test with and without dimnames on x 179s > for (setDimnames in c(TRUE, FALSE)) { 179s + if (setDimnames) dimnames(x) <- dimnames 179s + else dimnames(x) <- NULL 179s + # Check names attribute 179s + for (useNames in c(TRUE, FALSE)) { 179s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 179s + y <- rowCollapse(x, idxs, useNames = useNames) 179s + stopifnot(identical(y, y_truth)) 179s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 179s + stopifnot(identical(y2, y)) 179s + } 179s + } 179s > 179s > 179s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 179s + res <- c(x[1:5, 1], x[6:9, 3]) 179s + # Preserve names attribute? 179s + if (!useNames) names(res) <- NULL 179s + res 179s + } 179s > 179s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 179s > # Test with and without dimnames on x 179s > for (setDimnames in c(TRUE, FALSE)) { 179s + if (setDimnames) dimnames(x) <- dimnames 179s + else dimnames(x) <- NULL 179s + # Check names attribute 179s + for (useNames in c(TRUE, FALSE)) { 179s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 179s + y <- rowCollapse(x, idxs, useNames = useNames) 179s + stopifnot(identical(y, y_truth)) 179s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 179s + stopifnot(identical(y2, y)) 179s + } 179s + } 179s > 179s > 179s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 179s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 179s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 179s + # Preserve names attribute? 179s + if (useNames) { 179s + names <- rownames(x) 179s + if (!is.null(names)) names(res) <- names 179s + } 179s + res 179s + } 179s > 179s > idxs <- 1:3 179s > # Test with and without dimnames on x 179s > for (setDimnames in c(TRUE, FALSE)) { 179s + if (setDimnames) dimnames(x) <- dimnames 179s + else dimnames(x) <- NULL 179s + # Check names attribute 179s + for (useNames in c(TRUE, FALSE)) { 179s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 179s + y <- rowCollapse(x, idxs, useNames = useNames) 179s + stopifnot(identical(y, y_truth)) 179s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 179s + stopifnot(identical(y2, y)) 179s + } 179s + } 180s > 180s 180s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 180s Copyright (C) 2025 The R Foundation for Statistical Computing 180s Platform: x86_64-pc-linux-gnu 180s 180s R is free software and comes with ABSOLUTELY NO WARRANTY. 180s You are welcome to redistribute it under certain conditions. 180s Type 'license()' or 'licence()' for distribution details. 180s 180s R is a collaborative project with many contributors. 180s Type 'contributors()' for more information and 180s 'citation()' on how to cite R or R packages in publications. 180s 180s Type 'demo()' for some demos, 'help()' for on-line help, or 180s 'help.start()' for an HTML browser interface to help. 180s Type 'q()' to quit R. 180s 180s > library("matrixStats") 180s > 180s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 180s + ans <- c() 180s + storage.mode(ans) <- storage.mode(x) 180s + for (ii in seq_len(length(idxs))) { 180s + ans[ii] <- x[ii, idxs[ii]] 180s + } 180s + 180s + # Preserve names attribute 180s + if (useNames) { 180s + names <- rownames(x) 180s + if (!is.null(names)) names(ans) <- names 180s + } 180s + 180s + ans 180s + } 180s > 180s > 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > # Subsetted tests 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > source("utils/validateIndicesFramework.R") 180s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 180s > storage.mode(x) <- "integer" 180s > 180s > # To check names attribute 180s > dimnames <- list(letters[1:6], LETTERS[1:6]) 180s > 180s > for (rows in index_cases) { 180s + if (is.null(rows)) rows <- seq_len(nrow(x)) 180s + 180s + for (idxs in list(2L, seq_len(6L))) { 180s + for (useNames in c(TRUE, FALSE)) { 180s + suppressWarnings({ 180s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 180s + error = function(c) "error") 180s + expect <- tryCatch({ 180s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 180s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 180s + }, error = function(c) "error") 180s + }) 180s + stopifnot(all.equal(actual, expect)) 180s + 180s + suppressWarnings({ 180s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 180s + error = function(c) "error") 180s + }) 180s + stopifnot(all.equal(actual, expect)) 180s + 180s + # Check names attribute 180s + dimnames(x) <- dimnames 180s + suppressWarnings({ 180s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 180s + error = function(c) "error") 180s + expect <- tryCatch({ 180s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 180s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 180s + }, error = function(c) "error") 180s + }) 180s + stopifnot(all.equal(actual, expect)) 180s + 180s + suppressWarnings({ 180s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 180s + error = function(c) "error") 180s + }) 180s + stopifnot(all.equal(actual, expect)) 180s + 180s + dimnames(x) <- NULL 180s + } 180s + } 180s + } 180s > 180s 180s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 180s Copyright (C) 2025 The R Foundation for Statistical Computing 180s Platform: x86_64-pc-linux-gnu 180s 180s R is free software and comes with ABSOLUTELY NO WARRANTY. 180s You are welcome to redistribute it under certain conditions. 180s Type 'license()' or 'licence()' for distribution details. 180s 180s R is a collaborative project with many contributors. 180s Type 'contributors()' for more information and 180s 'citation()' on how to cite R or R packages in publications. 180s 180s Type 'demo()' for some demos, 'help()' for on-line help, or 180s 'help.start()' for an HTML browser interface to help. 180s Type 'q()' to quit R. 180s 180s > library("matrixStats") 180s > 180s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 180s + if (is.na(value)) { 180s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 180s + sum(is.na(x)) 180s + ) 180s + } else { 180s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 180s + sum(x == value, na.rm = na.rm) 180s + ) 180s + } 180s + # Preserve names attribute 180s + names <- names(counts) 180s + counts <- as.integer(counts) 180s + if (useNames && !is.null(names)) names(counts) <- names 180s + counts 180s + } 180s > 180s > 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > # Data type: integer and numeric 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > for (mode in c("integer", "double")) { 180s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 180s + x[sample.int(length(x), size = 7L)] <- 0 180s + storage.mode(x) <- mode 180s + 180s + dimnames = list(letters[1:10], LETTERS[1:5]) 180s + 180s + # Test with and without dimnames on x 180s + for (setDimnames in c(TRUE, FALSE)) { 180s + if (setDimnames) dimnames(x) <- dimnames 180s + else dimnames(x) <- NULL 180s + for (na.rm in c(FALSE, TRUE)) { 180s + # Check names attribute 180s + for (useNames in c(TRUE, FALSE)) { 180s + # Count zeros 180s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + 180s + # Count NAs 180s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + 180s + if (mode == "integer") { 180s + ux <- unique(as.vector(x)) 180s + r0 <- r1 <- r2 <- integer(nrow(x)) 180s + for (value in ux) { 180s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 180s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 180s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + } 180s + stopifnot(all(r0 == ncol(x))) 180s + } # if (mode == "integer") 180s + } # for (useNames ...) 180s + } # for (na.rm ...) 180s + } # for (setDimnames ...) 180s + } # for (mode ...) 180s > 180s > 180s > # All NAs 180s > na_list <- list(NA_integer_, NA_real_, NaN) 180s > for (na_value in na_list) { 180s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 180s + # Test with and without dimnames on x 180s + for (setDimnames in c(TRUE, FALSE)) { 180s + if (setDimnames) dimnames(x) <- dimnames 180s + else dimnames(x) <- NULL 180s + for (na.rm in c(FALSE, TRUE)) { 180s + # Check names attribute 180s + for (useNames in c(TRUE, FALSE)) { 180s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + 180s + # Count NAs 180s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 180s + stopifnot(all(r0 == ncol(x))) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + } 180s + } 180s + } 180s + } # for (na_value ...) 180s > 180s > 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > # Data type: logical 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 180s > x[7:8, 2:3] <- TRUE 180s > x[1:3, ] <- TRUE 180s > x[, 1] <- TRUE 180s > x[4, ] <- FALSE 180s > x[, 4] <- FALSE 180s > x[2, ] <- FALSE 180s > x[3, ] <- TRUE 180s > 180s > # To check names attribute 180s > dimnames <- list(letters[1:10], LETTERS[1:4]) 180s > 180s > # Test with and without dimnames on x 180s > for (setDimnames in c(TRUE, FALSE)) { 180s + if (setDimnames) dimnames(x) <- dimnames 180s + else dimnames(x) <- NULL 180s + # Row/column counts 180s + for (na.rm in c(FALSE, TRUE)) { 180s + # Check names attribute 180s + for (useNames in c(TRUE, FALSE)) { 180s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + 180s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 180s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 180s + stopifnot(r_true + r_false == ncol(x)) 180s + 180s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 180s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 180s + stopifnot(c_true + c_false == nrow(x)) 180s + 180s + # Count NAs 180s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 180s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + } 180s + } 180s + } 180s > 180s > 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > # Data type: character (not sure if this should be supported) 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 180s > x[2:3, 3:4] <- NA_character_ 180s > 180s > # Row/column counts 180s > for (na.rm in c(FALSE, TRUE)) { 180s + for (value in c("g", NA_character_)) { 180s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 180s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 180s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 180s + stopifnot(identical(r1, r0)) 180s + stopifnot(identical(r2, r0)) 180s + 180s + c <- count(x[1, ], value = value, na.rm = na.rm) 180s + stopifnot(identical(c, r1[1])) 180s + 180s + c <- count(x[2, ], value = value, na.rm = na.rm) 180s + stopifnot(identical(c, r1[2])) 180s + } 180s + } 180s > 180s > # NA row 180s > x <- matrix(0, nrow = 2L, ncol = 2L) 180s > x[1, ] <- NA_integer_ 180s > 180s > dimnames <- list(letters[1:2], LETTERS[1:2]) 180s > 180s > # Test with and without dimnames on x 180s > for (setDimnames in c(TRUE, FALSE)) { 180s + if (setDimnames) dimnames(x) <- dimnames 180s + else dimnames(x) <- NULL 180s + # Check names attribute 180s + for (useNames in c(TRUE, FALSE)) { 180s + r0 <- rowCounts(x, value = 0, useNames = useNames) 180s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 180s + stopifnot(identical(r0, r1)) 180s + } 180s + } 180s > 180s 180s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 180s Copyright (C) 2025 The R Foundation for Statistical Computing 180s Platform: x86_64-pc-linux-gnu 180s 180s R is free software and comes with ABSOLUTELY NO WARRANTY. 180s You are welcome to redistribute it under certain conditions. 180s Type 'license()' or 'licence()' for distribution details. 180s 180s R is a collaborative project with many contributors. 180s Type 'contributors()' for more information and 180s 'citation()' on how to cite R or R packages in publications. 180s 180s Type 'demo()' for some demos, 'help()' for on-line help, or 180s 'help.start()' for an HTML browser interface to help. 180s Type 'q()' to quit R. 180s 180s > library("matrixStats") 180s > 180s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 180s + if (is.na(value)) { 180s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 180s + sum(is.na(x)) 180s + ) 180s + } else { 180s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 180s + sum(x == value, na.rm = na.rm) 180s + ) 180s + } 180s + # Preserve names attribute 180s + names <- names(counts) 180s + counts <- as.integer(counts) 180s + if (useNames && !is.null(names)) names(counts) <- names 180s + counts 180s + } # rowCounts_R() 180s > 180s > 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > # Subsetted tests 180s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 180s > source("utils/validateIndicesFramework.R") 180s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 180s > x[2:3, 3:4] <- NA_real_ 180s > storage.mode(x) <- "integer" 180s > 180s > # To check names attribute 180s > dimnames <- list(letters[1:6], LETTERS[1:6]) 180s > 180s > # Test with and without dimnames on x 180s > for (setDimnames in c(TRUE, FALSE)) { 180s + if (setDimnames) dimnames(x) <- dimnames 180s + else dimnames(x) <- NULL 180s + for (rows in index_cases) { 180s + for (cols in index_cases) { 180s + # Check names attribute 180s + for (useNames in c(TRUE, FALSE)) { 180s + validateIndicesTestMatrix(x, rows, cols, 180s + ftest = rowCounts, fsure = rowCounts_R, 180s + value = 0, na.rm = TRUE, useNames = useNames) 180s + validateIndicesTestMatrix(x, rows, cols, 180s + fcoltest = colCounts, fsure = rowCounts_R, 180s + value = 0, na.rm = TRUE, useNames = useNames) 180s + for (value in c(0, NA_integer_)) { 180s + validateIndicesTestMatrix(x, rows, cols, 180s + ftest = rowCounts, fsure = rowCounts_R, 180s + value = value, useNames = useNames) 180s + validateIndicesTestMatrix(x, rows, cols, 180s + fcoltest = colCounts, fsure = rowCounts_R, 180s + value = value, useNames = useNames) 180s + } 180s + } 180s + } 180s + } 180s + } 181s > 181s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 181s > x[2:3, 3:4] <- NA_character_ 181s > # Test with and without dimnames on x 181s > for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) dimnames(x) <- dimnames 181s + else dimnames(x) <- NULL 181s + 181s + count <- 0L 181s + for (rows in index_cases) { 181s + for (cols in index_cases) { 181s + count <- count + 1L 181s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 181s + useNames <- c(TRUE, FALSE) 181s + useNames <- useNames[count %% length(useNames) + 1] 181s + 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = rowCounts, fsure = rowCounts_R, 181s + value = "g", na.rm = TRUE, useNames = useNames) 181s + validateIndicesTestMatrix(x, rows, cols, 181s + fcoltest = colCounts, fsure = rowCounts_R, 181s + value = "g", na.rm = TRUE, useNames = useNames) 181s + for (value in c("g", NA_character_)) { 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = rowCounts, fsure = rowCounts_R, 181s + value = value, useNames = useNames) 181s + validateIndicesTestMatrix(x, rows, cols, 181s + fcoltest = colCounts, fsure = rowCounts_R, 181s + value = value, useNames = useNames) 181s + } 181s + } 181s + } 181s + } 181s > 181s 181s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 181s Copyright (C) 2025 The R Foundation for Statistical Computing 181s Platform: x86_64-pc-linux-gnu 181s 181s R is free software and comes with ABSOLUTELY NO WARRANTY. 181s You are welcome to redistribute it under certain conditions. 181s Type 'license()' or 'licence()' for distribution details. 181s 181s R is a collaborative project with many contributors. 181s Type 'contributors()' for more information and 181s 'citation()' on how to cite R or R packages in publications. 181s 181s Type 'demo()' for some demos, 'help()' for on-line help, or 181s 'help.start()' for an HTML browser interface to help. 181s Type 'q()' to quit R. 181s 181s > library("matrixStats") 181s > 181s > rowCummins_R <- function(x, ..., useNames = TRUE) { 181s + suppressWarnings({ 181s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 181s + }) 181s + 181s + # Preserve dimnames attribute? 181s + dim(y) <- dim(x) 181s + dimnames(y) <- if (useNames) dimnames(x) else NULL 181s + y 181s + } 181s > 181s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 181s + mode <- storage.mode(x) 181s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 181s + storage.mode(x) <- "numeric" 181s + suppressWarnings({ 181s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 181s + }) 181s + 181s + # Preserve dimnames attribute? 181s + dim(y) <- dim(x) 181s + dimnames(y) <- if (useNames) dimnames(x) else NULL 181s + 181s + y 181s + } 181s > 181s > 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > # With and without some NAs 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > for (mode in c("logical", "integer", "double")) { 181s + for (add_na in c(FALSE, TRUE)) { 181s + cat("add_na = ", add_na, "\n", sep = "") 181s + 181s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 181s + diag(x) <- 0 181s + if (add_na) { 181s + x[3:7, c(2, 4)] <- NA_real_ 181s + } 181s + cat("mode: ", mode, "\n", sep = "") 181s + storage.mode(x) <- mode 181s + str(x) 181s + 181s + # To check dimnames attribute 181s + dimnames <- list(letters[1:10], LETTERS[1:5]) 181s + 181s + # Test with and without dimnames on x 181s + for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) dimnames(x) <- dimnames 181s + else dimnames(x) <- NULL 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + # Row/column ranges 181s + r0 <- rowCummins_R(x, useNames = useNames) 181s + r1 <- rowCummins(x, useNames = useNames) 181s + r2 <- t(colCummins(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + 181s + r0 <- rowCummaxs_R(x, useNames = useNames) 181s + r1 <- rowCummaxs(x, useNames = useNames) 181s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + } # for (useNames ...) 181s + } # for (setDimnames ...) 181s + } # for (add_na ...) 181s + } # for (mode ...) 181s add_na = FALSE 181s mode: logical 181s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 181s add_na = TRUE 181s mode: logical 181s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 181s add_na = FALSE 181s mode: integer 181s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 181s add_na = TRUE 181s mode: integer 181s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 181s add_na = FALSE 181s mode: double 181s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 181s add_na = TRUE 181s mode: double 181s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 181s > 181s > 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > # All NAs 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > for (mode in c("logical", "integer", "double")) { 181s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 181s + cat("mode: ", mode, "\n", sep = "") 181s + storage.mode(x) <- mode 181s + str(x) 181s + 181s + # Test with and without dimnames on x 181s + for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) dimnames(x) <- dimnames 181s + else dimnames(x) <- NULL 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + r0 <- rowCummins_R(x, useNames = useNames) 181s + r1 <- rowCummins(x, useNames = useNames) 181s + r2 <- t(colCummins(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + 181s + r0 <- rowCummaxs_R(x, useNames = useNames) 181s + r1 <- rowCummaxs(x, useNames = useNames) 181s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + } # for (useNames ...) 181s + } # for (setDimnames ...) 181s + } # for (mode ...) 181s mode: logical 181s logi [1:10, 1:5] NA NA NA NA NA NA ... 181s mode: integer 181s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 181s mode: double 181s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 181s > 181s > 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > # A 1x1 matrix 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > for (mode in c("logical", "integer", "double")) { 181s + x <- matrix(0, nrow = 1L, ncol = 1L) 181s + cat("mode: ", mode, "\n", sep = "") 181s + storage.mode(x) <- mode 181s + str(x) 181s + 181s + # To check dimnames attribute 181s + dimnames <- list("a", "A") 181s + 181s + # Test with and without dimnames on x 181s + for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) dimnames(x) <- dimnames 181s + else dimnames(x) <- NULL 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + r0 <- rowCummins_R(x, useNames = useNames) 181s + r1 <- rowCummins(x, useNames = useNames) 181s + r2 <- t(colCummins(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + 181s + r0 <- rowCummaxs_R(x, useNames = useNames) 181s + r1 <- rowCummaxs(x, useNames = useNames) 181s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + } # for (useNames ...) 181s + } # for (setDimnames ...) 181s + } # for (mode ...) 181s mode: logical 181s logi [1, 1] FALSE 181s mode: integer 181s int [1, 1] 0 181s mode: double 181s num [1, 1] 0 181s > 181s > 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > # Corner cases 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > for (mode in c("logical", "integer", "double")) { 181s + cat("mode: ", mode, "\n", sep = "") 181s + value <- 0 181s + storage.mode(value) <- mode 181s + value0 <- if (mode == "logical") 0L else value 181s + 181s + # A 0x0 matrix 181s + x <- matrix(value, nrow = 0L, ncol = 0L) 181s + str(x) 181s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 181s + r1 <- rowCummins(x) 181s + r2 <- t(colCummins(t(x))) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + 181s + # A 0xK matrix 181s + x <- matrix(value, nrow = 0L, ncol = 5L) 181s + str(x) 181s + colnames <- LETTERS[1:5] 181s + # Test with and without dimnames on x 181s + for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) colnames(x) <- colnames 181s + else dimnames(x) <- NULL 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + r0 <- rowCummins_R(x, useNames = useNames) 181s + r1 <- rowCummins(x, useNames = useNames) 181s + r2 <- t(colCummins(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + r0 <- rowCummaxs_R(x, useNames = useNames) 181s + r1 <- rowCummaxs(x, useNames = useNames) 181s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + } # for (useNames ...) 181s + } # for (setDimnames ...) 181s + 181s + # A Nx0 matrix 181s + x <- matrix(value, nrow = 5L, ncol = 0L) 181s + str(x) 181s + rownames <- LETTERS[1:5] 181s + # Test with and without dimnames on x 181s + for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) rownames(x) <- rownames 181s + else dimnames(x) <- NULL 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + r0 <- rowCummins_R(x, useNames = useNames) 181s + r1 <- rowCummins(x, useNames = useNames) 181s + r2 <- t(colCummins(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + 181s + r0 <- rowCummaxs_R(x, useNames = useNames) 181s + r1 <- rowCummaxs(x, useNames = useNames) 181s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 181s + stopifnot(all.equal(r1, r2)) 181s + stopifnot(all.equal(r1, r0)) 181s + stopifnot(all.equal(r2, r0)) 181s + } # for (useNames ...) 181s + } # for (setDimnames ...) 181s + } # for (mode ...) 181s mode: logical 181s logi[0 , 0 ] 181s logi[0 , 1:5] 181s logi[1:5, 0 ] 181s mode: integer 181s int[0 , 0 ] 181s int[0 , 1:5] 181s int[1:5, 0 ] 181s mode: double 181s num[0 , 0 ] 181s num[0 , 1:5] 181s num[1:5, 0 ] 181s > 181s 181s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 181s Copyright (C) 2025 The R Foundation for Statistical Computing 181s Platform: x86_64-pc-linux-gnu 181s 181s R is free software and comes with ABSOLUTELY NO WARRANTY. 181s You are welcome to redistribute it under certain conditions. 181s Type 'license()' or 'licence()' for distribution details. 181s 181s R is a collaborative project with many contributors. 181s Type 'contributors()' for more information and 181s 'citation()' on how to cite R or R packages in publications. 181s 181s Type 'demo()' for some demos, 'help()' for on-line help, or 181s 'help.start()' for an HTML browser interface to help. 181s Type 'q()' to quit R. 181s 181s > library("matrixStats") 181s > 181s > rowCummins_R <- function(x, ..., useNames = TRUE) { 181s + suppressWarnings({ 181s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 181s + }) 181s + 181s + # Preserve dimnames attribute? 181s + dim(y) <- dim(x) 181s + dimnames(y) <- if (useNames) dimnames(x) else NULL 181s + 181s + y 181s + } 181s > 181s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 181s + mode <- storage.mode(x) 181s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 181s + storage.mode(x) <- "numeric" 181s + suppressWarnings({ 181s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 181s + }) 181s + 181s + # Preserve dimnames attribute? 181s + dim(y) <- dim(x) 181s + dimnames(y) <- if (useNames) dimnames(x) else NULL 181s + 181s + storage.mode(y) <- mode 181s + y 181s + } 181s > 181s > 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > # Subsetted tests 181s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181s > source("utils/validateIndicesFramework.R") 181s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 181s > storage.mode(x) <- "integer" 181s > 181s > # To check dimnames attribute 181s > dimnames <- list(letters[1:6], LETTERS[1:6]) 181s > 181s > # Test with and without dimnames on x 181s > for (setDimnames in c(TRUE, FALSE)) { 181s + if (setDimnames) dimnames(x) <- dimnames 181s + else dimnames(x) <- NULL 181s + for (rows in index_cases) { 181s + for (cols in index_cases) { 181s + # Check names attribute 181s + for (useNames in c(TRUE, FALSE)) { 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = function(x, rows, cols, ..., useNames) { 181s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 181s + }, fsure = rowCummins_R, useNames = useNames) 181s + 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 181s + validateIndicesTestMatrix(x, rows, cols, 181s + ftest = function(x, rows, cols, ..., useNames) { 181s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 181s + }, fsure = rowCummaxs_R, useNames = useNames) 181s + } 181s + } 181s + } 181s + } 182s > 182s 182s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 182s Copyright (C) 2025 The R Foundation for Statistical Computing 182s Platform: x86_64-pc-linux-gnu 182s 182s R is free software and comes with ABSOLUTELY NO WARRANTY. 182s You are welcome to redistribute it under certain conditions. 182s Type 'license()' or 'licence()' for distribution details. 182s 182s R is a collaborative project with many contributors. 182s Type 'contributors()' for more information and 182s 'citation()' on how to cite R or R packages in publications. 182s 182s Type 'demo()' for some demos, 'help()' for on-line help, or 182s 'help.start()' for an HTML browser interface to help. 182s Type 'q()' to quit R. 182s 182s > library("matrixStats") 182s > 182s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 182s + suppressWarnings({ 182s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 182s + }) 182s + 182s + # Preserve dimnames attribute? 182s + dim(y) <- dim(x) 182s + dimnames(y) <- if (useNames) dimnames(x) else NULL 182s + 182s + y 182s + } 182s > 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # With and without some NAs 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > for (mode in c("logical", "integer", "double")) { 182s + for (add_na in c(FALSE, TRUE)) { 182s + cat("add_na = ", add_na, "\n", sep = "") 182s + 182s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 182s + if (add_na) { 182s + x[3:7, c(2, 4)] <- NA_real_ 182s + } 182s + cat("mode: ", mode, "\n", sep = "") 182s + storage.mode(x) <- mode 182s + str(x) 182s + 182s + # To check dimnames attribute 182s + dimnames <- list(letters[1:10], LETTERS[1:5]) 182s + 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) dimnames(x) <- dimnames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + # Row/column ranges 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(colCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + } # for (add_na ...) 182s + } # for (mode ...) 182s add_na = FALSE 182s mode: logical 182s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 182s add_na = TRUE 182s mode: logical 182s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 182s add_na = FALSE 182s mode: integer 182s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 182s add_na = TRUE 182s mode: integer 182s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 182s add_na = FALSE 182s mode: double 182s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 182s add_na = TRUE 182s mode: double 182s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 182s > 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # All NAs 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > for (mode in c("logical", "integer", "double")) { 182s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 182s + cat("mode: ", mode, "\n", sep = "") 182s + storage.mode(x) <- mode 182s + str(x) 182s + 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) dimnames(x) <- dimnames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + # Row/column ranges 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(colCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + } # for (mode ...) 182s mode: logical 182s logi [1:10, 1:5] NA NA NA NA NA NA ... 182s mode: integer 182s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 182s mode: double 182s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 182s > 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # A 1x1 matrix 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > for (mode in c("logical", "integer", "double")) { 182s + x <- matrix(0, nrow = 1L, ncol = 1L) 182s + cat("mode: ", mode, "\n", sep = "") 182s + storage.mode(x) <- mode 182s + str(x) 182s + 182s + dimnames <- list("a", "A") 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) dimnames(x) <- dimnames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + # Row/column ranges 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(colCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + } 182s mode: logical 182s logi [1, 1] FALSE 182s mode: integer 182s int [1, 1] 0 182s mode: double 182s num [1, 1] 0 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > for (mode in c("logical", "integer", "double")) { 182s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 182s + x[1, 2] <- 0 182s + x[2, 2] <- 1 182s + x[3, 1] <- 0 182s + storage.mode(x) <- mode 182s + cat("mode: ", mode, "\n", sep = "") 182s + str(x) 182s + 182s + dimnames <- list(letters[1:3], LETTERS[1:2]) 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) dimnames(x) <- dimnames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + # Row/column ranges 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(colCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + } 182s mode: logical 182s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 182s mode: integer 182s int [1:3, 1:2] NA NA 0 0 1 NA 182s mode: double 182s num [1:3, 1:2] NA NA 0 0 1 NA 182s > 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # Corner cases 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > for (mode in c("logical", "integer", "double")) { 182s + cat("mode: ", mode, "\n", sep = "") 182s + value <- 0 182s + storage.mode(value) <- mode 182s + if (mode == "logical") value2 <- 0L 182s + 182s + # A 0x0 matrix 182s + x <- matrix(value, nrow = 0L, ncol = 0L) 182s + str(x) 182s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 182s + r1 <- rowCumprods(x) 182s + r2 <- t(colCumprods(t(x))) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + 182s + # A 0xK matrix 182s + x <- matrix(value, nrow = 0L, ncol = 5L) 182s + str(x) 182s + colnames <- LETTERS[1:5] 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) colnames(x) <- colnames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + 182s + # A Nx0 matrix 182s + x <- matrix(value, nrow = 5L, ncol = 0L) 182s + str(x) 182s + rownames <- LETTERS[1:5] 182s + # Test with and without dimnames on x 182s + for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) rownames(x) <- rownames 182s + else dimnames(x) <- NULL 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + r0 <- rowCumprods_R(x, useNames = useNames) 182s + r1 <- rowCumprods(x, useNames = useNames) 182s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 182s + stopifnot(all.equal(r1, r2)) 182s + stopifnot(all.equal(r1, r0)) 182s + stopifnot(all.equal(r2, r0)) 182s + } # for (useNames ...) 182s + } # for (setDimnames ...) 182s + } # for (mode ...) 182s mode: logical 182s logi[0 , 0 ] 182s logi[0 , 1:5] 182s logi[1:5, 0 ] 182s mode: integer 182s int[0 , 0 ] 182s int[0 , 1:5] 182s int[1:5, 0 ] 182s mode: double 182s num[0 , 0 ] 182s num[0 , 1:5] 182s num[1:5, 0 ] 182s > 182s 182s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 182s Copyright (C) 2025 The R Foundation for Statistical Computing 182s Platform: x86_64-pc-linux-gnu 182s 182s R is free software and comes with ABSOLUTELY NO WARRANTY. 182s You are welcome to redistribute it under certain conditions. 182s Type 'license()' or 'licence()' for distribution details. 182s 182s R is a collaborative project with many contributors. 182s Type 'contributors()' for more information and 182s 'citation()' on how to cite R or R packages in publications. 182s 182s Type 'demo()' for some demos, 'help()' for on-line help, or 182s 'help.start()' for an HTML browser interface to help. 182s Type 'q()' to quit R. 182s 182s > library("matrixStats") 182s > 182s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 182s + suppressWarnings({ 182s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 182s + }) 182s + 182s + # Preserve dimnames attribute? 182s + dim(y) <- dim(x) 182s + dimnames(y) <- if (useNames) dimnames(x) else NULL 182s + 182s + y 182s + } 182s > 182s > 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > # Subsetted tests 182s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182s > source("utils/validateIndicesFramework.R") 182s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 182s > storage.mode(x) <- "integer" 182s > 182s > # To check dimnames attribute 182s > dimnames <- list(letters[1:6], LETTERS[1:6]) 182s > 182s > # Test with and without dimnames on x 182s > for (setDimnames in c(TRUE, FALSE)) { 182s + if (setDimnames) dimnames(x) <- dimnames 182s + else dimnames(x) <- NULL 182s + for (rows in index_cases) { 182s + for (cols in index_cases) { 182s + # Check names attribute 182s + for (useNames in c(TRUE, FALSE)) { 182s + validateIndicesTestMatrix(x, rows, cols, 182s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 182s + validateIndicesTestMatrix(x, rows, cols, 182s + ftest = function(x, rows, cols, ..., useNames) { 182s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 182s + }, fsure = rowCumprods_R, useNames = useNames) 182s + } 182s + } 182s + } 182s + } 183s > 183s 183s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 183s Copyright (C) 2025 The R Foundation for Statistical Computing 183s Platform: x86_64-pc-linux-gnu 183s 183s R is free software and comes with ABSOLUTELY NO WARRANTY. 183s You are welcome to redistribute it under certain conditions. 183s Type 'license()' or 'licence()' for distribution details. 183s 183s R is a collaborative project with many contributors. 183s Type 'contributors()' for more information and 183s 'citation()' on how to cite R or R packages in publications. 183s 183s Type 'demo()' for some demos, 'help()' for on-line help, or 183s 'help.start()' for an HTML browser interface to help. 183s Type 'q()' to quit R. 183s 183s > library("matrixStats") 183s > 183s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 183s + suppressWarnings({ 183s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 183s + }) 183s + 183s + # Preserve dimnames attribute? 183s + dim(y) <- dim(x) 183s + dimnames(y) <- if (useNames) dimnames(x) else NULL 183s + 183s + y 183s + } 183s > 183s > 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > # With and without some NAs 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 183s > for (mode in c("logical", "integer", "double")) { 183s + for (add_na in c(FALSE, TRUE)) { 183s + cat("add_na = ", add_na, "\n", sep = "") 183s + 183s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 183s + if (add_na) { 183s + x[3:7, c(2, 4)] <- NA_real_ 183s + } 183s + cat("mode: ", mode, "\n", sep = "") 183s + storage.mode(x) <- mode 183s + str(x) 183s + 183s + # Test with and without dimnames on x 183s + for (setDimnames in c(TRUE, FALSE)) { 183s + if (setDimnames) dimnames(x) <- dimnames 183s + else dimnames(x) <- NULL 183s + # Check names attribute 183s + for (useNames in c(TRUE, FALSE)) { 183s + # Row/column ranges 183s + r0 <- rowCumsums_R(x, useNames = useNames) 183s + r1 <- rowCumsums(x, useNames = useNames) 183s + r2 <- t(colCumsums(t(x), useNames = useNames)) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + } # for (useNames ...) 183s + } # for (setDimnames ...) 183s + } # for (add_na ...) 183s + } 183s add_na = FALSE 183s mode: logical 183s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 183s add_na = TRUE 183s mode: logical 183s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 183s add_na = FALSE 183s mode: integer 183s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 183s add_na = TRUE 183s mode: integer 183s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 183s add_na = FALSE 183s mode: double 183s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 183s add_na = TRUE 183s mode: double 183s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 183s > 183s > 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > # All NAs 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > for (mode in c("logical", "integer", "double")) { 183s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 183s + cat("mode: ", mode, "\n", sep = "") 183s + storage.mode(x) <- mode 183s + str(x) 183s + 183s + # Test with and without dimnames on x 183s + for (setDimnames in c(TRUE, FALSE)) { 183s + if (setDimnames) dimnames(x) <- dimnames 183s + else dimnames(x) <- NULL 183s + # Check names attribute 183s + for (useNames in c(TRUE, FALSE)) { 183s + # Row/column ranges 183s + r0 <- rowCumsums_R(x, useNames = useNames) 183s + r1 <- rowCumsums(x, useNames = useNames) 183s + r2 <- t(colCumsums(t(x), useNames = useNames)) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + } # for (useNames ...) 183s + } # for (setDimnames ...) 183s + } # for (mode ...) 183s mode: logical 183s logi [1:10, 1:5] NA NA NA NA NA NA ... 183s mode: integer 183s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 183s mode: double 183s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 183s > 183s > 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > # A 1x1 matrix 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > dimnames <- list("a", "A") # to check dimnames attribute 183s > for (mode in c("logical", "integer", "double")) { 183s + x <- matrix(0, nrow = 1L, ncol = 1L) 183s + cat("mode: ", mode, "\n", sep = "") 183s + storage.mode(x) <- mode 183s + str(x) 183s + 183s + r0 <- rowCumsums_R(x) 183s + r1 <- rowCumsums(x) 183s + r2 <- t(colCumsums(t(x))) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + 183s + # Check dimnames attribute 183s + dimnames(x) <- dimnames 183s + # r0 <- rowCumsums_R(x) 183s + # > r0 183s + # a 183s + # [1,] 0 183s + r1 <- rowCumsums(x, useNames = TRUE) 183s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 183s + stopifnot(identical(dimnames(r1), dimnames)) 183s + stopifnot(identical(dimnames(r2), dimnames)) 183s + dimnames(x) <- NULL 183s + } 183s mode: logical 183s logi [1, 1] FALSE 183s mode: integer 183s int [1, 1] 0 183s mode: double 183s num [1, 1] 0 183s > 183s > 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > # Corner cases 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > names <- LETTERS[1:5] # to check dimnames attribute 183s > for (mode in c("logical", "integer", "double")) { 183s + cat("mode: ", mode, "\n", sep = "") 183s + value <- 0 183s + storage.mode(value) <- mode 183s + value2 <- value 183s + if (mode == "logical") value2 <- 0L 183s + 183s + # A 0x0 matrix 183s + x <- matrix(value, nrow = 0L, ncol = 0L) 183s + str(x) 183s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 183s + r1 <- rowCumsums(x) 183s + r2 <- t(colCumsums(t(x))) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + 183s + # A 0xK matrix 183s + x <- matrix(value, nrow = 0L, ncol = 5L) 183s + str(x) 183s + colnames <- LETTERS[1:5] 183s + # Test with and without dimnames on x 183s + for (setDimnames in c(TRUE, FALSE)) { 183s + if (setDimnames) colnames(x) <- colnames 183s + else dimnames(x) <- NULL 183s + # Check names attribute 183s + for (useNames in c(TRUE, FALSE)) { 183s + r0 <- rowCumsums_R(x, useNames = useNames) 183s + r1 <- rowCumsums(x, useNames = useNames) 183s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + } # for (useNames ...) 183s + } # for (setDimnames ...) 183s + 183s + # A Nx0 matrix 183s + x <- matrix(value, nrow = 5L, ncol = 0L) 183s + str(x) 183s + rownames <- LETTERS[1:5] 183s + # Test with and without dimnames on x 183s + for (setDimnames in c(TRUE, FALSE)) { 183s + if (setDimnames) rownames(x) <- rownames 183s + else dimnames(x) <- NULL 183s + # Check names attribute 183s + for (useNames in c(TRUE, FALSE)) { 183s + r0 <- rowCumsums_R(x, useNames = useNames) 183s + r1 <- rowCumsums(x, useNames = useNames) 183s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 183s + stopifnot(all.equal(r1, r2)) 183s + stopifnot(all.equal(r1, r0)) 183s + stopifnot(all.equal(r2, r0)) 183s + } # for (useNames ...) 183s + } # for (setDimnames ...) 183s + } # for (mode ...) 183s mode: logical 183s logi[0 , 0 ] 183s logi[0 , 1:5] 183s logi[1:5, 0 ] 183s mode: integer 183s int[0 , 0 ] 183s int[0 , 1:5] 183s int[1:5, 0 ] 183s mode: double 183s num[0 , 0 ] 183s num[0 , 1:5] 183s num[1:5, 0 ] 183s > 183s 183s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 183s Copyright (C) 2025 The R Foundation for Statistical Computing 183s Platform: x86_64-pc-linux-gnu 183s 183s R is free software and comes with ABSOLUTELY NO WARRANTY. 183s You are welcome to redistribute it under certain conditions. 183s Type 'license()' or 'licence()' for distribution details. 183s 183s R is a collaborative project with many contributors. 183s Type 'contributors()' for more information and 183s 'citation()' on how to cite R or R packages in publications. 183s 183s Type 'demo()' for some demos, 'help()' for on-line help, or 183s 'help.start()' for an HTML browser interface to help. 183s Type 'q()' to quit R. 183s 183s > library("matrixStats") 183s > 183s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 183s + suppressWarnings({ 183s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 183s + }) 183s + 183s + # Preserve dimnames attribute? 183s + dim(y) <- dim(x) 183s + dimnames(y) <- if (useNames) dimnames(x) else NULL 183s + 183s + y 183s + } 183s > 183s > 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > # Subsetted tests 183s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 183s > source("utils/validateIndicesFramework.R") 183s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 183s > storage.mode(x) <- "integer" 183s > 183s > # To check dimnames attribute 183s > dimnames <- list(letters[1:6], LETTERS[1:6]) 183s > 183s > # Test with and without dimnames on x 183s > for (setDimnames in c(TRUE, FALSE)) { 183s + if (setDimnames) dimnames(x) <- dimnames 183s + else dimnames(x) <- NULL 183s + for (rows in index_cases) { 183s + for (cols in index_cases) { 183s + # Check names attribute 183s + for (useNames in c(TRUE, FALSE)) { 183s + validateIndicesTestMatrix(x, rows, cols, 183s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 183s + validateIndicesTestMatrix(x, rows, cols, 183s + ftest = function(x, rows, cols, ..., useNames) { 183s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 183s + }, fsure = rowCumsums_R, useNames = useNames) 183s + } 183s + } 183s + } 183s + } 184s > 184s 184s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 184s Copyright (C) 2025 The R Foundation for Statistical Computing 184s Platform: x86_64-pc-linux-gnu 184s 184s R is free software and comes with ABSOLUTELY NO WARRANTY. 184s You are welcome to redistribute it under certain conditions. 184s Type 'license()' or 'licence()' for distribution details. 184s 184s R is a collaborative project with many contributors. 184s Type 'contributors()' for more information and 184s 'citation()' on how to cite R or R packages in publications. 184s 184s Type 'demo()' for some demos, 'help()' for on-line help, or 184s 'help.start()' for an HTML browser interface to help. 184s Type 'q()' to quit R. 184s 184s > library("matrixStats") 184s > 184s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 184s + ncol2 <- ncol(x) - lag * differences 184s + if (ncol2 <= 0) { 184s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 184s + # Preserve names attribute 184s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 184s + return(y) 184s + } 184s + suppressWarnings({ 184s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 184s + }) 184s + y <- t(y) 184s + 184s + # Preserve dimnames attribute 184s + dim(y) <- c(nrow(x), ncol2) 184s + if (useNames && !is.null(dimnames(x))) { 184s + colnames <- colnames(x) 184s + if (!is.null(colnames)) { 184s + len <- length(colnames) 184s + colnames <- colnames[(len - ncol2 + 1):len] 184s + } 184s + dimnames(y) <- list(rownames(x), colnames) 184s + } 184s + else dimnames(y) <- NULL 184s + 184s + y 184s + } 184s > 184s > 184s > set.seed(0x42) 184s > 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > # With and without some NAs 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > for (mode in c("integer", "double")) { 184s + cat("mode: ", mode, "\n", sep = "") 184s + 184s + for (add_na in c(FALSE, TRUE)) { 184s + cat("add_na = ", add_na, "\n", sep = "") 184s + 184s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 184s + if (add_na) { 184s + x[3:7, c(2, 4)] <- NA_real_ 184s + } 184s + storage.mode(x) <- mode 184s + str(x) 184s + 184s + dimnames <- list(letters[1:10], LETTERS[1:8]) 184s + 184s + # Test with and without dimnames on x 184s + for (setDimnames in c(TRUE, FALSE)) { 184s + if (setDimnames) dimnames(x) <- dimnames 184s + else dimnames(x) <- NULL 184s + # Check dimnames attribute 184s + for (useNames in c(TRUE, FALSE)) { 184s + for (lag in 1:4) { 184s + for (differences in 1:3) { 184s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 184s + mode, lag, differences)) 184s + # Row/column ranges 184s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 184s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 184s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 184s + stopifnot(all.equal(r1, r0)) 184s + stopifnot(all.equal(r2, r0)) 184s + stopifnot(all.equal(r1, r2)) 184s + } 184s + } 184s + } # for (useNames ...) 184s + } # for (setDimnames ...) 184s + } # for (add_na ...) 184s + } # for (mode ...) 184s mode: integer 184s add_na = FALSE 184s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s add_na = TRUE 184s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: integer, lag = 1, differences = 1 184s mode: integer, lag = 1, differences = 2 184s mode: integer, lag = 1, differences = 3 184s mode: integer, lag = 2, differences = 1 184s mode: integer, lag = 2, differences = 2 184s mode: integer, lag = 2, differences = 3 184s mode: integer, lag = 3, differences = 1 184s mode: integer, lag = 3, differences = 2 184s mode: integer, lag = 3, differences = 3 184s mode: integer, lag = 4, differences = 1 184s mode: integer, lag = 4, differences = 2 184s mode: integer, lag = 4, differences = 3 184s mode: double 184s add_na = FALSE 184s 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 ... 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s add_na = TRUE 184s 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 ... 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s mode: double, lag = 1, differences = 1 184s mode: double, lag = 1, differences = 2 184s mode: double, lag = 1, differences = 3 184s mode: double, lag = 2, differences = 1 184s mode: double, lag = 2, differences = 2 184s mode: double, lag = 2, differences = 3 184s mode: double, lag = 3, differences = 1 184s mode: double, lag = 3, differences = 2 184s mode: double, lag = 3, differences = 3 184s mode: double, lag = 4, differences = 1 184s mode: double, lag = 4, differences = 2 184s mode: double, lag = 4, differences = 3 184s > 184s > 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > # All NAs 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > for (mode in c("integer", "double")) { 184s + cat("mode: ", mode, "\n", sep = "") 184s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 184s + storage.mode(x) <- mode 184s + str(x) 184s + 184s + dimnames <- list(letters[1:10], LETTERS[1:5]) 184s + 184s + # Test with and without dimnames on x 184s + for (setDimnames in c(TRUE, FALSE)) { 184s + if (setDimnames) dimnames(x) <- dimnames 184s + else dimnames(x) <- NULL 184s + # Check dimnames attribute 184s + for (useNames in c(TRUE, FALSE)) { 184s + r0 <- rowDiffs_R(x, useNames = useNames) 184s + r1 <- rowDiffs(x, useNames = useNames) 184s + r2 <- t(colDiffs(t(x), useNames = useNames)) 184s + stopifnot(all.equal(r1, r0)) 184s + stopifnot(all.equal(r2, r0)) 184s + stopifnot(all.equal(r1, r2)) 184s + } # for (useNames ...) 184s + } # for (setDimnames ...) 184s + } # for (mode ...) 184s mode: integer 184s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 184s mode: double 184s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 184s > 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > # A 1x1 matrix 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > x <- matrix(0, nrow = 1L, ncol = 1L) 184s > dimnames <- list("a", "A") 184s > # Test with and without dimnames on x 184s > for (setDimnames in c(TRUE, FALSE)) { 184s + if (setDimnames) dimnames(x) <- dimnames 184s + else dimnames(x) <- NULL 184s + # Check dimnames attribute 184s + for (useNames in c(TRUE, FALSE)) { 184s + r0 <- rowDiffs_R(x, useNames = useNames) 184s + r1 <- rowDiffs(x, useNames = useNames) 184s + r2 <- t(colDiffs(t(x), useNames = useNames)) 184s + stopifnot(all.equal(r1, r0)) 184s + stopifnot(all.equal(r2, r0)) 184s + stopifnot(all.equal(r1, r2)) 184s + } # for (useNames ...) 184s + } # for (setDimnames ...) 184s > 184s 184s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 184s Copyright (C) 2025 The R Foundation for Statistical Computing 184s Platform: x86_64-pc-linux-gnu 184s 184s R is free software and comes with ABSOLUTELY NO WARRANTY. 184s You are welcome to redistribute it under certain conditions. 184s Type 'license()' or 'licence()' for distribution details. 184s 184s R is a collaborative project with many contributors. 184s Type 'contributors()' for more information and 184s 'citation()' on how to cite R or R packages in publications. 184s 184s Type 'demo()' for some demos, 'help()' for on-line help, or 184s 'help.start()' for an HTML browser interface to help. 184s Type 'q()' to quit R. 184s 184s > library("matrixStats") 184s > 184s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 184s + ncol2 <- ncol(x) - lag * differences 184s + if (ncol2 <= 0) { 184s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 184s + # Preserve names attribute 184s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 184s + return(y) 184s + } 184s + suppressWarnings({ 184s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 184s + }) 184s + y <- t(y) 184s + 184s + # Preserve dimnames attribute 184s + dim(y) <- c(nrow(x), ncol2) 184s + if (useNames && !is.null(dimnames(x))) { 184s + colnames <- colnames(x) 184s + if (!is.null(colnames)) { 184s + len <- length(colnames) 184s + colnames <- colnames[(len - ncol2 + 1):len] 184s + } 184s + dimnames(y) <- list(rownames(x), colnames) 184s + } 184s + else dimnames(y) <- NULL 184s + 184s + y 184s + } 184s > 184s > 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > # Subsetted tests 184s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 184s > source("utils/validateIndicesFramework.R") 184s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 184s > storage.mode(x) <- "integer" 184s > 184s > # To check dimnames attribute 184s > dimnames <- list(letters[1:6], LETTERS[1:6]) 184s > 184s > # Test with and without dimnames on x 184s > for (setDimnames in c(TRUE, FALSE)) { 184s + if (setDimnames) dimnames(x) <- dimnames 184s + else dimnames(x) <- NULL 184s + 184s + count <- 0L 184s + for (rows in index_cases) { 184s + for (cols in index_cases) { 184s + count <- count + 1L 184s + for (lag in 1:2) { 184s + for (differences in 1:3) { 184s + # Check dimnames attribute 184s + useNames <- c(TRUE, FALSE) 184s + useNames <- useNames[count %% length(useNames) + 1] 184s + validateIndicesTestMatrix(x, rows, cols, 184s + ftest = rowDiffs, fsure = rowDiffs_R, 184s + lag = lag, differences = differences, useNames = useNames) 184s + validateIndicesTestMatrix(x, rows, cols, 184s + ftest = function(x, rows, cols, ..., useNames) { 184s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 184s + }, fsure = rowDiffs_R, 184s + lag = lag, differences = differences, useNames = useNames) 184s + } 184s + } 184s + } 184s + } 184s + } 185s > 185s 185s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 185s Copyright (C) 2025 The R Foundation for Statistical Computing 185s Platform: x86_64-pc-linux-gnu 185s 185s R is free software and comes with ABSOLUTELY NO WARRANTY. 185s You are welcome to redistribute it under certain conditions. 185s Type 'license()' or 'licence()' for distribution details. 185s 185s R is a collaborative project with many contributors. 185s Type 'contributors()' for more information and 185s 'citation()' on how to cite R or R packages in publications. 185s 185s Type 'demo()' for some demos, 'help()' for on-line help, or 185s 'help.start()' for an HTML browser interface to help. 185s Type 'q()' to quit R. 185s 185s > library("matrixStats") 185s > 185s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 185s + quantile_na <- function(x, ..., na.rm = FALSE) { 185s + if (!na.rm && anyMissing(x)) 185s + return(c(NA_real_, NA_real_)) 185s + quantile(x, ..., na.rm = na.rm) 185s + } 185s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 185s + probs = c(0.25, 0.75), na.rm = na.rm) 185s + rownames(q) <- NULL # Not needed anymore 185s + 185s + # Preserve names attribute 185s + dim(q) <- c(2L, nrow(x)) 185s + colnames(q) <- if (useNames) rownames(x) else NULL 185s + 185s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 185s + } 185s > 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > # Test with multiple quantiles 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > for (mode in c("integer", "double")) { 185s + cat("mode: ", mode, "\n", sep = "") 185s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 185s + storage.mode(x) <- mode 185s + str(x) 185s + 185s + # To check names attribute 185s + dimnames <- list(letters[1:10], LETTERS[1:10]) 185s + 185s + for (add_na in c(FALSE, TRUE)) { 185s + if (add_na) { 185s + x[3:5, 6:9] <- NA 185s + } 185s + # Test with and without dimnames on x 185s + for (setDimnames in c(TRUE, FALSE)) { 185s + if (setDimnames) dimnames(x) <- dimnames 185s + else dimnames(x) <- NULL 185s + for (na.rm in c(FALSE, TRUE)) { 185s + # Check names attribute 185s + for (useNames in c(TRUE, FALSE)) { 185s + probs <- c(0, 0.5, 1) 185s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 185s + print(q0) 185s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 185s + print(q1) 185s + stopifnot(all.equal(q1, q0)) 185s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 185s + stopifnot(all.equal(q2, q0)) 185s + 185s + q <- iqr(x[3, ], na.rm = na.rm) 185s + print(q) 185s + } # for (useNames ...) 185s + } # for (na.rm ...) 185s + } # for (setDimnames ...) 185s + } # for (add_na ...) 185s + } # for (mode ...) 185s mode: integer 185s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s a b c d e f g h i j 185s 45 45 NA NA NA 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s a b c d e f g h i j 185s 45 45 25 25 25 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s mode: double 185s 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 ... 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 45 45 45 45 45 45 45 45 45 185s [1] 45 185s a b c d e f g h i j 185s 45 45 NA NA NA 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s a b c d e f g h i j 185s 45 45 25 25 25 45 45 45 45 45 185s a b c d e f g h i j 185s 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] 45 45 NA NA NA 45 45 45 45 45 185s [1] NA 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 45 45 25 25 25 45 45 45 45 45 185s [1] 25 185s > 185s > 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > # Test corner cases 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > for (mode in c("integer", "double")) { 185s + cat("mode: ", mode, "\n", sep = "") 185s + # Empty vectors 185s + x <- integer(0L) 185s + storage.mode(x) <- mode 185s + str(x) 185s + q <- iqr(x) 185s + print(q) 185s + stopifnot(identical(q, NA_real_)) 185s + 185s + # Scalar 185s + x <- 1L 185s + storage.mode(x) <- mode 185s + str(x) 185s + q <- iqr(x) 185s + str(q) 185s + stopifnot(identical(q, 0)) 185s + } 185s mode: integer 185s int(0) 185s [1] NA 185s int 1 185s num 0 185s mode: double 185s num(0) 185s [1] NA 185s num 1 185s num 0 185s > 185s > 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > # Single row matrices 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > x <- matrix(1, nrow = 1L, ncol = 2L) 185s > dimnames <- list("a", LETTERS[1:2]) 185s > # Test with and without dimnames on x 185s > for (setDimnames in c(TRUE, FALSE)) { 185s + if (setDimnames) dimnames(x) <- dimnames 185s + else dimnames(x) <- NULL 185s + # Check names attribute 185s + for (useNames in c(TRUE, FALSE)) { 185s + q0 <- rowIQRs_R(x, useNames = useNames) 185s + q1 <- rowIQRs(x, useNames = useNames) 185s + q2 <- colIQRs(t(x), useNames = useNames) 185s + stopifnot(all.equal(q0, q1)) 185s + stopifnot(all.equal(q0, q2)) 185s + } 185s + } 185s > 185s > x <- matrix(1, nrow = 2L, ncol = 1L) 185s > q <- colIQRs(x) 185s > stopifnot(identical(q, 0)) 185s > 185s 185s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 185s Copyright (C) 2025 The R Foundation for Statistical Computing 185s Platform: x86_64-pc-linux-gnu 185s 185s R is free software and comes with ABSOLUTELY NO WARRANTY. 185s You are welcome to redistribute it under certain conditions. 185s Type 'license()' or 'licence()' for distribution details. 185s 185s R is a collaborative project with many contributors. 185s Type 'contributors()' for more information and 185s 'citation()' on how to cite R or R packages in publications. 185s 185s Type 'demo()' for some demos, 'help()' for on-line help, or 185s 'help.start()' for an HTML browser interface to help. 185s Type 'q()' to quit R. 185s 185s > library("matrixStats") 185s > 185s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 185s + quantile_na <- function(x, ..., na.rm = FALSE) { 185s + if (!na.rm && anyMissing(x)) 185s + return(c(NA_real_, NA_real_)) 185s + quantile(x, ..., na.rm = na.rm) 185s + } 185s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 185s + probs = c(0.25, 0.75), na.rm = na.rm) 185s + rownames(q) <- NULL # Not needed anymore 185s + 185s + # Preserve names attribute 185s + dim(q) <- c(2L, nrow(x)) 185s + colnames(q) <- if (useNames) rownames(x) else NULL 185s + 185s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 185s + } 185s > 185s > 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > # Subsetted tests 185s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185s > source("utils/validateIndicesFramework.R") 185s > x <- runif(6, min = -6, max = 6) 185s > for (idxs in index_cases) { 185s + for (na.rm in c(TRUE, FALSE)) { 185s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 185s + dim(x) <- c(1L, length(x)) 185s + rowIQRs_R(x, na.rm = na.rm) 185s + }, na.rm = na.rm) 185s + } 185s + } 185s > 185s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 185s > 185s > # To check names attribute 185s > dimnames <- list(letters[1:6], LETTERS[1:6]) 185s > 185s > # Test with and without dimnames on x 185s > for (setDimnames in c(TRUE, FALSE)) { 185s + if (setDimnames) dimnames(x) <- dimnames 185s + else dimnames(x) <- NULL 185s + 185s + count <- 0L 185s + for (rows in index_cases) { 185s + for (cols in index_cases) { 185s + count <- count + 1L 185s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 185s + useNames <- c(TRUE, FALSE) 185s + useNames <- useNames[count %% length(useNames) + 1] 185s + 185s + validateIndicesTestMatrix(x, rows, cols, 185s + ftest = rowIQRs, fsure = rowIQRs_R, 185s + na.rm = na.rm, useNames = useNames) 185s + validateIndicesTestMatrix(x, rows, cols, 185s + fcoltest = colIQRs, fsure = rowIQRs_R, 185s + na.rm = na.rm, useNames = useNames) 185s + } 185s + } 185s + } 186s > 186s 186s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 186s Copyright (C) 2025 The R Foundation for Statistical Computing 186s Platform: x86_64-pc-linux-gnu 186s 186s R is free software and comes with ABSOLUTELY NO WARRANTY. 186s You are welcome to redistribute it under certain conditions. 186s Type 'license()' or 'licence()' for distribution details. 186s 186s R is a collaborative project with many contributors. 186s Type 'contributors()' for more information and 186s 'citation()' on how to cite R or R packages in publications. 186s 186s Type 'demo()' for some demos, 'help()' for on-line help, or 186s 'help.start()' for an HTML browser interface to help. 186s Type 'q()' to quit R. 186s 186s > # Test inspired by the harmonic mean example in R-help 186s > # thread '[R] Beyond double-precision?' on May 9, 2009. 186s > 186s > library("matrixStats") 186s > library("stats") 186s > 186s > logSumExp0 <- function(lx) { 186s + idx_max <- which.max(lx) 186s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 186s + } 186s > 186s > n <- 200L 186s > set.seed(1) 186s > 186s > for (mode in c("integer", "double")) { 186s + cat("mode: ", mode, "\n", sep = "") 186s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 186s + storage.mode(x) <- mode 186s + str(x) 186s + 186s + # The logarithm of the harmonic mean by rows 186s + y_h <- log(1 / rowMeans(1 / x)) 186s + str(y_h) 186s + 186s + lx_neg <- -log(x) 186s + 186s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 186s + stopifnot(all.equal(y0, y_h)) 186s + 186s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 186s + stopifnot(all.equal(y1, y0)) 186s + 186s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 186s + stopifnot(all.equal(y2, y0)) 186s + 186s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 186s + stopifnot(all.equal(y3, y0)) 186s + 186s + 186s + # The logarithm of the harmonic mean by columns 186s + y_h <- log(1 / colMeans(1 / x)) 186s + str(y_h) 186s + 186s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 186s + stopifnot(all.equal(y0, y_h)) 186s + 186s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 186s + stopifnot(all.equal(y1, y0)) 186s + 186s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 186s + stopifnot(all.equal(y2, y0)) 186s + 186s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 186s + stopifnot(all.equal(y3, y0)) 186s + 186s + # Testing names 186s + rownames(lx_neg) <- seq_len(nrow(x)) 186s + colnames(lx_neg) <- seq_len(ncol(x)) 186s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 186s + stopifnot(identical(names(y2), rownames(lx_neg))) 186s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 186s + stopifnot(identical(names(y3), rownames(lx_neg))) 186s + } # for (mode ...) 186s mode: integer 186s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 186s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 186s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 186s mode: double 186s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 186s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 186s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 186s > 186s > 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > # Corner cases 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > ## Zero-size matrices 186s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s numeric(0) 186s > stopifnot(length(y) == nrow(lx)) 186s > 186s > y <- colLogSumExps(lx) 186s > print(y) 186s numeric(0) 186s > stopifnot(length(y) == ncol(lx)) 186s > 186s > ## Zero-height matrices 186s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s numeric(0) 186s > stopifnot(length(y) == nrow(lx)) 186s > 186s > y <- colLogSumExps(lx) 186s > print(y) 186s [1] -Inf -Inf -Inf -Inf -Inf 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(all(y == -Inf)) 186s > 186s > ## Zero-width matrices 186s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 186s > y <- colLogSumExps(lx) 186s > print(y) 186s numeric(0) 186s > stopifnot(length(y) == ncol(lx)) 186s > 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s [1] -Inf -Inf -Inf -Inf -Inf 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(y == -Inf)) 186s > 186s > 186s > ## Matrices with one element 186s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s [1] 1 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(y == lx)) 186s > 186s > y <- colLogSumExps(lx) 186s > print(y) 186s [1] 1 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(all(y == lx)) 186s > 186s > ## All missing values 186s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 186s > y <- rowLogSumExps(lx, na.rm = TRUE) 186s > print(y) 186s [1] -Inf 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(identical(y, -Inf)) 186s > 186s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 186s > y <- colLogSumExps(lx, na.rm = TRUE) 186s > print(y) 186s [1] -Inf 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(identical(y, -Inf)) 186s > 186s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 186s > y <- rowLogSumExps(lx, na.rm = TRUE) 186s > print(y) 186s [1] -Inf -Inf 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(y == -Inf)) 186s > 186s > y <- rowLogSumExps(lx, na.rm = FALSE) 186s > print(y) 186s [1] NA NA 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(is.na(y) & !is.nan(y))) 186s > 186s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 186s > y <- colLogSumExps(lx, na.rm = TRUE) 186s > print(y) 186s [1] -Inf -Inf 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(all(y == -Inf)) 186s > 186s > y <- colLogSumExps(lx, na.rm = FALSE) 186s > print(y) 186s [1] NA NA 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(all(is.na(y) & !is.nan(y))) 186s > 186s > ## +Inf values 186s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 186s > y <- colLogSumExps(lx, na.rm = TRUE) 186s > print(y) 186s [1] Inf Inf 186s > stopifnot(length(y) == ncol(lx)) 186s > stopifnot(all(y == +Inf)) 186s > 186s > ## multiple -Inf values 186s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s [1] -Inf -Inf 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(y == -Inf)) 186s > 186s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 186s > y <- rowLogSumExps(lx) 186s > print(y) 186s [1] 5 5 186s > stopifnot(length(y) == nrow(lx)) 186s > stopifnot(all(y == 5)) 186s > 186s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 186s > ## (This would core dump on Windows) 186s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 186s > y <- colLogSumExps(x) 186s > str(y) 186s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 186s > 186s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 186s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 186s > ## used) 186s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 186s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 186s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 186s > stopifnot(names(y) == c("c", "b", "a")) 186s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 186s > stopifnot(names(y) == "B") 186s > 186s > 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > # Check names attributes 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > 186s > ## Create isFALSE() if running on an old version of R 186s > if (!exists("isFALSE", mode="function")) { 186s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 186s + } 186s > 186s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 186s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 186s + log(sum(exp(rx), ...)) 186s + }, ...) 186s + if (isFALSE(useNames)) names(res) <- NULL 186s + res 186s + } 186s > 186s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 186s > 186s > # To check names attribute 186s > dimnames <- list(letters[1:6], LETTERS[1:6]) 186s > 186s > # Test with and without dimnames on x 186s > for (setDimnames in c(TRUE, FALSE)) { 186s + if (setDimnames) dimnames(x) <- dimnames 186s + else dimnames(x) <- NULL 186s + for (useNames in c(TRUE, FALSE)) { 186s + y0 <- rowLogSumExps_R(x, useNames = useNames) 186s + y1 <- rowLogSumExps(x, useNames = useNames) 186s + y2 <- colLogSumExps(t(x), useNames = useNames) 186s + stopifnot(all.equal(y1, y0)) 186s + stopifnot(all.equal(y2, y0)) 186s + } 186s + } 186s > 186s 186s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 186s Copyright (C) 2025 The R Foundation for Statistical Computing 186s Platform: x86_64-pc-linux-gnu 186s 186s R is free software and comes with ABSOLUTELY NO WARRANTY. 186s You are welcome to redistribute it under certain conditions. 186s Type 'license()' or 'licence()' for distribution details. 186s 186s R is a collaborative project with many contributors. 186s Type 'contributors()' for more information and 186s 'citation()' on how to cite R or R packages in publications. 186s 186s Type 'demo()' for some demos, 'help()' for on-line help, or 186s 'help.start()' for an HTML browser interface to help. 186s Type 'q()' to quit R. 186s 186s > library("matrixStats") 186s > 186s > ## Create isFALSE() if running on an old version of R 186s > if (!exists("isFALSE", mode="function")) { 186s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 186s + } 186s > 186s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 186s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 186s + log(sum(exp(rx), ...)) 186s + }, ...) 186s + if (isFALSE(useNames)) names(res) <- NULL 186s + res 186s + } 186s > 186s > 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > # Subsetted tests 186s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186s > source("utils/validateIndicesFramework.R") 186s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 186s > 186s > # To check names attribute 186s > dimnames <- list(letters[1:6], LETTERS[1:6]) 186s > 186s > # Test with and without dimnames on x 186s > for (setDimnames in c(TRUE, FALSE)) { 186s + if (setDimnames) dimnames(x) <- dimnames 186s + else dimnames(x) <- NULL 186s + for (rows in index_cases) { 186s + for (cols in index_cases) { 186s + for (na.rm in c(TRUE, FALSE)) { 186s + for (useNames in c(TRUE, FALSE)) { 186s + validateIndicesTestMatrix(x, rows, cols, 186s + ftest = rowLogSumExps, 186s + fsure = rowLogSumExps_R, 186s + na.rm = na.rm, useNames = useNames) 186s + validateIndicesTestMatrix(x, rows, cols, 186s + fcoltest = colLogSumExps, 186s + fsure = rowLogSumExps_R, 186s + na.rm = na.rm, useNames = useNames) 186s + } 186s + } 186s + } 186s + } 186s + } 187s > 187s 187s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 187s > library("matrixStats") 187s > 187s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 187s > options(matrixStats.center.onUse = "ignore") 187s > 187s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 187s + suppressWarnings({ 187s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 187s + }) 187s + if (!useNames) names(res) <- NULL 187s + res 187s + } 187s > 187s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 187s + suppressWarnings({ 187s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 187s + }) 187s + if (!useNames) names(res) <- NULL 187s + res 187s + } 187s > 187s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 187s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 187s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 187s + } 187s > 187s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 187s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 187s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 187s + } 187s > 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # A 3x3 matrix (no ties) 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > for (mode in c("integer", "double")) { 187s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 187s + cat("mode: ", mode, "\n", sep = "") 187s + storage.mode(x) <- mode 187s + str(x) 187s + 187s + # To check name attribute 187s + dimnames <- list(letters[1:3], LETTERS[1:3]) 187s + 187s + # Test with and without dimnames on x 187s + for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("rowMads():\n") 187s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 187s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 187s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 187s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 187s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 187s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r1b, r1)) 187s + stopifnot(all.equal(r1c, r1)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r2b, r2)) 187s + 187s + cat("colMads():\n") 187s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 187s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 187s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 187s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 187s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 187s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r1b, r1)) 187s + stopifnot(all.equal(r1c, r1)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r2b, r2)) 187s + } 187s + } 187s + } 187s mode: integer 187s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s mode: double 187s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # Ties: a 4x4 matrix 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > for (mode in c("integer", "double")) { 187s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 187s + cat("mode: ", mode, "\n", sep = "") 187s + storage.mode(x) <- mode 187s + str(x) 187s + tx <- t(x) 187s + 187s + # To check name attribute 187s + dimnames <- list(letters[1:4], LETTERS[1:4]) 187s + 187s + # Test with and without dimnames on x 187s + for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("rowMads():\n") 187s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 187s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + 187s + cat("colMads():\n") 187s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 187s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + } 187s + } 187s + } 187s mode: integer 187s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s mode: double 187s 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 ... 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s > tx <- NULL 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # No ties: a 3x3 matrix with an NA value 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > for (mode in c("integer", "double")) { 187s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 187s + x[2, 2] <- NA_real_ 187s + 187s + cat("mode: ", mode, "\n", sep = "") 187s + storage.mode(x) <- mode 187s + str(x) 187s + tx <- t(x) 187s + 187s + # To check name attribute 187s + dimnames <- list(letters[1:3], LETTERS[1:3]) 187s + 187s + # Test with and without dimnames on x 187s + for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("rowMads():\n") 187s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 187s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + 187s + cat("colMads():\n") 187s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 187s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 187s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + } 187s + } 187s + } 187s mode: integer 187s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s mode: double 187s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s rowMads(): 187s colMads(): 187s > tx <- NULL 187s > 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # With and without some NAs 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > for (add_na in c(FALSE, TRUE)) { 187s + cat("add_na = ", add_na, "\n", sep = "") 187s + 187s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 187s + if (add_na) { 187s + x[3:7, c(2, 4)] <- NA_real_ 187s + } 187s + 187s + # To check name attribute 187s + dimnames <- list(letters[1:10], LETTERS[1:5]) 187s + 187s + # Test with and without dimnames on x 187s + for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Row/column ranges 187s + for (na.rm in c(FALSE, TRUE)) { 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("na.rm = ", na.rm, "\n", sep = "") 187s + cat("rowMads():\n") 187s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 187s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 187s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 187s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 187s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r2, r1)) 187s + stopifnot(all.equal(r3, r0)) 187s + stopifnot(all.equal(r3, r1)) 187s + stopifnot(all.equal(r3, r2)) 187s + 187s + cat("colMads():\n") 187s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 187s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 187s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 187s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 187s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r2, r1)) 187s + stopifnot(all.equal(r3, r0)) 187s + stopifnot(all.equal(r3, r1)) 187s + stopifnot(all.equal(r3, r2)) 187s + } 187s + } 187s + } 187s + tx <- NULL 187s + } # for (add_na ...) 187s add_na = FALSE 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s add_na = TRUE 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = FALSE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s na.rm = TRUE 187s rowMads(): 187s colMads(): 187s > 187s > 187s > 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # All NAs 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 187s > # Test with and without dimnames on x 187s > for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Row/column ranges 187s + for (na.rm in c(FALSE, TRUE)) { 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("na.rm = ", na.rm, "\n", sep = "") 187s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 187s + if (na.rm) r0[is.na(r0)] <- NaN 187s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 187s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r1, r2)) 187s + } 187s + } 187s + } 187s na.rm = FALSE 187s na.rm = FALSE 187s na.rm = TRUE 187s na.rm = TRUE 187s na.rm = FALSE 187s na.rm = FALSE 187s na.rm = TRUE 187s na.rm = TRUE 187s > tx <- NULL 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # A 1x1 matrix 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > x <- matrix(0, nrow = 1L, ncol = 1L) 187s > dimnames <- list("a", "A") 187s > # Test with and without dimnames on x 187s > for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + tx <- t(x) 187s + # Row/column ranges 187s + for (na.rm in c(FALSE, TRUE)) { 187s + # Check names attribute 187s + for (useNames in c(TRUE, FALSE)) { 187s + cat("na.rm = ", na.rm, "\n", sep = "") 187s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 187s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 187s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + stopifnot(all.equal(r1, r2)) 187s + } 187s + } 187s + } 187s na.rm = FALSE 187s na.rm = FALSE 187s na.rm = TRUE 187s na.rm = TRUE 187s na.rm = FALSE 187s na.rm = FALSE 187s na.rm = TRUE 187s na.rm = TRUE 187s > 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # A 0x0 matrix 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > x <- matrix(double(0), nrow = 0, ncol = 0) 187s > tx <- t(x) 187s > for (na.rm in c(FALSE, TRUE)) { 187s + cat("na.rm = ", na.rm, "\n", sep = "") 187s + r0 <- rowMads_R(x, na.rm = na.rm) 187s + r1 <- rowMads(x, na.rm = na.rm) 187s + r2 <- colMads(tx, na.rm = na.rm) 187s + stopifnot(all.equal(r1, r2)) 187s + stopifnot(all.equal(r1, r0)) 187s + stopifnot(all.equal(r2, r0)) 187s + } 187s na.rm = FALSE 187s na.rm = TRUE 187s > 187s 187s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 187s > library("matrixStats") 187s > 187s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 187s > options(matrixStats.center.onUse = "ignore") 187s > 187s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 187s + suppressWarnings({ 187s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 187s + }) 187s + if (!useNames) names(res) <- NULL 187s + res 187s + } 187s > 187s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 187s + suppressWarnings({ 187s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 187s + }) 187s + if (!useNames) names(res) <- NULL 187s + res 187s + } 187s > 187s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 187s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 187s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 187s + } 187s > 187s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 187s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 187s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 187s + } 187s > 187s > 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > # Subsetted tests 187s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187s > source("utils/validateIndicesFramework.R") 187s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 187s > storage.mode(x) <- "integer" 187s > 187s > # To check names attribute 187s > dimnames <- list(letters[1:6], LETTERS[1:6]) 187s > 187s > # Test with and without dimnames on x 187s > for (setDimnames in c(TRUE, FALSE)) { 187s + if (setDimnames) dimnames(x) <- dimnames 187s + else dimnames(x) <- NULL 187s + 187s + count <- 0L 187s + for (rows in index_cases) { 187s + for (cols in index_cases) { 187s + count <- count + 1L 187s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 187s + useNames <- c(TRUE, FALSE) 187s + useNames <- useNames[count %% length(useNames) + 1] 187s + 187s + validateIndicesTestMatrix(x, rows, cols, 187s + ftest = rowMads, fsure = rowMads_R, 187s + na.rm = na.rm, useNames = useNames) 187s + validateIndicesTestMatrix(x, rows, cols, 187s + ftest = rowMads_center, fsure = rowMads_R, 187s + na.rm = na.rm, useNames = useNames) 187s + 187s + validateIndicesTestMatrix(x, rows, cols, 187s + fcoltest = colMads, fsure = rowMads_R, 187s + na.rm = na.rm, useNames = useNames) 187s + validateIndicesTestMatrix(x, rows, cols, 187s + fcoltest = colMads_center, fsure = rowMads_R, 187s + na.rm = na.rm, useNames = useNames) 187s + } 187s + } 187s + } 187s > 187s 187s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 187s > library("matrixStats") 188s > 188s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- rowMeans(x, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- colMeans(x, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > for (mode in c("integer", "logical", "double")) { 188s + x <- matrix(-4:4, nrow = 3, ncol = 3) 188s + storage.mode(x) <- mode 188s + if (mode == "double") x <- x + 0.1 188s + 188s + # To check names attribute 188s + dimnames <- list(letters[1:3], LETTERS[1:3]) 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Single-element matrix 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Single-element matrix:\n") 188s Special case: Single-element matrix: 188s > for (mode in c("integer", "logical", "double")) { 188s + x <- matrix(1, nrow = 1, ncol = 1) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list("a", "A") 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Empty matrix 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Empty matrix:\n") 188s Special case: Empty matrix: 188s > for (mode in c("integer", "logical", "double")) { 188s + x <- matrix(integer(0), nrow = 0, ncol = 0) 188s + storage.mode(x) <- mode 188s + 188s + y0 <- rowMeans(x, na.rm = FALSE) 188s + y1 <- rowMeans2(x, na.rm = FALSE) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans(x, na.rm = FALSE) 188s + y1 <- colMeans2(x, na.rm = FALSE) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All NAs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All NAs:\n") 188s Special case: All NAs: 188s > for (mode in c("integer", "logical", "double")) { 188s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list(letters[1:3], LETTERS[1:3]) 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All NaNs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All NaNs:\n") 188s Special case: All NaNs: 188s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All Infs:\n") 188s Special case: All Infs: 188s > x <- matrix(Inf, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All -Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All -Infs:\n") 188s Special case: All -Infs: 188s > x <- matrix(-Inf, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Infs and -Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Infs and -Infs:\n") 188s Special case: Infs and -Infs: 188s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 188s > 188s > # To check names attribute 188s > dimnames <- list(letters[1:4], LETTERS[1:4]) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: NaNs and NAs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: NaNs and NAs:\n") 188s Special case: NaNs and NAs: 188s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + str(y0) 188s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + str(y1) 188s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s Named num [1:4] NaN NA NaN NA 188s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 188s Named num [1:4] NaN NA NaN NA 188s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 188s num [1:4] NaN NA NaN NA 188s num [1:4] NaN NA NaN NA 188s num [1:4] NaN NA NaN NA 188s num [1:4] NaN NA NaN NA 188s num [1:4] NaN NA NaN NA 188s num [1:4] NaN NA NaN NA 188s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 188s > ## returned here (as one would expect). NaN might very well be returned, 188s > ## when both NA and NaN are involved. This is an accepted feature in R, 188s > ## which is documented in help("is.nan"). See also 188s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 188s > ## Thus, we cannot guarantee that y1 is identical to y0. 188s > 188s > 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Integer overflow with ties 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Integer overflow with ties:\n") 188s Special case: Integer overflow with ties: 188s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Consistency checks 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > set.seed(1) 188s > 188s > cat("Consistency checks:\n") 188s Consistency checks: 188s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 188s > for (kk in seq_len(n_sims)) { 188s + cat("Random test #", kk, "\n", sep = "") 188s + 188s + # Simulate data in a matrix of any shape 188s + dim <- sample(50:200, size = 2) 188s + n <- prod(dim) 188s + x <- rnorm(n, sd = 100) 188s + dim(x) <- dim 188s + 188s + # Add NAs? 188s + if ((kk %% 4) %in% c(3, 0)) { 188s + cat("Adding NAs\n") 188s + nna <- sample(n, size = 1) 188s + na_values <- c(NA_real_, NaN) 188s + t <- sample(na_values, size = nna, replace = TRUE) 188s + x[sample(length(x), size = nna)] <- t 188s + } 188s + 188s + # Mode? 188s + modes <- "double" 188s + if ((kk %% 4) %in% c(2, 0)) { 188s + modes <- c("integer", "logical") 188s + } 188s + 188s + for (mode in modes) { 188s + if (mode != "double") { 188s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 188s + storage.mode(x) <- mode 188s + } 188s + 188s + na.rm <- sample(c(TRUE, FALSE), size = 1) 188s + 188s + # rowMeans2(): 188s + y0 <- rowMeans(x, na.rm = na.rm) 188s + y1 <- rowMeans2(x, na.rm = na.rm) 188s + stopifnot(all.equal(y1, y0)) 188s + y2 <- colMeans2(t(x), na.rm = na.rm) 188s + stopifnot(all.equal(y2, y0)) 188s + 188s + # colMeans2(): 188s + y0 <- colMeans(x, na.rm = na.rm) 188s + y1 <- colMeans2(x, na.rm = na.rm) 188s + stopifnot(all.equal(y1, y0)) 188s + y2 <- rowMeans2(t(x), na.rm = na.rm) 188s + stopifnot(all.equal(y2, y0)) 188s + } 188s + } # for (kk ...) 188s Random test #1 188s Random test #2 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #3 188s Adding NAs 188s Random test #4 188s Adding NAs 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #5 188s Random test #6 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #7 188s Adding NAs 188s Random test #8 188s Adding NAs 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #9 188s Random test #10 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #11 188s Adding NAs 188s Random test #12 188s Adding NAs 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #13 188s Random test #14 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #15 188s Adding NAs 188s Random test #16 188s Adding NAs 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #17 188s Random test #18 188s Coercing from double to integer 188s Coercing from integer to logical 188s Random test #19 188s Adding NAs 188s Random test #20 188s Adding NAs 188s Coercing from double to integer 188s Coercing from integer to logical 188s > 188s 188s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- rowMeans(x, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Subsetted tests 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > source("utils/validateIndicesFramework.R") 188s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 188s > storage.mode(x) <- "integer" 188s > 188s > # To check names attribute 188s > dimnames <- list(letters[1:6], LETTERS[1:6]) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + 188s + count <- 0L 188s + for (rows in index_cases) { 188s + for (cols in index_cases) { 188s + count <- count + 1L 188s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 188s + useNames <- c(TRUE, FALSE) 188s + useNames <- useNames[count %% length(useNames) + 1] 188s + 188s + validateIndicesTestMatrix(x, rows, cols, 188s + ftest = rowMeans2, fsure = rowMeans_R, 188s + na.rm = na.rm, useNames = useNames) 188s + validateIndicesTestMatrix(x, rows, cols, 188s + fcoltest = colMeans2, fsure = rowMeans_R, 188s + na.rm = na.rm, useNames = useNames) 188s + } 188s + } 188s + } 188s > 188s 188s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Non-ties 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Non-ties:\n") 188s Special case: Non-ties: 188s > for (mode in c("integer", "double")) { 188s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list(letters[1:3], LETTERS[1:3]) 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Ties 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Ties:\n") 188s Special case: Ties: 188s > for (mode in c("integer", "double")) { 188s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list(letters[1:4], LETTERS[1:4]) 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Single-element matrix 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Single-element matrix:\n") 188s Special case: Single-element matrix: 188s > for (mode in c("integer", "double")) { 188s + x <- matrix(1, nrow = 1, ncol = 1) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list("a", "A") 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Empty matrix 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Empty matrix:\n") 188s Special case: Empty matrix: 188s > for (mode in c("integer", "double")) { 188s + x <- matrix(integer(0), nrow = 0, ncol = 0) 188s + storage.mode(x) <- mode 188s + 188s + y0 <- rowMedians_R(x, na.rm = FALSE) 188s + y1 <- rowMedians(x, na.rm = FALSE) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE) 188s + y1 <- colMedians(x, na.rm = FALSE) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All NAs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All NAs:\n") 188s Special case: All NAs: 188s > for (mode in c("integer", "double")) { 188s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 188s + storage.mode(x) <- mode 188s + 188s + # To check names attribute 188s + dimnames <- list(letters[1:3], LETTERS[1:3]) 188s + 188s + # Test with and without dimnames on x 188s + for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All NaNs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All NaNs:\n") 188s Special case: All NaNs: 188s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All Infs:\n") 188s Special case: All Infs: 188s > x <- matrix(Inf, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: All -Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: All -Infs:\n") 188s Special case: All -Infs: 188s > x <- matrix(-Inf, nrow = 3, ncol = 3) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Infs and -Infs 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Infs and -Infs:\n") 188s Special case: Infs and -Infs: 188s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 188s > 188s > # To check names attribute 188s > dimnames <- list(letters[1:4], LETTERS[1:4]) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Special case: Integer overflow with ties 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > cat("Special case: Integer overflow with ties:\n") 188s Special case: Integer overflow with ties: 188s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + # Check names attribute 188s + for (useNames in c(TRUE, FALSE)) { 188s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + 188s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 188s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 188s + stopifnot(all.equal(y1, y0)) 188s + } 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Consistency checks 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > set.seed(1) 188s > 188s > cat("Consistency checks:\n") 188s Consistency checks: 188s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 188s > for (kk in seq_len(n_sims)) { 188s + cat("Random test #", kk, "\n", sep = "") 188s + 188s + # Simulate data in a matrix of any shape 188s + dim <- sample(50:200, size = 2) 188s + n <- prod(dim) 188s + x <- rnorm(n, sd = 100) 188s + dim(x) <- dim 188s + 188s + # Add NAs? 188s + if ((kk %% 4) %in% c(3, 0)) { 188s + cat("Adding NAs\n") 188s + nna <- sample(n, size = 1) 188s + na_values <- c(NA_real_, NaN) 188s + t <- sample(na_values, size = nna, replace = TRUE) 188s + x[sample(length(x), size = nna)] <- t 188s + } 188s + 188s + # Integer or double? 188s + if ((kk %% 4) %in% c(2, 0)) { 188s + cat("Coercing to integers\n") 188s + storage.mode(x) <- "integer" 188s + } 188s + 188s + na.rm <- sample(c(TRUE, FALSE), size = 1) 188s + 188s + # rowMedians(): 188s + y0 <- rowMedians_R(x, na.rm = na.rm) 188s + y1 <- rowMedians(x, na.rm = na.rm) 188s + stopifnot(all.equal(y1, y0)) 188s + y2 <- colMedians(t(x), na.rm = na.rm) 188s + stopifnot(all.equal(y2, y0)) 188s + 188s + # colMedians(): 188s + y0 <- colMedians_R(x, na.rm = na.rm) 188s + y1 <- colMedians(x, na.rm = na.rm) 188s + stopifnot(all.equal(y1, y0)) 188s + y2 <- rowMedians(t(x), na.rm = na.rm) 188s + stopifnot(all.equal(y2, y0)) 188s + } # for (kk ...) 188s Random test #1 188s Random test #2 188s Coercing to integers 188s Random test #3 188s Adding NAs 188s Random test #4 188s Adding NAs 188s Coercing to integers 188s Random test #5 188s Random test #6 188s Coercing to integers 188s Random test #7 188s Adding NAs 188s Random test #8 188s Adding NAs 188s Coercing to integers 188s Random test #9 188s Random test #10 188s Coercing to integers 188s Random test #11 188s Adding NAs 188s Random test #12 188s Adding NAs 188s Coercing to integers 188s Random test #13 188s Random test #14 188s Coercing to integers 188s Random test #15 188s Adding NAs 188s Random test #16 188s Adding NAs 188s Coercing to integers 188s Random test #17 188s Random test #18 188s Coercing to integers 188s Random test #19 188s Adding NAs 188s Random test #20 188s Adding NAs 188s Coercing to integers 188s > 188s 188s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 188s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 188s + if (!useNames) names(res) <- NULL 188s + res 188s + } 188s > 188s > 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > # Subsetted tests 188s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188s > source("utils/validateIndicesFramework.R") 188s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 188s > storage.mode(x) <- "integer" 188s > 188s > # To check names attribute 188s > dimnames <- list(letters[1:6], LETTERS[1:6]) 188s > 188s > # Test with and without dimnames on x 188s > for (setDimnames in c(TRUE, FALSE)) { 188s + if (setDimnames) dimnames(x) <- dimnames 188s + else dimnames(x) <- NULL 188s + 188s + count <- 0L 188s + for (rows in index_cases) { 188s + for (cols in index_cases) { 188s + count <- count + 1L 188s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 188s + useNames <- c(TRUE, FALSE) 188s + useNames <- useNames[count %% length(useNames) + 1] 188s + 188s + validateIndicesTestMatrix(x, rows, cols, 188s + ftest = rowMedians, fsure = rowMedians_R, 188s + na.rm = na.rm, useNames = useNames) 188s + validateIndicesTestMatrix(x, rows, cols, 188s + fcoltest = colMedians, fsure = rowMedians_R, 188s + na.rm = na.rm, useNames = useNames) 188s + } 188s + } 188s + } 188s > 189s 189s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 189s Copyright (C) 2025 The R Foundation for Statistical Computing 189s Platform: x86_64-pc-linux-gnu 189s 189s R is free software and comes with ABSOLUTELY NO WARRANTY. 189s You are welcome to redistribute it under certain conditions. 189s Type 'license()' or 'licence()' for distribution details. 189s 189s R is a collaborative project with many contributors. 189s Type 'contributors()' for more information and 189s 'citation()' on how to cite R or R packages in publications. 189s 189s Type 'demo()' for some demos, 'help()' for on-line help, or 189s 'help.start()' for an HTML browser interface to help. 189s Type 'q()' to quit R. 189s 189s > library("matrixStats") 189s > library("stats") 189s > 189s > asWhich <- function(probs, max) { 189s + idx <- as.integer(round(probs * max)) 189s + if (idx < 1L) { 189s + idx <- 1L 189s + } else if (idx > max) { 189s + idx <- max 189s + } 189s + idx 189s + } # asWhich() 189s > 189s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 189s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 189s + 189s + # Remove Attributes 189s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 189s + ans 189s + } # rowOrderStats_R() 189s > 189s > 189s > set.seed(1) 189s > 189s > 189s > # Simulate data in a matrix of any shape 189s > nrow <- 60L 189s > ncol <- 30L 189s > x <- rnorm(nrow * ncol) 189s > dim(x) <- c(nrow, ncol) 189s > probs <- 0.3 189s > which <- asWhich(probs, max = ncol) 189s > 189s > y0 <- rowOrderStats_R(x, probs = probs) 189s > y1 <- rowOrderStats(x, which = which) 189s > stopifnot(all.equal(y1, y0)) 189s > y2 <- colOrderStats(t(x), which = which) 189s > stopifnot(all.equal(y2, y0)) 189s > 189s > 189s > 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > # Consistency checks 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > for (mode in c("integer", "double")) { 189s + cat("Consistency checks without NAs:\n") 189s + for (kk in 1:3) { 189s + cat("Random test #", kk, "\n", sep = "") 189s + 189s + # Simulate data in a matrix of any shape 189s + nrow <- sample(20L, size = 1L) 189s + ncol <- sample(20L, size = 1L) 189s + x <- rnorm(nrow * ncol) 189s + dim(x) <- c(nrow, ncol) 189s + 189s + cat("mode: ", mode, "\n", sep = "") 189s + storage.mode(x) <- mode 189s + str(x) 189s + 189s + probs <- runif(1) 189s + which <- asWhich(probs, max = ncol) 189s + 189s + y0 <- rowOrderStats_R(x, probs = probs) 189s + y1 <- rowOrderStats(x, which = which) 189s + stopifnot(all.equal(y1, y0)) 189s + y2 <- colOrderStats(t(x), which = which) 189s + stopifnot(all.equal(y2, y0)) 189s + } # for (kk in ...) 189s + } # for (mode ...) 189s Consistency checks without NAs: 189s Random test #1 189s mode: integer 189s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 189s Random test #2 189s mode: integer 189s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 189s Random test #3 189s mode: integer 189s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 189s Consistency checks without NAs: 189s Random test #1 189s mode: double 189s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 189s Random test #2 189s mode: double 189s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 189s Random test #3 189s mode: double 189s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 189s > 189s > 189s > # Check names attribute 189s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 189s > 189s > probs <- runif(1) 189s > which <- asWhich(probs, max = ncol(x)) 189s > 189s > dimnames <- list(letters[1:3], LETTERS[1:3]) 189s > 189s > # Test with and without dimnames on x 189s > for (setDimnames in c(TRUE, FALSE)) { 189s + if (setDimnames) dimnames(x) <- dimnames 189s + else dimnames(x) <- NULL 189s + # Check names attribute 189s + for (useNames in c(TRUE, FALSE)) { 189s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 189s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 189s + stopifnot(all.equal(y1, y0)) 189s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 189s + stopifnot(all.equal(y2, y0)) 189s + } 189s + } 189s > 189s 189s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 189s Copyright (C) 2025 The R Foundation for Statistical Computing 189s Platform: x86_64-pc-linux-gnu 189s 189s R is free software and comes with ABSOLUTELY NO WARRANTY. 189s You are welcome to redistribute it under certain conditions. 189s Type 'license()' or 'licence()' for distribution details. 189s 189s R is a collaborative project with many contributors. 189s Type 'contributors()' for more information and 189s 'citation()' on how to cite R or R packages in publications. 189s 189s Type 'demo()' for some demos, 'help()' for on-line help, or 189s 'help.start()' for an HTML browser interface to help. 189s Type 'q()' to quit R. 189s 189s > library("matrixStats") 189s > 189s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 189s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 189s + 189s + # Remove Attributes 189s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 189s + ans 189s + } # rowOrderStats_R() 189s > 189s > 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > # Subsetted tests 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > source("utils/validateIndicesFramework.R") 189s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 189s > storage.mode(x) <- "integer" 189s > 189s > # To check names attribute 189s > dimnames <- list(letters[1:6], LETTERS[1:6]) 189s > 189s > probs <- 0.3 189s > # Test with and without dimnames on x 189s > for (setDimnames in c(TRUE, FALSE)) { 189s + if (setDimnames) dimnames(x) <- dimnames 189s + else dimnames(x) <- NULL 189s + for (rows in index_cases) { 189s + for (cols in index_cases) { 189s + # Check names attribute 189s + for (useNames in c(TRUE, FALSE)) { 189s + if (is.null(cols)) which <- round(probs * ncol(x)) 189s + else { 189s + xxrows <- rows 189s + suppressWarnings({ 189s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 189s + if (identical(xx, "error")) which <- 0L 189s + else which <- round(probs * ncol(xx)) 189s + }) 189s + } 189s + if (which == 0L) next 189s + 189s + validateIndicesTestMatrix(x, rows, cols, 189s + ftest = rowOrderStats, fsure = rowOrderStats_R, 189s + which = which, probs = probs, useNames = useNames) 189s + validateIndicesTestMatrix(x, rows, cols, 189s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 189s + which = which, probs = probs, useNames = useNames) 189s + } 189s + } 189s + } 189s + } 189s > 189s 189s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 189s Copyright (C) 2025 The R Foundation for Statistical Computing 189s Platform: x86_64-pc-linux-gnu 189s 189s R is free software and comes with ABSOLUTELY NO WARRANTY. 189s You are welcome to redistribute it under certain conditions. 189s Type 'license()' or 'licence()' for distribution details. 189s 189s R is a collaborative project with many contributors. 189s Type 'contributors()' for more information and 189s 'citation()' on how to cite R or R packages in publications. 189s 189s Type 'demo()' for some demos, 'help()' for on-line help, or 189s 'help.start()' for an HTML browser interface to help. 189s Type 'q()' to quit R. 189s 189s > library("matrixStats") 189s > 189s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 189s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 189s + if (!useNames) names(res) <- NULL 189s + res 189s + } 189s > 189s > all.equal.na <- function(target, current, ...) { 189s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 189s + current[is.nan(current)] <- NA_real_ 189s + target[is.nan(target)] <- NA_real_ 189s + all.equal(target, current, ...) 189s + } 189s > 189s > for (mode in c("integer", "double")) { 189s + # Missing values 189s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 189s + cat("mode: ", mode, "\n", sep = "") 189s + storage.mode(x) <- mode 189s + str(x) 189s + 189s + # To check names attribute 189s + dimnames <- list(letters[1:4], LETTERS[1:2]) 189s + 189s + # Test with and without dimnames on x 189s + for (setDimnames in c(TRUE, FALSE)) { 189s + if (setDimnames) dimnames(x) <- dimnames 189s + else dimnames(x) <- NULL 189s + # Check names attribute 189s + for (useNames in c(TRUE, FALSE)) { 189s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 189s + print(y0) 189s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 189s + print(y1) 189s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 189s + print(y2) 189s + stopifnot(all.equal(y1, y0)) 189s + stopifnot(all.equal(y2, y1)) 189s + 189s + # Missing values 189s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 189s + print(y0) 189s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 189s + print(y1) 189s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 189s + print(y2) 189s + stopifnot(all.equal(y1, y0)) 189s + stopifnot(all.equal(y2, y1)) 189s + 189s + # "Empty" rows 189s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 189s + print(y0) 189s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 189s + print(y1) 189s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 189s + print(y2) 189s + stopifnot(all.equal.na(y1, y0)) 189s + stopifnot(all.equal(y2, y1)) 189s + stopifnot(length(y1) == 0L) 189s + 189s + # Using product() 189s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 189s + print(y1) 189s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 189s + print(y2) 189s + stopifnot(all.equal(y2, y1)) 189s + } 189s + } 189s + } # for (mode ...) 189s mode: integer 189s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 NA NA 0 189s a b c d 189s 1 NA NA 0 189s a b c d 189s 1 NA NA 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s a b c d 189s 1 NA NA 0 189s a b c d 189s 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s mode: double 189s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 0 1 0 189s a b c d 189s 1 NA NaN 0 189s a b c d 189s 1 NA NaN 0 189s a b c d 189s 1 NA NaN 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s a b c d 189s 1 NA NA 0 189s a b c d 189s 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 0 1 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s [1] 1 NA NaN 0 189s numeric(0) 189s numeric(0) 189s numeric(0) 189s [1] 1 NA NA 0 189s [1] 1 NA NA 0 189s > 189s > 189s > # Bug report 2012-06-25 189s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 189s > y0 <- rowProds_R(x) 189s > print(y0) 189s [1] 1 0 1 0 189s > y1 <- rowProds(x) 189s > print(y1) 189s [1] 1 0 1 0 189s > y2 <- colProds(t(x)) 189s > print(y2) 189s [1] 1 0 1 0 189s > stopifnot(all.equal.na(y1, y0)) 189s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 189s > stopifnot(all.equal.na(y2, y1)) 189s > # Check names attribute 189s > dimnames(x) <- dimnames 189s > y0 <- rowProds_R(x, useNames = TRUE) 189s > print(y0) 189s a b c d 189s 1 0 1 0 189s > y1 <- rowProds(x, useNames = TRUE) 189s > print(y1) 189s a b c d 189s 1 0 1 0 189s > y2 <- colProds(t(x), useNames = TRUE) 189s > print(y2) 189s a b c d 189s 1 0 1 0 189s > stopifnot(all.equal.na(y1, y0)) 189s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 189s > stopifnot(all.equal.na(y2, y1)) 189s > 189s > # Bug report 2014-03-25 ("all rows contains a zero") 189s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 189s > # To check names attribute 189s > dimnames <- list(letters[1:2], LETTERS[1:2]) 189s > y0 <- rowProds_R(x) 189s > print(y0) 189s [1] 0 0 189s > y1 <- rowProds(x) 189s > print(y1) 189s [1] 0 0 189s > y2 <- colProds(t(x)) 189s > print(y2) 189s [1] 0 0 189s > stopifnot(all.equal.na(y1, y0)) 189s > stopifnot(all.equal.na(y1, c(0, 0))) 189s > stopifnot(all.equal.na(y2, y1)) 189s > # Check names attribute 189s > dimnames(x) <- dimnames 189s > y0 <- rowProds_R(x, useNames = TRUE) 189s > print(y0) 189s a b 189s 0 0 189s > y1 <- rowProds(x, useNames = TRUE) 189s > print(y1) 189s a b 189s 0 0 189s > y2 <- colProds(t(x), useNames = TRUE) 189s > print(y2) 189s a b 189s 0 0 189s > stopifnot(all.equal.na(y1, y0)) 189s > stopifnot(all.equal.na(y2, y1)) 189s > 189s 189s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 189s Copyright (C) 2025 The R Foundation for Statistical Computing 189s Platform: x86_64-pc-linux-gnu 189s 189s R is free software and comes with ABSOLUTELY NO WARRANTY. 189s You are welcome to redistribute it under certain conditions. 189s Type 'license()' or 'licence()' for distribution details. 189s 189s R is a collaborative project with many contributors. 189s Type 'contributors()' for more information and 189s 'citation()' on how to cite R or R packages in publications. 189s 189s Type 'demo()' for some demos, 'help()' for on-line help, or 189s 'help.start()' for an HTML browser interface to help. 189s Type 'q()' to quit R. 189s 189s > library("matrixStats") 189s > 189s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 189s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 189s + if (!useNames) names(res) <- NULL 189s + res 189s + } 189s > 189s > 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > # Subsetted tests 189s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189s > source("utils/validateIndicesFramework.R") 189s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 189s > storage.mode(x) <- "integer" 189s > 189s > # To check names attribute 189s > dimnames <- list(letters[1:6], LETTERS[1:6]) 189s > 189s > # Test with and without dimnames on x 189s > for (setDimnames in c(TRUE, FALSE)) { 189s + if (setDimnames) dimnames(x) <- dimnames 189s + else dimnames(x) <- NULL 189s + for (rows in index_cases) { 189s + for (cols in index_cases) { 189s + for (na.rm in c(TRUE, FALSE)) { 189s + for (useNames in c(TRUE, FALSE)) { 189s + validateIndicesTestMatrix(x, rows, cols, 189s + ftest = rowProds, fsure = rowProds_R, 189s + method = "expSumLog", 189s + FUN = product, na.rm = na.rm, useNames = useNames) 189s + validateIndicesTestMatrix(x, rows, cols, 189s + fcoltest = colProds, fsure = rowProds_R, 189s + method = "expSumLog", 189s + FUN = product, na.rm = na.rm, useNames = useNames) 189s + } 189s + } 189s + } 189s + } 189s + } 190s > 190s 190s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 190s Copyright (C) 2025 The R Foundation for Statistical Computing 190s Platform: x86_64-pc-linux-gnu 190s 190s R is free software and comes with ABSOLUTELY NO WARRANTY. 190s You are welcome to redistribute it under certain conditions. 190s Type 'license()' or 'licence()' for distribution details. 190s 190s R is a collaborative project with many contributors. 190s Type 'contributors()' for more information and 190s 'citation()' on how to cite R or R packages in publications. 190s 190s Type 'demo()' for some demos, 'help()' for on-line help, or 190s 'help.start()' for an HTML browser interface to help. 190s Type 'q()' to quit R. 190s 190s > library("matrixStats") 190s > 190s > ## Create isFALSE() if running on an old version of R 190s > if (!exists("isFALSE", mode="function")) { 190s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 190s + } 190s > 190s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = TRUE) { 190s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 190s + if (!na.rm && any(is.na(x))) { 190s + na_value <- NA_real_ 190s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 190s + rep(na_value, times = length(probs)) 190s + } else { 190s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 190s + } 190s + }, probs = probs, na.rm = na.rm) 190s + 190s + if (!is.null(dim(q))) q <- t(q) 190s + else dim(q) <- c(nrow(x), length(probs)) 190s + 190s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 190s + rownames(q) <- rownames(x) 190s + if (isFALSE(useNames)) dimnames(q) <- NULL 190s + 190s + if (drop) q <- drop(q) 190s + q 190s + } 190s > 190s > 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > # Test with multiple quantiles 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > for (mode in c("logical", "integer", "double")) { 190s + cat("mode: ", mode, "\n", sep = "") 190s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 190s + storage.mode(x) <- mode 190s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 190s + str(x) 190s + 190s + probs <- c(0, 0.5, 1) 190s + # Test with and without dimnames on x 190s + for (setDimnames in c(TRUE, FALSE)) { 190s + if (setDimnames) dimnames(x) <- dimnames 190s + else dimnames(x) <- NULL 190s + # Check names attribute 190s + for (useNames in c(TRUE, FALSE)) { 190s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 190s + print(q0) 190s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 190s + print(q1) 190s + stopifnot(all.equal(q1, q0)) 190s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 190s + stopifnot(all.equal(q2, q0)) 190s + } 190s + } 190s + } # for (mode ...) 190s mode: logical 190s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 190s 0% 50% 100% 190s a 1 1 1 190s b 1 1 1 190s c 1 1 1 190s d 1 1 1 190s e 1 1 1 190s f 1 1 1 190s g 1 1 1 190s h 1 1 1 190s 0% 50% 100% 190s a 1 1 1 190s b 1 1 1 190s c 1 1 1 190s d 1 1 1 190s e 1 1 1 190s f 1 1 1 190s g 1 1 1 190s h 1 1 1 190s [,1] [,2] [,3] 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s [,1] [,2] [,3] 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s 0% 50% 100% 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s 0% 50% 100% 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s [,1] [,2] [,3] 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s [,1] [,2] [,3] 190s [1,] 1 1 1 190s [2,] 1 1 1 190s [3,] 1 1 1 190s [4,] 1 1 1 190s [5,] 1 1 1 190s [6,] 1 1 1 190s [7,] 1 1 1 190s [8,] 1 1 1 190s mode: integer 190s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 190s 0% 50% 100% 190s a 1 17 33 190s b 2 18 34 190s c 3 19 35 190s d 4 20 36 190s e 5 21 37 190s f 6 22 38 190s g 7 23 39 190s h 8 24 40 190s 0% 50% 100% 190s a 1 17 33 190s b 2 18 34 190s c 3 19 35 190s d 4 20 36 190s e 5 21 37 190s f 6 22 38 190s g 7 23 39 190s h 8 24 40 190s [,1] [,2] [,3] 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s [,1] [,2] [,3] 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s 0% 50% 100% 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s 0% 50% 100% 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s [,1] [,2] [,3] 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s [,1] [,2] [,3] 190s [1,] 1 17 33 190s [2,] 2 18 34 190s [3,] 3 19 35 190s [4,] 4 20 36 190s [5,] 5 21 37 190s [6,] 6 22 38 190s [7,] 7 23 39 190s [8,] 8 24 40 190s mode: double 190s 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 ... 190s 0% 50% 100% 190s a 1.1 17.1 33.1 190s b 2.1 18.1 34.1 190s c 3.1 19.1 35.1 190s d 4.1 20.1 36.1 190s e 5.1 21.1 37.1 190s f 6.1 22.1 38.1 190s g 7.1 23.1 39.1 190s h 8.1 24.1 40.1 190s 0% 50% 100% 190s a 1.1 17.1 33.1 190s b 2.1 18.1 34.1 190s c 3.1 19.1 35.1 190s d 4.1 20.1 36.1 190s e 5.1 21.1 37.1 190s f 6.1 22.1 38.1 190s g 7.1 23.1 39.1 190s h 8.1 24.1 40.1 190s [,1] [,2] [,3] 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s [,1] [,2] [,3] 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s 0% 50% 100% 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s 0% 50% 100% 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s [,1] [,2] [,3] 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s [,1] [,2] [,3] 190s [1,] 1.1 17.1 33.1 190s [2,] 2.1 18.1 34.1 190s [3,] 3.1 19.1 35.1 190s [4,] 4.1 20.1 36.1 190s [5,] 5.1 21.1 37.1 190s [6,] 6.1 22.1 38.1 190s [7,] 7.1 23.1 39.1 190s [8,] 8.1 24.1 40.1 190s > 190s > 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > # Test with a single quantile 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > for (mode in c("logical", "integer", "double")) { 190s + cat("mode: ", mode, "\n", sep = "") 190s + x <- matrix(1:40, nrow = 8, ncol = 5) 190s + storage.mode(x) <- mode 190s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 190s + str(x) 190s + 190s + probs <- c(0.5) 190s + # Test with and without dimnames on x 190s + for (setDimnames in c(TRUE, FALSE)) { 190s + if (setDimnames) dimnames(x) <- dimnames 190s + else dimnames(x) <- NULL 190s + # Check names attribute 190s + for (useNames in c(TRUE, FALSE)) { 190s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 190s + print(q0) 190s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 190s + print(q1) 190s + stopifnot(all.equal(q1, q0)) 190s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 190s + stopifnot(all.equal(q2, q0)) 190s + } 190s + } 190s + } # for (mode ...) 190s mode: logical 190s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 190s a b c d e f g h 190s 1 1 1 1 1 1 1 1 190s a b c d e f g h 190s 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s [1] 1 1 1 1 1 1 1 1 190s mode: integer 190s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 190s a b c d e f g h 190s 17 18 19 20 21 22 23 24 190s a b c d e f g h 190s 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s mode: double 190s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 190s a b c d e f g h 190s 17 18 19 20 21 22 23 24 190s a b c d e f g h 190s 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s [1] 17 18 19 20 21 22 23 24 190s > 190s > 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > # Consistency checks 190s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190s > set.seed(1) 190s > 190s > probs <- seq(from = 0, to = 1, by = 0.25) 190s > 190s > cat("Consistency checks:\n") 190s Consistency checks: 190s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 190s > for (kk in seq_len(n_sims)) { 190s + cat("Random test #", kk, "\n", sep = "") 190s + 190s + # Simulate data in a matrix of any shape 190s + dim <- sample(20:60, size = 2L) 190s + n <- prod(dim) 190s + x <- rnorm(n, sd = 100) 190s + dim(x) <- dim 190s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 190s + 190s + # Add NAs? 190s + has_na <- ((kk %% 2) == 0L) 190s + if (has_na) { 190s + cat("Adding NAs\n") 190s + nna <- sample(n, size = 1) 190s + na_values <- c(NA_real_, NaN) 190s + t <- sample(na_values, size = nna, replace = TRUE) 190s + x[sample(length(x), size = nna)] <- t 190s + } 190s + 190s + # Logical, integer, or double? 190s + mode <- "numeric" 190s + if ((kk %% 6) %in% 1:2) { 190s + cat("Coercing to logical\n") 190s + mode <- "logical" 190s + } else if ((kk %% 6) %in% 3:4) { 190s + cat("Coercing to integers\n") 190s + mode <- "integer" 190s + } 190s + storage.mode(x) <- mode 190s + 190s + str(x) 190s + 190s + # rowQuantiles(): 190s + for (type in 1:9) { 190s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 190s + # Test with and without dimnames on x 190s + for (setDimnames in c(TRUE, FALSE)) { 190s + if (setDimnames) dimnames(x) <- dimnames 190s + else dimnames(x) <- NULL 190s + # Check names attribute 190s + for (useNames in c(TRUE, FALSE)) { 190s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 190s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 190s + stopifnot(all.equal(q1, q0)) 190s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 190s + stopifnot(all.equal(q2, q0)) 190s + } 190s + } 190s + } 190s + } # for (kk ...) 190s Random test #1 190s Coercing to logical 190s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 190s type=1, has_na=FALSE: 190s type=2, has_na=FALSE: 190s type=3, has_na=FALSE: 190s type=4, has_na=FALSE: 190s type=5, has_na=FALSE: 190s type=6, has_na=FALSE: 190s type=7, has_na=FALSE: 190s type=8, has_na=FALSE: 190s type=9, has_na=FALSE: 190s Random test #2 190s Adding NAs 190s Coercing to logical 190s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 190s type=1, has_na=TRUE: 190s type=2, has_na=TRUE: 190s type=3, has_na=TRUE: 190s type=4, has_na=TRUE: 190s type=5, has_na=TRUE: 190s type=6, has_na=TRUE: 190s type=7, has_na=TRUE: 190s type=8, has_na=TRUE: 191s type=9, has_na=TRUE: 191s Random test #3 191s Coercing to integers 191s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 191s type=1, has_na=FALSE: 191s type=2, has_na=FALSE: 191s type=3, has_na=FALSE: 191s type=4, has_na=FALSE: 191s type=5, has_na=FALSE: 191s type=6, has_na=FALSE: 191s type=7, has_na=FALSE: 191s type=8, has_na=FALSE: 191s type=9, has_na=FALSE: 191s Random test #4 191s Adding NAs 191s Coercing to integers 191s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 191s type=1, has_na=TRUE: 191s type=2, has_na=TRUE: 191s type=3, has_na=TRUE: 191s type=4, has_na=TRUE: 191s type=5, has_na=TRUE: 191s type=6, has_na=TRUE: 191s type=7, has_na=TRUE: 191s type=8, has_na=TRUE: 191s type=9, has_na=TRUE: 191s Random test #5 191s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 191s type=1, has_na=FALSE: 191s type=2, has_na=FALSE: 191s type=3, has_na=FALSE: 191s type=4, has_na=FALSE: 191s type=5, has_na=FALSE: 191s type=6, has_na=FALSE: 191s type=7, has_na=FALSE: 191s type=8, has_na=FALSE: 191s type=9, has_na=FALSE: 191s Random test #6 191s Adding NAs 191s num [1:46, 1:22] 197 -107 15 148 -110 ... 191s type=1, has_na=TRUE: 191s type=2, has_na=TRUE: 191s type=3, has_na=TRUE: 191s type=4, has_na=TRUE: 191s type=5, has_na=TRUE: 191s type=6, has_na=TRUE: 191s type=7, has_na=TRUE: 191s type=8, has_na=TRUE: 191s type=9, has_na=TRUE: 191s Random test #7 191s Coercing to logical 191s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 191s type=1, has_na=FALSE: 191s type=2, has_na=FALSE: 191s type=3, has_na=FALSE: 191s type=4, has_na=FALSE: 191s type=5, has_na=FALSE: 191s type=6, has_na=FALSE: 191s type=7, has_na=FALSE: 191s type=8, has_na=FALSE: 192s type=9, has_na=FALSE: 192s Random test #8 192s Adding NAs 192s Coercing to logical 192s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 192s type=1, has_na=TRUE: 192s type=2, has_na=TRUE: 192s type=3, has_na=TRUE: 192s type=4, has_na=TRUE: 192s type=5, has_na=TRUE: 192s type=6, has_na=TRUE: 192s type=7, has_na=TRUE: 192s type=8, has_na=TRUE: 192s type=9, has_na=TRUE: 192s Random test #9 192s Coercing to integers 192s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 192s type=1, has_na=FALSE: 192s type=2, has_na=FALSE: 192s type=3, has_na=FALSE: 192s type=4, has_na=FALSE: 192s type=5, has_na=FALSE: 192s type=6, has_na=FALSE: 192s type=7, has_na=FALSE: 192s type=8, has_na=FALSE: 192s type=9, has_na=FALSE: 192s Random test #10 192s Adding NAs 192s Coercing to integers 192s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 192s type=1, has_na=TRUE: 192s type=2, has_na=TRUE: 192s type=3, has_na=TRUE: 192s type=4, has_na=TRUE: 192s type=5, has_na=TRUE: 192s type=6, has_na=TRUE: 192s type=7, has_na=TRUE: 192s type=8, has_na=TRUE: 192s type=9, has_na=TRUE: 192s Random test #11 192s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 192s type=1, has_na=FALSE: 192s type=2, has_na=FALSE: 192s type=3, has_na=FALSE: 192s type=4, has_na=FALSE: 192s type=5, has_na=FALSE: 192s type=6, has_na=FALSE: 192s type=7, has_na=FALSE: 192s type=8, has_na=FALSE: 192s type=9, has_na=FALSE: 192s Random test #12 192s Adding NAs 192s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 192s type=1, has_na=TRUE: 192s type=2, has_na=TRUE: 193s type=3, has_na=TRUE: 193s type=4, has_na=TRUE: 193s type=5, has_na=TRUE: 193s type=6, has_na=TRUE: 193s type=7, has_na=TRUE: 193s type=8, has_na=TRUE: 193s type=9, has_na=TRUE: 193s Random test #13 193s Coercing to logical 193s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 193s type=1, has_na=FALSE: 193s type=2, has_na=FALSE: 193s type=3, has_na=FALSE: 193s type=4, has_na=FALSE: 193s type=5, has_na=FALSE: 193s type=6, has_na=FALSE: 193s type=7, has_na=FALSE: 193s type=8, has_na=FALSE: 193s type=9, has_na=FALSE: 193s Random test #14 193s Adding NAs 193s Coercing to logical 193s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 193s type=1, has_na=TRUE: 193s type=2, has_na=TRUE: 193s type=3, has_na=TRUE: 193s type=4, has_na=TRUE: 193s type=5, has_na=TRUE: 193s type=6, has_na=TRUE: 193s type=7, has_na=TRUE: 193s type=8, has_na=TRUE: 193s type=9, has_na=TRUE: 193s Random test #15 193s Coercing to integers 193s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 193s type=1, has_na=FALSE: 193s type=2, has_na=FALSE: 193s type=3, has_na=FALSE: 193s type=4, has_na=FALSE: 193s type=5, has_na=FALSE: 193s type=6, has_na=FALSE: 193s type=7, has_na=FALSE: 193s type=8, has_na=FALSE: 193s type=9, has_na=FALSE: 193s Random test #16 193s Adding NAs 193s Coercing to integers 193s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 193s type=1, has_na=TRUE: 193s type=2, has_na=TRUE: 193s type=3, has_na=TRUE: 193s type=4, has_na=TRUE: 193s type=5, has_na=TRUE: 193s type=6, has_na=TRUE: 193s type=7, has_na=TRUE: 193s type=8, has_na=TRUE: 193s type=9, has_na=TRUE: 193s Random test #17 193s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 193s type=1, has_na=FALSE: 194s type=2, has_na=FALSE: 194s type=3, has_na=FALSE: 194s type=4, has_na=FALSE: 194s type=5, has_na=FALSE: 194s type=6, has_na=FALSE: 194s type=7, has_na=FALSE: 194s type=8, has_na=FALSE: 194s type=9, has_na=FALSE: 194s Random test #18 194s Adding NAs 194s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 194s type=1, has_na=TRUE: 194s type=2, has_na=TRUE: 194s type=3, has_na=TRUE: 194s type=4, has_na=TRUE: 194s type=5, has_na=TRUE: 194s type=6, has_na=TRUE: 194s type=7, has_na=TRUE: 194s type=8, has_na=TRUE: 194s type=9, has_na=TRUE: 194s Random test #19 194s Coercing to logical 194s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 194s type=1, has_na=FALSE: 194s type=2, has_na=FALSE: 194s type=3, has_na=FALSE: 194s type=4, has_na=FALSE: 194s type=5, has_na=FALSE: 194s type=6, has_na=FALSE: 194s type=7, has_na=FALSE: 194s type=8, has_na=FALSE: 194s type=9, has_na=FALSE: 194s Random test #20 194s Adding NAs 194s Coercing to logical 194s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 194s type=1, has_na=TRUE: 194s type=2, has_na=TRUE: 194s type=3, has_na=TRUE: 194s type=4, has_na=TRUE: 194s type=5, has_na=TRUE: 194s type=6, has_na=TRUE: 194s type=7, has_na=TRUE: 194s type=8, has_na=TRUE: 194s type=9, has_na=TRUE: 194s Random test #21 194s Coercing to integers 194s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 194s type=1, has_na=FALSE: 194s type=2, has_na=FALSE: 194s type=3, has_na=FALSE: 194s type=4, has_na=FALSE: 194s type=5, has_na=FALSE: 195s type=6, has_na=FALSE: 195s type=7, has_na=FALSE: 195s type=8, has_na=FALSE: 195s type=9, has_na=FALSE: 195s Random test #22 195s Adding NAs 195s Coercing to integers 195s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 195s type=1, has_na=TRUE: 195s type=2, has_na=TRUE: 195s type=3, has_na=TRUE: 195s type=4, has_na=TRUE: 195s type=5, has_na=TRUE: 195s type=6, has_na=TRUE: 195s type=7, has_na=TRUE: 195s type=8, has_na=TRUE: 195s type=9, has_na=TRUE: 195s Random test #23 195s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 195s type=1, has_na=FALSE: 195s type=2, has_na=FALSE: 195s type=3, has_na=FALSE: 195s type=4, has_na=FALSE: 195s type=5, has_na=FALSE: 195s type=6, has_na=FALSE: 195s type=7, has_na=FALSE: 195s type=8, has_na=FALSE: 195s type=9, has_na=FALSE: 195s Random test #24 195s Adding NAs 195s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 195s type=1, has_na=TRUE: 195s type=2, has_na=TRUE: 195s type=3, has_na=TRUE: 195s type=4, has_na=TRUE: 195s type=5, has_na=TRUE: 195s type=6, has_na=TRUE: 195s type=7, has_na=TRUE: 195s type=8, has_na=TRUE: 195s type=9, has_na=TRUE: 195s > 195s > 195s > 195s > for (mode in c("logical", "integer", "double")) { 195s + naValue <- NA_real_ 195s + storage.mode(naValue) <- mode 195s + 195s + someValue <- 1 195s + storage.mode(someValue) <- mode 195s + 195s + for (type in 1:9) { 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + # All NA 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 195s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + # Test with and without dimnames on x 195s + for (setDimnames in c(TRUE, FALSE)) { 195s + if (setDimnames) dimnames(x) <- dimnames 195s + else dimnames(x) <- NULL 195s + # Check names attribute 195s + for (useNames in c(TRUE, FALSE)) { 195s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 195s + 195s + qr <- rowQuantiles(x, type = type, useNames = useNames) 195s + stopifnot(identical(qr, qr0)) 195s + 195s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 195s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 195s + 195s + stopifnot(identical(qc, qr)) 195s + } 195s + } 195s + 195s + 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + # Empty matrices 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + probs <- c(0, 0.25, 0.75, 1) 195s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 195s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 195s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 195s + 195s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 195s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 195s + 195s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 195s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 195s + 195s + 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + # Single column matrices 195s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s + probs <- c(0, 0.25, 0.75, 1) 195s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 195s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + print(qr) 195s + 195s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 195s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 195s + print(qc) 195s + 195s + stopifnot(identical(qc, qr)) 195s + } 195s + } 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s 0% 25% 75% 100% 195s a 1 1 1 1 195s b 1 1 1 1 195s > 195s 195s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 195s Copyright (C) 2025 The R Foundation for Statistical Computing 195s Platform: x86_64-pc-linux-gnu 195s 195s R is free software and comes with ABSOLUTELY NO WARRANTY. 195s You are welcome to redistribute it under certain conditions. 195s Type 'license()' or 'licence()' for distribution details. 195s 195s R is a collaborative project with many contributors. 195s Type 'contributors()' for more information and 195s 'citation()' on how to cite R or R packages in publications. 195s 195s Type 'demo()' for some demos, 'help()' for on-line help, or 195s 'help.start()' for an HTML browser interface to help. 195s Type 'q()' to quit R. 195s 195s > library("matrixStats") 195s > 195s > ## Create isFALSE() if running on an old version of R 195s > if (!exists("isFALSE", mode="function")) { 195s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 195s + } 195s > 195s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = TRUE) { 195s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 195s + if (!na.rm && any(is.na(x))) { 195s + na_value <- NA_real_ 195s + storage.mode(na_value) <- storage.mode(x) 195s + rep(na_value, times = length(probs)) 195s + 195s + } else { 195s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 195s + } 195s + }, probs = probs, na.rm = na.rm) 195s + 195s + if (!is.null(dim(q))) q <- t(q) 195s + else dim(q) <- c(nrow(x), length(probs)) 195s + 195s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 195s + rownames(q) <- rownames(x) 195s + if (isFALSE(useNames)) dimnames(q) <- NULL 195s + 195s + if (drop) q <- drop(q) 195s + q 195s + } 195s > 195s > 195s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s > # Subsetted tests 195s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195s > source("utils/validateIndicesFramework.R") 195s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 195s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 195s > probs <- c(0, 0.25, 0.75, 1) 195s > # Test with and without dimnames on x 195s > for (setDimnames in c(TRUE, FALSE)) { 195s + if (setDimnames) dimnames(x) <- dimnames 195s + else dimnames(x) <- NULL 195s + 195s + count <- 0L 195s + for (rows in index_cases) { 195s + for (cols in index_cases) { 195s + count <- count + 1L 195s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 195s + useNames <- c(TRUE, FALSE) 195s + useNames <- useNames[count %% length(useNames) + 1] 195s + 195s + validateIndicesTestMatrix(x, rows, cols, 195s + ftest = rowQuantiles, fsure = rowQuantiles_R, 195s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 195s + validateIndicesTestMatrix(x, rows, cols, 195s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 195s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 195s + } 195s + } 195s + } 196s > 196s > 196s 196s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 196s Copyright (C) 2025 The R Foundation for Statistical Computing 196s Platform: x86_64-pc-linux-gnu 196s 196s R is free software and comes with ABSOLUTELY NO WARRANTY. 196s You are welcome to redistribute it under certain conditions. 196s Type 'license()' or 'licence()' for distribution details. 196s 196s R is a collaborative project with many contributors. 196s Type 'contributors()' for more information and 196s 'citation()' on how to cite R or R packages in publications. 196s 196s Type 'demo()' for some demos, 'help()' for on-line help, or 196s 'help.start()' for an HTML browser interface to help. 196s Type 'q()' to quit R. 196s 196s > library("matrixStats") 196s > 196s > rowMins_R <- function(x, ..., useNames = TRUE) { 196s + suppressWarnings({ 196s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 196s + }) 196s + if (!useNames) names(res) <- NULL 196s + res 196s + } # rowMins_R() 196s > 196s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 196s + suppressWarnings({ 196s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 196s + }) 196s + if (!useNames) names(res) <- NULL 196s + res 196s + } # rowMaxs_R() 196s > 196s > rowRanges_R <- function(x, ..., useNames = TRUE) { 196s + suppressWarnings({ 196s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 196s + }) 196s + 196s + # Preserve rownames attribute 196s + dim <- c(dim(x)[1], 2L) 196s + if (!isTRUE(all.equal(dim(ans), dim))) { 196s + dim(ans) <- dim 196s + rownames <- rownames(x) 196s + if (!is.null(dimnames)) rownames(ans) <- rownames 196s + } 196s + if (!useNames) dimnames(ans) <- NULL 196s + ans 196s + } # rowRanges_R() 196s > 196s > 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > # With and without some NAs 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > for (mode in c("integer", "double")) { 196s + cat("mode: ", mode, "\n", sep = "") 196s + 196s + for (add_na in c(FALSE, TRUE)) { 196s + cat("add_na = ", add_na, "\n", sep = "") 196s + 196s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 196s + if (add_na) { 196s + x[3:7, c(2, 4)] <- NA_real_ 196s + } 196s + storage.mode(x) <- mode 196s + str(x) 196s + 196s + # To check names attribute 196s + dimnames <- list(letters[1:10], LETTERS[1:5]) 196s + 196s + # Test with and without dimnames on x 196s + for (setDimnames in c(TRUE, FALSE)) { 196s + if (setDimnames) dimnames(x) <- dimnames 196s + else dimnames(x) <- NULL 196s + # Row/column extremes 196s + for (na.rm in c(FALSE, TRUE)) { 196s + # Check names attribute 196s + for (useNames in c(TRUE, FALSE)) { 196s + cat("na.rm = ", na.rm, "\n", sep = "") 196s + 196s + # Ranges 196s + cat("range:\n") 196s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 196s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 196s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 196s + stopifnot(all.equal(r1, r2)) 196s + stopifnot(all.equal(r1, r0)) 196s + 196s + # Min 196s + cat("min:\n") 196s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 196s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 196s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 196s + stopifnot(all.equal(m1, m2)) 196s + stopifnot(all.equal(m1, m0)) 196s + 196s + # Max 196s + cat("max:\n") 196s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 196s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 196s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 196s + stopifnot(all.equal(m1, m2)) 196s + stopifnot(all.equal(m1, m0)) 196s + } 196s + } 196s + } 196s + } # for (add_na ...) 196s + } # for (mode ...) 196s mode: integer 196s add_na = FALSE 196s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s add_na = TRUE 196s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s mode: double 196s add_na = FALSE 196s 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 ... 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s add_na = TRUE 196s 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 ... 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = FALSE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s na.rm = TRUE 196s range: 196s min: 196s max: 196s > 196s > 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > # All NAs 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > for (mode in c("integer", "double")) { 196s + cat("mode: ", mode, "\n", sep = "") 196s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 196s + storage.mode(x) <- mode 196s + str(x) 196s + 196s + # Test with and without dimnames on x 196s + for (setDimnames in c(TRUE, FALSE)) { 196s + if (setDimnames) dimnames(x) <- dimnames 196s + else dimnames(x) <- NULL 196s + for (na.rm in c(FALSE, TRUE)) { 196s + # Check names attribute 196s + for (useNames in c(TRUE, FALSE)) { 196s + cat("na.rm = ", na.rm, "\n", sep = "") 196s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 196s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 196s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 196s + stopifnot(all.equal(r1, r2)) 196s + stopifnot(all.equal(r1, r0)) 196s + } 196s + } 196s + } 196s + } # for (mode ...) 196s mode: integer 196s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 196s na.rm = FALSE 196s na.rm = FALSE 196s na.rm = TRUE 196s na.rm = TRUE 196s na.rm = FALSE 196s na.rm = FALSE 196s na.rm = TRUE 196s na.rm = TRUE 196s mode: double 196s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 196s na.rm = FALSE 196s na.rm = FALSE 196s na.rm = TRUE 196s na.rm = TRUE 196s na.rm = FALSE 196s na.rm = FALSE 196s na.rm = TRUE 196s na.rm = TRUE 196s > 196s > 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > # Special cases 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > # Nx0 matrix 196s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 196s > r0 <- rowRanges_R(x) 196s > #r1 <- rowRanges(x) 196s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 196s > #stopifnot(all.equal(r1, r_truth)) 196s > 196s > # 0xN matrix 196s > x <- t(x) 196s > #r1 <- colRanges(x) 196s > #stopifnot(all.equal(r1, r_truth)) 196s > 196s > # Nx1 matrix 196s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 196s > # To check names attribute 196s > dimnames <- list(letters[1:5], "A") 196s > r1 <- rowRanges(x) 196s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 196s > stopifnot(all.equal(r1, r_truth)) 196s > # Check names attribute 196s > dimnames(x) <- dimnames 196s > r0 <- rowRanges_R(x, useNames = TRUE) 196s > r1 <- rowRanges(x, useNames = TRUE) 196s > stopifnot(all.equal(r1, r0)) 196s > dimnames(x) <- NULL 196s > 196s > # 1xN matrix 196s > x <- t(x) 196s > r1 <- colRanges(x) 196s > stopifnot(all.equal(r1, r_truth)) 196s > # Check names attribute 196s > dimnames(x) <- list("a", LETTERS[1:5]) 196s > r1 <- colRanges(x, useNames = TRUE) 196s > stopifnot(identical(rownames(r1), colnames(x))) 196s > 196s > 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 196s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 196s > 196s > na_list <- list( 196s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 196s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 196s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 196s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 196s + ) 196s > 196s > na <- na_list[["real"]] 196s > na[2, 2] <- NA 196s > na_list[["real + NA cell"]] <- na 196s > 196s > na <- na_list[["real"]] 196s > na[2, ] <- NA 196s > na_list[["real + NA row"]] <- na 196s > 196s > na <- na_list[["real"]] 196s > na[2, ] <- NaN 196s > na_list[["real + NaN row"]] <- na 196s > 196s > na <- na_list[["real"]] 196s > na[2, 2] <- Inf 196s > na_list[["real + Inf cell"]] <- na 196s > 196s > na <- na_list[["real"]] 196s > na[2, ] <- Inf 196s > na_list[["real + Inf row"]] <- na 196s > 196s > na <- na_list[["real"]] 196s > na[2, 2] <- NaN 196s > na_list[["real + NaN cell"]] <- na 196s > 196s > na <- na_list[["real w/ NA"]] 196s > na[2, 2] <- NaN 196s > na_list[["real w/ NA + NaN cell"]] <- na 196s > 196s > na <- na_list[["real w/ NA"]] 196s > na[2, ] <- NaN 196s > na_list[["real w/ NA + NaN row"]] <- na 196s > 196s > # To check names attribute 196s > dimnames <- list(letters[1:4], LETTERS[1:3]) 196s > 196s > # Test with and without dimnames on x 196s > for (setDimnames in c(TRUE, FALSE)) { 196s + if (setDimnames) dimnames(x) <- dimnames 196s + else dimnames(x) <- NULL 196s + for (na.rm in c(FALSE, TRUE)) { 196s + for (name in names(na_list)) { 196s + # Check names attribute 196s + for (useNames in c(TRUE, FALSE)) { 196s + na <- na_list[[name]] 196s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 196s + print(na) 196s + 196s + cat(" min:\n") 196s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 196s + str(y0) 196s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 196s + str(y1) 196s + stopifnot(all.equal(y1, y0)) 196s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 196s + str(y1c) 196s + stopifnot(all.equal(y1c, y1)) 196s + 196s + cat(" max:\n") 196s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 196s + str(y0) 196s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 196s + str(y1) 196s + stopifnot(all.equal(y1, y0)) 196s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 196s + str(y1c) 196s + stopifnot(all.equal(y1c, y1)) 196s + 196s + cat(" range:\n") 196s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 196s + str(y0) 196s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 196s + str(y1) 196s + stopifnot(all.equal(y1, y0)) 196s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 196s + str(y1c) 196s + stopifnot(all.equal(y1c, y1)) 196s + } 196s + } # for (name ...) 196s + } # for (na.rm ...) 196s + } 196s integer (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer w/ NA (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s max: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s range: 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s integer w/ NA (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s max: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s range: 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real w/ NA (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real + NA cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + Inf cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + Inf row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s max: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s range: 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s real w/ NA + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s max: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s range: 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s integer (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer w/ NA (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s integer w/ NA (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real w/ NA (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real w/ NA (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real + NA cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real + NA cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real + NA row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NA row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NaN row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NaN row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s num [1:4] 9 -Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + Inf cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + Inf row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NaN cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real + NaN cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real w/ NA + NaN row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real w/ NA + NaN row (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s integer (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer w/ NA (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s max: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s range: 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s integer w/ NA (integer) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s max: 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s int [1:4] NA NA NA NA 196s range: 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s int [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real w/ NA (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real + NA cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NA 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NA row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NA NA NA 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s num [1:4] 1 NA 3 4 196s max: 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s num [1:4] 9 NA 11 12 196s range: 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 196s real + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] NaN NaN NaN 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + Inf cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 Inf 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s num [1:4, 1:2] 1 2 3 4 9 ... 196s real + Inf row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + Inf row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] Inf Inf Inf 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s num [1:4] 1 Inf 3 4 196s max: 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s num [1:4] 9 Inf 11 12 196s range: 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s num [1:4, 1:2] 1 Inf 3 4 9 ... 196s real + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 NaN 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s num [1:4] 1 NaN 3 4 196s max: 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s num [1:4] 9 NaN 11 12 196s range: 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 196s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NaN NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s max: 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s num [1:4] NA NA NA NA 196s range: 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s num [1:4, 1:2] NA NA NA NA NA NA NA NA 196s real w/ NA + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s max: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s range: 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s real w/ NA + NaN row (double) w/ na.rm = FALSE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NaN NaN NaN 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s max: 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s num [1:4] NA NaN NA NA 196s range: 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 196s integer (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s int [1:4] 1 2 3 4 196s max: 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s int [1:4] 9 10 11 12 196s range: 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s int [1:4, 1:2] 1 2 3 4 9 10 11 12 196s integer w/ NA (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s integer w/ NA (integer) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] 1 5 9 196s [2,] 2 6 10 196s [3,] 3 7 11 196s [4,] 4 8 12 196s min: 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s num [1:4] 1 2 3 4 196s max: 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s num [1:4] 9 10 11 12 196s range: 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s num [1:4, 1:2] 1 2 3 4 9 10 11 12 196s real w/ NA (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real w/ NA (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 196s [1,] NA NA NA 196s [2,] NA NA NA 196s [3,] NA NA NA 196s [4,] NA NA NA 196s min: 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s num [1:4] Inf Inf Inf Inf 196s max: 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s num [1:4] -Inf -Inf -Inf -Inf 196s range: 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 196s real + NA cell (double) w/ na.rm = TRUE: 196s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 NA 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s real + NA cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 NA 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s real + NA row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] NA NA NA 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + NA row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] NA NA NA 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + NaN row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] NaN NaN NaN 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + NaN row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] NaN NaN NaN 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s num [1:4] 9 -Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + Inf cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 Inf 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s real + Inf cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 Inf 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s num [1:4, 1:2] 1 2 3 4 9 ... 197s real + Inf row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] Inf Inf Inf 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + Inf row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] Inf Inf Inf 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s num [1:4] 1 Inf 3 4 197s max: 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s num [1:4] 9 Inf 11 12 197s range: 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s num [1:4, 1:2] 1 Inf 3 4 9 ... 197s real + NaN cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 NaN 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s real + NaN cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] 1 5 9 197s [2,] 2 NaN 10 197s [3,] 3 7 11 197s [4,] 4 8 12 197s min: 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s num [1:4] 1 2 3 4 197s max: 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s num [1:4] 9 10 11 12 197s range: 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s num [1:4, 1:2] 1 2 3 4 9 10 11 12 197s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] NA NA NA 197s [2,] NA NaN NA 197s [3,] NA NA NA 197s [4,] NA NA NA 197s min: 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s max: 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s range: 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] NA NA NA 197s [2,] NA NaN NA 197s [3,] NA NA NA 197s [4,] NA NA NA 197s min: 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s max: 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s range: 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s real w/ NA + NaN row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] NA NA NA 197s [2,] NaN NaN NaN 197s [3,] NA NA NA 197s [4,] NA NA NA 197s min: 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s max: 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s range: 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s real w/ NA + NaN row (double) w/ na.rm = TRUE: 197s [,1] [,2] [,3] 197s [1,] NA NA NA 197s [2,] NaN NaN NaN 197s [3,] NA NA NA 197s [4,] NA NA NA 197s min: 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s num [1:4] Inf Inf Inf Inf 197s max: 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s num [1:4] -Inf -Inf -Inf -Inf 197s range: 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 197s > 197s 197s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowMins_R <- function(x, ..., useNames = TRUE) { 197s + suppressWarnings({ 197s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 197s + }) 197s + if (!useNames) names(res) <- NULL 197s + res 197s + } # rowMins_R() 197s > 197s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 197s + suppressWarnings({ 197s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 197s + }) 197s + if (!useNames) names(res) <- NULL 197s + res 197s + } # rowMaxs_R() 197s > 197s > rowRanges_R <- function(x, ..., useNames = TRUE) { 197s + suppressWarnings({ 197s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 197s + }) 197s + 197s + # Preserve rownames attribute 197s + dim <- c(dim(x)[1], 2L) 197s + if (!isTRUE(all.equal(dim(ans), dim))) { 197s + dim(ans) <- dim 197s + rownames <- rownames(x) 197s + if (!is.null(dimnames)) rownames(ans) <- rownames 197s + } 197s + if (!useNames) dimnames(ans) <- NULL 197s + ans 197s + } # rowRanges_R() 197s > 197s > 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > # Subsetted tests 197s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 197s > source("utils/validateIndicesFramework.R") 197s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 197s > storage.mode(x) <- "integer" 197s > 197s > # To check rownames/names attributes 197s > dimnames <- list(letters[1:6], LETTERS[1:6]) 197s > 197s > # Test with and without dimnames on x 197s > for (setDimnames in c(TRUE, FALSE)) { 197s + if (setDimnames) dimnames(x) <- dimnames 197s + else dimnames(x) <- NULL 197s + 197s + count <- 0L 197s + for (rows in index_cases) { 197s + for (cols in index_cases) { 197s + count <- count + 1L 197s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 197s + useNames <- c(TRUE, FALSE) 197s + useNames <- useNames[count %% length(useNames) + 1] 197s + 197s + validateIndicesTestMatrix(x, rows, cols, 197s + ftest = rowRanges, fsure = rowRanges_R, 197s + na.rm = na.rm, useNames = useNames) 197s + validateIndicesTestMatrix(x, rows, cols, 197s + ftest = rowMins, fsure = rowMins_R, 197s + na.rm = na.rm, useNames = useNames) 197s + validateIndicesTestMatrix(x, rows, cols, 197s + ftest = rowMaxs, fsure = rowMaxs_R, 197s + na.rm = na.rm, useNames = useNames) 197s + 197s + validateIndicesTestMatrix(x, rows, cols, 197s + fcoltest = colRanges, fsure = rowRanges_R, 197s + na.rm = na.rm, useNames = useNames) 197s + validateIndicesTestMatrix(x, rows, cols, 197s + fcoltest = colMins, fsure = rowMins_R, 197s + na.rm = na.rm, useNames = useNames) 197s + validateIndicesTestMatrix(x, rows, cols, 197s + fcoltest = colMaxs, fsure = rowMaxs_R, 197s + na.rm = na.rm, useNames = useNames) 197s + } 197s + } 197s + } 197s > 197s 197s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > dense_rank <- function(x) match(x, table = sort(unique(x))) 197s > 197s > rowRanks_R <- function(x, ties.method, ..., useNames = TRUE) { 197s + if (ties.method == "dense") { 197s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 197s + } else { 197s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 197s + } 197s + 197s + # Preserve dimnames attribute? 197s + dim(res) <- dim(x) 197s + dimnames(res) <- if (useNames) dimnames(x) else NULL 197s + 197s + res 197s + } 197s > 197s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 197s + if (ties.method == "dense") { 197s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 197s + } else { 197s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 197s + } 197s + 197s + # Preserve dimnames attribute? 197s + tx <- t(x) 197s + dim(res) <- dim(tx) 197s + dimnames(res) <- if (useNames) dimnames(tx) else NULL 197s + 197s + if (preserveShape) res <- t(res) 197s + res 197s + } 197s > 197s > set.seed(1) 197s > 197s > cat("Consistency checks:\n") 197s Consistency checks: 197s > xs <- vector("list", length = 4L) 197s > for (kk in 1:4) { 197s + 197s + # Simulate data in a matrix of any shape 197s + dim <- sample(40:80, size = 2L) 197s + n <- prod(dim) 197s + x <- rnorm(n, sd = 10) 197s + dim(x) <- dim 197s + 197s + # Add NAs? 197s + if ((kk %% 4) %in% c(3, 0)) { 197s + cat("Adding NAs\n") 197s + nna <- sample(n, size = 1L) 197s + x[sample(length(x), size = nna)] <- NA_real_ 197s + } 197s + 197s + # Integer or double? 197s + if ((kk %% 4) %in% c(2, 0)) { 197s + cat("Coercing to integers\n") 197s + storage.mode(x) <- "integer" 197s + } 197s + 197s + xs[[kk]] <- x 197s + } # for (kk ...) 197s Coercing to integers 197s Adding NAs 197s Adding NAs 197s Coercing to integers 197s > str(xs) 197s List of 4 197s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 197s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 197s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 197s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 197s > 197s > for (kk in 1:4) { 197s + cat("Random test #", kk, "\n", sep = "") 197s + x <- xs[[kk]] 197s + tx <- t(x) 197s + 197s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 197s + cat(sprintf("ties.method = %s\n", ties)) 197s + # rowRanks(): 197s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 197s + y2 <- rowRanks_R(x, ties.method = ties) 197s + stopifnot(identical(y1, y2)) 197s + 197s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 197s + stopifnot(identical(y1, y3)) 197s + 197s + # colRanks(): 197s + y1 <- matrixStats::colRanks(x, ties.method = ties) 197s + y2 <- colRanks_R(x, ties.method = ties) 197s + stopifnot(identical(y1, y2)) 197s + 197s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 197s + stopifnot(identical(y1, y3)) 197s + } 197s + } # for (kk ...) 197s Random test #1 197s ties.method = max 197s ties.method = min 197s ties.method = average 197s ties.method = first 197s ties.method = last 197s ties.method = dense 197s Random test #2 197s ties.method = max 197s ties.method = min 197s ties.method = average 197s ties.method = first 197s ties.method = last 197s ties.method = dense 197s Random test #3 197s ties.method = max 197s ties.method = min 197s ties.method = average 197s ties.method = first 197s ties.method = last 197s ties.method = dense 197s Random test #4 197s ties.method = max 197s ties.method = min 197s ties.method = average 197s ties.method = first 197s ties.method = last 197s ties.method = dense 198s > 198s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 198s > 198s > cat("Consistency checks for random:\n") 198s Consistency checks for random: 198s > tolerance <- 0.1 198s > nsamples <- 10000 198s > for (kk in 1:4) { 198s + cat("Random test #", kk, "\n", sep = "") 198s + x <- xs[[kk]] 198s + tx <- t(x) 198s + 198s + for (ties in c("random")) { 198s + cat(sprintf("ties.method = %s\n", ties)) 198s + 198s + ## rowRanks(): 198s + y0 <- rowRanks_R(x, ties.method = ties) 198s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 198s + 198s + ## Assert symmetric rank differences 198s + d <- y1 - y0 198s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 198s + 198s + ## Assert within [min, max] 198s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 198s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 198s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 198s + ## Assert near average 198s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 198s + y1mean <- Reduce(`+`, y1list) / nsamples 198s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 198s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 198s + 198s + ## colRanks(): 198s + y0 <- colRanks_R(x, ties.method = ties) 198s + y1 <- matrixStats::colRanks(x, ties.method = ties) 198s + 198s + ## Assert symmetric rank differences 198s + d <- y1 - y0 198s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 198s + 198s + ## Assert within [min, max] 198s + y2min <- matrixStats::colRanks(x, ties.method = "min") 198s + y2max <- matrixStats::colRanks(x, ties.method = "max") 198s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 198s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 198s + y1mean <- Reduce(`+`, y1list) / nsamples 198s + ## Assert near average 198s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 198s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 198s + } 198s + } # for (kk ...) 198s Random test #1 198s ties.method = random 199s Random test #2 199s ties.method = random 200s Random test #3 200s ties.method = random 200s Random test #4 200s ties.method = random 201s > 201s > 201s > ## Exception handling 201s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 201s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 201s > stopifnot(inherits(y, "try-error")) 201s > 201s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 201s > stopifnot(inherits(y, "try-error")) 201s > 201s > dimnames <- list(letters[1:3], LETTERS[1:4]) 201s > for (mode in c("integer", "double")){ 201s + storage.mode(x) <- mode 201s + # Test with and without dimnames on x 201s + for (setDimnames in c(TRUE, FALSE)) { 201s + if (setDimnames) dimnames(x) <- dimnames 201s + else dimnames(x) <- NULL 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 201s + cat(sprintf("ties.method = %s\n", ties)) 201s + # rowRanks(): 201s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 201s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 201s + stopifnot(identical(y1, y2)) 201s + 201s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 201s + stopifnot(identical(y1, y3)) 201s + 201s + # colRanks(): 201s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 201s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 201s + stopifnot(identical(y1, y2)) 201s + 201s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 201s + stopifnot(identical(y1, y3)) 201s + 201s + # Check preserveShape 201s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 201s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 201s + stopifnot(identical(y1, y2)) 201s + } 201s + } 201s + } 201s + } 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s ties.method = max 201s ties.method = min 201s ties.method = average 201s ties.method = first 201s ties.method = last 201s ties.method = dense 201s ties.method = random 201s > 201s 201s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowRanks_R <- function(x, ties.method = "average", ..., useNames = TRUE) { 201s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 201s + ties.method = ties.method)) 201s + 201s + # Preserve dimnames attribute? 201s + dim(ans) <- dim(x) 201s + dimnames(ans) <- if (useNames) dimnames(x) else NULL 201s + 201s + ans 201s + } 201s > 201s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 201s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 201s + 201s + # Preserve dimnames attribute? 201s + tx <- t(x) 201s + dim(ans) <- dim(tx) 201s + dimnames(ans) <- if (useNames) dimnames(tx) else NULL 201s + 201s + if (preserveShape) ans <- t(ans) 201s + ans 201s + } 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # Subsetted tests 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > source("utils/validateIndicesFramework.R") 201s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 201s > storage.mode(x) <- "integer" 201s > 201s > # To check dimnames attribute 201s > dimnames <- list(letters[1:6], LETTERS[1:6]) 201s > 201s > colRanks_R_t <- function(x, rows, cols, ..., useNames = TRUE) { 201s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 201s + } 201s > 201s > # Test with and without dimnames on x 201s > for (setDimnames in c(TRUE, FALSE)) { 201s + if (setDimnames) dimnames(x) <- dimnames 201s + else dimnames(x) <- NULL 201s + 201s + count <- 0L 201s + for (rows in index_cases) { 201s + for (cols in index_cases) { 201s + count <- count + 1L 201s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 201s + useNames <- c(TRUE, FALSE) 201s + useNames <- useNames[count %% length(useNames) + 1] 201s + 201s + validateIndicesTestMatrix(x, rows, cols, 201s + ftest = rowRanks, fsure = rowRanks_R, 201s + ties.method = "average", useNames = useNames) 201s + 201s + validateIndicesTestMatrix(x, rows, cols, 201s + ftest = colRanks_R_t, fsure = rowRanks_R, 201s + ties.method = "average", useNames = useNames) 201s + 201s + for (perserveShape in c(TRUE, FALSE)) { 201s + validateIndicesTestMatrix(x, rows, cols, 201s + ftest = colRanks, fsure = colRanks_R, 201s + ties.method = "average", perserveShape = perserveShape, 201s + useNames = useNames) 201s + } 201s + } 201s + } 201s + } 201s > 201s 201s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > ## Always allow testing of the 'center' argument (as long as it's not defunct) 201s > options(matrixStats.center.onUse = "ignore") 201s > 201s > ## Create isFALSE() if running on an old version of R 201s > if (!exists("isFALSE", mode="function")) { 201s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 201s + } 201s > 201s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 201s + suppressWarnings({ 201s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 201s + }) 201s + stopifnot(!any(is.infinite(sigma))) 201s + 201s + # Keep naming support consistency same as rowSds() 201s + if (is.null(center) || ncol(x) <= 1L) { 201s + if (isFALSE(useNames)) names(sigma) <- NULL 201s + } 201s + else if (isFALSE(useNames)) names(sigma) <- NULL 201s + sigma 201s + } 201s > 201s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 201s + suppressWarnings({ 201s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 201s + }) 201s + stopifnot(!any(is.infinite(sigma))) 201s + 201s + # Keep naming support consistency same as colSds() 201s + if (is.null(center) || nrow(x) <= 1L) { 201s + if (isFALSE(useNames)) names(sigma) <- NULL 201s + } 201s + if (isFALSE(useNames)) names(sigma) <- NULL 201s + sigma 201s + } 201s > 201s > 201s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 201s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 201s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 201s + stopifnot(!any(is.infinite(sigma))) 201s + sigma 201s + } 201s > 201s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 201s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 201s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 201s + stopifnot(!any(is.infinite(sigma))) 201s + sigma 201s + } 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # With and without some NAs 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > for (mode in c("integer", "double")) { 201s + for (add_na in c(FALSE, TRUE)) { 201s + cat("add_na = ", add_na, "\n", sep = "") 201s + 201s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 201s + if (add_na) { 201s + x[3:7, c(2, 4)] <- NA_real_ 201s + } 201s + cat("mode: ", mode, "\n", sep = "") 201s + storage.mode(x) <- mode 201s + str(x) 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 + if (setDimnames) dimnames(x) <- dimnames 201s + else dimnames(x) <- NULL 201s + # Row/column ranges 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 201s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 201s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 201s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 201s + stopifnot(all.equal(r1, r2)) 201s + stopifnot(all.equal(r1, r0)) 201s + stopifnot(all.equal(r2, r0)) 201s + stopifnot(all.equal(r1b, r2b)) 201s + stopifnot( 201s + !any(is.infinite(r1)), 201s + !any(is.infinite(r2)), 201s + !any(is.infinite(r1b)), 201s + !any(is.infinite(r2b)) 201s + ) 201s + } 201s + } 201s + } 201s + } # for (add_na ...) 201s + } 201s add_na = FALSE 201s mode: integer 201s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 201s add_na = TRUE 201s mode: integer 201s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 201s add_na = FALSE 201s mode: double 201s 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 ... 201s add_na = TRUE 201s mode: double 201s 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 ... 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # All NAs 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > for (mode in c("integer", "double")) { 201s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 201s + cat("mode: ", mode, "\n", sep = "") 201s + storage.mode(x) <- mode 201s + str(x) 201s + 201s + # Test with and without dimnames on x 201s + for (setDimnames in c(TRUE, FALSE)) { 201s + if (setDimnames) dimnames(x) <- dimnames 201s + else dimnames(x) <- NULL 201s + # Row/column ranges 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 201s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 201s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 201s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 201s + stopifnot(all.equal(r1, r2)) 201s + stopifnot(all.equal(r1, r0)) 201s + stopifnot(all.equal(r2, r0)) 201s + stopifnot(all.equal(r1b, r2b)) 201s + stopifnot( 201s + !any(is.infinite(r1)), 201s + !any(is.infinite(r2)), 201s + !any(is.infinite(r1b)), 201s + !any(is.infinite(r2b)) 201s + ) 201s + } 201s + } 201s + } 201s + } 201s mode: integer 201s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 201s mode: double 201s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 201s > 201s > 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > # A 1x1 matrix 201s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 201s > x <- matrix(0, nrow = 1L, ncol = 1L) 201s > dimnames <- list("a", "A") 201s > for (na.rm in c(FALSE, TRUE)) { 201s + cat("na.rm = ", na.rm, "\n", sep = "") 201s + 201s + # Test with and without dimnames on x 201s + for (setDimnames in c(TRUE, FALSE)) { 201s + if (setDimnames) dimnames(x) <- dimnames 201s + else dimnames(x) <- NULL 201s + # Row/column ranges 201s + for (na.rm in c(FALSE, TRUE)) { 201s + # Check names attribute 201s + for (useNames in c(TRUE, FALSE)) { 201s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 201s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 201s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 201s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 201s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 201s + stopifnot(all.equal(r1, r2)) 201s + stopifnot(all.equal(r1, r0)) 201s + stopifnot(all.equal(r2, r0)) 201s + stopifnot(all.equal(r1b, r2b)) 201s + stopifnot( 201s + !any(is.infinite(r1)), 201s + !any(is.infinite(r2)), 201s + !any(is.infinite(r1b)), 201s + !any(is.infinite(r2b)) 201s + ) 201s + } 201s + } 201s + } 201s + } 201s na.rm = FALSE 201s na.rm = TRUE 201s > 201s 201s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 202s > library("matrixStats") 202s > 202s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 202s > options(matrixStats.center.onUse = "ignore") 202s > 202s > ## Create isFALSE() if running on an old version of R 202s > if (!exists("isFALSE", mode="function")) { 202s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 202s + } 202s > 202s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 202s + suppressWarnings({ 202s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 202s + }) 202s + stopifnot(!any(is.infinite(sigma))) 202s + 202s + # Keep naming support consistency same as rowSds() 202s + if (is.null(center) || ncol(x) <= 1L) { 202s + if (isFALSE(useNames)) names(sigma) <- NULL 202s + } 202s + else if (isFALSE(useNames)) names(sigma) <- NULL 202s + sigma 202s + } 202s > 202s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 202s + suppressWarnings({ 202s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 202s + }) 202s + stopifnot(!any(is.infinite(sigma))) 202s + 202s + # Keep naming support consistency same as colSds() 202s + if (is.null(center) || nrow(x) <= 1L) { 202s + if (isFALSE(useNames)) names(sigma) <- NULL 202s + } 202s + else if (isFALSE(useNames)) names(sigma) <- NULL 202s + sigma 202s + } 202s > 202s > 202s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 202s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 202s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 202s + stopifnot(!any(is.infinite(sigma))) 202s + sigma 202s + } 202s > 202s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 202s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 202s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 202s + stopifnot(!any(is.infinite(sigma))) 202s + sigma 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Subsetted tests 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > source("utils/validateIndicesFramework.R") 202s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 202s > storage.mode(x) <- "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 = rowSds, fsure = rowSds_R, 202s + na.rm = na.rm, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowSds_center, fsure = rowSds_R, 202s + na.rm = na.rm, center = TRUE, useNames = useNames) 202s + 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colSds, fsure = rowSds_R, 202s + na.rm = na.rm, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colSds_center, fsure = rowSds_R, 202s + na.rm = na.rm, center = TRUE, useNames = useNames) 202s + } 202s + } 202s + } 202s > 202s 202s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 202s + ## FIXME: sum() may overflow for integers, whereas 202s + ## base::rowSums() doesn't. What should rowSums2() do? 202s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 202s + res <- rowSums(x, na.rm = na.rm) 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 202s + ## FIXME: sum() may overflow for integers, whereas 202s + ## base::colSums() doesn't. What should colSums2() do? 202s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 202s + res <- colSums(x, na.rm = na.rm) 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > for (mode in c("integer", "logical", "double")) { 202s + x <- matrix(-4:4, nrow = 3, ncol = 3) 202s + storage.mode(x) <- mode 202s + if (mode == "double") x <- x + 0.1 202s + 202s + # To check names attribute 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 + if (setDimnames) dimnames(x) <- dimnames 202s + else dimnames(x) <- NULL 202s + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s + } 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: Single-element matrix 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: Single-element matrix:\n") 202s Special case: Single-element matrix: 202s > for (mode in c("integer", "logical", "double")) { 202s + x <- matrix(1, nrow = 1, ncol = 1) 202s + storage.mode(x) <- mode 202s + 202s + # To check names attribute 202s + dimnames <- list("a", "A") 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: Empty matrix 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: Empty matrix:\n") 202s Special case: Empty matrix: 202s > for (mode in c("integer", "logical", "double")) { 202s + x <- matrix(integer(0), nrow = 0, ncol = 0) 202s + storage.mode(x) <- mode 202s + 202s + y0 <- rowSums2_R(x, na.rm = FALSE) 202s + y1 <- rowSums2(x, na.rm = FALSE) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE) 202s + y1 <- colSums2(x, na.rm = FALSE) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: All NAs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: All NAs:\n") 202s Special case: All NAs: 202s > for (mode in c("integer", "logical", "double")) { 202s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 202s + storage.mode(x) <- mode 202s + 202s + # To check names attribute 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 + if (setDimnames) dimnames(x) <- dimnames 202s + else dimnames(x) <- NULL 202s + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: All NaNs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: All NaNs:\n") 202s Special case: All NaNs: 202s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: All Infs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: All Infs:\n") 202s Special case: All Infs: 202s > x <- matrix(Inf, nrow = 3, ncol = 3) 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: All -Infs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: All -Infs:\n") 202s Special case: All -Infs: 202s > x <- matrix(-Inf, nrow = 3, ncol = 3) 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: Infs and -Infs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: Infs and -Infs:\n") 202s Special case: Infs and -Infs: 202s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 202s > 202s > # To check names attribute 202s > dimnames <- list(letters[1:4], LETTERS[1:4]) 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: NaNs and NAs 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: Infs and -Infs:\n") 202s Special case: Infs and -Infs: 202s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 202s > 202s > y0 <- rowSums(x, na.rm = FALSE) 202s > str(y0) 202s num [1:4] NaN NA NaN NA 202s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 202s > y1 <- rowSums2(x, na.rm = FALSE) 202s > str(y0) 202s num [1:4] NaN NA NaN NA 202s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 202s > stopifnot(all.equal(y1, y0)) 202s > 202s > y0 <- colSums(x, na.rm = FALSE) 202s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 202s > y1 <- colSums2(x, na.rm = FALSE) 202s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 202s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 202s > ## returned here (as one would expect). NaN might very well be returned, 202s > ## when both NA and NaN are involved. This is an accepted feature in R, 202s > ## which is documented in help("is.nan"). See also 202s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 202s > ## Thus, we cannot guarantee that y1 is identical to y0. 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Special case: Integer overflow with ties 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > cat("Special case: Integer overflow with ties:\n") 202s Special case: Integer overflow with ties: 202s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 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 + # Check names attribute 202s + for (useNames in c(TRUE, FALSE)) { 202s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + 202s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 202s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 202s + stopifnot(all.equal(y1, y0)) 202s + } 202s + } 202s > 202s > 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > # Consistency checks 202s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202s > set.seed(1) 202s > 202s > cat("Consistency checks:\n") 202s Consistency checks: 202s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 202s > for (kk in seq_len(n_sims)) { 202s + cat("Random test #", kk, "\n", sep = "") 202s + 202s + # Simulate data in a matrix of any shape 202s + dim <- sample(50:200, size = 2) 202s + n <- prod(dim) 202s + x <- rnorm(n, sd = 100) 202s + dim(x) <- dim 202s + 202s + # Add NAs? 202s + if ((kk %% 4) %in% c(3, 0)) { 202s + cat("Adding NAs\n") 202s + nna <- sample(n, size = 1) 202s + na_values <- c(NA_real_, NaN) 202s + t <- sample(na_values, size = nna, replace = TRUE) 202s + x[sample(length(x), size = nna)] <- t 202s + } 202s + 202s + # Mode? 202s + modes <- "double" 202s + if ((kk %% 4) %in% c(2, 0)) { 202s + modes <- c("integer", "logical") 202s + } 202s + 202s + for (mode in modes) { 202s + if (mode != "double") { 202s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 202s + storage.mode(x) <- mode 202s + } 202s + 202s + na.rm <- sample(c(TRUE, FALSE), size = 1) 202s + 202s + # rowSums2(): 202s + y0 <- rowSums2_R(x, na.rm = na.rm) 202s + y1 <- rowSums2(x, na.rm = na.rm) 202s + stopifnot(all.equal(y1, y0)) 202s + y2 <- colSums2(t(x), na.rm = na.rm) 202s + stopifnot(all.equal(y2, y0)) 202s + 202s + # colSums2(): 202s + y0 <- colSums2_R(x, na.rm = na.rm) 202s + y1 <- colSums2(x, na.rm = na.rm) 202s + stopifnot(all.equal(y1, y0)) 202s + y2 <- rowSums2(t(x), na.rm = na.rm) 202s + stopifnot(all.equal(y2, y0)) 202s + } 202s + } # for (kk ...) 202s Random test #1 202s Random test #2 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #3 202s Adding NAs 202s Random test #4 202s Adding NAs 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #5 202s Random test #6 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #7 202s Adding NAs 202s Random test #8 202s Adding NAs 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #9 202s Random test #10 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #11 202s Adding NAs 202s Random test #12 202s Adding NAs 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #13 202s Random test #14 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #15 202s Adding NAs 202s Random test #16 202s Adding NAs 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #17 202s Random test #18 202s Coercing from double to integer 202s Coercing from integer to logical 202s Random test #19 202s Adding NAs 202s Random test #20 202s Adding NAs 202s Coercing from double to integer 202s Coercing from integer to logical 202s > 202s 202s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 202s + ## FIXME: sum() may overflow for integers, whereas 202s + ## base::rowSums() doesn't. What should rowSums2() do? 202s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 202s + res <- rowSums(x, na.rm = na.rm) 202s + if (!useNames) names(res) <- NULL 202s + res 202s + } 202s > 202s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 202s + ## FIXME: sum() may overflow for integers, whereas 202s + ## base::colSums() doesn't. What should colSums2() do? 202s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 202s + res <- colSums(x, na.rm = na.rm) 202s + if (!useNames) names(res) <- NULL 202s + res 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 > 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 + for (rows in index_cases) { 202s + for (cols in index_cases) { 202s + for (na.rm in c(TRUE, FALSE)) { 202s + for (useNames in c(TRUE, FALSE)) { 202s + validateIndicesTestMatrix(x, rows, cols, 202s + ftest = rowSums2, fsure = rowSums2_R, 202s + na.rm = na.rm, useNames = useNames) 202s + validateIndicesTestMatrix(x, rows, cols, 202s + fcoltest = colSums2, fsure = rowSums2_R, 202s + na.rm = na.rm, useNames = useNames) 202s + } 202s + } 202s + } 202s + } 202s + } 203s > 203s 203s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 203s Copyright (C) 2025 The R Foundation for Statistical Computing 203s Platform: x86_64-pc-linux-gnu 203s 203s R is free software and comes with ABSOLUTELY NO WARRANTY. 203s You are welcome to redistribute it under certain conditions. 203s Type 'license()' or 'licence()' for distribution details. 203s 203s R is a collaborative project with many contributors. 203s Type 'contributors()' for more information and 203s 'citation()' on how to cite R or R packages in publications. 203s 203s Type 'demo()' for some demos, 'help()' for on-line help, or 203s 'help.start()' for an HTML browser interface to help. 203s Type 'q()' to quit R. 203s 203s > library("matrixStats") 203s > 203s > nrow <- 6L 203s > ncol <- 5L 203s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 203s > 203s > # To check names attribute 203s > dimnames <- list(letters[1:6], LETTERS[1:5]) 203s > 203s > modes <- c("integer", "logical", "raw") 203s > for (mode in modes) { 203s + cat(sprintf("Mode: %s...\n", mode)) 203s + 203s + x <- data 203s + if (mode == "logical") x <- x - 2L 203s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 203s + storage.mode(x) <- mode 203s + print(x) 203s + 203s + unique_values <- unique(as.vector(x)) 203s + nbr_of_unique_values <- length(unique_values) 203s + 203s + y <- rowTabulates(x) 203s + print(y) 203s + stopifnot( 203s + identical(dim(y), c(nrow, nbr_of_unique_values)), 203s + all(y >= 0) 203s + ) 203s + if (mode != "raw") { 203s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 203s + stopifnot(all(y == y0)) 203s + } 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- rowTabulates(x, useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y <- rowTabulates(x, useNames = TRUE) 203s + stopifnot(identical(rownames(y), rownames(x))) 203s + dimnames(x) <- NULL 203s + 203s + y <- colTabulates(x) 203s + print(y) 203s + stopifnot( 203s + identical(dim(y), c(ncol, nbr_of_unique_values)), 203s + all(y >= 0) 203s + ) 203s + if (mode != "raw") { 203s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 203s + stopifnot(all(y == y0)) 203s + } 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- colTabulates(x, useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y <- colTabulates(x, useNames = TRUE) 203s + stopifnot(identical(rownames(y), colnames(x))) 203s + dimnames(x) <- NULL 203s + 203s + # Count only certain values 203s + if (mode == "integer") { 203s + subset <- c(0:2, NA_integer_) 203s + } else if (mode == "logical") { 203s + subset <- c(TRUE, FALSE, NA) 203s + } else { 203s + subset <- c(0:2) 203s + } 203s + y <- rowTabulates(x, values = subset) 203s + print(y) 203s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y <- rowTabulates(x, values = subset, useNames = TRUE) 203s + stopifnot(identical(rownames(y), rownames(x))) 203s + dimnames(x) <- NULL 203s + 203s + y <- colTabulates(x, values = subset) 203s + print(y) 203s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y <- colTabulates(x, values = subset, useNames = TRUE) 203s + stopifnot(identical(rownames(y), colnames(x))) 203s + dimnames(x) <- NULL 203s + 203s + # Raw 203s + if (mode %in% c("integer", "raw")) { 203s + subset <- c(0:2) 203s + 203s + y <- rowTabulates(x, values = as.raw(subset)) 203s + print(y) 203s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 203s + stopifnot(identical(rownames(y3), rownames(x))) 203s + dimnames(x) <- NULL 203s + 203s + y2 <- colTabulates(t(x), values = as.raw(subset)) 203s + print(y2) 203s + stopifnot( 203s + identical(dim(y2), c(nrow, length(subset))), 203s + identical(y2, y) 203s + ) 203s + # Check names attribute 203s + dimnames(x) <- dimnames 203s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 203s + stopifnot(all.equal(y1, y)) 203s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 203s + stopifnot(identical(rownames(y), colnames(t(x)))) 203s + dimnames(x) <- NULL 203s + } 203s + 203s + cat(sprintf("Mode: %s...done\n", mode)) 203s + } # for (mode ...) 203s Mode: integer... 203s [,1] [,2] [,3] [,4] [,5] 203s [1,] 0 NA 2 3 4 203s [2,] NA 2 3 4 0 203s [3,] 2 3 4 0 1 203s [4,] 3 4 0 1 2 203s [5,] NA 0 1 2 3 203s [6,] 0 1 2 3 4 203s 0 1 2 3 4 203s [1,] 1 0 1 1 1 1 203s [2,] 1 0 1 1 1 1 203s [3,] 1 1 1 1 1 0 203s [4,] 1 1 1 1 1 0 203s [5,] 1 1 1 1 0 1 203s [6,] 1 1 1 1 1 0 203s 0 1 2 3 4 203s [1,] 2 0 1 1 0 2 203s [2,] 1 1 1 1 1 1 203s [3,] 1 1 2 1 1 0 203s [4,] 1 1 1 2 1 0 203s [5,] 1 1 1 1 2 0 203s 0 1 2 203s [1,] 1 0 1 1 203s [2,] 1 0 1 1 203s [3,] 1 1 1 0 203s [4,] 1 1 1 0 203s [5,] 1 1 1 1 203s [6,] 1 1 1 0 203s 0 1 2 203s [1,] 2 0 1 2 203s [2,] 1 1 1 1 203s [3,] 1 1 2 0 203s [4,] 1 1 1 0 203s [5,] 1 1 1 0 203s 0x0 0x1 0x2 203s [1,] 1 0 1 203s [2,] 1 0 1 203s [3,] 1 1 1 203s [4,] 1 1 1 203s [5,] 1 1 1 203s [6,] 1 1 1 203s 0x0 0x1 0x2 203s [1,] 1 0 1 203s [2,] 1 0 1 203s [3,] 1 1 1 203s [4,] 1 1 1 203s [5,] 1 1 1 203s [6,] 1 1 1 203s Mode: integer...done 203s Mode: logical... 203s [,1] [,2] [,3] [,4] [,5] 203s [1,] TRUE NA FALSE TRUE TRUE 203s [2,] NA FALSE TRUE TRUE TRUE 203s [3,] FALSE TRUE TRUE TRUE TRUE 203s [4,] TRUE TRUE TRUE TRUE FALSE 203s [5,] NA TRUE TRUE FALSE TRUE 203s [6,] TRUE TRUE FALSE TRUE TRUE 203s FALSE TRUE 203s [1,] 1 3 1 203s [2,] 1 3 1 203s [3,] 1 4 0 203s [4,] 1 4 0 203s [5,] 1 3 1 203s [6,] 1 4 0 203s FALSE TRUE 203s [1,] 1 3 2 203s [2,] 1 4 1 203s [3,] 2 4 0 203s [4,] 1 5 0 203s [5,] 1 5 0 203s TRUE FALSE 203s [1,] 3 1 1 203s [2,] 3 1 1 203s [3,] 4 1 0 203s [4,] 4 1 0 203s [5,] 3 1 1 203s [6,] 4 1 0 203s TRUE FALSE 203s [1,] 3 1 2 203s [2,] 4 1 1 203s [3,] 4 2 0 203s [4,] 5 1 0 203s [5,] 5 1 0 203s Mode: logical...done 203s Mode: raw... 203s [,1] [,2] [,3] [,4] [,5] 203s [1,] 00 01 02 03 04 203s [2,] 01 02 03 04 00 203s [3,] 02 03 04 00 01 203s [4,] 03 04 00 01 02 203s [5,] 04 00 01 02 03 203s [6,] 00 01 02 03 04 203s 0x0 0x1 0x2 0x3 0x4 203s [1,] 1 1 1 1 1 203s [2,] 1 1 1 1 1 203s [3,] 1 1 1 1 1 203s [4,] 1 1 1 1 1 203s [5,] 1 1 1 1 1 203s [6,] 1 1 1 1 1 203s 0x0 0x1 0x2 0x3 0x4 203s [1,] 2 1 1 1 1 203s [2,] 1 2 1 1 1 203s [3,] 1 1 2 1 1 203s [4,] 1 1 1 2 1 203s [5,] 1 1 1 1 2 203s 0 1 2 203s [1,] 1 1 1 203s [2,] 1 1 1 203s [3,] 1 1 1 203s [4,] 1 1 1 203s [5,] 1 1 1 203s [6,] 1 1 1 203s 0 1 2 203s [1,] 2 1 1 203s [2,] 1 2 1 203s [3,] 1 1 2 203s [4,] 1 1 1 203s [5,] 1 1 1 203s 0x0 0x1 0x2 203s [1,] 1 1 1 203s [2,] 1 1 1 203s [3,] 1 1 1 203s [4,] 1 1 1 203s [5,] 1 1 1 203s [6,] 1 1 1 203s 0x0 0x1 0x2 203s [1,] 1 1 1 203s [2,] 1 1 1 203s [3,] 1 1 1 203s [4,] 1 1 1 203s [5,] 1 1 1 203s [6,] 1 1 1 203s Mode: raw...done 203s > 203s 203s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 203s Copyright (C) 2025 The R Foundation for Statistical Computing 203s Platform: x86_64-pc-linux-gnu 203s 203s R is free software and comes with ABSOLUTELY NO WARRANTY. 203s You are welcome to redistribute it under certain conditions. 203s Type 'license()' or 'licence()' for distribution details. 203s 203s R is a collaborative project with many contributors. 203s Type 'contributors()' for more information and 203s 'citation()' on how to cite R or R packages in publications. 203s 203s Type 'demo()' for some demos, 'help()' for on-line help, or 203s 'help.start()' for an HTML browser interface to help. 203s Type 'q()' to quit R. 203s 203s > library("matrixStats") 203s > 203s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 203s > # Subsetted tests 203s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 203s > source("utils/validateIndicesFramework.R") 203s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 203s > storage.mode(x) <- "integer" 203s > 203s > # To check names attribute 203s > dimnames <- list(letters[1:6], LETTERS[1:6]) 203s > 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 + 203s + count <- 0L 203s + for (rows in index_cases) { 203s + for (cols in index_cases) { 203s + count <- count + 1L 203s + useNames <- c(TRUE, FALSE) 203s + useNames <- useNames[count %% length(useNames) + 1] 203s + 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = rowTabulates, fsure = rowTabulates, 203s + values = 1:3, useNames = useNames) 203s + 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 203s + validateIndicesTestMatrix(x, rows, cols, 203s + ftest = colTabulates, fsure = colTabulates, 203s + values = 1:3, useNames = useNames) 203s + } 203s + } 203s + } 203s > 204s 204s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 204s Copyright (C) 2025 The R Foundation for Statistical Computing 204s Platform: x86_64-pc-linux-gnu 204s 204s R is free software and comes with ABSOLUTELY NO WARRANTY. 204s You are welcome to redistribute it under certain conditions. 204s Type 'license()' or 'licence()' for distribution details. 204s 204s R is a collaborative project with many contributors. 204s Type 'contributors()' for more information and 204s 'citation()' on how to cite R or R packages in publications. 204s 204s Type 'demo()' for some demos, 'help()' for on-line help, or 204s 'help.start()' for an HTML browser interface to help. 204s Type 'q()' to quit R. 204s 204s > library("matrixStats") 204s > 204s > fcns <- list( 204s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 204s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 204s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 204s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 204s + ) 204s > 204s > for (fcn in names(fcns)) { 204s + cat(sprintf("%s()...\n", fcn)) 204s + row_fcn <- fcns[[fcn]][[1L]] 204s + col_fcn <- fcns[[fcn]][[2L]] 204s + 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + # With and without some NAs 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + for (mode in c("integer", "double")) { 204s + for (add_na in c(FALSE, TRUE)) { 204s + cat("add_na = ", add_na, "\n", sep = "") 204s + 204s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 204s + if (add_na) { 204s + x[3:7, c(2, 4)] <- NA_real_ 204s + } 204s + cat("mode: ", mode, "\n", sep = "") 204s + storage.mode(x) <- mode 204s + str(x) 204s + 204s + # To check names attribute 204s + dimnames <- list(letters[1:10], LETTERS[1:5]) 204s + 204s + # Test with and without dimnames on x 204s + for (setDimnames in c(TRUE, FALSE)) { 204s + if (setDimnames) dimnames(x) <- dimnames 204s + else dimnames(x) <- NULL 204s + # Row/column ranges 204s + for (na.rm in c(FALSE, TRUE)) { 204s + # Check names attribute 204s + for (useNames in c(TRUE, FALSE)) { 204s + cat("na.rm = ", na.rm, "\n", sep = "") 204s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 204s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 204s + stopifnot(all.equal(r1, r2)) 204s + } 204s + } 204s + } 204s + } # for (add_na ...) 204s + } 204s + 204s + 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + # All NAs 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + for (mode in c("integer", "double")) { 204s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 204s + cat("mode: ", mode, "\n", sep = "") 204s + storage.mode(x) <- mode 204s + str(x) 204s + 204s + # Test with and without dimnames on x 204s + for (setDimnames in c(TRUE, FALSE)) { 204s + if (setDimnames) dimnames(x) <- dimnames 204s + else dimnames(x) <- NULL 204s + # Row/column ranges 204s + for (na.rm in c(FALSE, TRUE)) { 204s + # Check names attribute 204s + for (useNames in c(TRUE, FALSE)) { 204s + cat("na.rm = ", na.rm, "\n", sep = "") 204s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 204s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 204s + stopifnot(all.equal(r1, r2)) 204s + } 204s + } 204s + } 204s + } 204s + 204s + 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + # A 1x1 matrix 204s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s + x <- matrix(0, nrow = 1L, ncol = 1L) 204s + dimnames <- list("a", "A") 204s + # Test with and without dimnames on x 204s + for (setDimnames in c(TRUE, FALSE)) { 204s + if (setDimnames) dimnames(x) <- dimnames 204s + else dimnames(x) <- NULL 204s + # Row/column ranges 204s + for (na.rm in c(FALSE, TRUE)) { 204s + # Check names attribute 204s + for (useNames in c(TRUE, FALSE)) { 204s + cat("na.rm = ", na.rm, "\n", sep = "") 204s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 204s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 204s + stopifnot(all.equal(r1, r2)) 204s + } 204s + } 204s + } 204s + 204s + cat(sprintf("%s()...DONE\n", fcn)) 204s + } # for (fcn ...) 204s rowVarDiffs()... 204s add_na = FALSE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = FALSE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: integer 204s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: double 204s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s rowVarDiffs()...DONE 204s rowSdDiffs()... 204s add_na = FALSE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = FALSE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: integer 204s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: double 204s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s rowSdDiffs()...DONE 204s rowMadDiffs()... 204s add_na = FALSE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = FALSE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: integer 204s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: double 204s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s rowMadDiffs()...DONE 204s rowIQRDiffs()... 204s add_na = FALSE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: integer 204s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = FALSE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s add_na = TRUE 204s mode: double 204s 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 ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: integer 204s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s mode: double 204s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s na.rm = FALSE 204s na.rm = FALSE 204s na.rm = TRUE 204s na.rm = TRUE 204s rowIQRDiffs()...DONE 204s > 204s 204s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 204s Copyright (C) 2025 The R Foundation for Statistical Computing 204s Platform: x86_64-pc-linux-gnu 204s 204s R is free software and comes with ABSOLUTELY NO WARRANTY. 204s You are welcome to redistribute it under certain conditions. 204s Type 'license()' or 'licence()' for distribution details. 204s 204s R is a collaborative project with many contributors. 204s Type 'contributors()' for more information and 204s 'citation()' on how to cite R or R packages in publications. 204s 204s Type 'demo()' for some demos, 'help()' for on-line help, or 204s 'help.start()' for an HTML browser interface to help. 204s Type 'q()' to quit R. 204s 204s > library("matrixStats") 204s > 204s > fcns <- list( 204s + madDiff = c(rowMadDiffs, colMadDiffs), 204s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 204s + ) 204s > 204s > 204s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s > # Subsetted tests 204s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 204s > source("utils/validateIndicesFramework.R") 204s > # To check names attribute 204s > dimnames <- list(letters[1:6], LETTERS[1:6]) 204s > trim <- runif(1, min = 0, max = 0.5) 204s > for (fcn in names(fcns)) { 204s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 204s + row_fcn <- fcns[[fcn]][[1L]] 204s + col_fcn <- fcns[[fcn]][[2L]] 204s + 204s + for (mode in c("numeric", "integer")) { 204s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 204s + storage.mode(x) <- mode 204s + if (mode == "numeric") x[1:2, 3:4] <- Inf 204s + 204s + # Test with and without dimnames on x 204s + for (setDimnames in c(TRUE, FALSE)) { 204s + if (setDimnames) dimnames(x) <- dimnames 204s + else dimnames(x) <- NULL 204s + 204s + count <- 0L 204s + for (diff in 1:2) { 204s + for (rows in index_cases) { 204s + for (cols in index_cases) { 204s + count <- count + 1L 204s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 204s + useNames <- c(TRUE, FALSE) 204s + useNames <- useNames[count %% length(useNames) + 1] 204s + validateIndicesTestMatrix(x, rows, cols, 204s + ftest = row_fcn, fsure = row_fcn, 204s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 204s + validateIndicesTestMatrix(x, rows, cols, 204s + fcoltest = col_fcn, fsure = row_fcn, 204s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 204s + } 204s + } 204s + } 204s + } 204s + } 204s + cat(sprintf("%s()...DONE\n", fcn)) 204s + } 204s subsetted tests on madDiff()... 205s madDiff()...DONE 205s subsetted tests on iqrDiff()... 206s iqrDiff()...DONE 206s > 206s 206s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 206s Copyright (C) 2025 The R Foundation for Statistical Computing 206s Platform: x86_64-pc-linux-gnu 206s 206s R is free software and comes with ABSOLUTELY NO WARRANTY. 206s You are welcome to redistribute it under certain conditions. 206s Type 'license()' or 'licence()' for distribution details. 206s 206s R is a collaborative project with many contributors. 206s Type 'contributors()' for more information and 206s 'citation()' on how to cite R or R packages in publications. 206s 206s Type 'demo()' for some demos, 'help()' for on-line help, or 206s 'help.start()' for an HTML browser interface to help. 206s Type 'q()' to quit R. 206s 206s > library("matrixStats") 206s > 206s > fcns <- list( 206s + varDiff = c(rowVarDiffs, colVarDiffs), 206s + sdDiff = c(rowSdDiffs, colSdDiffs) 206s + ) 206s > 206s > 206s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 206s > # Subsetted tests 206s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 206s > source("utils/validateIndicesFramework.R") 206s > # To check names attribute 206s > dimnames <- list(letters[1:6], LETTERS[1:6]) 206s > trim <- runif(1, min = 0, max = 0.5) 206s > for (fcn in names(fcns)) { 206s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 206s + row_fcn <- fcns[[fcn]][[1L]] 206s + col_fcn <- fcns[[fcn]][[2L]] 206s + 206s + for (mode in c("numeric", "integer")) { 206s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 206s + storage.mode(x) <- mode 206s + if (mode == "numeric") x[1:2, 3:4] <- Inf 206s + 206s + # Test with and without dimnames on x 206s + for (setDimnames in c(TRUE, FALSE)) { 206s + if (setDimnames) dimnames(x) <- dimnames 206s + else dimnames(x) <- NULL 206s + 206s + count <- 0L 206s + for (diff in 1:2) { 206s + for (rows in index_cases) { 206s + for (cols in index_cases) { 206s + count <- count + 1L 206s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 206s + useNames <- c(TRUE, FALSE) 206s + useNames <- useNames[count %% length(useNames) + 1] 206s + 206s + validateIndicesTestMatrix(x, rows, cols, 206s + ftest = row_fcn, fsure = row_fcn, 206s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 206s + validateIndicesTestMatrix(x, rows, cols, 206s + fcoltest = col_fcn, fsure = row_fcn, 206s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 206s + } 206s + } 206s + } 206s + } 206s + } 206s + cat(sprintf("%s()...DONE\n", fcn)) 206s + } 206s subsetted tests on varDiff()... 207s varDiff()...DONE 207s subsetted tests on sdDiff()... 208s sdDiff()...DONE 208s > 208s 208s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > ## Always allow testing of the 'center' argument (as long as it's not defunct) 208s > options(matrixStats.center.onUse = "ignore") 208s > options(matrixStats.vars.formula.freq = Inf) 208s > 208s > ## Create isFALSE() if running on an old version of R 208s > if (!exists("isFALSE", mode="function")) { 208s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 208s + } 208s > 208s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 208s + suppressWarnings({ 208s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 208s + }) 208s + stopifnot(!any(is.infinite(res))) 208s + 208s + # Keep naming support consistency same as rowVars() 208s + if (is.null(center) || ncol(x) <= 1L) { 208s + if (isFALSE(useNames)) names(res) <- NULL 208s + } 208s + else if (isFALSE(useNames)) names(res) <- NULL 208s + res 208s + } 208s > 208s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 208s + suppressWarnings({ 208s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 208s + }) 208s + stopifnot(!any(is.infinite(res))) 208s + 208s + # Keep naming support consistency same as colVars() 208s + if (is.null(center) || ncol(x) <= 1L) { 208s + if (isFALSE(useNames)) names(res) <- NULL 208s + } 208s + else if (isFALSE(useNames)) names(res) <- NULL 208s + res 208s + } 208s > 208s > 208s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 208s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 208s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 208s + x[is.infinite(center), ] <- NaN 208s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 208s + x[, is.infinite(center)] <- NaN 208s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # With and without some NAs or Infs 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > for (mode in c("integer", "double")) { 208s + if (mode == "integer") { 208s + specials <- c(0L, NA_integer_) 208s + delta <- 0L 208s + } else { 208s + specials <- c(0, NA_real_, Inf) 208s + delta <- 0.1 208s + } 208s + 208s + for (special in specials) { 208s + cat("special = ", special, "\n", sep = "") 208s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 208s + x[3:7, c(2, 4)] <- special 208s + cat("mode: ", mode, "\n", sep = "") 208s + str(x) 208s + stopifnot(storage.mode(x) == mode) 208s + 208s + # To check names attribute 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 + # Row/column variance 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + cat("na.rm = ", na.rm, "\n", sep = "") 208s + center <- rowMeans(x, na.rm = na.rm) 208s + 208s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 208s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 208s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 208s + 208s + tx <- t(x) 208s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 208s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 208s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 208s + tx <- NULL 208s + 208s + stopifnot(all.equal(r1, r2)) 208s + stopifnot(all.equal(r1, r0)) 208s + stopifnot(all.equal(r1b, r1c)) 208s + stopifnot(all.equal(r2, r0)) 208s + stopifnot(all.equal(r2b, r2c)) 208s + 208s + center <- colMeans(x, na.rm = na.rm) 208s + 208s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 208s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 208s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 208s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 208s + stopifnot(all.equal(r3b, r3)) 208s + stopifnot(all.equal(r3c, r3)) 208s + stopifnot(all.equal(r3d, r3)) 208s + 208s + stopifnot( 208s + !any(is.infinite(r0)), 208s + !any(is.infinite(r1)), 208s + !any(is.infinite(r2)), 208s + !any(is.infinite(r3)), 208s + !any(is.infinite(r1b)), 208s + !any(is.infinite(r1c)), 208s + !any(is.infinite(r2b)), 208s + !any(is.infinite(r2c)), 208s + !any(is.infinite(r3b)), 208s + !any(is.infinite(r3c)), 208s + !any(is.infinite(r3d)) 208s + ) 208s + } 208s + } 208s + } 208s + } # for (special ...) 208s + } 208s special = 0 208s mode: integer 208s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s special = NA 208s mode: integer 208s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s special = 0 208s mode: double 208s 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 ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s special = NA 208s mode: double 208s 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 ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s special = Inf 208s mode: double 208s 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 ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # All NAs 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > for (mode in c("integer", "double")) { 208s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 208s + cat("mode: ", mode, "\n", sep = "") 208s + storage.mode(x) <- mode 208s + str(x) 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 variance 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + cat("na.rm = ", na.rm, "\n", sep = "") 208s + 208s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 208s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 208s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 208s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 208s + stopifnot(all.equal(r1, r2)) 208s + stopifnot(all.equal(r1, r0)) 208s + stopifnot(all.equal(r2, r0)) 208s + stopifnot(all.equal(r1b, r2b)) 208s + stopifnot( 208s + !any(is.infinite(r0)), 208s + !any(is.infinite(r1)), 208s + !any(is.infinite(r2)), 208s + !any(is.infinite(r1b)), 208s + !any(is.infinite(r2b)) 208s + ) 208s + } 208s + } 208s + } 208s + } 208s mode: integer 208s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s mode: double 208s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # A 1x1 matrix 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > x <- matrix(0, nrow = 1L, ncol = 1L) 208s > dimnames <- list("a", "A") 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 variance 208s + for (na.rm in c(FALSE, TRUE)) { 208s + # Check names attribute 208s + for (useNames in c(TRUE, FALSE)) { 208s + cat("na.rm = ", na.rm, "\n", sep = "") 208s + 208s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 208s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 208s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 208s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 208s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 208s + stopifnot(all.equal(r1, r2)) 208s + stopifnot(all.equal(r1, r0)) 208s + stopifnot(all.equal(r2, r0)) 208s + stopifnot(all.equal(r1b, r2b)) 208s + stopifnot( 208s + !any(is.infinite(r0)), 208s + !any(is.infinite(r1)), 208s + !any(is.infinite(r2)), 208s + !any(is.infinite(r1b)), 208s + !any(is.infinite(r2b)) 208s + ) 208s + } 208s + } 208s + } 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s na.rm = FALSE 208s na.rm = FALSE 208s na.rm = TRUE 208s na.rm = TRUE 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # center and .dim 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 208s > a <- array(m, dim = c(3, 2, 2)) 208s > stopifnot(prod(dim(a)) == prod(dim(m))) 208s > 208s > y0 <- rowVars(m, dim. = dim(m)) 208s > print(y0) 208s [1] 15 15 15 208s > y1 <- rowVars(a, dim. = dim(m)) 208s > print(y1) 208s [1] 15 15 15 208s > stopifnot(identical(y1, y0)) 208s > stopifnot( 208s + !any(is.infinite(y0)), 208s + !any(is.infinite(y1)) 208s + ) 208s > 208s > mu <- rowMeans(m) 208s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 208s > print(y0) 208s [1] 15 15 15 208s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 208s > print(y1) 208s [1] 15 15 15 208s > stopifnot(identical(y1, y0)) 208s > stopifnot( 208s + !any(is.infinite(y0)), 208s + !any(is.infinite(y1)) 208s + ) 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Corner cases 208s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 208s > x[1,1] <- NA_real_ 208s > x[1,2] <- Inf 208s > 208s > center <- colMeans2(x, na.rm = TRUE) 208s > y <- colVars(x, center = center, na.rm = TRUE) 208s > stopifnot(!any(is.infinite(y))) 208s > 208s > x <- t(x) 208s > center <- rowMeans2(x, na.rm = TRUE) 208s > y <- rowVars(x, center = center, na.rm = TRUE) 208s > stopifnot(!any(is.infinite(y))) 208s > 208s 208s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > ## Always allow testing of the 'center' argument (as long as it's not defunct) 208s > options(matrixStats.center.onUse = "ignore") 208s > 208s > ## Create isFALSE() if running on an old version of R 208s > if (!exists("isFALSE", mode="function")) { 208s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 208s + } 208s > 208s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 208s + suppressWarnings({ 208s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 208s + }) 208s + stopifnot(!any(is.infinite(res))) 208s + 208s + # Keep naming support consistency same as rowVars() 208s + if (is.null(center) || ncol(x) <= 1L) { 208s + if (isFALSE(useNames)) names(res) <- NULL 208s + } 208s + else if (isFALSE(useNames)) names(res) <- NULL 208s + res 208s + } 208s > 208s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 208s + suppressWarnings({ 208s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 208s + }) 208s + stopifnot(!any(is.infinite(res))) 208s + 208s + # Keep naming support consistency same as colVars() 208s + if (is.null(center) || nrow(x) <= 1L) { 208s + if (isFALSE(useNames)) names(res) <- NULL 208s + } 208s + else if (isFALSE(useNames)) names(res) <- NULL 208s + res 208s + } 208s > 208s > 208s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 208s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 208s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 208s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 208s + stopifnot(!any(is.infinite(res))) 208s + res 208s + } 208s > 208s > 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > # Subsetted tests 208s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 208s > source("utils/validateIndicesFramework.R") 208s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 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 + 208s + count <- 0L 208s + for (rows in index_cases) { 208s + for (cols in index_cases) { 208s + count <- count + 1L 208s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 208s + useNames <- c(TRUE, FALSE) 208s + useNames <- useNames[count %% length(useNames) + 1] 208s + 208s + validateIndicesTestMatrix(x, rows, cols, 208s + ftest = rowVars, fsure = rowVars_R, 208s + na.rm = na.rm, useNames = useNames) 208s + validateIndicesTestMatrix(x, rows, cols, 208s + ftest = rowVars_center, fsure = rowVars_R, 208s + na.rm = na.rm, center = TRUE, useNames = useNames) 208s + 208s + validateIndicesTestMatrix(x, rows, cols, 208s + fcoltest = colVars, fsure = rowVars_R, 208s + na.rm = na.rm, useNames = useNames) 208s + validateIndicesTestMatrix(x, rows, cols, 208s + fcoltest = colVars_center, fsure = rowVars_R, 208s + na.rm = na.rm, center = TRUE, useNames = useNames) 208s + } 208s + } 208s + } 208s > 209s 209s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 209s Copyright (C) 2025 The R Foundation for Statistical Computing 209s Platform: x86_64-pc-linux-gnu 209s 209s R is free software and comes with ABSOLUTELY NO WARRANTY. 209s You are welcome to redistribute it under certain conditions. 209s Type 'license()' or 'licence()' for distribution details. 209s 209s R is a collaborative project with many contributors. 209s Type 'contributors()' for more information and 209s 'citation()' on how to cite R or R packages in publications. 209s 209s Type 'demo()' for some demos, 'help()' for on-line help, or 209s 'help.start()' for an HTML browser interface to help. 209s Type 'q()' to quit R. 209s 209s > library("matrixStats") 209s > 209s > ## Create isFALSE() if running on an old version of R 209s > if (!exists("isFALSE", mode="function")) { 209s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 209s + } 209s > 209s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as rowWeightedMeans() 209s + idxs <- which(is.na(w) | w != 0) 209s + nw <- length(idxs) 209s + if (na.rm) na.rm <- anyMissing(x) 209s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 209s + if (!useNames) names(res) <- NULL 209s + } 209s + else if (isFALSE(useNames)) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as colWeightedMeans() 209s + idxs <- which(is.na(w) | w != 0) 209s + nw <- length(idxs) 209s + if (!is.null(w) && nw == 0L) { 209s + if (!useNames) names(res) <- NULL 209s + } 209s + else if (isFALSE(useNames)) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > set.seed(1) 209s > 209s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 209s > print(x) 209s [,1] [,2] [,3] [,4] 209s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 209s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 209s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 209s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 209s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 209s > 209s > # To check names attribute 209s > dimnames <- list(letters[1:5], LETTERS[1:4]) 209s > 209s > # Non-weighted row averages 209s > x_est0 <- rowMeans(x) 209s > x_est1 <- rowWeightedMeans(x) 209s > print(x_est1) 209s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x)) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > # Check names attribute 209s > dimnames(x) <- dimnames 209s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 209s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > x_est0 <- rowMeans(x) 209s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 209s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > dimnames(x) <- NULL 209s > 209s > 209s > # Weighted row averages (uniform weights) 209s > w <- rep(2.5, times = ncol(x)) 209s > x_est0 <- rowMeans(x) 209s > x_est1 <- rowWeightedMeans(x, w = w) 209s > print(x_est1) 209s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row averages (excluding some columns) 209s > w <- c(1, 1, 0, 1) 209s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMeans(x, w = w) 209s > print(x_est1) 209s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row averages (excluding some columns) 209s > w <- c(0, 1, 0, 0) 209s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMeans(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row averages (all zero weights) 209s > w <- c(0, 0, 0, 0) 209s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMeans(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted averages by rows and columns 209s > w <- 1:4 209s > x_est1 <- rowWeightedMeans(x, w = w) 209s > print(x_est1) 209s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 209s > x_est2 <- colWeightedMeans(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > x[sample(length(x), size = 0.3 * length(x))] <- NA 209s > print(x) 209s [,1] [,2] [,3] [,4] 209s [1,] -0.6264538 NA 1.5117812 -0.04493361 209s [2,] 0.1836433 NA NA -0.01619026 209s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 209s [4,] 1.5952808 NA -2.2146999 0.82122120 209s [5,] 0.3295078 NA NA 0.59390132 209s > 209s > # Non-weighted row averages with missing values 209s > x_est0 <- rowMeans(x, na.rm = TRUE) 209s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 209s > print(x_est1) 209s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > # Check names attribute 209s > dimnames(x) <- dimnames 209s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 209s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > x_est0 <- rowMeans(x, na.rm = TRUE) 209s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 209s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > stopifnot(all.equal(x_est2, x_est0)) 209s > dimnames(x) <- NULL 209s > 209s > 209s > # Weighted row averages with missing values 209s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 209s > print(x_est0) 209s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 209s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 209s > print(x_est1) 209s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted averages by rows and columns 209s > w <- 1:4 209s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 209s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # w contains missing value 209s > w[1] <- NA_integer_ 209s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 209s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 209s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 209s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 209s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s 209s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 209s Copyright (C) 2025 The R Foundation for Statistical Computing 209s Platform: x86_64-pc-linux-gnu 209s 209s R is free software and comes with ABSOLUTELY NO WARRANTY. 209s You are welcome to redistribute it under certain conditions. 209s Type 'license()' or 'licence()' for distribution details. 209s 209s R is a collaborative project with many contributors. 209s Type 'contributors()' for more information and 209s 'citation()' on how to cite R or R packages in publications. 209s 209s Type 'demo()' for some demos, 'help()' for on-line help, or 209s 'help.start()' for an HTML browser interface to help. 209s Type 'q()' to quit R. 209s 209s > library("matrixStats") 209s > 209s > ## Create isFALSE() if running on an old version of R 209s > if (!exists("isFALSE", mode="function")) { 209s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 209s + } 209s > 209s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as rowWeightedMeans() 209s + idxs <- which(is.na(w) | w != 0) 209s + nw <- length(idxs) 209s + if (na.rm) na.rm <- anyMissing(x) 209s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 209s + if (!useNames) names(res) <- NULL 209s + } 209s + else if (isFALSE(useNames)) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as colWeightedMeans() 209s + idxs <- which(is.na(w) | w != 0) 209s + nw <- length(idxs) 209s + if (!is.null(w) && nw == 0L) { 209s + if (!useNames) names(res) <- NULL 209s + } 209s + else if (isFALSE(useNames)) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > 209s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209s > # Subsetted tests 209s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209s > source("utils/validateIndicesFramework.R") 209s > # To check names attribute 209s > dimnames <- list(letters[1:6], LETTERS[1:6]) 209s > for (mode in c("numeric", "integer", "logical")) { 209s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 209s + w <- runif(6, min = 0, max = 6) 209s + storage.mode(x) <- mode 209s + storage.mode(w) <- if (mode == "logical") "integer" else mode 209s + if (mode == "numeric") w[1] <- Inf 209s + 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_w(x, w, rows, cols, 209s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 209s + na.rm = na.rm, useNames = useNames) 209s + validateIndicesTestMatrix_w(x, w, rows, cols, 209s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 209s + na.rm = na.rm, useNames = useNames) 209s + } 209s + } 209s + } 209s + } 209s > 209s 209s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 209s Copyright (C) 2025 The R Foundation for Statistical Computing 209s Platform: x86_64-pc-linux-gnu 209s 209s R is free software and comes with ABSOLUTELY NO WARRANTY. 209s You are welcome to redistribute it under certain conditions. 209s Type 'license()' or 'licence()' for distribution details. 209s 209s R is a collaborative project with many contributors. 209s Type 'contributors()' for more information and 209s 'citation()' on how to cite R or R packages in publications. 209s 209s Type 'demo()' for some demos, 'help()' for on-line help, or 209s 'help.start()' for an HTML browser interface to help. 209s Type 'q()' to quit R. 209s 209s > library("matrixStats") 209s > 209s > ## Create isFALSE() if running on an old version of R 209s > if (!exists("isFALSE", mode="function")) { 209s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 209s + } 209s > 209s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as rowWeightedMedians() 209s + if (!is.null(w)) { 209s + if (isFALSE(useNames)) names(res) <- NULL 209s + } 209s + else if (!useNames) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 209s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 209s + 209s + # Keep naming support consistency same as colWeightedMedians() 209s + if (!is.null(w)) { 209s + if (isFALSE(useNames)) names(res) <- NULL 209s + } 209s + else if (!useNames) names(res) <- NULL 209s + 209s + res 209s + } 209s > 209s > set.seed(1) 209s > 209s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 209s > print(x) 209s [,1] [,2] [,3] [,4] 209s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 209s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 209s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 209s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 209s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 209s > 209s > # To check names attribute 209s > dimnames <- list(letters[1:5], LETTERS[1:4]) 209s > 209s > # Non-weighted row medians 209s > x_est0 <- rowMedians(x) 209s > x_est1 <- rowWeightedMedians(x) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x)) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowMedians(x, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 209s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + stopifnot(all.equal(x_est2, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row medians (uniform weights) 209s > w <- rep(2.5, times = ncol(x)) 209s > x_est0 <- rowMedians(x) 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row medians (excluding some columns) 209s > w <- c(1, 1, 0, 1) 209s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > # Weighted row medians (excluding some columns) 209s > w <- c(0, 1, 0, 0) 209s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > # Weighted row medians (all zero weights) 209s > w <- c(0, 0, 0, 0) 209s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > # Weighted medians by rows and columns 209s > w <- 1:4 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Weighted row medians with missing values 209s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 209s > print(x_est0) 209s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 209s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 209s > print(x_est1) 209s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 209s > stopifnot(all.equal(x_est1, x_est0)) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(all.equal(x_est2, x_est0)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > # Weighted medians by rows and columns 209s > w <- 1:4 209s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 209s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 209s > stopifnot(all.equal(x_est2, x_est1)) 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 + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s > 209s > # Inf weight 209s > x <- matrix(1:2, nrow = 1, ncol = 2) 209s > w <- c(7, Inf) 209s > x_est1 <- rowWeightedMedians(x, w = w) 209s > x_est2 <- colWeightedMedians(t(x), w = w) 209s > stopifnot(identical(2, x_est1)) 209s > stopifnot(identical(2, x_est2)) 209s > # Test with and without dimnames on x 209s > dimnames <- list("a", LETTERS[1:2]) 209s > for (setDimnames in c(TRUE, FALSE)) { 209s + if (setDimnames) dimnames(x) <- dimnames 209s + else dimnames(x) <- NULL 209s + # Check names attribute 209s + for (useNames in c(TRUE, FALSE)) { 209s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 209s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 209s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 209s + stopifnot(all.equal(x_est1, x_est0)) 209s + } 209s + } 209s > 209s 209s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 209s Copyright (C) 2025 The R Foundation for Statistical Computing 209s Platform: x86_64-pc-linux-gnu 209s 209s R is free software and comes with ABSOLUTELY NO WARRANTY. 209s You are welcome to redistribute it under certain conditions. 209s Type 'license()' or 'licence()' for distribution details. 209s 209s R is a collaborative project with many contributors. 209s Type 'contributors()' for more information and 209s 'citation()' on how to cite R or R packages in publications. 209s 209s Type 'demo()' for some demos, 'help()' for on-line help, or 209s 'help.start()' for an HTML browser interface to help. 209s Type 'q()' to quit R. 209s 210s > library("matrixStats") 210s > 210s > ## Create isFALSE() if running on an old version of R 210s > if (!exists("isFALSE", mode="function")) { 210s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 210s + } 210s > 210s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 210s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 210s + 210s + # Keep naming support consistency same as rowWeightedMedians() 210s + if (!is.null(w)) { 210s + if (isFALSE(useNames)) names(res) <- NULL 210s + } 210s + else if (!useNames) names(res) <- NULL 210s + 210s + res 210s + } 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # Subsetted tests 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > source("utils/validateIndicesFramework.R") 210s > # To check names attribute 210s > dimnames <- list(letters[1:6], LETTERS[1:6]) 210s > for (mode in c("numeric", "integer", "logical")) { 210s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 210s + w <- runif(6, min = 0, max = 6) 210s + storage.mode(x) <- mode 210s + storage.mode(w) <- if (mode == "logical") "integer" else mode 210s + if (mode == "numeric") w[1] <- Inf 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 + 210s + count <- 0L 210s + for (rows in index_cases) { 210s + for (cols in index_cases) { 210s + count <- count + 1L 210s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 210s + useNames <- c(TRUE, FALSE) 210s + useNames <- useNames[count %% length(useNames) + 1] 210s + 210s + validateIndicesTestMatrix_w(x, w, rows, cols, 210s + ftest = rowWeightedMedians, 210s + fsure = rowWeightedMedians_R, 210s + na.rm = na.rm, useNames = useNames) 210s + validateIndicesTestMatrix_w(x, w, rows, cols, 210s + fcoltest = colWeightedMedians, 210s + fsure = rowWeightedMedians_R, 210s + na.rm = na.rm, useNames = useNames) 210s + } 210s + } 210s + } 210s + } 210s > 210s 210s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > set.seed(1) 210s > 210s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 210s > print(x) 210s [,1] [,2] [,3] [,4] 210s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 210s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 210s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 210s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 210s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 210s > 210s > # To check names attribute 210s > dimnames <- list(letters[1:5], LETTERS[1:4]) 210s > 210s > # Weighted row variances (uniform weights - all w = 1) 210s > # Non-weighted row variances 210s > x_est0 <- rowVars(x) 210s > w <- rep(1, times = ncol(x)) 210s > x_est1 <- rowWeightedVars(x, w = w) 210s > print(x_est1) 210s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowVars(x, useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row variances (uniform weights - all w = 3) 210s > x3 <- cbind(x, x, x) 210s > x_est0 <- rowVars(x3) 210s > w <- rep(3, times = ncol(x)) 210s > x_est1 <- rowWeightedVars(x, w = w) 210s > print(x_est1) 210s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x3 <- cbind(x, x, x) 210s > x_est0 <- rowVars(x3, useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row variances (excluding some columns) 210s > w <- c(1, 1, 0, 1) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 210s > x_est1 <- rowWeightedVars(x, w = w) 210s > print(x_est1) 210s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row variances (excluding some columns) 210s > w <- c(0, 1, 0, 0) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 210s > x_est1 <- rowWeightedVars(x, w = w) 210s > #stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est1)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row variances (all zero weights) 210s > w <- c(0, 0, 0, 0) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 210s > x_est1 <- rowWeightedVars(x, w = w) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > # Weighted variances by rows and columns 210s > w <- 1:4 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 + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 210s + print(x_est1) 210s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 210s + stopifnot(all.equal(x_est2, x_est1)) 210s + } 210s + } 210s a b c d e 210s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 210s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 210s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 210s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 210s > 210s > 210s > x[sample(length(x), size = 0.3 * length(x))] <- NA 210s > print(x) 210s [,1] [,2] [,3] [,4] 210s [1,] -0.6264538 NA 1.5117812 -0.04493361 210s [2,] 0.1836433 NA NA -0.01619026 210s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 210s [4,] 1.5952808 NA -2.2146999 0.82122120 210s [5,] 0.3295078 NA NA 0.59390132 210s > 210s > # Non-weighted row variances with missing values 210s > x_est0 <- rowVars(x, na.rm = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 210s > print(x_est1) 210s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 210s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 210s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 210s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row variances with missing values 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 + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 210s + print(x_est1) 210s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 210s + stopifnot(all.equal(x_est2, x_est1)) 210s + } 210s + } 210s a b c d e 210s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s > 210s > 210s > # Weighted variances by rows and columns 210s > w <- 1:4 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 + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 210s + print(x_est1) 210s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 210s + stopifnot(all.equal(x_est2, x_est1)) 210s + } 210s + } 210s a b c d e 210s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 210s > 210s > 210s > # Weighted row standard deviation (excluding some columns) 210s > w <- c(1, 1, 0, 1) 210s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 210s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 210s > x_est1 <- rowWeightedSds(x, w = w) 210s > print(x_est1) 210s [1] NA NA 0.9734868 NA NA 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 210s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 210s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 210s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s > 210s > # Weighted row MADs (excluding some columns) 210s > w <- c(1, 1, 0, 1) 210s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 210s > x_est1 <- rowWeightedMads(x, w = w) 210s > print(x_est1) 210s [1] NA NA 0.3046914 NA NA 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > x_est2 <- colWeightedMads(t(x), w = w) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > # Check names attribute 210s > dimnames(x) <- dimnames 210s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 210s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 210s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 210s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 210s > stopifnot(all.equal(x_est1, x_est0)) 210s > stopifnot(all.equal(x_est2, x_est0)) 210s > dimnames(x) <- NULL 210s > 210s 210s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > fcns <- list( 210s + weightedVar = c(rowWeightedVars, colWeightedVars), 210s + weightedSd = c(rowWeightedSds, colWeightedSds), 210s + weightedMad = c(rowWeightedMads, colWeightedMads) 210s + ) 210s > 210s > 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > # Subsetted tests 210s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210s > source("utils/validateIndicesFramework.R") 210s > # To check names attribute 210s > dimnames <- list(letters[1:6], LETTERS[1:6]) 210s > for (fcn in names(fcns)) { 210s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 210s + row_fcn <- fcns[[fcn]][[1]] 210s + col_fcn <- fcns[[fcn]][[2]] 210s + 210s + for (mode in c("numeric", "integer")) { 210s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 210s + w <- runif(6, min = 0, max = 6) 210s + storage.mode(x) <- mode 210s + storage.mode(w) <- mode 210s + if (mode == "numeric") w[1] <- Inf 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 + 210s + count <- 0L 210s + for (rows in index_cases) { 210s + for (cols in index_cases) { 210s + count <- count + 1L 210s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 210s + useNames <- c(TRUE, FALSE) 210s + useNames <- useNames[count %% length(useNames) + 1] 210s + 210s + validateIndicesTestMatrix_w(x, w, rows, cols, 210s + ftest = row_fcn, fsure = row_fcn, 210s + na.rm = na.rm, useNames = useNames) 210s + validateIndicesTestMatrix_w(x, w, rows, cols, 210s + fcoltest = col_fcn, fsure = row_fcn, 210s + na.rm = na.rm, useNames = useNames) 210s + } 210s + } 210s + } 210s + } 210s + cat(sprintf("%s()...DONE\n", fcn)) 210s + } 210s subsetted tests on matrix weightedVar()... 211s weightedVar()...DONE 211s subsetted tests on matrix weightedSd()... 211s weightedSd()...DONE 211s subsetted tests on matrix weightedMad()... 211s weightedMad()...DONE 211s > 211s 211s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 211s Copyright (C) 2025 The R Foundation for Statistical Computing 211s Platform: x86_64-pc-linux-gnu 211s 211s R is free software and comes with ABSOLUTELY NO WARRANTY. 211s You are welcome to redistribute it under certain conditions. 211s Type 'license()' or 'licence()' for distribution details. 211s 211s R is a collaborative project with many contributors. 211s Type 'contributors()' for more information and 211s 'citation()' on how to cite R or R packages in publications. 211s 211s Type 'demo()' for some demos, 'help()' for on-line help, or 211s 'help.start()' for an HTML browser interface to help. 211s Type 'q()' to quit R. 211s 211s > library("matrixStats") 211s > 211s > signTabulate0 <- function(x, ...) { 211s + nneg <- sum(x < 0, na.rm = TRUE) 211s + nzero <- sum(x == 0, na.rm = TRUE) 211s + npos <- sum(x > 0, na.rm = TRUE) 211s + nna <- sum(is.na(x)) 211s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 211s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 211s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 211s + res <- as.double(res) 211s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 211s + if (is.integer(x)) res <- res[1:4] 211s + res 211s + } # signTabulate0() 211s > 211s > 211s > # Simulate data 211s > set.seed(0xBEEF) 211s > n <- 100L 211s > x <- runif(n) 211s > x[sample(n, size = 0.1 * n)] <- 0 211s > x[sample(n, size = 0.1 * n)] <- NA_real_ 211s > x[sample(n, size = 0.1 * n)] <- -Inf 211s > x[sample(n, size = 0.1 * n)] <- +Inf 211s > 211s > # Doubles 211s > message("Doubles:") 211s > counts0 <- signTabulate0(x) 211s Doubles: 211s Integers: 211s > print(counts0) 211s -1 0 +1 NA -Inf +Inf 211s 9 7 77 7 9 10 211s > counts1 <- signTabulate(x) 211s > print(counts1) 211s -1 0 +1 NA -Inf +Inf 211s 9 7 77 7 9 10 211s > stopifnot(identical(counts1, counts0)) 211s > 211s > # Integers 211s > message("Integers:") 211s > x <- suppressWarnings(as.integer(x)) 211s > counts0 <- signTabulate0(x) 211s > print(counts0) 211s -1 0 +1 NA 211s 0 74 0 26 211s > counts1 <- signTabulate(x) 211s > print(counts1) 211s -1 0 +1 NA 211s 0 74 0 26 211s > stopifnot(identical(counts1, counts0)) 211s > 211s 211s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 211s Copyright (C) 2025 The R Foundation for Statistical Computing 211s Platform: x86_64-pc-linux-gnu 211s 211s R is free software and comes with ABSOLUTELY NO WARRANTY. 211s You are welcome to redistribute it under certain conditions. 211s Type 'license()' or 'licence()' for distribution details. 211s 211s R is a collaborative project with many contributors. 211s Type 'contributors()' for more information and 211s 'citation()' on how to cite R or R packages in publications. 211s 211s Type 'demo()' for some demos, 'help()' for on-line help, or 211s 'help.start()' for an HTML browser interface to help. 211s Type 'q()' to quit R. 211s 212s > library("matrixStats") 212s > 212s > signTabulate0 <- function(x, ...) { 212s + nneg <- sum(x < 0, na.rm = TRUE) 212s + nzero <- sum(x == 0, na.rm = TRUE) 212s + npos <- sum(x > 0, na.rm = TRUE) 212s + nna <- sum(is.na(x)) 212s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 212s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 212s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 212s + res <- as.double(res) 212s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 212s + if (is.integer(x)) res <- res[1:4] 212s + res 212s + } # signTabulate0() 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Subsetted tests 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > source("utils/validateIndicesFramework.R") 212s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 212s > x[2:3, 4:5] <- +Inf 212s > x[4:5, 1:2] <- -Inf 212s > for (idxs in index_cases) { 212s + validateIndicesTestVector(x, idxs, 212s + ftest = signTabulate, fsure = signTabulate0) 212s + } 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > options(warn = 1) 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Consistency checks 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > set.seed(1) 212s > 212s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 212s + if (is.null(idxs)) { 212s + sum(x, na.rm = na.rm) 212s + } else { 212s + sum(x[idxs], na.rm = na.rm) 212s + } 212s + } # sum2_R() 212s > 212s > 212s > cat("Consistency checks:\n") 212s Consistency checks: 212s > for (kk in 1:20) { 212s + cat("Random test #", kk, "\n", sep = "") 212s + 212s + # Simulate data in a matrix of any shape 212s + n <- sample(1e3, size = 1L) 212s + x <- rnorm(n, sd = 100) 212s + 212s + # Add NAs? 212s + if ((kk %% 4) %in% c(3, 0)) { 212s + cat("Adding NAs\n") 212s + nna <- sample(n, size = 1L) 212s + na_values <- c(NA_real_, NaN) 212s + t <- sample(na_values, size = nna, replace = TRUE) 212s + x[sample(length(x), size = nna)] <- t 212s + } 212s + 212s + # Integer or double? 212s + if ((kk %% 4) %in% c(2, 0)) { 212s + cat("Coercing to integers\n") 212s + storage.mode(x) <- "integer" 212s + } 212s + 212s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 212s + 212s + # Sum over all 212s + y0 <- sum2_R(x, na.rm = na.rm) 212s + y1 <- sum2(x, na.rm = na.rm) 212s + stopifnot(all.equal(y1, y0)) 212s + 212s + # Sum over subset 212s + nidxs <- sample(n, size = 1L) 212s + idxs <- sample(n, size = nidxs) 212s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 212s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 212s + stopifnot(all.equal(y1, y0)) 212s + 212s + if (storage.mode(x) == "integer") { 212s + storage.mode(x) <- "logical" 212s + 212s + y0 <- sum2_R(x, na.rm = na.rm) 212s + y1 <- sum2(x, na.rm = na.rm) 212s + stopifnot(all.equal(y1, y0)) 212s + 212s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 212s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 212s + stopifnot(all.equal(y1, y0)) 212s + } 212s + } # for (kk ...) 212s Random test #1 212s Random test #2 212s Coercing to integers 212s Random test #3 212s Adding NAs 212s Random test #4 212s Adding NAs 212s Coercing to integers 212s Random test #5 212s Random test #6 212s Coercing to integers 212s Random test #7 212s Adding NAs 212s Random test #8 212s Adding NAs 212s Coercing to integers 212s Random test #9 212s Random test #10 212s Coercing to integers 212s Random test #11 212s Adding NAs 212s Random test #12 212s Adding NAs 212s Coercing to integers 212s Random test #13 212s Random test #14 212s Coercing to integers 212s Random test #15 212s Adding NAs 212s Random test #16 212s Adding NAs 212s Coercing to integers 212s Random test #17 212s Random test #18 212s Coercing to integers 212s Random test #19 212s Adding NAs 212s Random test #20 212s Adding NAs 212s Coercing to integers 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # All missing values 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (n in 0:2) { 212s + for (na.rm in c(FALSE, TRUE)) { 212s + x <- rep(NA_real_, times = n) 212s + y0 <- sum(x, na.rm = na.rm) 212s + y <- sum2(x, na.rm = na.rm) 212s + stopifnot(all.equal(y, y0)) 212s + 212s + x <- rep(NA_integer_, times = n) 212s + y0 <- sum(x, na.rm = na.rm) 212s + y <- sum2(x, na.rm = na.rm) 212s + stopifnot(all.equal(y, y0)) 212s + 212s + x <- rep(NA, times = n) 212s + y0 <- sum(x, na.rm = na.rm) 212s + y <- sum2(x, na.rm = na.rm) 212s + stopifnot(all.equal(y, y0)) 212s + } 212s + } 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Special cases 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > for (na.rm in c(FALSE, TRUE)) { 212s + # Summing over zero elements (integers) 212s + x <- integer(0) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot(identical(s1, s2)) 212s + 212s + x <- 1:10 212s + idxs <- integer(0) 212s + s1 <- sum(x[idxs], na.rm = na.rm) 212s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 212s + stopifnot(identical(s1, s2)) 212s + 212s + # Summing over NA_integer_:s 212s + x <- rep(NA_integer_, times = 10L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot(identical(s1, s2)) 212s + 212s + x <- rep(NA_integer_, times = 10L) 212s + idxs <- 1:5 212s + s1 <- sum(x[idxs], na.rm = na.rm) 212s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 212s + stopifnot(identical(s1, s2)) 212s + 212s + 212s + # Summing over zero elements (doubles) 212s + x <- double(0) 212s + s1 <- sum(x) 212s + s2 <- sum2(x) 212s + stopifnot( 212s + identical(s1, 0), 212s + identical(s1, s2) 212s + ) 212s + 212s + x <- as.double(1:10) 212s + idxs <- integer(0) 212s + s1 <- sum(x[idxs]) 212s + s2 <- sum2(x, idxs = idxs) 212s + stopifnot( 212s + identical(s1, 0), 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over NA_real_:s 212s + x <- rep(NA_real_, times = 10L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot( 212s + !na.rm || s1 == 0, 212s + identical(s1, s2) 212s + ) 212s + 212s + x <- rep(NA_real_, times = 10L) 212s + idxs <- 1:5 212s + s1 <- sum(x[idxs], na.rm = na.rm) 212s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 212s + stopifnot( 212s + !na.rm || s1 == 0, 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over -Inf:s 212s + x <- rep(-Inf, times = 3L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot( 212s + is.infinite(s1) && s1 < 0, 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over +Inf:s 212s + x <- rep(+Inf, times = 3L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot(identical(s1, s2)) 212s + stopifnot( 212s + is.infinite(s1) && s1 > 0, 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over mix of -Inf:s and +Inf:s 212s + x <- rep(c(-Inf, +Inf), times = 3L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot( 212s + is.nan(s1), 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over mix of -Inf:s and +Inf:s and numerics 212s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + stopifnot( 212s + is.nan(s1), 212s + identical(s1, s2) 212s + ) 212s + 212s + # Summing over mix of NaN, NA, +Inf, and numerics 212s + x <- c(NaN, NA, +Inf, 3.14) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + if (na.rm) { 212s + stopifnot( 212s + is.infinite(s1) && s1 > 0, 212s + identical(s2, s1) 212s + ) 212s + } else { 212s + stopifnot(is.na(s1), is.na(s2)) 212s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 212s + ## returned here (as one would expect). NaN might very well be returned, 212s + ## when both NA and NaN are involved. This is an accepted feature in R, 212s + ## which is documented in help("is.nan"). See also 212s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 212s + ## Thus, we cannot guarantee that s1 is identical to s0. 212s + } 212s + 212s + # Summing over mix of NaN, NA, +Inf, and numerics 212s + x <- c(NA, NaN, +Inf, 3.14) 212s + s1 <- sum(x, na.rm = na.rm) 212s + s2 <- sum2(x, na.rm = na.rm) 212s + if (na.rm) { 212s + stopifnot( 212s + is.infinite(s1) && s1 > 0, 212s + identical(s2, s1) 212s + ) 212s + } else { 212s + stopifnot(is.na(s1), is.na(s2)) 212s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 212s + ## returned here (as one would expect). NaN might very well be returned, 212s + ## when both NA and NaN are involved. This is an accepted feature in R, 212s + ## which is documented in help("is.nan"). See also 212s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 212s + ## Thus, we cannot guarantee that s1 is identical to s0. 212s + } 212s + } 212s Warning in sum2(x[1:2]) : 212s Integer overflow. Use sum2(..., mode = "double") to avoid this. 212s Warning in sum2(x, mode = "integer") : 212s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Summing of large integers 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 212s > 212s > # Total gives integer overflow 212s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 212s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 212s > stopifnot( 212s + identical(s2, NA_integer_) 212s + ) 212s > 212s > ## Assert above warning 212s > res <- tryCatch({ 212s + s2 <- sum2(x[1:2]) 212s + }, warning = identity) 212s > stopifnot(inherits(res, "warning")) 212s > 212s > 212s > # Total gives integer overflow (coerce to numeric) 212s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 212s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 212s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 212s > stopifnot( 212s + identical(s1, 2147483648), 212s + identical(s1, s2), 212s + identical(s1, s3) 212s + ) 212s > 212s > # Cumulative sum would give integer overflow but not the total 212s > s1 <- sum(x) # 1L 212s > s2 <- sum2(x) # 1L 212s > stopifnot( 212s + identical(s1, 1L), 212s + identical(s1, s2) 212s + ) 212s > 212s > # Input is double but coercing result to integer 212s > x <- c(1, 2, 3.1) 212s > s1 <- sum2(x) 212s > s2 <- sum2(x, mode = "integer") 212s > stopifnot( 212s + identical(as.integer(s1), s2) 212s + ) 212s > 212s > ## Assert above warning 212s > res <- tryCatch({ 212s + s2 <- sum2(x, mode = "integer") 212s + }, warning = identity) 212s > stopifnot(inherits(res, "warning")) 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Summing of large doubles 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > ## Double overflow 212s > x <- rep(.Machine$double.xmax, times = 2L) 212s > y0 <- sum(x) 212s > print(y0) 212s [1] Inf 212s > y <- sum2(x) 212s > print(y) 212s [1] Inf 212s > stopifnot( 212s + is.infinite(y) && y > 0, 212s + identical(y, y0) 212s + ) 212s > 212s > x <- rep(-.Machine$double.xmax, times = 2L) 212s > y0 <- sum(x) 212s > print(y0) 212s [1] -Inf 212s > y <- sum2(x) 212s > print(y) 212s [1] -Inf 212s > stopifnot( 212s + is.infinite(y) && y < 0, 212s + identical(y, y0) 212s + ) 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Argument 'idxs' 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > x <- 1:10 212s > idxs_list <- list( 212s + integer = 1:5, 212s + double = as.double(1:5), 212s + logical = (x <= 5) 212s + ) 212s > 212s > for (idxs in idxs_list) { 212s + cat("idxs:\n") 212s + str(idxs) 212s + s1 <- sum(x[idxs], na.rm = TRUE) 212s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 212s + stopifnot(identical(s1, s2)) 212s + } 212s idxs: 212s int [1:5] 1 2 3 4 5 212s idxs: 212s num [1:5] 1 2 3 4 5 212s idxs: 212s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Subsetted tests 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > source("utils/validateIndicesFramework.R") 212s > x <- runif(6, min = -6, max = 6) 212s > storage.mode(x) <- "integer" 212s > for (idxs in index_cases) { 212s + validateIndicesTestVector(x, idxs, 212s + ftest = sum2, fsure = sum, 212s + na.rm = FALSE) 212s + validateIndicesTestVector(x, idxs, 212s + ftest = sum2, fsure = sum, 212s + na.rm = TRUE) 212s + } 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > set.seed(1) 212s > x <- rnorm(1e4) 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Variance estimators 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > sigma2_a <- var(x) 212s > cat(sprintf("var(x) = %g\n", sigma2_a)) 212s var(x) = 1.02487 212s > 212s > sigma2_b <- varDiff(x) 212s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 212s varDiff(x) = 1.01224 212s > 212s > d <- abs(sigma2_b - sigma2_a) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 0.0126268 212s > stopifnot(d < 0.02) 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Standard deviation estimators 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > sigma_a <- sd(x) 212s > cat(sprintf("sd(x) = %g\n", sigma_a)) 212s sd(x) = 1.01236 212s > 212s > sigma_b <- sdDiff(x) 212s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 212s sdDiff(x) = 1.0061 212s > 212s > d <- abs(sigma_b - sigma_a) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 0.00625567 212s > stopifnot(d < 0.01) 212s > 212s > # Sanity checks 212s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 212s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 212s > 212s > 212s > sigma_a2 <- mad(x) 212s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 212s mad(x) = 0.998376 212s > 212s > sigma_b2 <- madDiff(x) 212s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 212s madDiff(x) = 1.02513 212s > 212s > d <- abs(sigma_b2 - sigma_a2) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 0.0267497 212s > stopifnot(d < 0.05) 212s > 212s > 212s > sigma_a3 <- IQR(x) 212s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 212s IQR(x) = 1.35105 212s > 212s > sigma_b3 <- iqrDiff(x) 212s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 212s iqrDiff(x) = 1.37797 212s > 212s > d <- abs(sigma_b3 - sigma_a3) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 0.0269152 212s > stopifnot(d < 0.05) 212s > 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Trimmed estimators 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > y <- x 212s > outliers <- sample(length(x), size = 0.1 * length(x)) 212s > y[outliers] <- 100 * y[outliers] 212s > 212s > sigma_ao <- sd(y[-outliers]) 212s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 212s sd(y) = 1.01166 212s > 212s > sigma_bo <- sdDiff(y[-outliers]) 212s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 212s sdDiff(y) = 1.00743 212s > 212s > d <- abs(sigma_b - sigma_a) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 0.00625567 212s > stopifnot(d < 0.01) 212s > 212s > sigma_bot <- sdDiff(y, trim = 0.05) 212s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 212s sdDiff(y, trim = 0.05) = 7.74327 212s > 212s > d <- abs(sigma_bot - sigma_a) 212s > cat(sprintf("Absolute difference = %g\n", d)) 212s Absolute difference = 6.73091 212s > #stopifnot(d < 1e-3) 212s > 212s > sigma_cot <- madDiff(y, trim = 0.05) 212s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 212s madDiff(y, trim = 0.05) = 1.15278 212s > 212s > sigma_dot <- iqrDiff(y, trim = 0.05) 212s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 212s iqrDiff(y, trim = 0.05) = 1.55762 212s > 212s > 212s > fcns <- list( 212s + varDiff = varDiff, 212s + sdDiff = sdDiff, 212s + madDiff = madDiff, 212s + iqrDiff = iqrDiff 212s + ) 212s > 212s > for (name in names(fcns)) { 212s + cat(sprintf("%s()...\n", name)) 212s + fcn <- fcns[[name]] 212s + 212s + for (mode in c("integer", "double")) { 212s + cat("mode: ", mode, "", sep = "") 212s + for (n in 0:3) { 212s + x <- runif(n, min = -5, max = 5) 212s + storage.mode(x) <- mode 212s + str(x) 212s + 212s + y <- fcn(x) 212s + yt <- fcn(x, trim = 0.1) 212s + str(list("non-trimmed" = y, trimmed = yt)) 212s + } # for (mode ...) 212s + } 212s + 212s + cat(sprintf("%s()...DONE\n", name)) 212s + } # for (name ...) 212s varDiff()... 212s mode: integer int(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int -4 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:2] 3 2 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:3] 1 4 -1 212s List of 2 212s $ non-trimmed: num 16 212s $ trimmed : num 16 212s mode: double num(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num -0.794 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:2] 0.897 -3.728 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:3] 2.07 -1.13 1.94 212s List of 2 212s $ non-trimmed: num 9.83 212s $ trimmed : num 9.83 212s varDiff()...DONE 212s sdDiff()... 212s mode: integer int(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int 2 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:2] -4 1 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:3] -2 1 -1 212s List of 2 212s $ non-trimmed: num 2.5 212s $ trimmed : num 2.5 212s mode: double num(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num -3.78 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:2] -2.04 2.38 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:3] 1.42 -2.14 1.14 212s List of 2 212s $ non-trimmed: num 3.42 212s $ trimmed : num 3.42 212s sdDiff()...DONE 212s madDiff()... 212s mode: integer int(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int -1 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:2] -1 4 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int [1:3] -1 0 -3 212s List of 2 212s $ non-trimmed: num 2.1 212s $ trimmed : num 2.1 212s mode: double num(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num -1.13 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:2] -1.7 -1.21 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num [1:3] -2.39 -0.464 3.086 212s List of 2 212s $ non-trimmed: num 0.851 212s $ trimmed : num 0.851 212s madDiff()...DONE 212s iqrDiff()... 212s mode: integer int(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s int 3 212s List of 2 212s $ non-trimmed: num 0 212s $ trimmed : num 0 212s int [1:2] -3 4 212s List of 2 212s $ non-trimmed: num 0 212s $ trimmed : num 0 212s int [1:3] 0 -2 -2 212s List of 2 212s $ non-trimmed: num 0.707 212s $ trimmed : num 0.707 212s mode: double num(0) 212s List of 2 212s $ non-trimmed: num NA 212s $ trimmed : num NA 212s num -4.46 212s List of 2 212s $ non-trimmed: num 0 212s $ trimmed : num 0 212s num [1:2] 3.67 1.02 212s List of 2 212s $ non-trimmed: num 0 212s $ trimmed : num 0 212s num [1:3] -0.537 -2.733 2.857 212s List of 2 212s $ non-trimmed: num 2.75 212s $ trimmed : num 2.75 212s iqrDiff()...DONE 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > fcns <- list( 212s + varDiff = varDiff, 212s + sdDiff = sdDiff, 212s + madDiff = madDiff, 212s + iqrDiff = iqrDiff 212s + ) 212s > 212s > 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > # Subsetted tests 212s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212s > source("utils/validateIndicesFramework.R") 212s > for (name in names(fcns)) { 212s + cat(sprintf("subsetted tests on %s()...\n", name)) 212s + fcn <- fcns[[name]] 212s + 212s + for (mode in c("numeric", "integer")) { 212s + x <- runif(6, min = -6, max = 6) 212s + storage.mode(x) <- mode 212s + trim <- runif(1, min = 0, max = 0.5) 212s + if (mode == "numeric") x[1] <- Inf 212s + 212s + for (diff in 1:2) { 212s + for (idxs in index_cases) { 212s + validateIndicesTestVector(x, idxs, 212s + ftest = fcn, fsure = fcn, 212s + na.rm = TRUE, diff = diff, trim = trim) 212s + validateIndicesTestVector(x, idxs, 212s + ftest = fcn, fsure = fcn, 212s + na.rm = FALSE, diff = diff, trim = trim) 212s + } 212s + } 212s + } 212s + cat(sprintf("%s()...DONE\n", name)) 212s + } 212s subsetted tests on varDiff()... 212s varDiff()...DONE 212s subsetted tests on sdDiff()... 212s sdDiff()...DONE 212s subsetted tests on madDiff()... 212s madDiff()...DONE 212s subsetted tests on iqrDiff()... 212s iqrDiff()...DONE 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > for (mode in c("logical", "integer", "double")) { 212s + cat("mode: ", mode, "", sep = "") 212s + n <- 2L 212s + x <- runif(n, min = -5, max = 5) 212s + if (mode == "logical") { 212s + x <- x > 0 212s + } 212s + storage.mode(x) <- mode 212s + str(x) 212s + 212s + cat("All weights are 1\n") 212s + w <- rep(1, times = n) 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + 212s + cat("First weight is 5\n") 212s + # Pull the mean towards zero 212s + w[1] <- 5 212s + str(w) 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + 212s + cat("All weights are 0\n") 212s + # All weights set to zero 212s + w <- rep(0, times = n) 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + 212s + cat("First weight is 8.5\n") 212s + # Put even more weight on the zero 212s + w[1] <- 8.5 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + 212s + cat("First weight is Inf\n") 212s + # All weight on the first value 212s + w[1] <- Inf 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + 212s + cat("Last weight is Inf\n") 212s + # All weight on the last value 212s + w[1] <- 1 212s + w[n] <- Inf 212s + m0 <- weighted.mean(x, w) 212s + m1 <- weightedMean(x, w) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(identical(m1, m0)) 212s + } # for (mode ...) 212s mode: logical logi [1:2] FALSE TRUE 212s All weights are 1 212s List of 2 212s $ m0: num 0.5 212s $ m1: num 0.5 212s First weight is 5 212s num [1:2] 5 1 212s List of 2 212s $ m0: num 0.167 212s $ m1: num 0.167 212s All weights are 0 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s First weight is 8.5 212s List of 2 212s $ m0: num 0 212s $ m1: num 0 212s First weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s Last weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s mode: integer int [1:2] 1 3 212s All weights are 1 212s List of 2 212s $ m0: num 2 212s $ m1: num 2 212s First weight is 5 212s num [1:2] 5 1 212s List of 2 212s $ m0: num 1.33 212s $ m1: num 1.33 212s All weights are 0 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s First weight is 8.5 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s First weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s Last weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s mode: double num [1:2] 3.68 3.42 212s All weights are 1 212s List of 2 212s $ m0: num 3.55 212s $ m1: num 3.55 212s First weight is 5 212s num [1:2] 5 1 212s List of 2 212s $ m0: num 3.63 212s $ m1: num 3.63 212s All weights are 0 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s First weight is 8.5 212s List of 2 212s $ m0: num 3.68 212s $ m1: num 3.68 212s First weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s Last weight is Inf 212s List of 2 212s $ m0: num NaN 212s $ m1: num NaN 212s > 212s > 212s > message("*** Testing for missing values") 212s > # NA tests 212s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 212s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 212s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 212s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 212s > ## is because 'x' is dropped and therefore that first element 212s > ## is skipped in the computation. It basically does 212s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 212s > ## without looking at 'w'. 212s > for (x in xs) { 212s + for (mode in c("logical", "integer", "double")) { 212s + storage.mode(x) <- mode 212s + for (w in ws) { 212s + for (na.rm in c(FALSE, TRUE)) { 212s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 212s + str(list(x = x, w = w)) 212s + m0 <- weighted.mean(x, w, na.rm = na.rm) 212s + m1 <- weightedMean(x, w, na.rm = na.rm) 212s + str(list(m0 = m0, m1 = m1)) 212s + stopifnot(all.equal(m1, m0)) 212s + } 212s + } 212s + } 212s + } 212s *** Testing for missing values 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] TRUE TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] 1 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] 1 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: logical, na.rm = FALSE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: logical, na.rm = TRUE 212s List of 2 212s $ x: logi [1:3] NA TRUE TRUE 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: integer, na.rm = FALSE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: integer, na.rm = TRUE 212s List of 2 212s $ x: int [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] NA 1 1 212s List of 2 212s $ m0: num 1 212s $ m1: num 1 212s mode: double, na.rm = FALSE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s mode: double, na.rm = TRUE 212s List of 2 212s $ x: num [1:3] NA 1 1 212s $ w: num [1:3] 1 NA 1 212s List of 2 212s $ m0: num NA 212s $ m1: num NA 212s > 212s 212s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Subsetted tests 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > source("utils/validateIndicesFramework.R") 213s > for (mode in c("numeric", "integer")) { 213s + x <- runif(6, min = -6, max = 6) 213s + w <- runif(6, min = 0, max = 6) 213s + storage.mode(x) <- mode 213s + storage.mode(w) <- mode 213s + if (mode == "numeric") w[1] <- Inf 213s + 213s + for (idxs in index_cases) { 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMean, fsure = weighted.mean, 213s + na.rm = TRUE, refine = TRUE) 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMean, fsure = weighted.mean, 213s + na.rm = FALSE, refine = TRUE) 213s + } 213s + } 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s > 213s > x <- 1:5 213s > y <- weightedMedian(x) 213s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 213s > print(y) 213s [1] 3 213s > 213s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 213s > print(y) 213s [1] NA 213s > stopifnot(is.na(y)) 213s > 213s > x <- 1:10 213s > n <- length(x) 213s > 213s > y1 <- median(x) # 5.5 213s > y2 <- weightedMedian(x) # 5.5 213s > stopifnot(all.equal(y1, y2)) 213s > 213s > 213s > w <- rep(1, times = n) 213s > y1 <- weightedMedian(x, w) # 5.5 (default) 213s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 213s > y2b <- weightedMedian(x, ties = "min") # 5 213s > y2c <- weightedMedian(x, ties = "max") # 6 213s > stopifnot(all.equal(y2a, y1)) 213s > 213s > y3 <- weightedMedian(x, w) # 5.5 (default) 213s > 213s > 213s > # Pull the median towards zero 213s > w[1] <- 5 213s > y1 <- weightedMedian(x, w) # 3.5 213s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 213s > y2 <- median(y) # 3.5 213s > stopifnot(all.equal(y1, y2)) 213s > 213s > # Put even more weight on the zero 213s > w[1] <- 8.5 213s > y <- weightedMedian(x, w) # 2 213s > 213s > # All weight on the first value 213s > w[1] <- Inf 213s > y <- weightedMedian(x, w) # 1 213s > 213s > # All weight on the last value 213s > w[1] <- 1 213s > w[n] <- Inf 213s > y <- weightedMedian(x, w) # 10 213s > 213s > # All weights set to zero 213s > w <- rep(0, times = n) 213s > y <- weightedMedian(x, w) # NA 213s > 213s > x <- 1:4 213s > w <- rep(1, times = 4) 213s > for (mode in c("integer", "double")) { 213s + storage.mode(x) <- mode 213s + for (ties in c("weighted", "mean", "min", "max")) { 213s + cat(sprintf("ties = %s\n", ties)) 213s + y <- weightedMedian(x, w, ties = ties) 213s + } 213s + } 213s ties = weighted 213s ties = mean 213s ties = min 213s ties = max 213s ties = weighted 213s ties = mean 213s ties = min 213s ties = max 213s > 213s > set.seed(0x42) 213s > 213s > y <- weightedMedian(x = double(0L)) 213s > print(y) 213s [1] NA 213s > stopifnot(length(y) == 1L) 213s > stopifnot(is.na(y)) 213s > 213s > y <- weightedMedian(x = x[1]) 213s > print(y) 213s [1] 1 213s > stopifnot(length(y) == 1L) 213s > stopifnot(all.equal(y, x[1])) 213s > 213s > 213s > n <- 1e3 213s > x <- runif(n) 213s > w <- runif(n, min = 0, max = 1) 213s > for (mode in c("integer", "double")) { 213s + storage.mode(x) <- mode 213s + for (ties in c("weighted", "mean", "min", "max")) { 213s + y <- weightedMedian(x, w, ties = ties) 213s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 213s + } 213s + } 213s mode = integer, ties = weighted, result = 0 213s mode = integer, ties = mean, result = 0 213s mode = integer, ties = min, result = 0 213s mode = integer, ties = max, result = 0 213s mode = double, ties = weighted, result = 0 213s mode = double, ties = mean, result = 0 213s mode = double, ties = min, result = 0 213s mode = double, ties = max, result = 0 213s > 213s > 213s > # A large vector 213s > n <- 1e5 213s > x <- runif(n) 213s > w <- runif(n, min = 0, max = 1) 213s > y <- weightedMedian(x, w) 213s > 213s > y <- weightedMedian(x, w, ties = "min") 213s > 213s > 213s > # Single Number 213s > xs <- c(1, NA_integer_) 213s > ws <- c(1, NA_integer_) 213s > for (x in xs) { 213s + for (w in ws) { 213s + y <- weightedMedian(x = x, w = w) 213s + if (is.na(w)) z <- NA_real_ 213s + else z <- x[1] 213s + stopifnot(all.equal(y, z)) 213s + } 213s + } 213s > 213s > ## Logical 213s > x1 <- c(TRUE, FALSE, TRUE) 213s > w0 <- c(0, 0, 0) 213s > stopifnot(!is.finite(weightedMedian(x1, w0)), 213s + !is.infinite(weightedMedian(x1, w0))) 213s > 213s > w1 <- c(1, 1, 1) 213s > stopifnot(weightedMedian(x1, w1) == 1) 213s > 213s > w2 <- c(1, 2, 3) 213s > stopifnot(weightedMedian(x1, w2) == 1) 213s > 213s > ### NA 213s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 213s + c(1, 2, 3))), 213s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 213s + c(1, 2, 3), 213s + na.rm = TRUE), 213s + weightedMedian(c(TRUE, FALSE), 213s + c(1, 2)))) 213s > ### Identical to as.integer() 213s > x <- rcauchy(100) 213s > w <- abs(rcauchy(100)) 213s > stopifnot(all.equal(weightedMedian(x > 0, w), 213s + weightedMedian(as.integer(x > 0), w))) 213s > 213s > 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Subsetted tests 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > source("utils/validateIndicesFramework.R") 213s > for (mode in c("numeric", "integer")) { 213s + x <- runif(6, min = -6, max = 6) 213s + w <- runif(6, min = 0, max = 6) 213s + storage.mode(x) <- mode 213s + storage.mode(w) <- mode 213s + if (mode == "numeric") w[1] <- Inf 213s + 213s + for (idxs in index_cases) { 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMedian, 213s + fsure = weightedMedian, 213s + na.rm = TRUE) 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMedian, 213s + fsure = weightedMedian, 213s + na.rm = FALSE) 213s + 213s + for (ties in c("weighted", "mean", "min", "max")) { 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMedian, 213s + fsure = weightedMedian, 213s + na.rm = TRUE, ties = ties) 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = weightedMedian, 213s + fsure = weightedMedian, 213s + na.rm = FALSE, ties = ties) 213s + } 213s + } 213s + } 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s *** weightedVar() ... 213s - Zero elements 213s > 213s > weightedVar_R <- function(x, w) { 213s + mu <- weighted.mean(x, w = w) 213s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 213s + } 213s > 213s > 213s > n <- 10 213s > x <- as.double(1:n) 213s > 213s > message("*** weightedVar() ...") 213s > 213s > message("- Zero elements") 213s > m0 <- var(integer(0)) 213s > m1 <- weightedVar(integer(0), w = integer(0)) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num NA 213s $ m1:- One elements 213s - Uniform weights (all w = 1) 213s - Uniform weights (all w = 3) 213s - Uniform weights on the first five elements 213s - Uniform weights on every second elements 213s - All weights are zero 213s - Infinite weight on first element 213s - Missing-value weight on first element 213s - Frequency weights 213s *** weightedVar() ... DONE 213s int NA 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- One elements") 213s > m0 <- var(1) 213s > m1 <- weightedVar(1) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num NA 213s $ m1: num NA 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- Uniform weights (all w = 1)") 213s > m0 <- var(x) 213s > w <- rep(1, times = n) 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num 9.17 213s $ m1: num 9.17 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- Uniform weights (all w = 3)") 213s > m0 <- var(rep(x, each = 3)) 213s > w <- rep(3, times = n) 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num 8.53 213s $ m1: num 8.53 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- Uniform weights on the first five elements") 213s > idxs <- 1:5 213s > m0 <- var(x[1:5]) 213s > w <- rep(0, times = n) 213s > w[idxs] <- 1 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num 2.5 213s $ m1: num 2.5 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- Uniform weights on every second elements") 213s > idxs <- seq(from = 1, to = n, by = 2) 213s > m0 <- var(x[idxs]) 213s > w <- rep(0, times = n) 213s > w[idxs] <- 1 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num 10 213s $ m1: num 10 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > 213s > message("- All weights are zero") 213s > idxs <- integer(0L) 213s > m0 <- var(x[idxs]) 213s > w <- rep(0, times = n) 213s > w[idxs] <- 1 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num NA 213s $ m1: num NA 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > message("- Infinite weight on first element") 213s > idxs <- 1L 213s > m0 <- var(x[idxs]) 213s > w <- rep(0, times = n) 213s > w[idxs] <- Inf 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num NA 213s $ m1: num NA 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > message("- Missing-value weight on first element") 213s > idxs <- 1L 213s > w <- rep(1, times = n) 213s > w[idxs] <- NA_real_ 213s > m1 <- weightedVar(x, w = w) 213s > str(list(m1 = m1)) 213s List of 1 213s $ m1: num NA 213s > stopifnot(identical(m1, NA_real_)) 213s > 213s > 213s > message("- Frequency weights") 213s > 213s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 213s > y <- c(2, 2, 4, 5, 5, 5) 213s > x <- unique(y) 213s > w <- table(y) 213s > stopifnot(names(w) == x) 213s > 213s > m0 <- weightedVar(x, w = w) 213s > m1 <- var(y) 213s > stopifnot(all.equal(m1, m0)) 213s > m2 <- weightedVar(x, w = w) 213s > str(list(m0 = m0, m1 = m1, m2 = m2)) 213s List of 3 213s $ m0: num 2.17 213s $ m1: num 2.17 213s $ m2: num 2.17 213s > stopifnot(all.equal(m2, m0)) 213s > 213s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 213s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 213s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 213s > 213s > m0 <- weightedVar(large, w = years) 213s > m1 <- weightedVar(large, w = years) 213s > str(list(m0 = m0, m1 = m1)) 213s List of 2 213s $ m0: num 899 213s $ m1: num 899 213s > stopifnot(all.equal(m1, m0)) 213s > 213s > message("*** weightedVar() ... DONE") 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s > 213s > fcns <- list( 213s + weightedVar = weightedVar, 213s + weightedSd = weightedSd, 213s + weightedMad = weightedMad 213s + ) 213s > 213s > for (name in names(fcns)) { 213s + cat(sprintf("%s()...\n", name)) 213s + fcn <- fcns[[name]] 213s + 213s + for (mode in c("integer", "double")) { 213s + cat("mode: ", mode, "\n", sep = "") 213s + n <- 15L 213s + x <- runif(n, min = -5, max = 5) 213s + storage.mode(x) <- mode 213s + str(x) 213s + 213s + for (add_na in c(FALSE, TRUE)) { 213s + cat("add_na: ", add_na, "\n", sep = "") 213s + if (add_na) { 213s + x[c(5, 7)] <- NA 213s + } 213s + str(x) 213s + 213s + for (na.rm in c(FALSE, TRUE)) { 213s + cat("na.rm: ", na.rm, "\n", sep = "") 213s + 213s + cat("Weights are not specified (all are 1)\n") 213s + m1 <- fcn(x, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("All weights are 1\n") 213s + w <- rep(1, times = n) 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("First weight is 5\n") 213s + # Pull the mean towards zero 213s + w[1] <- 5 213s + str(w) 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("All weights are 0\n") 213s + # All weights set to zero 213s + w <- rep(0, times = n) 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("First weight is 8.5\n") 213s + # Put even more weight on the zero 213s + w[1] <- 8.5 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("First weight is Inf\n") 213s + # All weight on the first value 213s + w[1] <- Inf 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("Last weight is Inf\n") 213s + # All weight on the last value 213s + w[1] <- 1 213s + w[n] <- Inf 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + 213s + cat("Last weight is NA\n") 213s + # All weight on the last value 213s + w[1] <- 1 213s + w[n] <- NA_real_ 213s + m1 <- fcn(x, w, na.rm = na.rm) 213s + str(list(m1 = m1)) 213s + } # for (na.rm ...) 213s + } # for (add_na ...) 213s + } # for (mode ...) 213s + 213s + cat(sprintf("%s()...DONE\n", name)) 213s + } # for (name ...) 213s weightedVar()... 213s mode: integer 213s int [1:15] 4 0 0 -3 1 -1 4 4 0 4 ... 213s add_na: FALSE 213s int [1:15] 4 0 0 -3 1 -1 4 4 0 4 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 5.54 213s All weights are 1 213s List of 1 213s $ m1: num 5.54 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 5.32 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int NA 213s First weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 5.54 213s All weights are 1 213s List of 1 213s $ m1: num 5.54 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 5.32 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int NA 213s First weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s add_na: TRUE 213s int [1:15] 4 0 0 -3 NA -1 NA 4 0 4 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: int NA 213s All weights are 1 213s List of 1 213s $ m1: int NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: int NA 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int NA 213s First weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 5.94 213s All weights are 1 213s List of 1 213s $ m1: num 5.94 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 5.68 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int NA 213s First weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is Inf 213s List of 1 213s $ m1: int NA 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s mode: double 213s num [1:15] -3.225 0.941 -0.138 -0.544 0.131 ... 213s add_na: FALSE 213s num [1:15] -3.225 0.941 -0.138 -0.544 0.131 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 6.32 213s All weights are 1 213s List of 1 213s $ m1: num 6.32 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 6.02 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 6.32 213s All weights are 1 213s List of 1 213s $ m1: num 6.32 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 6.02 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s add_na: TRUE 213s num [1:15] -3.225 0.941 -0.138 -0.544 NA ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num NA 213s All weights are 1 213s List of 1 213s $ m1: num NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num NA 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 7.24 213s All weights are 1 213s List of 1 213s $ m1: num 7.24 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 6.64 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s weightedVar()...DONE 213s weightedSd()... 213s mode: integer 213s int [1:15] -4 -2 3 1 -1 0 3 -1 2 4 ... 213s add_na: FALSE 213s int [1:15] -4 -2 3 1 -1 0 3 -1 2 4 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.67 213s All weights are 1 213s List of 1 213s $ m1: num 2.67 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.89 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.67 213s All weights are 1 213s List of 1 213s $ m1: num 2.67 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.89 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s add_na: TRUE 213s int [1:15] -4 -2 3 1 NA 0 NA -1 2 4 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num NA 213s All weights are 1 213s List of 1 213s $ m1: num NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num NA 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.73 213s All weights are 1 213s List of 1 213s $ m1: num 2.73 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.9 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s mode: double 213s num [1:15] 2.09 -2.74 4.24 3.56 -2.28 ... 213s add_na: FALSE 213s num [1:15] 2.09 -2.74 4.24 3.56 -2.28 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.96 213s All weights are 1 213s List of 1 213s $ m1: num 2.96 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.82 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.96 213s All weights are 1 213s List of 1 213s $ m1: num 2.96 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.82 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s add_na: TRUE 213s num [1:15] 2.09 -2.74 4.24 3.56 NA ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num NA 213s All weights are 1 213s List of 1 213s $ m1: num NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num NA 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 3.12 213s All weights are 1 213s List of 1 213s $ m1: num 3.12 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.92 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num NA 213s First weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is Inf 213s List of 1 213s $ m1: num NA 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s weightedSd()...DONE 213s weightedMad()... 213s mode: integer 213s int [1:15] 0 -2 -4 2 -1 4 -4 4 0 3 ... 213s add_na: FALSE 213s int [1:15] 0 -2 -4 2 -1 4 -4 4 0 3 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 4.45 213s All weights are 1 213s List of 1 213s $ m1: num 4.45 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.97 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int 0 213s First weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 4.45 213s All weights are 1 213s List of 1 213s $ m1: num 4.45 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.97 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int 0 213s First weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s add_na: TRUE 213s int [1:15] 0 -2 -4 2 NA 4 NA 4 0 3 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num NA 213s All weights are 1 213s List of 1 213s $ m1: int NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: int NA 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int 0 213s First weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 4.45 213s All weights are 1 213s List of 1 213s $ m1: num 4.45 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 2.97 213s All weights are 0 213s List of 1 213s $ m1: int NA 213s First weight is 8.5 213s List of 1 213s $ m1: int 0 213s First weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is Inf 213s List of 1 213s $ m1: int 0 213s Last weight is NA 213s List of 1 213s $ m1: int NA 213s mode: double 213s num [1:15] 4.56 1.54 1.17 -2.07 1.08 ... 213s add_na: FALSE 213s num [1:15] 4.56 1.54 1.17 -2.07 1.08 ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.55 213s All weights are 1 213s List of 1 213s $ m1: num 2.55 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 3.13 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num 0 213s First weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.55 213s All weights are 1 213s List of 1 213s $ m1: num 2.55 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 3.13 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num 0 213s First weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s add_na: TRUE 213s num [1:15] 4.56 1.54 1.17 -2.07 NA ... 213s na.rm: FALSE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num NA 213s All weights are 1 213s List of 1 213s $ m1: num NA 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num NA 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num 0 213s First weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s na.rm: TRUE 213s Weights are not specified (all are 1) 213s List of 1 213s $ m1: num 2.55 213s All weights are 1 213s List of 1 213s $ m1: num 2.55 213s First weight is 5 213s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 213s List of 1 213s $ m1: num 3.16 213s All weights are 0 213s List of 1 213s $ m1: num NA 213s First weight is 8.5 213s List of 1 213s $ m1: num 0 213s First weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is Inf 213s List of 1 213s $ m1: num 0 213s Last weight is NA 213s List of 1 213s $ m1: num NA 213s weightedMad()...DONE 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s > 213s > fcns <- list( 213s + weightedVar = weightedVar, 213s + weightedSd = weightedSd, 213s + weightedMad = weightedMad 213s + ) 213s > 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Subsetted tests 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > source("utils/validateIndicesFramework.R") 213s > for (name in names(fcns)) { 213s + cat(sprintf("subsetted tests on %s()...\n", name)) 213s + fcn <- fcns[[name]] 213s + 213s + for (mode in c("numeric", "integer")) { 213s + x <- runif(6, min = -6, max = 6) 213s + w <- runif(6, min = 0, max = 6) 213s + storage.mode(x) <- mode 213s + storage.mode(w) <- mode 213s + if (mode == "numeric") w[1] <- Inf 213s + 213s + for (idxs in index_cases) { 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = fcn, fsure = fcn, 213s + na.rm = TRUE) 213s + validateIndicesTestVector_w(x, w, idxs, 213s + ftest = fcn, fsure = fcn, 213s + na.rm = FALSE) 213s + } 213s + } 213s + cat(sprintf("%s()...DONE\n", name)) 213s + } 213s subsetted tests on weightedVar()... 213s weightedVar()...DONE 213s subsetted tests on weightedSd()... 213s weightedSd()...DONE 213s subsetted tests on weightedMad()... 213s weightedMad()...DONE 213s > 213s 213s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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") 213s > 213s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 213s + if (na.rm) { 213s + xnok <- is.na(x) 213s + ynok <- is.na(y) 213s + anok <- xnok & ynok 213s + unit <- switch(OP, 213s + "+" = 0, 213s + "-" = NA_real_, 213s + "*" = 1, 213s + "/" = NA_real_, 213s + stop("Unknown 'OP' operator: ", OP) 213s + ) 213s + x[xnok] <- unit 213s + y[ynok] <- unit 213s + } 213s + 213s + ans <- switch(OP, 213s + "+" = x + y, 213s + "-" = x - y, 213s + "*" = x * y, 213s + "/" = x / y, 213s + stop("Unknown 'OP' operator: ", OP) 213s + ) 213s + 213s + if (na.rm) { 213s + ans[anok] <- NA_real_ 213s + } 213s + 213s + ans 213s + } # x_OP_y_R() 213s > 213s > 213s > 213s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 213s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 213s + } 213s > 213s > 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # No missing values 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > x <- matrix(1:16, nrow = 4, ncol = 4) 213s > y <- 1:nrow(x) 213s > storage.mode(y) <- storage.mode(x) 213s > 213s > for (OP in c("+", "-", "*", "/")) { 213s + for (na.rm in c(FALSE, TRUE)) { 213s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 213s + 213s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 213s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 213s + str(a1) 213s + stopifnot(all.equal(a1, a0)) 213s + 213s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 213s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 213s + str(b1) 213s + stopifnot(all.equal(b1, b0)) 213s + } 213s + } 213s OP = '+', na.rm = FALSE 213s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 213s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 213s OP = '+', na.rm = TRUE 213s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 213s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 213s OP = '-', na.rm = FALSE 213s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 213s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 213s OP = '-', na.rm = TRUE 213s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 213s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 213s OP = '*', na.rm = FALSE 213s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 213s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 213s OP = '*', na.rm = TRUE 213s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 213s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 213s OP = '/', na.rm = FALSE 213s num [1:4, 1:4] 1 1 1 1 5 ... 213s num [1:4, 1:4] 1 2 3 4 2.5 ... 213s OP = '/', na.rm = TRUE 213s num [1:4, 1:4] 1 1 1 1 5 ... 213s num [1:4, 1:4] 1 2 3 4 2.5 ... 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Missing values in x, y, or both. 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > for (which in c("x", "y", "both")) { 213s + x <- matrix(1:16, nrow = 4, ncol = 4) 213s + y <- 1:nrow(x) 213s + storage.mode(y) <- storage.mode(x) 213s + 213s + if (which == "x") { 213s + x[3:6] <- NA_real_ 213s + } else if (which == "y") { 213s + y[c(1, 3)] <- NA_real_ 213s + } else if (which == "both") { 213s + x[3:6] <- NA_real_ 213s + y[c(1, 3)] <- NA_real_ 213s + } 213s + 213s + for (OP in c("+", "-", "*", "/")) { 213s + for (na.rm in c(FALSE, TRUE)) { 213s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 213s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 213s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 213s + str(a1) 213s + stopifnot(all.equal(a1, a0)) 213s + 213s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 213s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 213s + str(b1) 213s + stopifnot(all.equal(b1, b0)) 213s + } 213s + } 213s + } 213s OP = '+', na.rm = FALSE 213s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 213s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 213s OP = '+', na.rm = TRUE 213s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 213s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 213s OP = '-', na.rm = FALSE 213s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 213s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 213s OP = '-', na.rm = TRUE 213s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 213s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 213s OP = '*', na.rm = FALSE 213s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 213s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 213s OP = '*', na.rm = TRUE 213s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 213s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 213s OP = '/', na.rm = FALSE 213s num [1:4, 1:4] 1 1 NA NA NA ... 213s num [1:4, 1:4] 1 2 NA NA NA ... 213s OP = '/', na.rm = TRUE 213s num [1:4, 1:4] 1 1 NA NA NA ... 213s num [1:4, 1:4] 1 2 NA NA NA ... 213s OP = '+', na.rm = FALSE 213s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 213s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 213s OP = '+', na.rm = TRUE 213s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 213s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 213s OP = '-', na.rm = FALSE 213s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 213s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 213s OP = '-', na.rm = TRUE 213s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 213s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 213s OP = '*', na.rm = FALSE 213s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 213s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 213s OP = '*', na.rm = TRUE 213s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 213s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 213s OP = '/', na.rm = FALSE 213s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 213s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 213s OP = '/', na.rm = TRUE 213s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 213s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 213s OP = '+', na.rm = FALSE 213s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 213s OP = '+', na.rm = TRUE 213s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 213s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 213s OP = '-', na.rm = FALSE 213s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 213s OP = '-', na.rm = TRUE 213s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 213s OP = '*', na.rm = FALSE 213s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 213s OP = '*', na.rm = TRUE 213s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 213s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 213s OP = '/', na.rm = FALSE 213s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 213s OP = '/', na.rm = TRUE 213s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 213s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 213s > 213s > 213s > 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > # Length differences 213s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 213s > x <- matrix(1:8, nrow = 2, ncol = 4) 213s > y <- 1:ncol(x) 213s > storage.mode(y) <- storage.mode(x) 213s > 213s > for (OP in c("+", "-", "*", "/")) { 213s + for (na.rm in c(FALSE, TRUE)) { 213s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 213s + 213s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 213s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 213s + str(a1) 213s + stopifnot(all.equal(a1, a0)) 213s + 213s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 213s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 213s + str(b1) 213s + stopifnot(all.equal(b1, b0)) 213s + } 213s + } 213s OP = '+', na.rm = FALSE 213s int [1:2, 1:4] 2 4 6 8 6 8 10 12 213s int [1:2, 1:4] 2 3 5 6 8 9 11 12 213s OP = '+', na.rm = TRUE 213s int [1:2, 1:4] 2 4 6 8 6 8 10 12 213s int [1:2, 1:4] 2 3 5 6 8 9 11 12 213s OP = '-', na.rm = FALSE 213s int [1:2, 1:4] 0 0 0 0 4 4 4 4 213s int [1:2, 1:4] 0 1 1 2 2 3 3 4 213s OP = '-', na.rm = TRUE 213s int [1:2, 1:4] 0 0 0 0 4 4 4 4 213s int [1:2, 1:4] 0 1 1 2 2 3 3 4 213s OP = '*', na.rm = FALSE 213s int [1:2, 1:4] 1 4 9 16 5 12 21 32 214s int [1:2, 1:4] 1 2 6 8 15 18 28 32 214s OP = '*', na.rm = TRUE 214s int [1:2, 1:4] 1 4 9 16 5 12 21 32 214s int [1:2, 1:4] 1 2 6 8 15 18 28 32 214s OP = '/', na.rm = FALSE 214s num [1:2, 1:4] 1 1 1 1 5 ... 214s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 214s OP = '/', na.rm = TRUE 214s num [1:2, 1:4] 1 1 1 1 5 ... 214s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # All missing values 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > xs <- list( 214s + A = matrix(1:2, nrow = 2, ncol = 2), 214s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 214s + ) 214s > ys <- list( 214s + A = 1L, 214s + B = NA_integer_ 214s + ) 214s > 214s > for (x in xs) { 214s + for (y in ys) { 214s + for (mode in c("logical", "integer", "double")) { 214s + storage.mode(x) <- mode 214s + storage.mode(y) <- mode 214s + str(list(x = x, y = y)) 214s + 214s + for (OP in c("+", "-", "*", "/")) { 214s + for (na.rm in c(FALSE, TRUE)) { 214s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 214s + suppressWarnings({ 214s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 214s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 214s + }) 214s + str(z) 214s + stopifnot(all.equal(z, z0)) 214s + } 214s + } 214s + } # for (mode ...) 214s + } # for (y ...) 214s + } # for (x ...) 214s List of 2 214s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 214s $ y: logi TRUE 214s mode = 'logical', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] 2 2 2 2 214s mode = 'logical', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 2 2 2 2 214s mode = 'logical', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] 0 0 0 0 214s mode = 'logical', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] 0 0 0 0 214s mode = 'logical', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s List of 2 214s $ x: int [1:2, 1:2] 1 1 1 1 214s $ y: int 1 214s mode = 'integer', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] 2 2 2 2 214s mode = 'integer', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 2 2 2 2 214s mode = 'integer', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] 0 0 0 0 214s mode = 'integer', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] 0 0 0 0 214s mode = 'integer', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s List of 2 214s $ x: num [1:2, 1:2] 1 1 1 1 214s $ y: num 1 214s mode = 'double', OP = '+', na.rm = FALSE 214s num [1:2, 1:2] 2 2 2 2 214s mode = 'double', OP = '+', na.rm = TRUE 214s num [1:2, 1:2] 2 2 2 2 214s mode = 'double', OP = '-', na.rm = FALSE 214s num [1:2, 1:2] 0 0 0 0 214s mode = 'double', OP = '-', na.rm = TRUE 214s num [1:2, 1:2] 0 0 0 0 214s mode = 'double', OP = '*', na.rm = FALSE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '*', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s List of 2 214s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 214s $ y: logi NA 214s mode = 'logical', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: int [1:2, 1:2] 1 1 1 1 214s $ y: int NA 214s mode = 'integer', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: num [1:2, 1:2] 1 1 1 1 214s $ y: num NA 214s mode = 'double', OP = '+', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '+', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '-', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '-', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: logi [1:2, 1:2] NA NA NA NA 214s $ y: logi TRUE 214s mode = 'logical', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'logical', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: int [1:2, 1:2] NA NA NA NA 214s $ y: int 1 214s mode = 'integer', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] 1 1 1 1 214s mode = 'integer', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: num [1:2, 1:2] NA NA NA NA 214s $ y: num 1 214s mode = 'double', OP = '+', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '+', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '-', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '-', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = TRUE 214s num [1:2, 1:2] 1 1 1 1 214s mode = 'double', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: logi [1:2, 1:2] NA NA NA NA 214s $ y: logi NA 214s mode = 'logical', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'logical', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: int [1:2, 1:2] NA NA NA NA 214s $ y: int NA 214s mode = 'integer', OP = '+', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '+', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '-', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '-', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = FALSE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '*', na.rm = TRUE 214s int [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'integer', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s List of 2 214s $ x: num [1:2, 1:2] NA NA NA NA 214s $ y: num NA 214s mode = 'double', OP = '+', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '+', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '-', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '-', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '*', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '/', na.rm = FALSE 214s num [1:2, 1:2] NA NA NA NA 214s mode = 'double', OP = '/', na.rm = TRUE 214s num [1:2, 1:2] NA NA NA NA 214s > 214s 214s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 214s + if (na.rm) { 214s + xnok <- is.na(x) 214s + ynok <- is.na(y) 214s + anok <- xnok & ynok 214s + unit <- switch(OP, 214s + "+" = 0, 214s + "-" = NA_real_, 214s + "*" = 1, 214s + "/" = NA_real_, 214s + stop("Unknown 'OP' operator: ", OP) 214s + ) 214s + x[xnok] <- unit 214s + y[ynok] <- unit 214s + } 214s + 214s + ans <- switch(OP, 214s + "+" = x + y, 214s + "-" = x - y, 214s + "*" = x * y, 214s + "/" = x / y, 214s + stop("Unknown 'OP' operator: ", OP) 214s + ) 214s + 214s + if (na.rm) { 214s + ans[anok] <- NA_real_ 214s + } 214s + 214s + ans 214s + } # x_OP_y_R() 214s > 214s > 214s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 214s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 214s + } 214s > 214s > 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > # Subsetted tests 214s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214s > source("utils/validateIndicesFramework.R") 214s > for (OP in c("+", "-", "*", "/")) { 214s + for (mode in c("numeric", "integer", "logical")) { 214s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 214s + y <- runif(6, min = 0, max = 6) 214s + storage.mode(x) <- mode 214s + storage.mode(y) <- mode 214s + if (mode == "numeric") y[1] <- Inf 214s + 214s + for (xrows in index_cases) { 214s + for (xcols in index_cases) { 214s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 214s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 214s + 214s + for (yidxs in list(xrows, xcols)) { 214s + for (na.rm in c(TRUE, FALSE)) { 214s + 214s + suppressWarnings({ 214s + actual <- tryCatch( 214s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 214s + na.rm = na.rm), 214s + error = function(c) "error" 214s + ) 214s + 214s + expect <- tryCatch( 214s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 214s + na.rm = na.rm), 214s + error = function(c) "error" 214s + ) 214s + }) 214s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 214s + 214s + suppressWarnings({ 214s + actual <- tryCatch( 214s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 214s + na.rm = na.rm), 214s + error = function(c) "error" 214s + ) 214s + 214s + expect <- tryCatch( 214s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 214s + na.rm = na.rm), 214s + error = function(c) "error" 214s + ) 214s + }) 214s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 214s + } 214s + } 214s + } 214s + } 214s + } 214s + } 215s > 215s 215s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 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 216s > ## These tests need to be last of all tests, otherwise 216s > ## covr::package_coverage() gives an error. 216s > cat("1. Loading package\n") 216s 1. Loading package 216s > loadNamespace("matrixStats") 216s 216s > stopifnot("matrixStats" %in% loadedNamespaces()) 216s > 216s > cat("2. Unloading package\n") 216s 2. Unloading package 216s > unloadNamespace("matrixStats") 216s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 216s > 216s > if (FALSE) { 216s + ## 'covr' gives "Error in library("matrixStats") : 216s + ## there is no package called 'matrixStats'" here, cf. 216s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 216s + 216s + cat("3. Attaching package\n") 216s + library("matrixStats") 216s + stopifnot("package:matrixStats" %in% search()) 216s + 216s + cat("4. Detaching package\n") 216s + detach("package:matrixStats") 216s + stopifnot(!"package:matrixStats" %in% search()) 216s + stopifnot("matrixStats" %in% loadedNamespaces()) 216s + 216s + cat("5. Unloading package\n") 216s + unloadNamespace("matrixStats") 216s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 216s + 216s + cat("6. Attaching package (again)\n") 216s + library("matrixStats") 216s + stopifnot("package:matrixStats" %in% search()) 216s + 216s + cat("7. Detaching package (again)\n") 216s + detach("package:matrixStats") 216s + stopifnot(!"package:matrixStats" %in% search()) 216s + stopifnot("matrixStats" %in% loadedNamespaces()) 216s + } 216s > 216s > cat("7. DONE\n") 216s 7. DONE 216s > 216s autopkgtest [05:30:05]: test run-unit-test: -----------------------] 216s autopkgtest [05:30:05]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 216s run-unit-test PASS 217s autopkgtest [05:30:06]: test pkg-r-autopkgtest: preparing testbed 236s Creating nova instance adt-resolute-amd64-r-cran-matrixstats-20260210-052629-juju-7f2275-prod-proposed-migration-environment-2-bcb2911b-cc5a-4553-b510-6a8e48ee2fa6 from image adt/ubuntu-resolute-amd64-server-20260204.img (UUID fedf54b4-458b-493e-8072-6425c19717b4)... 305s autopkgtest [05:31:34]: testbed dpkg architecture: amd64 306s autopkgtest [05:31:35]: testbed apt version: 3.1.14 306s autopkgtest [05:31:35]: @@@@@@@@@@@@@@@@@@@@ test bed setup 306s autopkgtest [05:31:35]: testbed release detected to be: resolute 307s autopkgtest [05:31:36]: updating testbed package index (apt update) 307s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 307s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 307s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 307s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 307s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [178 kB] 307s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1727 kB] 308s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [31.1 kB] 308s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main amd64 Packages [266 kB] 308s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main i386 Packages [219 kB] 308s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/main amd64 c-n-f Metadata [6184 B] 308s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/restricted amd64 c-n-f Metadata [120 B] 308s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/universe i386 Packages [792 kB] 308s Get:13 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 Packages [1787 kB] 308s Get:14 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 c-n-f Metadata [32.5 kB] 309s Get:15 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse amd64 Packages [26.4 kB] 309s Get:16 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse i386 Packages [5020 B] 309s Get:17 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse amd64 c-n-f Metadata [996 B] 309s Fetched 5197 kB in 2s (2919 kB/s) 310s Reading package lists... 310s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 310s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 310s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 310s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 311s Reading package lists... 311s Reading package lists... 311s Building dependency tree... 311s Reading state information... 311s Calculating upgrade... 311s The following package was automatically installed and is no longer required: 311s libpython3.13 311s Use 'sudo apt autoremove' to remove it. 311s The following NEW packages will be installed: 311s gcc-16-base libpython3.14 libpython3.14-minimal libpython3.14-stdlib 311s linux-headers-6.19.0-3 linux-headers-6.19.0-3-generic 311s linux-image-6.19.0-3-generic linux-modules-6.19.0-3-generic 311s linux-tools-6.19.0-3 linux-tools-6.19.0-3-generic 311s The following packages will be upgraded: 311s 3cpio amd64-microcode apt bpftool busybox-initramfs busybox-static 311s cryptsetup-bin dash dbus dbus-bin dbus-daemon dbus-session-bus-common 311s dbus-system-bus-common dbus-user-session debianutils dmsetup dracut-install 311s ethtool findutils gir1.2-girepository-3.0 gir1.2-glib-2.0 hwdata iproute2 311s iptables less libapt-pkg7.0 libatomic1 libattr1 libbpf1 libbrotli1 libbsd0 311s libcryptsetup12 libdbus-1-3 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common 311s libdrm2 libevent-core-2.1-7t64 libgcc-s1 libgdbm-compat4t64 libgdbm6t64 311s libgirepository-2.0-0 libglib2.0-0t64 libglib2.0-data libgpm2 libgudev-1.0-0 311s libidn2-0 libip4tc2 libip6tc2 libjansson4 libkeyutils1 liblsof0 311s libmaxminddb0 libnetfilter-conntrack3 libnpth0t64 libonig5 libpcap0.8t64 311s libpci3 libsensors-config libsensors5 libstdc++6 libusb-1.0-0 libwrap0 311s libxau6 libxkbcommon0 libxtables12 linux-generic linux-headers-generic 311s linux-headers-virtual linux-image-generic linux-image-virtual linux-perf 311s linux-tools-common linux-virtual lsof man-db mawk patch pciutils pnp.ids 311s pollinate python3-linkify-it python3-markdown-it python3-referencing sed 311s shared-mime-info tar tcpdump ubuntu-kernel-accessories ubuntu-standard wget 312s 91 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. 312s Need to get 237 MB of archives. 312s After this operation, 339 MB of additional disk space will be used. 312s Get:1 http://ftpmaster.internal/ubuntu resolute/main amd64 debianutils amd64 5.23.2build1 [93.3 kB] 312s Get:2 http://ftpmaster.internal/ubuntu resolute/main amd64 dash amd64 0.5.12-12ubuntu3 [96.0 kB] 312s Get:3 http://ftpmaster.internal/ubuntu resolute/main amd64 findutils amd64 4.10.0-3build2 [307 kB] 312s Get:4 http://ftpmaster.internal/ubuntu resolute/main amd64 sed amd64 4.9-2build3 [195 kB] 312s Get:5 http://ftpmaster.internal/ubuntu resolute/main amd64 tar amd64 1.35+dfsg-3.1build2 [257 kB] 312s Get:6 http://ftpmaster.internal/ubuntu resolute/main amd64 libattr1 amd64 1:2.5.2-3build2 [11.4 kB] 312s Get:7 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc-16-base amd64 16-20260208-1ubuntu1 [59.7 kB] 312s Get:8 http://ftpmaster.internal/ubuntu resolute/main amd64 libgcc-s1 amd64 16-20260208-1ubuntu1 [80.3 kB] 312s Get:9 http://ftpmaster.internal/ubuntu resolute/main amd64 libbsd0 amd64 0.12.2-2build2 [42.3 kB] 312s Get:10 http://ftpmaster.internal/ubuntu resolute/main amd64 mawk amd64 1.3.4.20260129-1 [133 kB] 312s Get:11 http://ftpmaster.internal/ubuntu resolute/main amd64 libstdc++6 amd64 16-20260208-1ubuntu1 [844 kB] 312s Get:12 http://ftpmaster.internal/ubuntu resolute/main amd64 libapt-pkg7.0 amd64 3.1.15 [1151 kB] 312s Get:13 http://ftpmaster.internal/ubuntu resolute/main amd64 apt amd64 3.1.15 [1479 kB] 313s Get:14 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-system-bus-common all 1.16.2-2ubuntu3 [55.8 kB] 313s Get:15 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-session-bus-common all 1.16.2-2ubuntu3 [54.4 kB] 313s Get:16 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-user-session amd64 1.16.2-2ubuntu3 [9696 B] 313s Get:17 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-daemon amd64 1.16.2-2ubuntu3 [119 kB] 313s Get:18 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus-bin amd64 1.16.2-2ubuntu3 [40.1 kB] 313s Get:19 http://ftpmaster.internal/ubuntu resolute/main amd64 dbus amd64 1.16.2-2ubuntu3 [24.2 kB] 313s Get:20 http://ftpmaster.internal/ubuntu resolute/main amd64 libdbus-1-3 amd64 1.16.2-2ubuntu3 [185 kB] 313s Get:21 http://ftpmaster.internal/ubuntu resolute/main amd64 libdevmapper1.02.1 amd64 2:1.02.205-2ubuntu3 [142 kB] 313s Get:22 http://ftpmaster.internal/ubuntu resolute/main amd64 dmsetup amd64 2:1.02.205-2ubuntu3 [79.4 kB] 313s Get:23 http://ftpmaster.internal/ubuntu resolute/main amd64 ethtool amd64 1:6.15-3build1 [318 kB] 313s Get:24 http://ftpmaster.internal/ubuntu resolute/main amd64 gir1.2-girepository-3.0 amd64 2.87.2-2 [25.2 kB] 313s Get:25 http://ftpmaster.internal/ubuntu resolute/main amd64 libgirepository-2.0-0 amd64 2.87.2-2 [76.1 kB] 313s Get:26 http://ftpmaster.internal/ubuntu resolute/main amd64 libatomic1 amd64 16-20260208-1ubuntu1 [11.4 kB] 313s Get:27 http://ftpmaster.internal/ubuntu resolute/main amd64 gir1.2-glib-2.0 amd64 2.87.2-2 [182 kB] 319s dpkg-preconfigure: unable to re-open stdin: No such file or directory 319s Get:28 http://ftpmaster.internal/ubuntu resolute/main amd64 libglib2.0-0t64 amd64 2.87.2-2 [1613 kB] 319s Get:29 http://ftpmaster.internal/ubuntu resolute/main amd64 libbpf1 amd64 1:1.6.2-1build1 [184 kB] 319s Get:30 http://ftpmaster.internal/ubuntu resolute/main amd64 iptables amd64 1.8.11-2ubuntu3 [381 kB] 319s Get:31 http://ftpmaster.internal/ubuntu resolute/main amd64 libip4tc2 amd64 1.8.11-2ubuntu3 [24.2 kB] 319s Get:32 http://ftpmaster.internal/ubuntu resolute/main amd64 libip6tc2 amd64 1.8.11-2ubuntu3 [24.4 kB] 319s Get:33 http://ftpmaster.internal/ubuntu resolute/main amd64 libnetfilter-conntrack3 amd64 1.1.1-1 [47.5 kB] 319s Get:34 http://ftpmaster.internal/ubuntu resolute/main amd64 libxtables12 amd64 1.8.11-2ubuntu3 [36.6 kB] 319s Get:35 http://ftpmaster.internal/ubuntu resolute/main amd64 iproute2 amd64 6.18.0-1ubuntu1 [1178 kB] 319s Get:36 http://ftpmaster.internal/ubuntu resolute/main amd64 less amd64 668-1build1 [172 kB] 319s Get:37 http://ftpmaster.internal/ubuntu resolute/main amd64 libcryptsetup12 amd64 2:2.8.0-1ubuntu3 [283 kB] 319s Get:38 http://ftpmaster.internal/ubuntu resolute/main amd64 libglib2.0-data all 2.87.2-2 [58.2 kB] 319s Get:39 http://ftpmaster.internal/ubuntu resolute/main amd64 libidn2-0 amd64 2.3.8-4build1 [67.6 kB] 319s Get:40 http://ftpmaster.internal/ubuntu resolute/main amd64 libkeyutils1 amd64 1.6.3-6ubuntu3 [10.6 kB] 319s Get:41 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-linkify-it all 2.0.3-1ubuntu3 [19.4 kB] 319s Get:42 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-markdown-it all 3.0.0-3build1 [54.4 kB] 319s Get:43 http://ftpmaster.internal/ubuntu resolute/main amd64 shared-mime-info amd64 2.4-5build3 [476 kB] 319s Get:44 http://ftpmaster.internal/ubuntu resolute/main amd64 busybox-static amd64 1:1.37.0-7ubuntu1 [1034 kB] 319s Get:45 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm-common all 2.4.131-1 [9774 B] 319s Get:46 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm2 amd64 2.4.131-1 [42.3 kB] 319s Get:47 http://ftpmaster.internal/ubuntu resolute/main amd64 libgdbm6t64 amd64 1.26-1build1 [36.5 kB] 319s Get:48 http://ftpmaster.internal/ubuntu resolute/main amd64 libgpm2 amd64 1.20.7-12build1 [14.4 kB] 319s Get:49 http://ftpmaster.internal/ubuntu resolute/main amd64 libjansson4 amd64 2.14-2build4 [33.2 kB] 319s Get:50 http://ftpmaster.internal/ubuntu resolute/main amd64 lsof amd64 4.99.4+dfsg-2build2 [239 kB] 319s Get:51 http://ftpmaster.internal/ubuntu resolute/main amd64 liblsof0 amd64 4.99.4+dfsg-2build2 [56.5 kB] 319s Get:52 http://ftpmaster.internal/ubuntu resolute/main amd64 libmaxminddb0 amd64 1.12.2-1build2 [18.9 kB] 319s Get:53 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcap0.8t64 amd64 1.10.5-2ubuntu3 [154 kB] 319s Get:54 http://ftpmaster.internal/ubuntu resolute/main amd64 pciutils amd64 1:3.14.0-1build2 [95.5 kB] 319s Get:55 http://ftpmaster.internal/ubuntu resolute/main amd64 libpci3 amd64 1:3.14.0-1build2 [38.1 kB] 319s Get:56 http://ftpmaster.internal/ubuntu resolute/main amd64 libsensors-config all 1:3.6.2-2build1 [6862 B] 319s Get:57 http://ftpmaster.internal/ubuntu resolute/main amd64 libsensors5 amd64 1:3.6.2-2build1 [28.9 kB] 319s Get:58 http://ftpmaster.internal/ubuntu resolute/main amd64 libusb-1.0-0 amd64 2:1.0.29-2build1 [56.9 kB] 319s Get:59 http://ftpmaster.internal/ubuntu resolute/main amd64 libxau6 amd64 1:1.0.11-1build2 [7502 B] 319s Get:60 http://ftpmaster.internal/ubuntu resolute/main amd64 libxkbcommon0 amd64 1.13.1-1 [159 kB] 319s Get:61 http://ftpmaster.internal/ubuntu resolute/main amd64 man-db amd64 2.13.1-1build1 [1392 kB] 319s Get:62 http://ftpmaster.internal/ubuntu resolute/main amd64 tcpdump amd64 4.99.5-2ubuntu3 [477 kB] 319s Get:63 http://ftpmaster.internal/ubuntu resolute/main amd64 wget amd64 1.25.0-2ubuntu4 [353 kB] 319s Get:64 http://ftpmaster.internal/ubuntu resolute/main amd64 ubuntu-standard amd64 1.564 [13.3 kB] 319s Get:65 http://ftpmaster.internal/ubuntu resolute/main amd64 3cpio amd64 0.14.0-1ubuntu1 [285 kB] 319s Get:66 http://ftpmaster.internal/ubuntu resolute/main amd64 bpftool amd64 7.7.0+6.19.0-3.3 [1229 kB] 319s Get:67 http://ftpmaster.internal/ubuntu resolute/main amd64 busybox-initramfs amd64 1:1.37.0-7ubuntu1 [191 kB] 319s Get:68 http://ftpmaster.internal/ubuntu resolute/main amd64 cryptsetup-bin amd64 2:2.8.0-1ubuntu3 [228 kB] 319s Get:69 http://ftpmaster.internal/ubuntu resolute/main amd64 dracut-install amd64 109-11ubuntu1 [45.8 kB] 319s Get:70 http://ftpmaster.internal/ubuntu resolute/main amd64 hwdata all 0.394-1build1 [1566 B] 319s Get:71 http://ftpmaster.internal/ubuntu resolute/main amd64 pnp.ids all 0.394-1build1 [29.6 kB] 319s Get:72 http://ftpmaster.internal/ubuntu resolute/main amd64 libbrotli1 amd64 1.2.0-3 [343 kB] 319s Get:73 http://ftpmaster.internal/ubuntu resolute/main amd64 libdrm-amdgpu1 amd64 2.4.131-1 [23.2 kB] 319s Get:74 http://ftpmaster.internal/ubuntu resolute/main amd64 libevent-core-2.1-7t64 amd64 2.1.12-stable-10build2 [93.1 kB] 319s Get:75 http://ftpmaster.internal/ubuntu resolute/main amd64 libgdbm-compat4t64 amd64 1.26-1build1 [6796 B] 319s Get:76 http://ftpmaster.internal/ubuntu resolute/main amd64 libgudev-1.0-0 amd64 1:238-7build1 [15.9 kB] 319s Get:77 http://ftpmaster.internal/ubuntu resolute/main amd64 libnpth0t64 amd64 1.8-3build1 [9302 B] 319s Get:78 http://ftpmaster.internal/ubuntu resolute/main amd64 libonig5 amd64 6.9.10-1build1 [174 kB] 319s Get:79 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14-minimal amd64 3.14.2-1 [920 kB] 319s Get:80 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14-stdlib amd64 3.14.2-1 [2398 kB] 319s Get:81 http://ftpmaster.internal/ubuntu resolute/main amd64 libpython3.14 amd64 3.14.2-1 [2568 kB] 319s Get:82 http://ftpmaster.internal/ubuntu resolute/main amd64 libwrap0 amd64 7.6.q-36build2 [48.5 kB] 319s Get:83 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-modules-6.19.0-3-generic amd64 6.19.0-3.3 [171 MB] 319s Get:84 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-6.19.0-3-generic amd64 6.19.0-3.3+1 [16.8 MB] 319s Get:85 http://ftpmaster.internal/ubuntu resolute/main amd64 amd64-microcode amd64 3.20251202.1ubuntu1 [459 kB] 319s Get:86 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-generic amd64 6.19.0-3.3 [1698 B] 319s Get:87 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-generic amd64 6.19.0-3.3 [12.2 kB] 319s Get:88 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-virtual amd64 6.19.0-3.3 [1700 B] 319s Get:89 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-image-virtual amd64 6.19.0-3.3 [12.1 kB] 319s Get:90 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-virtual amd64 6.19.0-3.3 [1646 B] 319s Get:91 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-6.19.0-3 all 6.19.0-3.3 [14.9 MB] 319s Get:92 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-6.19.0-3-generic amd64 6.19.0-3.3 [4330 kB] 319s Get:93 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-headers-generic amd64 6.19.0-3.3 [12.0 kB] 319s Get:94 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-perf amd64 6.19.0-3.3 [4480 kB] 319s Get:95 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-common all 6.19.0-3.3 [345 kB] 319s Get:96 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-6.19.0-3 amd64 6.19.0-3.3 [1455 kB] 319s Get:97 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-tools-6.19.0-3-generic amd64 6.19.0-3.3 [1612 B] 319s Get:98 http://ftpmaster.internal/ubuntu resolute/main amd64 patch amd64 2.8-2build1 [95.7 kB] 319s Get:99 http://ftpmaster.internal/ubuntu resolute/main amd64 pollinate all 4.33-4ubuntu5 [14.0 kB] 319s Get:100 http://ftpmaster.internal/ubuntu resolute/main amd64 python3-referencing all 0.36.2-1ubuntu2 [22.2 kB] 319s Get:101 http://ftpmaster.internal/ubuntu resolute/main amd64 ubuntu-kernel-accessories amd64 1.564 [13.1 kB] 319s Fetched 237 MB in 5s (49.0 MB/s) 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../debianutils_5.23.2build1_amd64.deb ... 319s Unpacking debianutils (5.23.2build1) over (5.23.2) ... 319s Setting up debianutils (5.23.2build1) ... 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../dash_0.5.12-12ubuntu3_amd64.deb ... 319s Unpacking dash (0.5.12-12ubuntu3) over (0.5.12-12ubuntu2) ... 319s Setting up dash (0.5.12-12ubuntu3) ... 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../findutils_4.10.0-3build2_amd64.deb ... 319s Unpacking findutils (4.10.0-3build2) over (4.10.0-3build1) ... 319s Setting up findutils (4.10.0-3build2) ... 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../sed_4.9-2build3_amd64.deb ... 319s Unpacking sed (4.9-2build3) over (4.9-2build2) ... 319s Setting up sed (4.9-2build3) ... 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../tar_1.35+dfsg-3.1build2_amd64.deb ... 319s Unpacking tar (1.35+dfsg-3.1build2) over (1.35+dfsg-3.1build1) ... 319s Setting up tar (1.35+dfsg-3.1build2) ... 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../libattr1_1%3a2.5.2-3build2_amd64.deb ... 319s Unpacking libattr1:amd64 (1:2.5.2-3build2) over (1:2.5.2-3build1) ... 319s Setting up libattr1:amd64 (1:2.5.2-3build2) ... 319s Selecting previously unselected package gcc-16-base:amd64. 319s (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 ... 83957 files and directories currently installed.) 319s Preparing to unpack .../gcc-16-base_16-20260208-1ubuntu1_amd64.deb ... 319s Unpacking gcc-16-base:amd64 (16-20260208-1ubuntu1) ... 319s Setting up gcc-16-base:amd64 (16-20260208-1ubuntu1) ... 319s (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 ... 83962 files and directories currently installed.) 319s Preparing to unpack .../libgcc-s1_16-20260208-1ubuntu1_amd64.deb ... 319s Unpacking libgcc-s1:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 319s Setting up libgcc-s1:amd64 (16-20260208-1ubuntu1) ... 319s (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 ... 83962 files and directories currently installed.) 319s Preparing to unpack .../00-libbsd0_0.12.2-2build2_amd64.deb ... 319s Unpacking libbsd0:amd64 (0.12.2-2build2) over (0.12.2-2build1) ... 319s Preparing to unpack .../01-mawk_1.3.4.20260129-1_amd64.deb ... 319s Unpacking mawk (1.3.4.20260129-1) over (1.3.4.20250131-2) ... 319s Preparing to unpack .../02-libstdc++6_16-20260208-1ubuntu1_amd64.deb ... 319s Unpacking libstdc++6:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 319s Preparing to unpack .../03-libapt-pkg7.0_3.1.15_amd64.deb ... 319s Unpacking libapt-pkg7.0:amd64 (3.1.15) over (3.1.14) ... 319s Preparing to unpack .../04-apt_3.1.15_amd64.deb ... 319s Unpacking apt (3.1.15) over (3.1.14) ... 319s Preparing to unpack .../05-dbus-system-bus-common_1.16.2-2ubuntu3_all.deb ... 319s Unpacking dbus-system-bus-common (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../06-dbus-session-bus-common_1.16.2-2ubuntu3_all.deb ... 319s Unpacking dbus-session-bus-common (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../07-dbus-user-session_1.16.2-2ubuntu3_amd64.deb ... 319s Unpacking dbus-user-session (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../08-dbus-daemon_1.16.2-2ubuntu3_amd64.deb ... 319s Unpacking dbus-daemon (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../09-dbus-bin_1.16.2-2ubuntu3_amd64.deb ... 319s Unpacking dbus-bin (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../10-dbus_1.16.2-2ubuntu3_amd64.deb ... 319s Unpacking dbus (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../11-libdbus-1-3_1.16.2-2ubuntu3_amd64.deb ... 319s Unpacking libdbus-1-3:amd64 (1.16.2-2ubuntu3) over (1.16.2-2ubuntu2) ... 319s Preparing to unpack .../12-libdevmapper1.02.1_2%3a1.02.205-2ubuntu3_amd64.deb ... 319s Unpacking libdevmapper1.02.1:amd64 (2:1.02.205-2ubuntu3) over (2:1.02.205-2ubuntu2) ... 319s Preparing to unpack .../13-dmsetup_2%3a1.02.205-2ubuntu3_amd64.deb ... 319s Unpacking dmsetup (2:1.02.205-2ubuntu3) over (2:1.02.205-2ubuntu2) ... 319s Preparing to unpack .../14-ethtool_1%3a6.15-3build1_amd64.deb ... 319s Unpacking ethtool (1:6.15-3build1) over (1:6.15-3) ... 319s Preparing to unpack .../15-gir1.2-girepository-3.0_2.87.2-2_amd64.deb ... 319s Unpacking gir1.2-girepository-3.0:amd64 (2.87.2-2) over (2.86.3-4) ... 319s Preparing to unpack .../16-libgirepository-2.0-0_2.87.2-2_amd64.deb ... 319s Unpacking libgirepository-2.0-0:amd64 (2.87.2-2) over (2.86.3-4) ... 319s Preparing to unpack .../17-libatomic1_16-20260208-1ubuntu1_amd64.deb ... 319s Unpacking libatomic1:amd64 (16-20260208-1ubuntu1) over (15.2.0-12ubuntu1) ... 319s Preparing to unpack .../18-gir1.2-glib-2.0_2.87.2-2_amd64.deb ... 319s Unpacking gir1.2-glib-2.0:amd64 (2.87.2-2) over (2.86.3-4) ... 319s Preparing to unpack .../19-libglib2.0-0t64_2.87.2-2_amd64.deb ... 319s Unpacking libglib2.0-0t64:amd64 (2.87.2-2) over (2.86.3-4) ... 319s Preparing to unpack .../20-libbpf1_1%3a1.6.2-1build1_amd64.deb ... 319s Unpacking libbpf1:amd64 (1:1.6.2-1build1) over (1:1.6.2-1) ... 319s Preparing to unpack .../21-iptables_1.8.11-2ubuntu3_amd64.deb ... 319s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 319s Preparing to unpack .../22-libip4tc2_1.8.11-2ubuntu3_amd64.deb ... 319s Unpacking libip4tc2:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 319s Preparing to unpack .../23-libip6tc2_1.8.11-2ubuntu3_amd64.deb ... 319s Unpacking libip6tc2:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 319s Preparing to unpack .../24-libnetfilter-conntrack3_1.1.1-1_amd64.deb ... 319s Unpacking libnetfilter-conntrack3:amd64 (1.1.1-1) over (1.1.0-1build1) ... 319s Preparing to unpack .../25-libxtables12_1.8.11-2ubuntu3_amd64.deb ... 319s Unpacking libxtables12:amd64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 319s Preparing to unpack .../26-iproute2_6.18.0-1ubuntu1_amd64.deb ... 319s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 319s Preparing to unpack .../27-less_668-1build1_amd64.deb ... 319s Unpacking less (668-1build1) over (668-1) ... 319s Preparing to unpack .../28-libcryptsetup12_2%3a2.8.0-1ubuntu3_amd64.deb ... 319s Unpacking libcryptsetup12:amd64 (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 319s Preparing to unpack .../29-libglib2.0-data_2.87.2-2_all.deb ... 319s Unpacking libglib2.0-data (2.87.2-2) over (2.86.3-4) ... 319s Preparing to unpack .../30-libidn2-0_2.3.8-4build1_amd64.deb ... 319s Unpacking libidn2-0:amd64 (2.3.8-4build1) over (2.3.8-4) ... 319s Preparing to unpack .../31-libkeyutils1_1.6.3-6ubuntu3_amd64.deb ... 319s Unpacking libkeyutils1:amd64 (1.6.3-6ubuntu3) over (1.6.3-6ubuntu2) ... 319s Preparing to unpack .../32-python3-linkify-it_2.0.3-1ubuntu3_all.deb ... 319s Unpacking python3-linkify-it (2.0.3-1ubuntu3) over (2.0.3-1ubuntu2) ... 319s Preparing to unpack .../33-python3-markdown-it_3.0.0-3build1_all.deb ... 319s Unpacking python3-markdown-it (3.0.0-3build1) over (3.0.0-3) ... 319s Preparing to unpack .../34-shared-mime-info_2.4-5build3_amd64.deb ... 319s Unpacking shared-mime-info (2.4-5build3) over (2.4-5build2) ... 319s Preparing to unpack .../35-busybox-static_1%3a1.37.0-7ubuntu1_amd64.deb ... 319s Unpacking busybox-static (1:1.37.0-7ubuntu1) over (1:1.37.0-4ubuntu1) ... 319s Preparing to unpack .../36-libdrm-common_2.4.131-1_all.deb ... 319s Unpacking libdrm-common (2.4.131-1) over (2.4.129-1) ... 319s Preparing to unpack .../37-libdrm2_2.4.131-1_amd64.deb ... 319s Unpacking libdrm2:amd64 (2.4.131-1) over (2.4.129-1) ... 319s Preparing to unpack .../38-libgdbm6t64_1.26-1build1_amd64.deb ... 319s Unpacking libgdbm6t64:amd64 (1.26-1build1) over (1.26-1) ... 319s Preparing to unpack .../39-libgpm2_1.20.7-12build1_amd64.deb ... 319s Unpacking libgpm2:amd64 (1.20.7-12build1) over (1.20.7-12) ... 319s Preparing to unpack .../40-libjansson4_2.14-2build4_amd64.deb ... 319s Unpacking libjansson4:amd64 (2.14-2build4) over (2.14-2build3) ... 319s Preparing to unpack .../41-lsof_4.99.4+dfsg-2build2_amd64.deb ... 319s Unpacking lsof (4.99.4+dfsg-2build2) over (4.99.4+dfsg-2build1) ... 319s Preparing to unpack .../42-liblsof0_4.99.4+dfsg-2build2_amd64.deb ... 319s Unpacking liblsof0 (4.99.4+dfsg-2build2) over (4.99.4+dfsg-2build1) ... 319s Preparing to unpack .../43-libmaxminddb0_1.12.2-1build2_amd64.deb ... 319s Unpacking libmaxminddb0:amd64 (1.12.2-1build2) over (1.12.2-1build1) ... 319s Preparing to unpack .../44-libpcap0.8t64_1.10.5-2ubuntu3_amd64.deb ... 319s Unpacking libpcap0.8t64:amd64 (1.10.5-2ubuntu3) over (1.10.5-2ubuntu2) ... 319s Preparing to unpack .../45-pciutils_1%3a3.14.0-1build2_amd64.deb ... 319s Unpacking pciutils (1:3.14.0-1build2) over (1:3.14.0-1build1) ... 319s Preparing to unpack .../46-libpci3_1%3a3.14.0-1build2_amd64.deb ... 319s Unpacking libpci3:amd64 (1:3.14.0-1build2) over (1:3.14.0-1build1) ... 319s Preparing to unpack .../47-libsensors-config_1%3a3.6.2-2build1_all.deb ... 319s Unpacking libsensors-config (1:3.6.2-2build1) over (1:3.6.2-2) ... 319s Preparing to unpack .../48-libsensors5_1%3a3.6.2-2build1_amd64.deb ... 319s Unpacking libsensors5:amd64 (1:3.6.2-2build1) over (1:3.6.2-2) ... 319s Preparing to unpack .../49-libusb-1.0-0_2%3a1.0.29-2build1_amd64.deb ... 319s Unpacking libusb-1.0-0:amd64 (2:1.0.29-2build1) over (2:1.0.29-2) ... 319s Preparing to unpack .../50-libxau6_1%3a1.0.11-1build2_amd64.deb ... 319s Unpacking libxau6:amd64 (1:1.0.11-1build2) over (1:1.0.11-1build1) ... 319s Preparing to unpack .../51-libxkbcommon0_1.13.1-1_amd64.deb ... 319s Unpacking libxkbcommon0:amd64 (1.13.1-1) over (1.12.3-1) ... 319s Preparing to unpack .../52-man-db_2.13.1-1build1_amd64.deb ... 319s Unpacking man-db (2.13.1-1build1) over (2.13.1-1) ... 319s Preparing to unpack .../53-tcpdump_4.99.5-2ubuntu3_amd64.deb ... 319s Unpacking tcpdump (4.99.5-2ubuntu3) over (4.99.5-2ubuntu2) ... 319s Preparing to unpack .../54-wget_1.25.0-2ubuntu4_amd64.deb ... 319s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 319s Preparing to unpack .../55-ubuntu-standard_1.564_amd64.deb ... 319s Unpacking ubuntu-standard (1.564) over (1.563) ... 319s Preparing to unpack .../56-3cpio_0.14.0-1ubuntu1_amd64.deb ... 319s Unpacking 3cpio (0.14.0-1ubuntu1) over (0.13.1-1ubuntu1) ... 319s Preparing to unpack .../57-bpftool_7.7.0+6.19.0-3.3_amd64.deb ... 319s Unpacking bpftool (7.7.0+6.19.0-3.3) over (7.7.0+6.18.0-9.9) ... 320s Preparing to unpack .../58-busybox-initramfs_1%3a1.37.0-7ubuntu1_amd64.deb ... 320s Unpacking busybox-initramfs (1:1.37.0-7ubuntu1) over (1:1.37.0-4ubuntu1) ... 320s Preparing to unpack .../59-cryptsetup-bin_2%3a2.8.0-1ubuntu3_amd64.deb ... 320s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 320s Preparing to unpack .../60-dracut-install_109-11ubuntu1_amd64.deb ... 320s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 320s Preparing to unpack .../61-hwdata_0.394-1build1_all.deb ... 320s Unpacking hwdata (0.394-1build1) over (0.394-1) ... 320s Preparing to unpack .../62-pnp.ids_0.394-1build1_all.deb ... 320s Unpacking pnp.ids (0.394-1build1) over (0.394-1) ... 320s Preparing to unpack .../63-libbrotli1_1.2.0-3_amd64.deb ... 320s Unpacking libbrotli1:amd64 (1.2.0-3) over (1.1.0-2build6) ... 320s Preparing to unpack .../64-libdrm-amdgpu1_2.4.131-1_amd64.deb ... 320s Unpacking libdrm-amdgpu1:amd64 (2.4.131-1) over (2.4.129-1) ... 320s Preparing to unpack .../65-libevent-core-2.1-7t64_2.1.12-stable-10build2_amd64.deb ... 320s Unpacking libevent-core-2.1-7t64:amd64 (2.1.12-stable-10build2) over (2.1.12-stable-10build1) ... 320s Preparing to unpack .../66-libgdbm-compat4t64_1.26-1build1_amd64.deb ... 320s Unpacking libgdbm-compat4t64:amd64 (1.26-1build1) over (1.26-1) ... 320s Preparing to unpack .../67-libgudev-1.0-0_1%3a238-7build1_amd64.deb ... 320s Unpacking libgudev-1.0-0:amd64 (1:238-7build1) over (1:238-7) ... 320s Preparing to unpack .../68-libnpth0t64_1.8-3build1_amd64.deb ... 320s Unpacking libnpth0t64:amd64 (1.8-3build1) over (1.8-3) ... 320s Preparing to unpack .../69-libonig5_6.9.10-1build1_amd64.deb ... 320s Unpacking libonig5:amd64 (6.9.10-1build1) over (6.9.10-1) ... 320s Selecting previously unselected package libpython3.14-minimal:amd64. 320s Preparing to unpack .../70-libpython3.14-minimal_3.14.2-1_amd64.deb ... 320s Unpacking libpython3.14-minimal:amd64 (3.14.2-1) ... 320s Selecting previously unselected package libpython3.14-stdlib:amd64. 320s Preparing to unpack .../71-libpython3.14-stdlib_3.14.2-1_amd64.deb ... 320s Unpacking libpython3.14-stdlib:amd64 (3.14.2-1) ... 320s Selecting previously unselected package libpython3.14:amd64. 320s Preparing to unpack .../72-libpython3.14_3.14.2-1_amd64.deb ... 320s Unpacking libpython3.14:amd64 (3.14.2-1) ... 320s Preparing to unpack .../73-libwrap0_7.6.q-36build2_amd64.deb ... 320s Unpacking libwrap0:amd64 (7.6.q-36build2) over (7.6.q-36build1) ... 320s Selecting previously unselected package linux-modules-6.19.0-3-generic. 320s Preparing to unpack .../74-linux-modules-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 320s Unpacking linux-modules-6.19.0-3-generic (6.19.0-3.3) ... 321s Selecting previously unselected package linux-image-6.19.0-3-generic. 321s Preparing to unpack .../75-linux-image-6.19.0-3-generic_6.19.0-3.3+1_amd64.deb ... 321s Unpacking linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 321s Preparing to unpack .../76-amd64-microcode_3.20251202.1ubuntu1_amd64.deb ... 321s Unpacking amd64-microcode (3.20251202.1ubuntu1) over (3.20250708.1ubuntu1) ... 321s Preparing to unpack .../77-linux-generic_6.19.0-3.3_amd64.deb ... 321s Unpacking linux-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 321s Preparing to unpack .../78-linux-image-generic_6.19.0-3.3_amd64.deb ... 321s Unpacking linux-image-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 321s Preparing to unpack .../79-linux-virtual_6.19.0-3.3_amd64.deb ... 321s Unpacking linux-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 321s Preparing to unpack .../80-linux-image-virtual_6.19.0-3.3_amd64.deb ... 321s Unpacking linux-image-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 321s Preparing to unpack .../81-linux-headers-virtual_6.19.0-3.3_amd64.deb ... 321s Unpacking linux-headers-virtual (6.19.0-3.3) over (6.18.0-9.9+1) ... 321s Selecting previously unselected package linux-headers-6.19.0-3. 321s Preparing to unpack .../82-linux-headers-6.19.0-3_6.19.0-3.3_all.deb ... 321s Unpacking linux-headers-6.19.0-3 (6.19.0-3.3) ... 322s Selecting previously unselected package linux-headers-6.19.0-3-generic. 322s Preparing to unpack .../83-linux-headers-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 322s Unpacking linux-headers-6.19.0-3-generic (6.19.0-3.3) ... 323s Preparing to unpack .../84-linux-headers-generic_6.19.0-3.3_amd64.deb ... 323s Unpacking linux-headers-generic (6.19.0-3.3) over (6.18.0-9.9+1) ... 323s Preparing to unpack .../85-linux-perf_6.19.0-3.3_amd64.deb ... 323s Unpacking linux-perf (6.19.0-3.3) over (6.18.0-9.9) ... 323s Preparing to unpack .../86-linux-tools-common_6.19.0-3.3_all.deb ... 323s Unpacking linux-tools-common (6.19.0-3.3) over (6.18.0-9.9) ... 323s Selecting previously unselected package linux-tools-6.19.0-3. 323s Preparing to unpack .../87-linux-tools-6.19.0-3_6.19.0-3.3_amd64.deb ... 323s Unpacking linux-tools-6.19.0-3 (6.19.0-3.3) ... 323s Selecting previously unselected package linux-tools-6.19.0-3-generic. 323s Preparing to unpack .../88-linux-tools-6.19.0-3-generic_6.19.0-3.3_amd64.deb ... 323s Unpacking linux-tools-6.19.0-3-generic (6.19.0-3.3) ... 323s Preparing to unpack .../89-patch_2.8-2build1_amd64.deb ... 323s Unpacking patch (2.8-2build1) over (2.8-2) ... 323s Preparing to unpack .../90-pollinate_4.33-4ubuntu5_all.deb ... 323s Unpacking pollinate (4.33-4ubuntu5) over (4.33-4ubuntu4) ... 323s Preparing to unpack .../91-python3-referencing_0.36.2-1ubuntu2_all.deb ... 323s Unpacking python3-referencing (0.36.2-1ubuntu2) over (0.36.2-1ubuntu1) ... 323s Preparing to unpack .../92-ubuntu-kernel-accessories_1.564_amd64.deb ... 323s Unpacking ubuntu-kernel-accessories (1.564) over (1.563) ... 323s Setting up libip4tc2:amd64 (1.8.11-2ubuntu3) ... 323s Setting up 3cpio (0.14.0-1ubuntu1) ... 323s Setting up libxau6:amd64 (1:1.0.11-1build2) ... 323s Setting up libnpth0t64:amd64 (1.8-3build1) ... 323s Setting up libkeyutils1:amd64 (1.6.3-6ubuntu3) ... 323s Setting up ubuntu-kernel-accessories (1.564) ... 323s Setting up libgpm2:amd64 (1.20.7-12build1) ... 323s Setting up libgdbm6t64:amd64 (1.26-1build1) ... 323s Setting up linux-modules-6.19.0-3-generic (6.19.0-3.3) ... 324s Setting up libgdbm-compat4t64:amd64 (1.26-1build1) ... 324s Setting up bpftool (7.7.0+6.19.0-3.3) ... 324s Setting up libip6tc2:amd64 (1.8.11-2ubuntu3) ... 324s Setting up liblsof0 (4.99.4+dfsg-2build2) ... 324s Setting up libmaxminddb0:amd64 (1.12.2-1build2) ... 324s Setting up libbrotli1:amd64 (1.2.0-3) ... 324s Setting up libpython3.14-minimal:amd64 (3.14.2-1) ... 324s Setting up libsensors-config (1:3.6.2-2build1) ... 324s Setting up less (668-1build1) ... 324s Setting up linux-headers-6.19.0-3 (6.19.0-3.3) ... 324s Setting up libidn2-0:amd64 (2.3.8-4build1) ... 324s Setting up amd64-microcode (3.20251202.1ubuntu1) ... 324s amd64-microcode: microcode will be updated at next boot 324s Setting up man-db (2.13.1-1build1) ... 324s Updating database of manual pages ... 326s man-db.service is a disabled or a static unit not running, not starting it. 326s Setting up libjansson4:amd64 (2.14-2build4) ... 326s Setting up libglib2.0-data (2.87.2-2) ... 326s Setting up pollinate (4.33-4ubuntu5) ... 336s Setting up busybox-static (1:1.37.0-7ubuntu1) ... 336s Setting up libwrap0:amd64 (7.6.q-36build2) ... 336s Setting up linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 338s I: /boot/vmlinuz is now a symlink to vmlinuz-6.19.0-3-generic 338s I: /boot/initrd.img is now a symlink to initrd.img-6.19.0-3-generic 338s Setting up libdbus-1-3:amd64 (1.16.2-2ubuntu3) ... 338s Setting up libatomic1:amd64 (16-20260208-1ubuntu1) ... 338s Setting up patch (2.8-2build1) ... 338s Setting up libsensors5:amd64 (1:3.6.2-2build1) ... 338s Setting up busybox-initramfs (1:1.37.0-7ubuntu1) ... 338s Setting up libxtables12:amd64 (1.8.11-2ubuntu3) ... 338s Setting up lsof (4.99.4+dfsg-2build2) ... 338s Setting up libpci3:amd64 (1:3.14.0-1build2) ... 338s Setting up libdevmapper1.02.1:amd64 (2:1.02.205-2ubuntu3) ... 338s Setting up dracut-install (109-11ubuntu1) ... 338s Setting up dmsetup (2:1.02.205-2ubuntu3) ... 338s Setting up libnetfilter-conntrack3:amd64 (1.1.1-1) ... 338s Setting up pnp.ids (0.394-1build1) ... 338s Setting up dbus-session-bus-common (1.16.2-2ubuntu3) ... 338s Setting up python3-linkify-it (2.0.3-1ubuntu3) ... 338s Setting up libpcap0.8t64:amd64 (1.10.5-2ubuntu3) ... 338s Setting up libcryptsetup12:amd64 (2:2.8.0-1ubuntu3) ... 338s Setting up mawk (1.3.4.20260129-1) ... 338s Setting up libevent-core-2.1-7t64:amd64 (2.1.12-stable-10build2) ... 338s Setting up libusb-1.0-0:amd64 (2:1.0.29-2build1) ... 338s Setting up linux-image-virtual (6.19.0-3.3) ... 338s Setting up dbus-system-bus-common (1.16.2-2ubuntu3) ... 338s Setting up libbsd0:amd64 (0.12.2-2build2) ... 338s Setting up libdrm-common (2.4.131-1) ... 338s Setting up libstdc++6:amd64 (16-20260208-1ubuntu1) ... 338s Setting up dbus-bin (1.16.2-2ubuntu3) ... 338s Setting up libonig5:amd64 (6.9.10-1build1) ... 338s Setting up libbpf1:amd64 (1:1.6.2-1build1) ... 338s Setting up ethtool (1:6.15-3build1) ... 338s Setting up python3-referencing (0.36.2-1ubuntu2) ... 338s Setting up libxkbcommon0:amd64 (1.13.1-1) ... 338s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 338s Setting up linux-headers-6.19.0-3-generic (6.19.0-3.3) ... 338s Setting up tcpdump (4.99.5-2ubuntu3) ... 338s Setting up linux-image-generic (6.19.0-3.3) ... 338s Setting up wget (1.25.0-2ubuntu4) ... 338s Setting up libpython3.14-stdlib:amd64 (3.14.2-1) ... 338s Setting up iptables (1.8.11-2ubuntu3) ... 338s Setting up iproute2 (6.18.0-1ubuntu1) ... 338s Setting up linux-headers-generic (6.19.0-3.3) ... 338s Setting up dbus-daemon (1.16.2-2ubuntu3) ... 338s Setting up hwdata (0.394-1build1) ... 338s Setting up dbus-user-session (1.16.2-2ubuntu3) ... 338s Setting up libglib2.0-0t64:amd64 (2.87.2-2) ... 338s No schema files found: doing nothing. 338s Setting up dbus (1.16.2-2ubuntu3) ... 338s A reboot is required to replace the running dbus-daemon. 338s Please reboot the system when convenient. 338s Setting up shared-mime-info (2.4-5build3) ... 339s Setting up gir1.2-glib-2.0:amd64 (2.87.2-2) ... 339s Setting up pciutils (1:3.14.0-1build2) ... 339s Setting up python3-markdown-it (3.0.0-3build1) ... 339s Setting up libdrm2:amd64 (2.4.131-1) ... 339s Setting up libpython3.14:amd64 (3.14.2-1) ... 339s Setting up libapt-pkg7.0:amd64 (3.1.15) ... 339s Setting up linux-tools-common (6.19.0-3.3) ... 339s Setting up libgudev-1.0-0:amd64 (1:238-7build1) ... 339s Setting up libdrm-amdgpu1:amd64 (2.4.131-1) ... 339s Setting up apt (3.1.15) ... 340s Setting up linux-headers-virtual (6.19.0-3.3) ... 340s Setting up linux-generic (6.19.0-3.3) ... 340s Setting up libgirepository-2.0-0:amd64 (2.87.2-2) ... 340s Setting up linux-tools-6.19.0-3 (6.19.0-3.3) ... 340s Setting up ubuntu-standard (1.564) ... 340s Setting up gir1.2-girepository-3.0:amd64 (2.87.2-2) ... 340s Setting up linux-virtual (6.19.0-3.3) ... 340s Setting up linux-perf (6.19.0-3.3) ... 340s Setting up linux-tools-6.19.0-3-generic (6.19.0-3.3) ... 340s Processing triggers for debianutils (5.23.2build1) ... 340s Processing triggers for install-info (7.2-5) ... 340s Processing triggers for initramfs-tools (0.150ubuntu7) ... 340s update-initramfs: Generating /boot/initrd.img-6.18.0-9-generic 344s Processing triggers for libc-bin (2.42-2ubuntu4) ... 344s Processing triggers for linux-image-6.19.0-3-generic (6.19.0-3.3+1) ... 344s /etc/kernel/postinst.d/initramfs-tools: 344s update-initramfs: Generating /boot/initrd.img-6.19.0-3-generic 348s /etc/kernel/postinst.d/zz-update-grub: 348s Sourcing file `/etc/default/grub' 348s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 348s Sourcing file `/etc/default/grub.d/90-autopkgtest.cfg' 348s Generating grub configuration file ... 348s Found linux image: /boot/vmlinuz-6.19.0-3-generic 348s Found initrd image: /boot/initrd.img-6.19.0-3-generic 349s Found linux image: /boot/vmlinuz-6.18.0-9-generic 349s Found initrd image: /boot/initrd.img-6.18.0-9-generic 349s Warning: os-prober will not be executed to detect other bootable partitions. 349s Systems on them will not be added to the GRUB boot configuration. 349s Check GRUB_DISABLE_OS_PROBER documentation entry. 349s Adding boot menu entry for UEFI Firmware Settings ... 349s done 349s autopkgtest [05:32:18]: upgrading testbed (apt dist-upgrade and autopurge) 349s Reading package lists... 350s Building dependency tree... 350s Reading state information... 350s Calculating upgrade... 350s The following package was automatically installed and is no longer required: 350s libpython3.13 350s Use 'sudo apt autoremove' to remove it. 350s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 350s Reading package lists... 350s Building dependency tree... 350s Reading state information... 350s Solving dependencies... 350s The following packages will be REMOVED: 350s libpython3.13* 350s 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 350s After this operation, 7599 kB disk space will be freed. 350s (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 ... 125273 files and directories currently installed.) 350s Removing libpython3.13:amd64 (3.13.11-1) ... 350s Processing triggers for libc-bin (2.42-2ubuntu4) ... 351s autopkgtest [05:32:20]: rebooting testbed after setup commands that affected boot 381s Reading package lists... 381s Building dependency tree... 381s Reading state information... 381s Solving dependencies... 382s The following NEW packages will be installed: 382s build-essential cpp cpp-15 cpp-15-x86-64-linux-gnu cpp-x86-64-linux-gnu 382s dctrl-tools fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 382s fonts-glyphicons-halflings fonts-mathjax g++ g++-15 g++-15-x86-64-linux-gnu 382s g++-x86-64-linux-gnu gcc gcc-15 gcc-15-x86-64-linux-gnu gcc-x86-64-linux-gnu 382s gfortran gfortran-15 gfortran-15-x86-64-linux-gnu gfortran-x86-64-linux-gnu 382s icu-devtools libasan8 libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev 382s libcairo2 libcc1-0 libcrypt-dev libdatrie1 libdeflate-dev libdeflate0 382s libfontconfig1 libgcc-15-dev libgfortran-15-dev libgfortran5 libgomp1 382s libgraphite2-3 libharfbuzz0b libhwasan0 libice6 libicu-dev libisl23 libitm1 382s libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev 382s libjs-bootstrap libjs-highlight.js libjs-jquery libjs-jquery-datatables 382s libjs-mathjax liblapack-dev liblapack3 liblerc4 liblsan0 liblzma-dev libmpc3 382s libncurses-dev libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 382s libpaper-utils libpaper2 libpcre2-16-0 libpcre2-32-0 libpcre2-dev 382s libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev libquadmath0 382s libreadline-dev libsharpyuv0 libsm6 libstdc++-15-dev libtcl8.6 libthai-data 382s libthai0 libtiff6 libtirpc-dev libtk8.6 libtsan2 libubsan1 libwebp7 382s libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 libzstd-dev 382s linux-libc-dev node-normalize.css pkg-r-autopkgtest pkgconf pkgconf-bin 382s r-base-core r-base-dev r-cran-base64enc r-cran-cli r-cran-commonmark 382s r-cran-evaluate r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable 382s r-cran-highr r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle 382s r-cran-markdown r-cran-matrixstats r-cran-r6 r-cran-rcolorbrewer 382s r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs r-cran-viridislite 382s r-cran-withr r-cran-xfun r-cran-yaml rpcsvc-proto unzip x11-common xdg-utils 382s zip zlib1g-dev 382s 0 upgraded, 138 newly installed, 0 to remove and 0 not upgraded. 382s Need to get 179 MB of archives. 382s After this operation, 567 MB of additional disk space will be used. 382s Get:1 http://ftpmaster.internal/ubuntu resolute/main amd64 libc-dev-bin amd64 2.42-2ubuntu4 [23.3 kB] 382s Get:2 http://ftpmaster.internal/ubuntu resolute/main amd64 linux-libc-dev amd64 6.19.0-3.3 [1846 kB] 382s Get:3 http://ftpmaster.internal/ubuntu resolute/main amd64 libcrypt-dev amd64 1:4.5.1-1 [122 kB] 382s Get:4 http://ftpmaster.internal/ubuntu resolute/main amd64 rpcsvc-proto amd64 1.4.3-1build1 [68.3 kB] 382s Get:5 http://ftpmaster.internal/ubuntu resolute/main amd64 libc6-dev amd64 2.42-2ubuntu4 [2207 kB] 382s Get:6 http://ftpmaster.internal/ubuntu resolute/main amd64 libisl23 amd64 0.27-1build1 [691 kB] 382s Get:7 http://ftpmaster.internal/ubuntu resolute/main amd64 libmpc3 amd64 1.3.1-2 [54.8 kB] 382s Get:8 http://ftpmaster.internal/ubuntu resolute/main amd64 cpp-15-x86-64-linux-gnu amd64 15.2.0-12ubuntu1 [12.9 MB] 382s Get:9 http://ftpmaster.internal/ubuntu resolute/main amd64 cpp-15 amd64 15.2.0-12ubuntu1 [1034 B] 382s Get:10 http://ftpmaster.internal/ubuntu resolute/main amd64 cpp-x86-64-linux-gnu amd64 4:15.2.0-4ubuntu1 [5746 B] 382s Get:11 http://ftpmaster.internal/ubuntu resolute/main amd64 cpp amd64 4:15.2.0-4ubuntu1 [22.4 kB] 382s Get:12 http://ftpmaster.internal/ubuntu resolute/main amd64 libcc1-0 amd64 16-20260208-1ubuntu1 [51.2 kB] 382s Get:13 http://ftpmaster.internal/ubuntu resolute/main amd64 libgomp1 amd64 16-20260208-1ubuntu1 [162 kB] 382s Get:14 http://ftpmaster.internal/ubuntu resolute/main amd64 libitm1 amd64 16-20260208-1ubuntu1 [30.2 kB] 382s Get:15 http://ftpmaster.internal/ubuntu resolute/main amd64 libasan8 amd64 16-20260208-1ubuntu1 [3182 kB] 383s Get:16 http://ftpmaster.internal/ubuntu resolute/main amd64 liblsan0 amd64 16-20260208-1ubuntu1 [1392 kB] 383s Get:17 http://ftpmaster.internal/ubuntu resolute/main amd64 libtsan2 amd64 16-20260208-1ubuntu1 [2838 kB] 383s Get:18 http://ftpmaster.internal/ubuntu resolute/main amd64 libubsan1 amd64 16-20260208-1ubuntu1 [1238 kB] 383s Get:19 http://ftpmaster.internal/ubuntu resolute/main amd64 libhwasan0 amd64 16-20260208-1ubuntu1 [1729 kB] 383s Get:20 http://ftpmaster.internal/ubuntu resolute/main amd64 libquadmath0 amd64 16-20260208-1ubuntu1 [155 kB] 383s Get:21 http://ftpmaster.internal/ubuntu resolute/main amd64 libgcc-15-dev amd64 15.2.0-12ubuntu1 [2866 kB] 383s Get:22 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc-15-x86-64-linux-gnu amd64 15.2.0-12ubuntu1 [25.4 MB] 385s Get:23 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc-15 amd64 15.2.0-12ubuntu1 [530 kB] 385s Get:24 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc-x86-64-linux-gnu amd64 4:15.2.0-4ubuntu1 [1208 B] 385s Get:25 http://ftpmaster.internal/ubuntu resolute/main amd64 gcc amd64 4:15.2.0-4ubuntu1 [5024 B] 385s Get:26 http://ftpmaster.internal/ubuntu resolute/main amd64 libstdc++-15-dev amd64 15.2.0-12ubuntu1 [2553 kB] 385s Get:27 http://ftpmaster.internal/ubuntu resolute/main amd64 g++-15-x86-64-linux-gnu amd64 15.2.0-12ubuntu1 [14.4 MB] 385s Get:28 http://ftpmaster.internal/ubuntu resolute/main amd64 g++-15 amd64 15.2.0-12ubuntu1 [25.3 kB] 385s Get:29 http://ftpmaster.internal/ubuntu resolute/main amd64 g++-x86-64-linux-gnu amd64 4:15.2.0-4ubuntu1 [966 B] 385s Get:30 http://ftpmaster.internal/ubuntu resolute/main amd64 g++ amd64 4:15.2.0-4ubuntu1 [1100 B] 385s Get:31 http://ftpmaster.internal/ubuntu resolute/main amd64 build-essential amd64 12.12ubuntu2 [5256 B] 385s Get:32 http://ftpmaster.internal/ubuntu resolute/main amd64 dctrl-tools amd64 2.24-3build4 [104 kB] 385s Get:33 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-dejavu-mono all 2.37-8build1 [502 kB] 385s Get:34 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-dejavu-core all 2.37-8build1 [834 kB] 385s Get:35 http://ftpmaster.internal/ubuntu resolute/main amd64 fontconfig-config amd64 2.17.1-3ubuntu1 [38.5 kB] 385s Get:36 http://ftpmaster.internal/ubuntu resolute/main amd64 libfontconfig1 amd64 2.17.1-3ubuntu1 [144 kB] 385s Get:37 http://ftpmaster.internal/ubuntu resolute/main amd64 fontconfig amd64 2.17.1-3ubuntu1 [180 kB] 385s Get:38 http://ftpmaster.internal/ubuntu resolute/universe amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 385s Get:39 http://ftpmaster.internal/ubuntu resolute/main amd64 fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 386s Get:40 http://ftpmaster.internal/ubuntu resolute/main amd64 libgfortran5 amd64 16-20260208-1ubuntu1 [957 kB] 386s Get:41 http://ftpmaster.internal/ubuntu resolute/main amd64 libgfortran-15-dev amd64 15.2.0-12ubuntu1 [973 kB] 386s Get:42 http://ftpmaster.internal/ubuntu resolute/main amd64 gfortran-15-x86-64-linux-gnu amd64 15.2.0-12ubuntu1 [13.6 MB] 386s Get:43 http://ftpmaster.internal/ubuntu resolute/main amd64 gfortran-15 amd64 15.2.0-12ubuntu1 [18.1 kB] 386s Get:44 http://ftpmaster.internal/ubuntu resolute/main amd64 gfortran-x86-64-linux-gnu amd64 4:15.2.0-4ubuntu1 [1014 B] 386s Get:45 http://ftpmaster.internal/ubuntu resolute/main amd64 gfortran amd64 4:15.2.0-4ubuntu1 [1172 B] 386s Get:46 http://ftpmaster.internal/ubuntu resolute/main amd64 icu-devtools amd64 78.2-1ubuntu1 [214 kB] 386s Get:47 http://ftpmaster.internal/ubuntu resolute/main amd64 libblas3 amd64 3.12.1-7ubuntu1 [260 kB] 386s Get:48 http://ftpmaster.internal/ubuntu resolute/main amd64 libblas-dev amd64 3.12.1-7ubuntu1 [235 kB] 386s Get:49 http://ftpmaster.internal/ubuntu resolute/main amd64 libbz2-dev amd64 1.0.8-6build2 [36.2 kB] 386s Get:50 http://ftpmaster.internal/ubuntu resolute/main amd64 libpixman-1-0 amd64 0.46.4-1 [287 kB] 386s Get:51 http://ftpmaster.internal/ubuntu resolute/main amd64 libxcb-render0 amd64 1.17.0-2ubuntu1 [16.2 kB] 386s Get:52 http://ftpmaster.internal/ubuntu resolute/main amd64 libxcb-shm0 amd64 1.17.0-2ubuntu1 [5808 B] 386s Get:53 http://ftpmaster.internal/ubuntu resolute/main amd64 libxrender1 amd64 1:0.9.12-1 [19.8 kB] 386s Get:54 http://ftpmaster.internal/ubuntu resolute/main amd64 libcairo2 amd64 1.18.4-3 [579 kB] 386s Get:55 http://ftpmaster.internal/ubuntu resolute/main amd64 libdatrie1 amd64 0.2.14-1 [19.8 kB] 386s Get:56 http://ftpmaster.internal/ubuntu resolute/main amd64 libdeflate0 amd64 1.23-2build1 [51.6 kB] 386s Get:57 http://ftpmaster.internal/ubuntu resolute/main amd64 libdeflate-dev amd64 1.23-2build1 [58.8 kB] 386s Get:58 http://ftpmaster.internal/ubuntu resolute/main amd64 libgraphite2-3 amd64 1.3.14-11ubuntu1 [73.7 kB] 386s Get:59 http://ftpmaster.internal/ubuntu resolute/main amd64 libharfbuzz0b amd64 12.3.2-1 [519 kB] 386s Get:60 http://ftpmaster.internal/ubuntu resolute/main amd64 x11-common all 1:7.7+24ubuntu1 [22.4 kB] 386s Get:61 http://ftpmaster.internal/ubuntu resolute/main amd64 libice6 amd64 2:1.1.1-1build1 [44.0 kB] 386s Get:62 http://ftpmaster.internal/ubuntu resolute/main amd64 libicu-dev amd64 78.2-1ubuntu1 [12.5 MB] 386s Get:63 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg-turbo8 amd64 2.1.5-4ubuntu3 [156 kB] 386s Get:64 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg-turbo8-dev amd64 2.1.5-4ubuntu3 [300 kB] 386s Get:65 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg8 amd64 8c-2ubuntu12 [2142 B] 386s Get:66 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg8-dev amd64 8c-2ubuntu12 [1480 B] 386s Get:67 http://ftpmaster.internal/ubuntu resolute/main amd64 libjpeg-dev amd64 8c-2ubuntu12 [1480 B] 386s Get:68 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 386s Get:69 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 386s Get:70 http://ftpmaster.internal/ubuntu resolute/main amd64 libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 386s Get:71 http://ftpmaster.internal/ubuntu resolute/universe amd64 libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 386s Get:72 http://ftpmaster.internal/ubuntu resolute/main amd64 liblapack3 amd64 3.12.1-7ubuntu1 [2739 kB] 386s Get:73 http://ftpmaster.internal/ubuntu resolute/main amd64 liblapack-dev amd64 3.12.1-7ubuntu1 [5433 kB] 386s Get:74 http://ftpmaster.internal/ubuntu resolute/main amd64 liblerc4 amd64 4.0.0+ds-5ubuntu2 [207 kB] 386s Get:75 http://ftpmaster.internal/ubuntu resolute/main amd64 libncurses-dev amd64 6.6+20251231-1 [389 kB] 386s Get:76 http://ftpmaster.internal/ubuntu resolute/main amd64 libthai-data all 0.1.30-1 [155 kB] 386s Get:77 http://ftpmaster.internal/ubuntu resolute/main amd64 libthai0 amd64 0.1.30-1 [19.2 kB] 386s Get:78 http://ftpmaster.internal/ubuntu resolute/main amd64 libpango-1.0-0 amd64 1.57.0-1 [241 kB] 386s Get:79 http://ftpmaster.internal/ubuntu resolute/main amd64 libpangoft2-1.0-0 amd64 1.57.0-1 [53.3 kB] 386s Get:80 http://ftpmaster.internal/ubuntu resolute/main amd64 libpangocairo-1.0-0 amd64 1.57.0-1 [29.0 kB] 386s Get:81 http://ftpmaster.internal/ubuntu resolute/main amd64 libpaper2 amd64 2.2.5-0.3build1 [17.3 kB] 386s Get:82 http://ftpmaster.internal/ubuntu resolute/main amd64 libpaper-utils amd64 2.2.5-0.3build1 [15.6 kB] 386s Get:83 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcre2-16-0 amd64 10.46-1 [243 kB] 386s Get:84 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcre2-32-0 amd64 10.46-1 [230 kB] 386s Get:85 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcre2-posix3 amd64 10.46-1 [7354 B] 387s Get:86 http://ftpmaster.internal/ubuntu resolute/main amd64 libpcre2-dev amd64 10.46-1 [832 kB] 387s Get:87 http://ftpmaster.internal/ubuntu resolute/main amd64 libpkgconf3 amd64 1.8.1-4build1 [32.8 kB] 387s Get:88 http://ftpmaster.internal/ubuntu resolute/main amd64 zlib1g-dev amd64 1:1.3.dfsg+really1.3.1-1ubuntu2 [898 kB] 387s Get:89 http://ftpmaster.internal/ubuntu resolute/main amd64 libpng-dev amd64 1.6.54-1 [273 kB] 387s Get:90 http://ftpmaster.internal/ubuntu resolute/main amd64 libreadline-dev amd64 8.3-3 [189 kB] 387s Get:91 http://ftpmaster.internal/ubuntu resolute/main amd64 libsharpyuv0 amd64 1.5.0-0.1build1 [17.6 kB] 387s Get:92 http://ftpmaster.internal/ubuntu resolute/main amd64 libsm6 amd64 2:1.2.6-1build1 [16.9 kB] 387s Get:93 http://ftpmaster.internal/ubuntu resolute/main amd64 libtcl8.6 amd64 8.6.17+dfsg-1build1 [1003 kB] 387s Get:94 http://ftpmaster.internal/ubuntu resolute/main amd64 libjbig0 amd64 2.1-6.1ubuntu3 [30.0 kB] 387s Get:95 http://ftpmaster.internal/ubuntu resolute/main amd64 libwebp7 amd64 1.5.0-0.1build1 [264 kB] 387s Get:96 http://ftpmaster.internal/ubuntu resolute/main amd64 libtiff6 amd64 4.7.0-3ubuntu3 [209 kB] 387s Get:97 http://ftpmaster.internal/ubuntu resolute/main amd64 libxft2 amd64 2.3.6-1build2 [45.1 kB] 387s Get:98 http://ftpmaster.internal/ubuntu resolute/main amd64 libxss1 amd64 1:1.2.3-1build4 [7084 B] 387s Get:99 http://ftpmaster.internal/ubuntu resolute/main amd64 libtk8.6 amd64 8.6.17-1 [823 kB] 387s Get:100 http://ftpmaster.internal/ubuntu resolute/main amd64 libxt6t64 amd64 1:1.2.1-1.3 [173 kB] 387s Get:101 http://ftpmaster.internal/ubuntu resolute/main amd64 libzstd-dev amd64 1.5.7+dfsg-3 [376 kB] 387s Get:102 http://ftpmaster.internal/ubuntu resolute/universe amd64 node-normalize.css all 8.0.1-5.1 [10.4 kB] 387s Get:103 http://ftpmaster.internal/ubuntu resolute/main amd64 zip amd64 3.0-15ubuntu3 [175 kB] 387s Get:104 http://ftpmaster.internal/ubuntu resolute/main amd64 unzip amd64 6.0-29ubuntu1 [180 kB] 387s Get:105 http://ftpmaster.internal/ubuntu resolute/main amd64 xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 387s Get:106 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-base-core amd64 4.5.2-1ubuntu2 [28.8 MB] 387s Get:107 http://ftpmaster.internal/ubuntu resolute/main amd64 liblzma-dev amd64 5.8.2-2 [179 kB] 387s Get:108 http://ftpmaster.internal/ubuntu resolute/main amd64 pkgconf-bin amd64 1.8.1-4build1 [21.7 kB] 387s Get:109 http://ftpmaster.internal/ubuntu resolute/main amd64 pkgconf amd64 1.8.1-4build1 [16.8 kB] 387s Get:110 http://ftpmaster.internal/ubuntu resolute/main amd64 libtirpc-dev amd64 1.3.6+ds-1 [195 kB] 387s Get:111 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-base-dev all 4.5.2-1ubuntu2 [1880 B] 387s Get:112 http://ftpmaster.internal/ubuntu resolute/universe amd64 pkg-r-autopkgtest all 20250812 [6158 B] 387s Get:113 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-base64enc amd64 0.1-3-3build1 [28.5 kB] 387s Get:114 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-cli amd64 3.6.4-1 [1394 kB] 387s Get:115 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-commonmark amd64 1.9.5-1 [138 kB] 387s Get:116 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-evaluate all 1.0.5-1 [117 kB] 387s Get:117 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-farver amd64 2.1.2-1 [1355 kB] 387s Get:118 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-glue amd64 1.8.0-1 [164 kB] 387s Get:119 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-rlang amd64 1.1.5-3 [1721 kB] 387s Get:120 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 387s Get:121 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 387s Get:122 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-isoband amd64 0.2.7-1 [1481 kB] 387s Get:123 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-s7 amd64 0.2.0-1 [328 kB] 387s Get:124 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-labeling all 0.4.3-1 [62.1 kB] 387s Get:125 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-r6 all 2.6.1-1 [101 kB] 387s Get:126 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 387s Get:127 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-viridislite all 0.4.3-1 [1088 kB] 387s Get:128 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-scales all 1.4.0-1 [725 kB] 387s Get:129 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-vctrs amd64 0.6.5-1 [1335 kB] 387s Get:130 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 388s Get:131 http://ftpmaster.internal/ubuntu resolute-proposed/universe amd64 r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 388s Get:132 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-xfun amd64 0.55+dfsg-1 [587 kB] 388s Get:133 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 388s Get:134 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-yaml amd64 2.3.10-1 [109 kB] 388s Get:135 http://ftpmaster.internal/ubuntu resolute/main amd64 libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 388s Get:136 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-knitr all 1.51+dfsg-1 [847 kB] 388s Get:137 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-markdown all 1.13-1 [162 kB] 388s Get:138 http://ftpmaster.internal/ubuntu resolute/universe amd64 r-cran-matrixstats amd64 1.5.0-1 [542 kB] 388s Preconfiguring packages ... 388s Fetched 179 MB in 6s (28.4 MB/s) 388s Selecting previously unselected package libc-dev-bin. 388s (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 ... 125269 files and directories currently installed.) 388s Preparing to unpack .../000-libc-dev-bin_2.42-2ubuntu4_amd64.deb ... 388s Unpacking libc-dev-bin (2.42-2ubuntu4) ... 388s Selecting previously unselected package linux-libc-dev:amd64. 388s Preparing to unpack .../001-linux-libc-dev_6.19.0-3.3_amd64.deb ... 388s Unpacking linux-libc-dev:amd64 (6.19.0-3.3) ... 388s Selecting previously unselected package libcrypt-dev:amd64. 388s Preparing to unpack .../002-libcrypt-dev_1%3a4.5.1-1_amd64.deb ... 388s Unpacking libcrypt-dev:amd64 (1:4.5.1-1) ... 388s Selecting previously unselected package rpcsvc-proto. 388s Preparing to unpack .../003-rpcsvc-proto_1.4.3-1build1_amd64.deb ... 388s Unpacking rpcsvc-proto (1.4.3-1build1) ... 388s Selecting previously unselected package libc6-dev:amd64. 388s Preparing to unpack .../004-libc6-dev_2.42-2ubuntu4_amd64.deb ... 388s Unpacking libc6-dev:amd64 (2.42-2ubuntu4) ... 388s Selecting previously unselected package libisl23:amd64. 388s Preparing to unpack .../005-libisl23_0.27-1build1_amd64.deb ... 388s Unpacking libisl23:amd64 (0.27-1build1) ... 388s Selecting previously unselected package libmpc3:amd64. 388s Preparing to unpack .../006-libmpc3_1.3.1-2_amd64.deb ... 388s Unpacking libmpc3:amd64 (1.3.1-2) ... 388s Selecting previously unselected package cpp-15-x86-64-linux-gnu. 388s Preparing to unpack .../007-cpp-15-x86-64-linux-gnu_15.2.0-12ubuntu1_amd64.deb ... 388s Unpacking cpp-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package cpp-15. 389s Preparing to unpack .../008-cpp-15_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking cpp-15 (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package cpp-x86-64-linux-gnu. 389s Preparing to unpack .../009-cpp-x86-64-linux-gnu_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking cpp-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package cpp. 389s Preparing to unpack .../010-cpp_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking cpp (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package libcc1-0:amd64. 389s Preparing to unpack .../011-libcc1-0_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libcc1-0:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libgomp1:amd64. 389s Preparing to unpack .../012-libgomp1_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libgomp1:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libitm1:amd64. 389s Preparing to unpack .../013-libitm1_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libitm1:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libasan8:amd64. 389s Preparing to unpack .../014-libasan8_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libasan8:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package liblsan0:amd64. 389s Preparing to unpack .../015-liblsan0_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking liblsan0:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libtsan2:amd64. 389s Preparing to unpack .../016-libtsan2_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libtsan2:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libubsan1:amd64. 389s Preparing to unpack .../017-libubsan1_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libubsan1:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libhwasan0:amd64. 389s Preparing to unpack .../018-libhwasan0_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libhwasan0:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libquadmath0:amd64. 389s Preparing to unpack .../019-libquadmath0_16-20260208-1ubuntu1_amd64.deb ... 389s Unpacking libquadmath0:amd64 (16-20260208-1ubuntu1) ... 389s Selecting previously unselected package libgcc-15-dev:amd64. 389s Preparing to unpack .../020-libgcc-15-dev_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking libgcc-15-dev:amd64 (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package gcc-15-x86-64-linux-gnu. 389s Preparing to unpack .../021-gcc-15-x86-64-linux-gnu_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking gcc-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package gcc-15. 389s Preparing to unpack .../022-gcc-15_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking gcc-15 (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package gcc-x86-64-linux-gnu. 389s Preparing to unpack .../023-gcc-x86-64-linux-gnu_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking gcc-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package gcc. 389s Preparing to unpack .../024-gcc_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking gcc (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package libstdc++-15-dev:amd64. 389s Preparing to unpack .../025-libstdc++-15-dev_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking libstdc++-15-dev:amd64 (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package g++-15-x86-64-linux-gnu. 389s Preparing to unpack .../026-g++-15-x86-64-linux-gnu_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking g++-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package g++-15. 389s Preparing to unpack .../027-g++-15_15.2.0-12ubuntu1_amd64.deb ... 389s Unpacking g++-15 (15.2.0-12ubuntu1) ... 389s Selecting previously unselected package g++-x86-64-linux-gnu. 389s Preparing to unpack .../028-g++-x86-64-linux-gnu_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking g++-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package g++. 389s Preparing to unpack .../029-g++_4%3a15.2.0-4ubuntu1_amd64.deb ... 389s Unpacking g++ (4:15.2.0-4ubuntu1) ... 389s Selecting previously unselected package build-essential. 389s Preparing to unpack .../030-build-essential_12.12ubuntu2_amd64.deb ... 389s Unpacking build-essential (12.12ubuntu2) ... 389s Selecting previously unselected package dctrl-tools. 389s Preparing to unpack .../031-dctrl-tools_2.24-3build4_amd64.deb ... 389s Unpacking dctrl-tools (2.24-3build4) ... 390s Selecting previously unselected package fonts-dejavu-mono. 390s Preparing to unpack .../032-fonts-dejavu-mono_2.37-8build1_all.deb ... 390s Unpacking fonts-dejavu-mono (2.37-8build1) ... 390s Selecting previously unselected package fonts-dejavu-core. 390s Preparing to unpack .../033-fonts-dejavu-core_2.37-8build1_all.deb ... 390s Unpacking fonts-dejavu-core (2.37-8build1) ... 390s Selecting previously unselected package fontconfig-config. 390s Preparing to unpack .../034-fontconfig-config_2.17.1-3ubuntu1_amd64.deb ... 390s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 390s Selecting previously unselected package libfontconfig1:amd64. 390s Preparing to unpack .../035-libfontconfig1_2.17.1-3ubuntu1_amd64.deb ... 390s Unpacking libfontconfig1:amd64 (2.17.1-3ubuntu1) ... 390s Selecting previously unselected package fontconfig. 390s Preparing to unpack .../036-fontconfig_2.17.1-3ubuntu1_amd64.deb ... 390s Unpacking fontconfig (2.17.1-3ubuntu1) ... 390s Selecting previously unselected package fonts-glyphicons-halflings. 390s Preparing to unpack .../037-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 390s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 390s Selecting previously unselected package fonts-mathjax. 390s Preparing to unpack .../038-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 390s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 390s Selecting previously unselected package libgfortran5:amd64. 390s Preparing to unpack .../039-libgfortran5_16-20260208-1ubuntu1_amd64.deb ... 390s Unpacking libgfortran5:amd64 (16-20260208-1ubuntu1) ... 390s Selecting previously unselected package libgfortran-15-dev:amd64. 390s Preparing to unpack .../040-libgfortran-15-dev_15.2.0-12ubuntu1_amd64.deb ... 390s Unpacking libgfortran-15-dev:amd64 (15.2.0-12ubuntu1) ... 390s Selecting previously unselected package gfortran-15-x86-64-linux-gnu. 390s Preparing to unpack .../041-gfortran-15-x86-64-linux-gnu_15.2.0-12ubuntu1_amd64.deb ... 390s Unpacking gfortran-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 390s Selecting previously unselected package gfortran-15. 390s Preparing to unpack .../042-gfortran-15_15.2.0-12ubuntu1_amd64.deb ... 390s Unpacking gfortran-15 (15.2.0-12ubuntu1) ... 390s Selecting previously unselected package gfortran-x86-64-linux-gnu. 390s Preparing to unpack .../043-gfortran-x86-64-linux-gnu_4%3a15.2.0-4ubuntu1_amd64.deb ... 390s Unpacking gfortran-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 390s Selecting previously unselected package gfortran. 390s Preparing to unpack .../044-gfortran_4%3a15.2.0-4ubuntu1_amd64.deb ... 390s Unpacking gfortran (4:15.2.0-4ubuntu1) ... 390s Selecting previously unselected package icu-devtools. 390s Preparing to unpack .../045-icu-devtools_78.2-1ubuntu1_amd64.deb ... 390s Unpacking icu-devtools (78.2-1ubuntu1) ... 390s Selecting previously unselected package libblas3:amd64. 390s Preparing to unpack .../046-libblas3_3.12.1-7ubuntu1_amd64.deb ... 390s Unpacking libblas3:amd64 (3.12.1-7ubuntu1) ... 390s Selecting previously unselected package libblas-dev:amd64. 390s Preparing to unpack .../047-libblas-dev_3.12.1-7ubuntu1_amd64.deb ... 390s Unpacking libblas-dev:amd64 (3.12.1-7ubuntu1) ... 390s Selecting previously unselected package libbz2-dev:amd64. 390s Preparing to unpack .../048-libbz2-dev_1.0.8-6build2_amd64.deb ... 390s Unpacking libbz2-dev:amd64 (1.0.8-6build2) ... 390s Selecting previously unselected package libpixman-1-0:amd64. 390s Preparing to unpack .../049-libpixman-1-0_0.46.4-1_amd64.deb ... 390s Unpacking libpixman-1-0:amd64 (0.46.4-1) ... 390s Selecting previously unselected package libxcb-render0:amd64. 390s Preparing to unpack .../050-libxcb-render0_1.17.0-2ubuntu1_amd64.deb ... 390s Unpacking libxcb-render0:amd64 (1.17.0-2ubuntu1) ... 390s Selecting previously unselected package libxcb-shm0:amd64. 390s Preparing to unpack .../051-libxcb-shm0_1.17.0-2ubuntu1_amd64.deb ... 390s Unpacking libxcb-shm0:amd64 (1.17.0-2ubuntu1) ... 390s Selecting previously unselected package libxrender1:amd64. 390s Preparing to unpack .../052-libxrender1_1%3a0.9.12-1_amd64.deb ... 390s Unpacking libxrender1:amd64 (1:0.9.12-1) ... 390s Selecting previously unselected package libcairo2:amd64. 390s Preparing to unpack .../053-libcairo2_1.18.4-3_amd64.deb ... 390s Unpacking libcairo2:amd64 (1.18.4-3) ... 390s Selecting previously unselected package libdatrie1:amd64. 390s Preparing to unpack .../054-libdatrie1_0.2.14-1_amd64.deb ... 390s Unpacking libdatrie1:amd64 (0.2.14-1) ... 390s Selecting previously unselected package libdeflate0:amd64. 390s Preparing to unpack .../055-libdeflate0_1.23-2build1_amd64.deb ... 390s Unpacking libdeflate0:amd64 (1.23-2build1) ... 390s Selecting previously unselected package libdeflate-dev:amd64. 390s Preparing to unpack .../056-libdeflate-dev_1.23-2build1_amd64.deb ... 390s Unpacking libdeflate-dev:amd64 (1.23-2build1) ... 390s Selecting previously unselected package libgraphite2-3:amd64. 390s Preparing to unpack .../057-libgraphite2-3_1.3.14-11ubuntu1_amd64.deb ... 390s Unpacking libgraphite2-3:amd64 (1.3.14-11ubuntu1) ... 390s Selecting previously unselected package libharfbuzz0b:amd64. 390s Preparing to unpack .../058-libharfbuzz0b_12.3.2-1_amd64.deb ... 390s Unpacking libharfbuzz0b:amd64 (12.3.2-1) ... 390s Selecting previously unselected package x11-common. 390s Preparing to unpack .../059-x11-common_1%3a7.7+24ubuntu1_all.deb ... 390s Unpacking x11-common (1:7.7+24ubuntu1) ... 390s Selecting previously unselected package libice6:amd64. 390s Preparing to unpack .../060-libice6_2%3a1.1.1-1build1_amd64.deb ... 390s Unpacking libice6:amd64 (2:1.1.1-1build1) ... 390s Selecting previously unselected package libicu-dev:amd64. 390s Preparing to unpack .../061-libicu-dev_78.2-1ubuntu1_amd64.deb ... 390s Unpacking libicu-dev:amd64 (78.2-1ubuntu1) ... 390s Selecting previously unselected package libjpeg-turbo8:amd64. 390s Preparing to unpack .../062-libjpeg-turbo8_2.1.5-4ubuntu3_amd64.deb ... 390s Unpacking libjpeg-turbo8:amd64 (2.1.5-4ubuntu3) ... 390s Selecting previously unselected package libjpeg-turbo8-dev:amd64. 390s Preparing to unpack .../063-libjpeg-turbo8-dev_2.1.5-4ubuntu3_amd64.deb ... 390s Unpacking libjpeg-turbo8-dev:amd64 (2.1.5-4ubuntu3) ... 390s Selecting previously unselected package libjpeg8:amd64. 390s Preparing to unpack .../064-libjpeg8_8c-2ubuntu12_amd64.deb ... 390s Unpacking libjpeg8:amd64 (8c-2ubuntu12) ... 390s Selecting previously unselected package libjpeg8-dev:amd64. 390s Preparing to unpack .../065-libjpeg8-dev_8c-2ubuntu12_amd64.deb ... 390s Unpacking libjpeg8-dev:amd64 (8c-2ubuntu12) ... 390s Selecting previously unselected package libjpeg-dev:amd64. 390s Preparing to unpack .../066-libjpeg-dev_8c-2ubuntu12_amd64.deb ... 390s Unpacking libjpeg-dev:amd64 (8c-2ubuntu12) ... 391s Selecting previously unselected package libjs-bootstrap. 391s Preparing to unpack .../067-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 391s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 391s Selecting previously unselected package libjs-highlight.js. 391s Preparing to unpack .../068-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 391s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 391s Selecting previously unselected package libjs-jquery. 391s Preparing to unpack .../069-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 391s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 391s Selecting previously unselected package libjs-jquery-datatables. 391s Preparing to unpack .../070-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 391s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 391s Selecting previously unselected package liblapack3:amd64. 391s Preparing to unpack .../071-liblapack3_3.12.1-7ubuntu1_amd64.deb ... 391s Unpacking liblapack3:amd64 (3.12.1-7ubuntu1) ... 391s Selecting previously unselected package liblapack-dev:amd64. 391s Preparing to unpack .../072-liblapack-dev_3.12.1-7ubuntu1_amd64.deb ... 391s Unpacking liblapack-dev:amd64 (3.12.1-7ubuntu1) ... 391s Selecting previously unselected package liblerc4:amd64. 391s Preparing to unpack .../073-liblerc4_4.0.0+ds-5ubuntu2_amd64.deb ... 391s Unpacking liblerc4:amd64 (4.0.0+ds-5ubuntu2) ... 391s Selecting previously unselected package libncurses-dev:amd64. 391s Preparing to unpack .../074-libncurses-dev_6.6+20251231-1_amd64.deb ... 391s Unpacking libncurses-dev:amd64 (6.6+20251231-1) ... 391s Selecting previously unselected package libthai-data. 391s Preparing to unpack .../075-libthai-data_0.1.30-1_all.deb ... 391s Unpacking libthai-data (0.1.30-1) ... 391s Selecting previously unselected package libthai0:amd64. 391s Preparing to unpack .../076-libthai0_0.1.30-1_amd64.deb ... 391s Unpacking libthai0:amd64 (0.1.30-1) ... 391s Selecting previously unselected package libpango-1.0-0:amd64. 391s Preparing to unpack .../077-libpango-1.0-0_1.57.0-1_amd64.deb ... 391s Unpacking libpango-1.0-0:amd64 (1.57.0-1) ... 391s Selecting previously unselected package libpangoft2-1.0-0:amd64. 391s Preparing to unpack .../078-libpangoft2-1.0-0_1.57.0-1_amd64.deb ... 391s Unpacking libpangoft2-1.0-0:amd64 (1.57.0-1) ... 391s Selecting previously unselected package libpangocairo-1.0-0:amd64. 391s Preparing to unpack .../079-libpangocairo-1.0-0_1.57.0-1_amd64.deb ... 391s Unpacking libpangocairo-1.0-0:amd64 (1.57.0-1) ... 391s Selecting previously unselected package libpaper2:amd64. 391s Preparing to unpack .../080-libpaper2_2.2.5-0.3build1_amd64.deb ... 391s Unpacking libpaper2:amd64 (2.2.5-0.3build1) ... 391s Selecting previously unselected package libpaper-utils. 391s Preparing to unpack .../081-libpaper-utils_2.2.5-0.3build1_amd64.deb ... 391s Unpacking libpaper-utils (2.2.5-0.3build1) ... 391s Selecting previously unselected package libpcre2-16-0:amd64. 391s Preparing to unpack .../082-libpcre2-16-0_10.46-1_amd64.deb ... 391s Unpacking libpcre2-16-0:amd64 (10.46-1) ... 391s Selecting previously unselected package libpcre2-32-0:amd64. 391s Preparing to unpack .../083-libpcre2-32-0_10.46-1_amd64.deb ... 391s Unpacking libpcre2-32-0:amd64 (10.46-1) ... 391s Selecting previously unselected package libpcre2-posix3:amd64. 391s Preparing to unpack .../084-libpcre2-posix3_10.46-1_amd64.deb ... 391s Unpacking libpcre2-posix3:amd64 (10.46-1) ... 391s Selecting previously unselected package libpcre2-dev:amd64. 391s Preparing to unpack .../085-libpcre2-dev_10.46-1_amd64.deb ... 391s Unpacking libpcre2-dev:amd64 (10.46-1) ... 391s Selecting previously unselected package libpkgconf3:amd64. 391s Preparing to unpack .../086-libpkgconf3_1.8.1-4build1_amd64.deb ... 391s Unpacking libpkgconf3:amd64 (1.8.1-4build1) ... 391s Selecting previously unselected package zlib1g-dev:amd64. 391s Preparing to unpack .../087-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu2_amd64.deb ... 391s Unpacking zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 391s Selecting previously unselected package libpng-dev:amd64. 391s Preparing to unpack .../088-libpng-dev_1.6.54-1_amd64.deb ... 391s Unpacking libpng-dev:amd64 (1.6.54-1) ... 391s Selecting previously unselected package libreadline-dev:amd64. 391s Preparing to unpack .../089-libreadline-dev_8.3-3_amd64.deb ... 391s Unpacking libreadline-dev:amd64 (8.3-3) ... 391s Selecting previously unselected package libsharpyuv0:amd64. 391s Preparing to unpack .../090-libsharpyuv0_1.5.0-0.1build1_amd64.deb ... 391s Unpacking libsharpyuv0:amd64 (1.5.0-0.1build1) ... 391s Selecting previously unselected package libsm6:amd64. 391s Preparing to unpack .../091-libsm6_2%3a1.2.6-1build1_amd64.deb ... 391s Unpacking libsm6:amd64 (2:1.2.6-1build1) ... 391s Selecting previously unselected package libtcl8.6:amd64. 391s Preparing to unpack .../092-libtcl8.6_8.6.17+dfsg-1build1_amd64.deb ... 391s Unpacking libtcl8.6:amd64 (8.6.17+dfsg-1build1) ... 391s Selecting previously unselected package libjbig0:amd64. 391s Preparing to unpack .../093-libjbig0_2.1-6.1ubuntu3_amd64.deb ... 391s Unpacking libjbig0:amd64 (2.1-6.1ubuntu3) ... 391s Selecting previously unselected package libwebp7:amd64. 391s Preparing to unpack .../094-libwebp7_1.5.0-0.1build1_amd64.deb ... 391s Unpacking libwebp7:amd64 (1.5.0-0.1build1) ... 391s Selecting previously unselected package libtiff6:amd64. 391s Preparing to unpack .../095-libtiff6_4.7.0-3ubuntu3_amd64.deb ... 391s Unpacking libtiff6:amd64 (4.7.0-3ubuntu3) ... 391s Selecting previously unselected package libxft2:amd64. 391s Preparing to unpack .../096-libxft2_2.3.6-1build2_amd64.deb ... 391s Unpacking libxft2:amd64 (2.3.6-1build2) ... 391s Selecting previously unselected package libxss1:amd64. 391s Preparing to unpack .../097-libxss1_1%3a1.2.3-1build4_amd64.deb ... 391s Unpacking libxss1:amd64 (1:1.2.3-1build4) ... 391s Selecting previously unselected package libtk8.6:amd64. 391s Preparing to unpack .../098-libtk8.6_8.6.17-1_amd64.deb ... 391s Unpacking libtk8.6:amd64 (8.6.17-1) ... 391s Selecting previously unselected package libxt6t64:amd64. 391s Preparing to unpack .../099-libxt6t64_1%3a1.2.1-1.3_amd64.deb ... 391s Unpacking libxt6t64:amd64 (1:1.2.1-1.3) ... 391s Selecting previously unselected package libzstd-dev:amd64. 391s Preparing to unpack .../100-libzstd-dev_1.5.7+dfsg-3_amd64.deb ... 391s Unpacking libzstd-dev:amd64 (1.5.7+dfsg-3) ... 391s Selecting previously unselected package node-normalize.css. 391s Preparing to unpack .../101-node-normalize.css_8.0.1-5.1_all.deb ... 391s Unpacking node-normalize.css (8.0.1-5.1) ... 391s Selecting previously unselected package zip. 391s Preparing to unpack .../102-zip_3.0-15ubuntu3_amd64.deb ... 391s Unpacking zip (3.0-15ubuntu3) ... 391s Selecting previously unselected package unzip. 391s Preparing to unpack .../103-unzip_6.0-29ubuntu1_amd64.deb ... 391s Unpacking unzip (6.0-29ubuntu1) ... 391s Selecting previously unselected package xdg-utils. 391s Preparing to unpack .../104-xdg-utils_1.2.1-2ubuntu2_all.deb ... 391s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 391s Selecting previously unselected package r-base-core. 391s Preparing to unpack .../105-r-base-core_4.5.2-1ubuntu2_amd64.deb ... 391s Unpacking r-base-core (4.5.2-1ubuntu2) ... 391s Selecting previously unselected package liblzma-dev:amd64. 391s Preparing to unpack .../106-liblzma-dev_5.8.2-2_amd64.deb ... 391s Unpacking liblzma-dev:amd64 (5.8.2-2) ... 391s Selecting previously unselected package pkgconf-bin. 391s Preparing to unpack .../107-pkgconf-bin_1.8.1-4build1_amd64.deb ... 391s Unpacking pkgconf-bin (1.8.1-4build1) ... 391s Selecting previously unselected package pkgconf:amd64. 391s Preparing to unpack .../108-pkgconf_1.8.1-4build1_amd64.deb ... 391s Unpacking pkgconf:amd64 (1.8.1-4build1) ... 391s Selecting previously unselected package libtirpc-dev:amd64. 391s Preparing to unpack .../109-libtirpc-dev_1.3.6+ds-1_amd64.deb ... 391s Unpacking libtirpc-dev:amd64 (1.3.6+ds-1) ... 391s Selecting previously unselected package r-base-dev. 391s Preparing to unpack .../110-r-base-dev_4.5.2-1ubuntu2_all.deb ... 391s Unpacking r-base-dev (4.5.2-1ubuntu2) ... 391s Selecting previously unselected package pkg-r-autopkgtest. 391s Preparing to unpack .../111-pkg-r-autopkgtest_20250812_all.deb ... 391s Unpacking pkg-r-autopkgtest (20250812) ... 391s Selecting previously unselected package r-cran-base64enc. 391s Preparing to unpack .../112-r-cran-base64enc_0.1-3-3build1_amd64.deb ... 391s Unpacking r-cran-base64enc (0.1-3-3build1) ... 391s Selecting previously unselected package r-cran-cli. 391s Preparing to unpack .../113-r-cran-cli_3.6.4-1_amd64.deb ... 391s Unpacking r-cran-cli (3.6.4-1) ... 392s Selecting previously unselected package r-cran-commonmark. 392s Preparing to unpack .../114-r-cran-commonmark_1.9.5-1_amd64.deb ... 392s Unpacking r-cran-commonmark (1.9.5-1) ... 392s Selecting previously unselected package r-cran-evaluate. 392s Preparing to unpack .../115-r-cran-evaluate_1.0.5-1_all.deb ... 392s Unpacking r-cran-evaluate (1.0.5-1) ... 392s Selecting previously unselected package r-cran-farver. 392s Preparing to unpack .../116-r-cran-farver_2.1.2-1_amd64.deb ... 392s Unpacking r-cran-farver (2.1.2-1) ... 392s Selecting previously unselected package r-cran-glue. 392s Preparing to unpack .../117-r-cran-glue_1.8.0-1_amd64.deb ... 392s Unpacking r-cran-glue (1.8.0-1) ... 392s Selecting previously unselected package r-cran-rlang. 392s Preparing to unpack .../118-r-cran-rlang_1.1.5-3_amd64.deb ... 392s Unpacking r-cran-rlang (1.1.5-3) ... 392s Selecting previously unselected package r-cran-lifecycle. 392s Preparing to unpack .../119-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 392s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 392s Selecting previously unselected package r-cran-gtable. 392s Preparing to unpack .../120-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 392s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 392s Selecting previously unselected package r-cran-isoband. 392s Preparing to unpack .../121-r-cran-isoband_0.2.7-1_amd64.deb ... 392s Unpacking r-cran-isoband (0.2.7-1) ... 392s Selecting previously unselected package r-cran-s7. 392s Preparing to unpack .../122-r-cran-s7_0.2.0-1_amd64.deb ... 392s Unpacking r-cran-s7 (0.2.0-1) ... 392s Selecting previously unselected package r-cran-labeling. 392s Preparing to unpack .../123-r-cran-labeling_0.4.3-1_all.deb ... 392s Unpacking r-cran-labeling (0.4.3-1) ... 392s Selecting previously unselected package r-cran-r6. 392s Preparing to unpack .../124-r-cran-r6_2.6.1-1_all.deb ... 392s Unpacking r-cran-r6 (2.6.1-1) ... 392s Selecting previously unselected package r-cran-rcolorbrewer. 392s Preparing to unpack .../125-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 392s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 392s Selecting previously unselected package r-cran-viridislite. 392s Preparing to unpack .../126-r-cran-viridislite_0.4.3-1_all.deb ... 392s Unpacking r-cran-viridislite (0.4.3-1) ... 392s Selecting previously unselected package r-cran-scales. 392s Preparing to unpack .../127-r-cran-scales_1.4.0-1_all.deb ... 392s Unpacking r-cran-scales (1.4.0-1) ... 392s Selecting previously unselected package r-cran-vctrs. 392s Preparing to unpack .../128-r-cran-vctrs_0.6.5-1_amd64.deb ... 392s Unpacking r-cran-vctrs (0.6.5-1) ... 392s Selecting previously unselected package r-cran-withr. 392s Preparing to unpack .../129-r-cran-withr_3.0.2+dfsg-1_all.deb ... 392s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 392s Selecting previously unselected package r-cran-ggplot2. 392s Preparing to unpack .../130-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 392s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 392s Selecting previously unselected package r-cran-xfun. 392s Preparing to unpack .../131-r-cran-xfun_0.55+dfsg-1_amd64.deb ... 392s Unpacking r-cran-xfun (0.55+dfsg-1) ... 392s Selecting previously unselected package r-cran-highr. 392s Preparing to unpack .../132-r-cran-highr_0.11+dfsg-1_all.deb ... 392s Unpacking r-cran-highr (0.11+dfsg-1) ... 392s Selecting previously unselected package r-cran-yaml. 392s Preparing to unpack .../133-r-cran-yaml_2.3.10-1_amd64.deb ... 392s Unpacking r-cran-yaml (2.3.10-1) ... 392s Selecting previously unselected package libjs-mathjax. 392s Preparing to unpack .../134-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 392s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 392s Selecting previously unselected package r-cran-knitr. 392s Preparing to unpack .../135-r-cran-knitr_1.51+dfsg-1_all.deb ... 392s Unpacking r-cran-knitr (1.51+dfsg-1) ... 392s Selecting previously unselected package r-cran-markdown. 392s Preparing to unpack .../136-r-cran-markdown_1.13-1_all.deb ... 392s Unpacking r-cran-markdown (1.13-1) ... 392s Selecting previously unselected package r-cran-matrixstats. 392s Preparing to unpack .../137-r-cran-matrixstats_1.5.0-1_amd64.deb ... 392s Unpacking r-cran-matrixstats (1.5.0-1) ... 392s Setting up libgraphite2-3:amd64 (1.3.14-11ubuntu1) ... 392s Setting up libpixman-1-0:amd64 (0.46.4-1) ... 392s Setting up libsharpyuv0:amd64 (1.5.0-0.1build1) ... 392s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 392s Setting up liblerc4:amd64 (4.0.0+ds-5ubuntu2) ... 392s Setting up libzstd-dev:amd64 (1.5.7+dfsg-3) ... 392s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 392s Setting up libxrender1:amd64 (1:0.9.12-1) ... 392s Setting up libdatrie1:amd64 (0.2.14-1) ... 392s Setting up libxcb-render0:amd64 (1.17.0-2ubuntu1) ... 392s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 392s Setting up unzip (6.0-29ubuntu1) ... 392s Setting up x11-common (1:7.7+24ubuntu1) ... 392s Setting up libdeflate0:amd64 (1.23-2build1) ... 392s Setting up linux-libc-dev:amd64 (6.19.0-3.3) ... 392s Setting up libxcb-shm0:amd64 (1.17.0-2ubuntu1) ... 392s Setting up libgomp1:amd64 (16-20260208-1ubuntu1) ... 392s Setting up libjbig0:amd64 (2.1-6.1ubuntu3) ... 392s Setting up libpcre2-16-0:amd64 (10.46-1) ... 392s Setting up zip (3.0-15ubuntu3) ... 392s Setting up libpcre2-32-0:amd64 (10.46-1) ... 392s Setting up libblas3:amd64 (3.12.1-7ubuntu1) ... 392s 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 392s Setting up libtirpc-dev:amd64 (1.3.6+ds-1) ... 392s Setting up libpkgconf3:amd64 (1.8.1-4build1) ... 392s Setting up rpcsvc-proto (1.4.3-1build1) ... 392s Setting up libquadmath0:amd64 (16-20260208-1ubuntu1) ... 392s Setting up fonts-dejavu-mono (2.37-8build1) ... 392s Setting up libmpc3:amd64 (1.3.1-2) ... 392s Setting up libtcl8.6:amd64 (8.6.17+dfsg-1build1) ... 392s Setting up icu-devtools (78.2-1ubuntu1) ... 392s Setting up fonts-dejavu-core (2.37-8build1) ... 392s Setting up pkgconf-bin (1.8.1-4build1) ... 392s Setting up libjpeg-turbo8:amd64 (2.1.5-4ubuntu3) ... 392s Setting up libgfortran5:amd64 (16-20260208-1ubuntu1) ... 392s Setting up libwebp7:amd64 (1.5.0-0.1build1) ... 392s Setting up liblzma-dev:amd64 (5.8.2-2) ... 392s Setting up libubsan1:amd64 (16-20260208-1ubuntu1) ... 392s Setting up libpcre2-posix3:amd64 (10.46-1) ... 392s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 392s Setting up libhwasan0:amd64 (16-20260208-1ubuntu1) ... 392s Setting up libcrypt-dev:amd64 (1:4.5.1-1) ... 392s Setting up libasan8:amd64 (16-20260208-1ubuntu1) ... 392s Setting up libharfbuzz0b:amd64 (12.3.2-1) ... 392s Setting up libthai-data (0.1.30-1) ... 392s Setting up libxss1:amd64 (1:1.2.3-1build4) ... 392s Setting up libpaper2:amd64 (2.2.5-0.3build1) ... 393s Setting up libtsan2:amd64 (16-20260208-1ubuntu1) ... 393s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 393s Setting up libisl23:amd64 (0.27-1build1) ... 393s Setting up libc-dev-bin (2.42-2ubuntu4) ... 393s Setting up libdeflate-dev:amd64 (1.23-2build1) ... 393s Setting up node-normalize.css (8.0.1-5.1) ... 393s Setting up xdg-utils (1.2.1-2ubuntu2) ... 393s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 393s Setting up libcc1-0:amd64 (16-20260208-1ubuntu1) ... 393s Setting up liblsan0:amd64 (16-20260208-1ubuntu1) ... 393s Setting up libblas-dev:amd64 (3.12.1-7ubuntu1) ... 393s 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 393s Setting up dctrl-tools (2.24-3build4) ... 393s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 393s Setting up libitm1:amd64 (16-20260208-1ubuntu1) ... 393s Setting up libjpeg8:amd64 (8c-2ubuntu12) ... 393s Setting up libice6:amd64 (2:1.1.1-1build1) ... 393s Setting up liblapack3:amd64 (3.12.1-7ubuntu1) ... 393s 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 393s Setting up libgcc-15-dev:amd64 (15.2.0-12ubuntu1) ... 393s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 393s Setting up libpaper-utils (2.2.5-0.3build1) ... 393s Setting up cpp-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 393s Setting up libgfortran-15-dev:amd64 (15.2.0-12ubuntu1) ... 393s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 393s Setting up pkgconf:amd64 (1.8.1-4build1) ... 393s Setting up gcc-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 393s Setting up libthai0:amd64 (0.1.30-1) ... 393s Setting up liblapack-dev:amd64 (3.12.1-7ubuntu1) ... 393s 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 393s Setting up cpp-15 (15.2.0-12ubuntu1) ... 393s Setting up libtiff6:amd64 (4.7.0-3ubuntu3) ... 393s Setting up libc6-dev:amd64 (2.42-2ubuntu4) ... 393s Setting up libfontconfig1:amd64 (2.17.1-3ubuntu1) ... 393s Setting up libsm6:amd64 (2:1.2.6-1build1) ... 393s Setting up libicu-dev:amd64 (78.2-1ubuntu1) ... 393s Setting up libbz2-dev:amd64 (1.0.8-6build2) ... 393s Setting up cpp-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 393s Setting up gfortran-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 393s Setting up fontconfig (2.17.1-3ubuntu1) ... 395s Regenerating fonts cache... done. 395s Setting up libjpeg-turbo8-dev:amd64 (2.1.5-4ubuntu3) ... 395s Setting up libxft2:amd64 (2.3.6-1build2) ... 395s Setting up libncurses-dev:amd64 (6.6+20251231-1) ... 395s Setting up libpcre2-dev:amd64 (10.46-1) ... 395s Setting up gcc-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 395s Setting up libtk8.6:amd64 (8.6.17-1) ... 395s Setting up libpango-1.0-0:amd64 (1.57.0-1) ... 395s Setting up libreadline-dev:amd64 (8.3-3) ... 395s Setting up gfortran-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 395s Setting up libcairo2:amd64 (1.18.4-3) ... 395s Setting up gcc-15 (15.2.0-12ubuntu1) ... 395s Setting up libstdc++-15-dev:amd64 (15.2.0-12ubuntu1) ... 395s Setting up libxt6t64:amd64 (1:1.2.1-1.3) ... 395s Setting up zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 395s Setting up cpp (4:15.2.0-4ubuntu1) ... 395s Setting up libpangoft2-1.0-0:amd64 (1.57.0-1) ... 395s Setting up libjpeg8-dev:amd64 (8c-2ubuntu12) ... 395s Setting up gfortran-15 (15.2.0-12ubuntu1) ... 395s Setting up libpangocairo-1.0-0:amd64 (1.57.0-1) ... 395s Setting up g++-15-x86-64-linux-gnu (15.2.0-12ubuntu1) ... 395s Setting up libpng-dev:amd64 (1.6.54-1) ... 395s Setting up libjpeg-dev:amd64 (8c-2ubuntu12) ... 395s Setting up gcc (4:15.2.0-4ubuntu1) ... 395s Setting up r-base-core (4.5.2-1ubuntu2) ... 395s Creating config file /etc/R/Renviron with new version 395s Setting up r-cran-labeling (0.4.3-1) ... 395s Setting up r-cran-farver (2.1.2-1) ... 395s Setting up r-cran-viridislite (0.4.3-1) ... 395s Setting up g++-x86-64-linux-gnu (4:15.2.0-4ubuntu1) ... 395s Setting up r-cran-commonmark (1.9.5-1) ... 395s Setting up r-cran-r6 (2.6.1-1) ... 395s Setting up g++-15 (15.2.0-12ubuntu1) ... 395s Setting up r-cran-rlang (1.1.5-3) ... 395s Setting up r-cran-matrixstats (1.5.0-1) ... 395s Setting up r-cran-xfun (0.55+dfsg-1) ... 395s Setting up r-cran-withr (3.0.2+dfsg-1) ... 395s Setting up r-cran-base64enc (0.1-3-3build1) ... 395s Setting up r-cran-yaml (2.3.10-1) ... 395s Setting up r-cran-evaluate (1.0.5-1) ... 395s Setting up r-cran-highr (0.11+dfsg-1) ... 395s Setting up r-cran-glue (1.8.0-1) ... 395s Setting up r-cran-cli (3.6.4-1) ... 395s Setting up gfortran (4:15.2.0-4ubuntu1) ... 395s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 395s 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 395s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 395s 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 395s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 395s Setting up r-cran-markdown (1.13-1) ... 395s Setting up r-cran-s7 (0.2.0-1) ... 395s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 395s Setting up r-cran-isoband (0.2.7-1) ... 395s Setting up r-cran-scales (1.4.0-1) ... 395s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 395s Setting up r-cran-knitr (1.51+dfsg-1) ... 395s Setting up g++ (4:15.2.0-4ubuntu1) ... 395s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 395s Setting up build-essential (12.12ubuntu2) ... 395s Setting up r-cran-vctrs (0.6.5-1) ... 395s Setting up r-base-dev (4.5.2-1ubuntu2) ... 395s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 395s Setting up pkg-r-autopkgtest (20250812) ... 395s Processing triggers for libc-bin (2.42-2ubuntu4) ... 395s Processing triggers for man-db (2.13.1-1build1) ... 396s Processing triggers for install-info (7.2-5) ... 397s autopkgtest [05:33:06]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 397s autopkgtest [05:33:06]: test pkg-r-autopkgtest: [----------------------- 398s Test: Try to load the R library matrixStats 398s 398s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 398s Copyright (C) 2025 The R Foundation for Statistical Computing 398s Platform: x86_64-pc-linux-gnu 398s 398s R is free software and comes with ABSOLUTELY NO WARRANTY. 398s You are welcome to redistribute it under certain conditions. 398s Type 'license()' or 'licence()' for distribution details. 398s 398s R is a collaborative project with many contributors. 398s Type 'contributors()' for more information and 398s 'citation()' on how to cite R or R packages in publications. 398s 398s Type 'demo()' for some demos, 'help()' for on-line help, or 398s 'help.start()' for an HTML browser interface to help. 398s Type 'q()' to quit R. 398s 398s > library('matrixStats') 398s > 398s autopkgtest [05:33:07]: test pkg-r-autopkgtest: -----------------------] 398s autopkgtest [05:33:07]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 398s pkg-r-autopkgtest PASS 399s autopkgtest [05:33:08]: @@@@@@@@@@@@@@@@@@@@ summary 399s run-unit-test PASS 399s pkg-r-autopkgtest PASS