Learn R Programming

tropicalSparse (version 0.1.0)

counter: Count non-infinit values

Description

counter is used to get total number of non-infinit values in a matrix.

Usage

counter(M)

Arguments

M

is a matrix.

Value

Returns total number of non-infinit values.

Details

The input of this function is a matrix. This function returns the total number of non-infinite values in the given matrix. In order to work properly, M must be a matrix otherwise this method generates an error.

Examples

Run this code
# NOT RUN {
a <- matrix(data = c(2, Inf, Inf, 0, Inf, Inf, Inf, 10, Inf), nrow = 3, ncol = 3, byrow = TRUE)

counter(a)

# [1] 3

# }

Run the code above in your browser using DataLab