1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RustQuant: A Rust library for quantitative finance tools.
// Copyright (C) 2023 https://github.com/avhz
// Dual licensed under Apache 2.0 and MIT.
// See:
// - LICENSE-APACHE.md
// - LICENSE-MIT.md
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//! Reverse accumulation trait.
//! This trait is used to reverse accumulate the gradient for different types.
//!
//! Types that implement this trait will hopefully be:
//!
//! - `Variable<'v>` <- Done
//! - `DMatrix<Variable<'v>>` <- Currently not possible due to lifetimes
//! - `DVector<Variable<'v>>` <- Currently not possible due to lifetimes
//! - `Array<Variable<'v>, Ix2>` <- Work in progress
use Variable;
/// Trait to reverse accumulate the gradient for different types.