Skip to content

Work done! #2207

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

Closed
wants to merge 0 commits into from
Closed

Work done! #2207

wants to merge 0 commits into from

Conversation

denstadnyk
Copy link

No description provided.

@denstadnyk denstadnyk closed this Jul 30, 2016
@suvo240
Copy link

suvo240 commented Dec 14, 2016

Caching the Inverse of a Matrix:

Matrix inversion is usually a costly computation and there may be some

benefit to caching the inverse of a matrix rather than compute it repeatedly.

Below are a pair of functions that are used to create a special object that

stores a matrix and caches its inverse.

This function creates a special "matrix" object that can cache its inverse.

makeCacheMatrix <- function(x = matrix()) {
inv <- NULL
set <- function(y) {
x <<- y
inv <<- NULL
}
get <- function() x
setInverse <- function(inverse) inv <<- inverse
getInverse <- function() inv
list(set = set,
get = get,
setInverse = setInverse,
getInverse = getInverse)
}

This function computes the inverse of the special "matrix" created by

makeCacheMatrix above. If the inverse has already been calculated (and the

matrix has not changed), then it should retrieve the inverse from the cache.

cacheSolve <- function(x, ...) {

Return a matrix that is the inverse of 'x'

inv <- x$getInverse()
if (!is.null(inv)) {
message("getting cached data")
return(inv)
}
mat <- x$get()
inv <- solve(mat, ...)
x$setInverse(inv)
inv
}

@danielfrangel
Copy link

nice

@ANILREDDY36
Copy link

good job!

@avulashukla
Copy link

good job

@jiahongdu
Copy link

good

@ShalluArora
Copy link

nice

2 similar comments
@YogeshPatodia
Copy link

nice

@klmnavneet
Copy link

nice

@renuka1611
Copy link

good

1 similar comment
@Buzz-afk
Copy link

Buzz-afk commented Nov 9, 2017

good

@yamroh
Copy link

yamroh commented Apr 9, 2018

Good work

@sagarika12123
Copy link

good

@rubygrover
Copy link

Good work

@Sixu922
Copy link

Sixu922 commented Jul 8, 2019

well donw

@weiyizz
Copy link

weiyizz commented Jan 21, 2020

good work

@Nagaraj-gcet
Copy link

good

@kspavithra1982
Copy link

Good

@minimanimoh
Copy link

good

@huishin2020
Copy link

Good.

@RAQIB-1
Copy link

RAQIB-1 commented Jun 24, 2020

good

@manojmanu297
Copy link

manojmanu297 commented Jul 3, 2020

Caching the Inverse of a Matrix:
Matrix inversion is usually a time taking activity and there may be some
the benefit to caching the inverse of a matrix rather than compute it repeatedly. pair of functions that are used to create a special object that stores a matrix and caches its inverse.
This function creates a special "matrix" object.

makeCacheMatrix <- function(x = matrix()){
inv <- NULL
set <- function(y){
x <<- y
inv <<- NULL
}
get <- function() {x}
SetInverse <- function(inverse) {inv <<- inverse}
getInverse <- function() {inv}
list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)
}

The following function returns the inverse of cache matrix. And evaluates the inverse of a matrix

cacheSolve <- function(x, ...){
inv <- x$getInverse()
if(!is.null(inv)){
message("getting cached data")
return(inv)
}
mat <- x$get()
inv <- solve(mat, ...)
x$setInverse(inv)
inv
}

@manojmanu297
Copy link

manojmanu297 commented Jul 3, 2020

please review the assignment

@RAQIB-1
Copy link

RAQIB-1 commented Jul 4, 2020 via email

@shrashtip
Copy link

Put comments here that give an overall description of what your

functions do

Write a short comment describing this function

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

}

Write a short comment describing this function

cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
}

@maryamosama217
Copy link

good job

@kushwantkaur
Copy link

excellent

@tanishq-ctrl
Copy link

good job

@omoaletsane
Copy link

Programming Assignment II

	### Creat Special Matrix

makeCacheMatrix <- function(x = matrix()) {
j <- NULL
set <- function(y){
x <<- y ### Assignment Operator in the Parent Environment
j <<- NULL
}
get <- function()x
setInverse <- function(inverse) j <<- inverse
getInverse <- function() j
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
### Cache the Matrix
cacheSolve <- function(x, ...) {
### Return a matrix that is the inverse of 'x'
j <- x$getInverse()
if(!is.null(j)){
message("getting cached data")
return(j)
}
mat <- x$get()
j <- solve(mat,...)
x$setInverse(j)
j
}

@wangbup34
Copy link

good

@tiffanywsx
Copy link

nice

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.