Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Summation of ConstantArray of 0 with vector of 0's fails

Offen
#123 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
r
Bereich
data

Rechercherichtung

Reproduziere den Fall mit dem Wert null, beginnend mit DelayedArray::ConstantArray und dem Einstiegspunkt HDF5Array::writeHDF5Array, und vergleiche ihn anschließend mit den funktionierenden Kombinationen im Bericht. Als erledigt gilt die Aufgabe, wenn das Schreiben von ConstantArray mit dem Wert null zusammen mit einem Vektor mit dem Wert null erfolgreich möglich ist und die vorhandenen Beispiele als Regressionstests dienen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi,

I ran into a curious edge case, where summing a ConstantArray with a vector fails if both are zero and then writing it with HDF5Array::writeHDF5Array, but not in any other combination:

mat <- DelayedArray::ConstantArray(c(2, 4), value = 0)
res <- mat + rep(0, 2)
res
#> <2 x 4> sparse DelayedMatrix object of type "double":
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    0    0
#> [2,]    0    0    0    0
HDF5Array::writeHDF5Array(res)
#> Error in .Arith_SVT1_v2(.Generic, e1, e2): "+" is not supported between a SparseArray object and a numeric vector
#>   (result wouldn't be sparse in general)

# All other combination seems to work
mat <- DelayedArray::ConstantArray(c(2, 4), value = 0)
res <- mat + rep(3, 2)
HDF5Array::writeHDF5Array(res)
#> <2 x 4> HDF5Matrix object of type "double":
#>      [,1] [,2] [,3] [,4]
#> [1,]    3    3    3    3
#> [2,]    3    3    3    3

mat <- DelayedArray::ConstantArray(c(2, 4), value = 17)
res <- mat + rep(0, 2)
HDF5Array::writeHDF5Array(res)
#> <2 x 4> HDF5Matrix object of type "double":
#>      [,1] [,2] [,3] [,4]
#> [1,]   17   17   17   17
#> [2,]   17   17   17   17

mat <- DelayedArray::ConstantArray(c(2, 4), value = 0)
res <- mat + 0
HDF5Array::writeHDF5Array(res)
#> <2 x 4> sparse HDF5Matrix object of type "double":
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    0    0
#> [2,]    0    0    0    0

Created on 2025-03-05 with reprex v2.1.1

I am not actually 100% this is an DelayedArray issue or if it might rather need to be moved to HDF5Array.

Best,
Constantin

Vorherrschende Sprache
R
Sterne
29
Forks
12
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Bioconductor/DelayedArray

Alle Issues in Bioconductor/DelayedArray

Ähnliche Issues

Weitere Issues zu R

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.