Skip to content

Commit 065992d

Browse files
committed
Update cachematrix.R
1 parent 264ebe3 commit 065992d

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

cachematrix.R

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
## Put comments here that give an overall description of what your
2-
## functions do
1+
## This program compute the inverse of a matriz and it verifies in
2+
##this one has been computed, in this case, it returns the above
3+
##value
4+
5+
##I make in almost all, a copy paste of the example R program
6+
7+
8+
## This function creates a special "matrix", which is really a list containing a function to
9+
##set the value of the matrix
10+
##get the value of the matrix
11+
##set the value of the inverse
12+
##get the value of the inverse
313

4-
## Write a short comment describing this function
514

615
makeCacheMatrix <- function(x = matrix()) {
716
m <- NULL
@@ -10,6 +19,9 @@ makeCacheMatrix <- function(x = matrix()) {
1019
m <<- NULL
1120
}
1221
get <- function() x
22+
##Here is the principal difference, we change mean by solve
23+
##Where we put mean, now, we puto xxxinverse in order to do
24+
##the variable more explainable
1325
setinverse <- function(solve) m <<- solve
1426
getinverse <- function() m
1527
list(set = set, get = get,
@@ -18,7 +30,10 @@ makeCacheMatrix <- function(x = matrix()) {
1830
}
1931

2032

21-
## Write a short comment describing this function
33+
##This function calculates the inverse of the special "matrix" created with the above function. It first checks
34+
##to see if the inverse has already been calculated. If so, it gets the inverse from the cache and skips
35+
##the computation. Otherwise, it calculates the inverse of the data and sets the value of the inverse in the
36+
##cache via the setmean function
2237

2338
cacheSolve <- function(x, ...) {
2439
## Return a matrix that is the inverse of 'x'
@@ -32,4 +47,3 @@ m <- x$getinverse()
3247
x$setinverse(m)
3348
m
3449
}
35-

0 commit comments

Comments
 (0)