File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Expand file tree Collapse file tree 1 file changed +24
-5
lines changed 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
1
+ # # Archivo que contiene las funciones para generar una matriz y calcular la inversa
3
2
4
- # # Write a short comment describing this function
3
+ # # Crea una matriz
5
4
6
5
makeCacheMatrix <- function (x = matrix ()) {
6
+ m <- NULL
7
+ set <- function (y ) {
8
+ x <<- y
9
+ m <<- NULL
10
+ }
11
+ get <- function () x
12
+ setsolve <- function (solve ) m <<- solve
13
+ getmean <- function () m
14
+ list (set = set , get = get ,
15
+ setsolve = setsolve ,
16
+ getsolve = getsolve )
7
17
8
18
}
9
19
10
20
11
- # # Write a short comment describing this function
21
+ # # Mete en cache la matriz
12
22
13
23
cacheSolve <- function (x , ... ) {
14
- # # Return a matrix that is the inverse of 'x'
24
+ # # Return a matrix that is the inverse of 'x'
25
+ m <- x $ getsolve()
26
+ if (! is.null(m )) {
27
+ message(" getting cached data" )
28
+ return (m )
29
+ }
30
+ data <- x $ get()
31
+ m <- solve(data , ... )
32
+ x $ setsolve(m )
33
+ m
15
34
}
You can’t perform that action at this time.
0 commit comments