Skip to content

Commit a127cac

Browse files
author
Erik Larson
committed
added some comments
1 parent a8cebf1 commit a127cac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cachematrix.R

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
## Put comments here that give an overall description of what your
2-
## functions do
1+
## Matrix inversion is usually a costly computation and their may be some
2+
## benefit to caching the inverse of a matrix rather than compute it
3+
## repeatedly. This assignment is to write a pair of functions that cache
4+
## the inverse of a matrix.
35

4-
## Write a short comment describing this function
6+
## This function creates a special "matrix" object that can cache its inverse.
57

68
makeCacheMatrix <- function(x = matrix()) {
9+
710
i <- NULL
11+
812
set <- function(y) {
913
x <<- y
1014
i <<- NULL
@@ -18,7 +22,10 @@ makeCacheMatrix <- function(x = matrix()) {
1822
}
1923

2024

21-
## Write a short comment describing this function
25+
## This function computes the inverse of the special "matrix" returned by
26+
## makeCacheMatrix above. If the inverse has already been calculated (and the
27+
## matrix has not changed), then the cachesolve should retrieve the inverse
28+
## from the cache.
2229

2330
cacheSolve <- function(x, ...) {
2431
## Return a matrix that is the inverse of 'x'

0 commit comments

Comments
 (0)