Learn R Programming

sparseinv (version 0.1.3)

densify: Densify with explicit zeroes

Description

This function takes two sparse matrices and returns the first matrix padded with explicit zeros so that it is at least dense (probably denser) than the second matrix. This function only works with matrices of class Matrix #'

Usage

densify(A, B)

Arguments

A

object of class Matrix

B

object of class Matrix

Value

object of class Matrix

Examples

Run this code
# NOT RUN {
require(Matrix)
Q1 <- sparseMatrix(i = c(1, 2, 2), j = c(1, 1, 2), x = c(0.1, 0.2, 1))
Q2 <- sparseMatrix(i = c(1, 1, 2, 2),j = c(1, 2, 1, 2), x = c(0.1, 0.3, 0.2, 1))
Q1dens <- densify(Q1, Q2)
Q1
Q1dens
# }

Run the code above in your browser using DataLab