Skip to content

Type-preserving alternative to read_block #40

@LTLA

Description

@LTLA

This request is mainly motivated by the current DelayedMatrix matrix multiplication code, which does a read_block call to obtain a dense matrix for actual multiplication. This prevents us from taking advantage of underlying features of the matrix representation that might enable faster multiplication with native methods, e.g., dgCMatrix with Matrix::%*%. I guess this touches on some stuff that SparseArraySeed was designed for, but in a more general fashion (e.g., to handle remote matrices with operations executed server-side).

This would be resolved by having a read_block alternative that tries to preserve the underlying nature of the matrix. The easiest way to do this is to allow extract_array to return something other than a dense ordinary matrix, e.g., by passing something like dense=FALSE to extract_array. I know that an arbitrary matrix representation may not support various delayed operations, whereas a dense matrix always will. In such cases, one could use selectMethod() to check whether the delayed operation dispatch is possible for the matrix representation; execute it if it is; and convert it into a dense matrix if it isn't.

Does this sound reasonable, or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions