Learn R Programming

FedIRT (version 1.1.0)

mem: Memoization Function for Speed Optimization

Description

A simple memoization function that stores the results of expensive function calls and reuses those results when the same inputs occur again. This technique greatly speeds up the computation of fedirt function by caching previously computed values.

Usage

mem(f)

Value

Returns a memd version of function f that will cache its previously computed results for faster subsequent evaluations, especially beneficial when applied to fedirt.

Arguments

f

Function to be memd.

Examples

Run this code
# To mem a function, simply wrap it with `mem`:
mem(function(a,b){return(a+b)})

Run the code above in your browser using DataLab