Skip to content

Commit 5e2a076

Browse files
committed
edited the comments
1 parent 0e92e52 commit 5e2a076

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cachematrix.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ makeCacheMatrix <- function(x = matrix()) {
3131
cacheSolve <- function(x, ...) {
3232
## Return a matrix that is the inverse of 'x'
3333
m <- x$getinverse()
34+
##Has the inverse already been calculated?
35+
##If so, returns the inverse from the cache
3436
if(!is.null(m)) {
3537
message("getting cached data")
3638
return(m)
3739
}
40+
#Otherwise, it calculates the mean of the data and sets
41+
#the value of the inverse in the cache via the setinverse function.
3842
data <- x$get()
43+
##Using the solve function to
44+
##compute the inverse of the square matrix
3945
m <- solve(data, ...)
4046
x$setinverse(m)
4147
m

0 commit comments

Comments
 (0)