Skip to content

Commit 6e30e64

Browse files
committed
Changed comments
1 parent 67fd9a7 commit 6e30e64

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cachematrix.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Make a cache matrix with an initially unset inverse
1+
## Make a cached 'matrix' with an initially unset inverse
22
makeCacheMatrix <- function(x = matrix()) {
33
# Inverse is initially null
44
i <- NULL
@@ -22,16 +22,17 @@ makeCacheMatrix <- function(x = matrix()) {
2222
## Memoize the solve function so as to provide a cached version of the inverse, if available, otherwise
2323
## calculate, cache and return the inverse.
2424
cacheSolve <- function(x, ...) {
25-
# If the inverse is already calculated return it
25+
# Get the inverse, if the inverse is already calculated return it
2626
i <- x$getinv()
2727
if (!is.null(i)) {
2828
message("getting cached data")
2929
return(i)
3030
}
3131
# Retrieve the data from the 'matrix'
3232
data <- x$get()
33-
# Solve the matrix to retrieve the inverse
33+
# Solve the matrix to retrieve the inverse, passing the additional options from the caller
3434
i <- solve(data, ...)
35+
# Store the result
3536
x$setinv(i)
3637
i
3738
}

0 commit comments

Comments
 (0)