We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4a62e0 commit b796636Copy full SHA for b796636
cachematrix.R
@@ -7,8 +7,8 @@
7
# matrix
8
makeCacheMatrix <- function(x=matrix()) {
9
10
- cached_solved_matrix <- NULL
11
- original_matrix <- matrix
+ cached_solved_matrix <<- NULL
+ original_matrix <<- matrix
12
13
## To me it makes the most sense to create and cache the solved matrix here.
14
## When set, if the given matrix isn't equal to the existing matrix
@@ -18,7 +18,7 @@ makeCacheMatrix <- function(x=matrix()) {
18
# sanity check
19
matrix = as.matrix(matrix)
20
21
- if (!identical(matrix,original_matrix) || is.null(cached_solved_matrix)) {
+ if (!identical(matrix, original_matrix) || is.null(cached_solved_matrix)) {
22
set_solved_matrix(cacheSolve(matrix))
23
original_matrix <<- matrix
24
}
0 commit comments