Skip to content

Update cachematrix.R #5802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update cachematrix.R #5802

wants to merge 2 commits into from

Conversation

srikg20
Copy link

@srikg20 srikg20 commented Jun 15, 2025

No description provided.

@@ -6,38 +6,42 @@
## This function computes the median of the special "matrix" returned by makeCacheMatrix.

makeCacheMatrix <- function(x = matrix()) {
m <- NULL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of mean , calculate inverse

m <<- NULL
}
get <- function() x
setmedian <- function(median) m <<- median

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setInverse<-function() inv<<-solve(x)


  # If not cached, compute the inverse
  mat <- x$get()         # Get the matrix
  inv <- solve(mat, ...) # Compute the inverse using solve()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calculate inverse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants