## This function creates a special "matrix" object
    that can cache its inverse
## The object doesn't calculate the inverse, but saves it.
## set: sets matrix
## get: returns matrix
## setSolve: saves solve value
## getSolve: returns cached inverse value


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

        i <- NULL
        set <- function(y) {
                x <<- y
                i <<- NULL
        }
        get <- function() x
        setinv <- function(solve) i <<- solve
        getinv <- function() i
        list(set = set, get = get, setinv = setinv, getinv = getinv)

}



## The function gets the inversed matrix from an object created by makeCacheMatrix.
## If the inverse value is already cached it returns the value.
## Otherwise it calculates the inverse and  saves it using method 'setSolve'


  cacheSolve <- function(x, ...) {
        i<- x$getinv()
        if(!is.null(i)) {
                message("read from Cache data")
                return(i)
        }
        data <- x$get()
        i<- solve(data, ...)
        x$setinv(i)
        i

}