File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # # Put comments here that give an overall description of what your
2- # # functions do
3-
4- # # Write a short comment describing this function
5-
1+ # makeCacheMatrix function will store the matrix (original) data and the inverse matrix
2+ # and returns those data when requested
63makeCacheMatrix <- function (x = matrix ()) {
74 s <- NULL
85 set <- function (y ) {
@@ -17,11 +14,11 @@ makeCacheMatrix <- function(x = matrix()) {
1714 getsolve = getsolve )
1815}
1916
20-
21- # # Write a short comment describing this function
22-
23- cacheSolve <- function ( x , ... ) {
24- # # Return a matrix that is the inverse of 'x'
17+ # cacheSolve function work togheter with makeCacheMatrix,
18+ # this will check first
19+ # if inverse matrix was already solved and return
20+ # else solve and store it on "cache" for posterior use
21+ cacheSolve <- function ( x , ... ) {
2522 s <- x $ getsolve()
2623 if (! is.null(s )) {
2724 message(" getting cached data" )
@@ -30,5 +27,5 @@ cacheSolve <- function(x, ...) {
3027 data <- x $ get()
3128 s <- solve(data , ... )
3229 x $ setsolve(s )
33- s
30+ s
3431}
You can’t perform that action at this time.
0 commit comments