File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-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
3
1
4
- # # Write a short comment describing this function
2
+
3
+ # # making matrix object with all required inner functions :)
5
4
6
5
makeCacheMatrix <- function (x = matrix ()) {
6
+ i <- NULL
7
+ set <- function (y ) {
8
+ x <<- y
9
+ i <<- NULL
10
+ }
11
+ get <- function () x
12
+ getinvert <- function () {
13
+ i
14
+ }
15
+ setinvert <- function (y ) {
16
+ i <<- y
17
+ }
18
+ list (set = set , get = get ,
19
+ getinvert = getinvert ,
20
+ setinvert = setinvert )
7
21
8
22
}
9
23
10
24
11
- # # Write a short comment describing this function
25
+ # # getting the invert value
12
26
13
27
cacheSolve <- function (x , ... ) {
14
- # # Return a matrix that is the inverse of 'x'
28
+ i <- x $ getinvert()
29
+ if (! is.null(i )) {
30
+ message(" getting cached data" )
31
+ return (i )
32
+ }
33
+ data <- x $ get()
34
+ i <- solve(data , ... )
35
+ x $ setinvert(i )
36
+ i
15
37
}
You can’t perform that action at this time.
0 commit comments