You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cachematrix.R
+1-32Lines changed: 1 addition & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,7 @@
1
-
## Put comments here that give an overall description of what your
2
-
## functions do
3
1
# Matrix inversion is usually a costly computation and there may be some benefit to caching the inverse of a matrix rather than compute it repeatedly (there are also alternatives to matrix inversion that we will not discuss here). Your assignment is to write a pair of functions that cache the inverse of a matrix.
4
2
5
-
## Write a short comment describing this function
6
3
# makeCacheMatrix: This function creates a special "matrix" object that can cache its inverse.
# cacheSolve: This function computes the inverse of the special "matrix" returned by makeCacheMatrix above. If the inverse has already been calculated (and the matrix has not changed), then the cachesolve should retrieve the inverse from the cache.
39
-
40
-
# cachemean <- function(x, ...) {
41
-
# m <- x$getmean()
42
-
# if(!is.null(m)) {
43
-
# message("getting cached data")
44
-
# return(m)
45
-
# }
46
-
# data <- x$get()
47
-
# m <- mean(data, ...)
48
-
# x$setmean(m)
49
-
# m
50
-
# }
19
+
# cacheSolve: This function computes the inverse of the special "matrix" returned by makeCacheMatrix above. If the inverse has already been calculated (and the matrix has not changed), then the cachesolve should retrieve the inverse from the cache.s
0 commit comments