# Buffers

Buffers are simply structs gathering containers that are used for in-place computations. They inherit from

`DiffusionDefinition.AbstractBuffer`

— Type`AbstractBuffer{T} <: AbstractArray{T,1}`

Types inheriting from `AbstractBuffer`

define buffers used for various in-place computations.

and don't require any special methods, except for functions `b!`

and `σ!`

(or for linear diffusions `B!`

and `β!`

in place of `b!`

) having to specify explicitly how the drift and volatility are supposed to be saved inside the buffers. We provide implementation of standard buffers that should be sufficient for many problems:

`DiffusionDefinition.StandardEulerBuffer`

— Type```
struct StandardEulerBuffer{Tb,Tσ,Tdw} <: AbstractBuffer
b::Tb
y::Tb
σ::Tσ
dW::Tdw
end
```

Standard buffer for the Euler-Maruyama simulations. The intermediary data is stored in `b`

, `σ`

, `y`

and `dW`

.

`DiffusionDefinition.LinearDiffBuffer`

— Type```
struct LinearDiffBuffer{Tb,Tσ,Tdw,TB} <: AbstractBuffer
b::Tb
y::Tb
σ::Tσ
dW::Tdw
B::TB
end
```

A buffer for Euler-Maruyama simulations of linear diffusions. Almost the same as `StandardEulerBuffer`

, but contains additional space for an intermediate construction of a matrix `B`

.

If you call in-place methods multiple times, then make sure to pre-define a buffer and then pass it explicitly to `solve!`

.