File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
# # makeCacheMatrix is the fuctintion creating an object and calculated the inversion value of the matrix.
2
2
# # In case there is the matrix already calculated the cached value is used instead of calculation
3
3
makeCacheMatrix <- function (x = matrix ()) {
4
+
5
+ # # Initialization
4
6
invValX <- NULL
7
+
5
8
set <- function (Y )
6
9
{
7
10
x <<- y
@@ -10,11 +13,11 @@ makeCacheMatrix <- function(x = matrix()) {
10
13
11
14
get <- function () x
12
15
13
- setinverse <- function ( inverse ) inv_x <<- inverse
14
- getinverse <- function () inv_x
15
- list ( set = set , get = get ,
16
- setinverse = setinverse ,
17
- getinverse = getinverse )
16
+ # Calculate the inverse value
17
+ setinverse <- function (inverse ) invValX <<- inverse
18
+ getinverse <- function () invValX
19
+
20
+ list ( set = set , get = get , setinverse = setinverse , getinverse = getinverse )
18
21
}
19
22
20
23
# # The function cacheSolve returns the inverse of a matrix by function makeCacheMatrix.
You can’t perform that action at this time.
0 commit comments