Skip to content

Commit 1b811f7

Browse files
committed
Update cachematrix.R
first fun
1 parent ecaf317 commit 1b811f7

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

cachematrix.R

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,32 @@
55
## Write a short comment describing this function
66
# makeCacheMatrix: This function creates a special "matrix" object that can cache its inverse.
77

8-
#
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+
# }
921

1022
makeCacheMatrix <- function(x = matrix()) {
11-
23+
m_cashe <- NULL
24+
set <- function(new_val) {
25+
x <<- new_val
26+
m_cashe <<- NULL
27+
}
28+
get <- function() x
29+
set_inverse <- function(solve) m_cashe <<- solve
30+
get_inverse <- function() m_cashe
31+
list(set = set, get = get,
32+
set_inverse = set_inverse,
33+
get_inverse = get_inverse)
1234
}
1335

1436

0 commit comments

Comments
 (0)