Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 023973c

Browse files
committed
Update cachematrix.R
clean up
1 parent 01d0714 commit 023973c

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

cachematrix.R

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
## Put comments here that give an overall description of what your
2-
## functions do
31
# 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.
42

5-
## Write a short comment describing this function
63
# makeCacheMatrix: This function creates a special "matrix" object that can cache its inverse.
74

8-
# makeVector <- function(x = numeric()) {
9-
# m <- NULL
10-
# set <- function(y) {
11-
# x <<- y
12-
# m <<- NULL
13-
# }
14-
# get <- function() x
15-
# setmean <- function(mean) m <<- mean
16-
# getmean <- function() m
17-
# list(set = set, get = get,
18-
# setmean = setmean,
19-
# getmean = getmean)
20-
# }
21-
225
makeCacheMatrix <- function(x = matrix()) {
236
m_cashe <- NULL
247
set <- function(new_val) {
@@ -33,21 +16,7 @@ makeCacheMatrix <- function(x = matrix()) {
3316
get_inverse = get_inverse)
3417
}
3518

36-
37-
## Write a short comment describing this function
38-
# 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
5120

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

0 commit comments

Comments
 (0)