From d@tr7320 @end|ng |rom un|@@ydney@edu@@u  Mon Jun  7 09:00:04 2021
From: d@tr7320 @end|ng |rom un|@@ydney@edu@@u (Dario Strbenac)
Date: Mon, 7 Jun 2021 07:00:04 +0000
Subject: [Rd] dgTMatrix Segmentation Fault
Message-ID: <SYBPR01MB4761C684F1CA43CA4945FA25CD389@SYBPR01MB4761.ausprd01.prod.outlook.com>

Good day,

I notice that summing rows of a large dgTMatrix fails.

library(Matrix)
aMatrix <- new("dgTMatrix",
                i = as.integer(sample(200000, 10000)-1), j = as.integer(sample(50000, 10000)-1), x = rnorm(10000),
		Dim = c(200000L, 50000L)
	      )
totals <- rowSums(aMatrix == 0)  # Segmentation fault.

The server has 768 GB of RAM and it was never close to being consumed by this. Converting it to an ordinary matrix works fine.

big <- as.matrix(aMatrix)
totals <- rowSums(big == 0)      # Uses more RAM but there is no segmentation fault and result is returned.

May it be made more robust for dgTMatrix?

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia



[Rd] dgTMatrix Segmentation Fault
Dario Strbenac