Skip to content
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

[WIP] Reverse Mode For Static Matrix Multiplication #1884

Closed
wants to merge 116 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
b216a80
Adds vari_value and var_value types to replace var and vari
SteveBronder May 8, 2020
f7e1dae
fixup docs
SteveBronder May 8, 2020
5cf20dc
cpplint fixes
SteveBronder May 8, 2020
149f0cc
update test_ad common_binary to check over more types
SteveBronder May 8, 2020
fee39f6
remove changes to test_ad
SteveBronder May 8, 2020
fbdded3
start templating rev operators
SteveBronder May 9, 2020
6f8b058
all ops use op_vari
SteveBronder May 9, 2020
c034eb6
mark init for vari as final
SteveBronder May 9, 2020
ea22605
use const ref for operators
SteveBronder May 9, 2020
c8c0184
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 9, 2020
da4c0ce
cpplint
SteveBronder May 10, 2020
701949d
merge to develop
SteveBronder May 10, 2020
f003090
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 10, 2020
60df871
Eigen vari type
SteveBronder May 10, 2020
7d1a757
fix headers
SteveBronder May 10, 2020
223a980
Merge branch 'feature/op_vari' into feature/eigen-vari
SteveBronder May 10, 2020
446f77e
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 10, 2020
28ae46a
const Arith& in wrong place for operator_divide
SteveBronder May 10, 2020
fe67a1d
Merge branch 'feature/op_vari' of github.com:stan-dev/math into featu…
SteveBronder May 10, 2020
6fa2762
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 10, 2020
fce1d1a
swap require_vt_arith for require_arith_t in operators
SteveBronder May 10, 2020
f8c6ed1
Merge branch 'feature/op_vari' of github.com:stan-dev/math into featu…
SteveBronder May 10, 2020
011cecc
update precomp_*_vari tests
SteveBronder May 10, 2020
b7d07dc
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 10, 2020
dab2d86
fix fmin and fmax
SteveBronder May 11, 2020
b656b38
Merge branch 'feature/op_vari' of github.com:stan-dev/math into featu…
SteveBronder May 11, 2020
4b3222e
update to develop
SteveBronder May 11, 2020
38cacd7
Merge branch 'feature/op_vari' into feature/eigen-vari
SteveBronder May 11, 2020
7658252
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 11, 2020
c9e4fb3
Merge remote-tracking branch 'origin/develop' into feature/eigen-vari
SteveBronder May 12, 2020
a741736
add multiplication of two varis with Eigen types reverse mode special…
SteveBronder May 12, 2020
a75cd5a
add multiply vari example
SteveBronder May 12, 2020
15c544e
pseudo code for op_vari with stack mem
SteveBronder May 13, 2020
cd8f0b0
update with docs
SteveBronder May 13, 2020
ef84365
Merge commit '3b2dbbdf05373cc62017eecd79bef43723c65589' into HEAD
yashikno May 13, 2020
cc344b6
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 13, 2020
cfc85d5
trying to refactor op_vari_stack_mem
SteveBronder May 14, 2020
bef5d37
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 14, 2020
228d591
get positions and properly allocate eigen memory in autodiff stack fo…
SteveBronder May 14, 2020
933e7bf
merge to remote
SteveBronder May 14, 2020
1131293
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 14, 2020
72abf6c
fix cpplint
SteveBronder May 14, 2020
2e14a28
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 14, 2020
a031b54
update docs
SteveBronder May 15, 2020
060c0b0
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 15, 2020
6c550f7
update docs
SteveBronder May 15, 2020
0dc07a7
Merge branch 'feature/eigen-vari-ops' of github.com:stan-dev/math int…
SteveBronder May 15, 2020
8bc5421
Clean up adj_jac_apply (static matrix design doc)
bbbales2 May 15, 2020
f8bcc76
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 15, 2020
81698ab
Merge remote-tracking branch 'origin/develop' into feature/eigen-vari…
SteveBronder May 15, 2020
a2817b4
halfway through adj_jac fixes
SteveBronder May 17, 2020
4866261
push up partial_impl
SteveBronder May 18, 2020
fefda4a
Merge commit '19f5f25bf9de1d267c92522d68eccfd0d73e12d0' into HEAD
yashikno May 18, 2020
aa04a0e
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 18, 2020
e357425
adj_jac compiles but throws
SteveBronder May 20, 2020
780e306
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 20, 2020
822df6d
Fixed some problems with std::vectors in adj_jac_apply
bbbales2 May 20, 2020
f46f2fc
Merge commit '4a3cd07bd2a1bfc3b7ebeba9bd777b1494f9efcd' into HEAD
yashikno May 20, 2020
682c02f
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 20, 2020
58110b6
fix multiplication return type and memory allocation for std vector. …
SteveBronder May 20, 2020
b6e8ad8
merge to remote
SteveBronder May 20, 2020
fb39311
Merge commit 'e672c9072cec2ba07db8964aef281c211d77cd16' into HEAD
yashikno May 20, 2020
c899714
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 20, 2020
959fb94
add debug test
SteveBronder May 20, 2020
466cb2b
Merge branch 'feature/eigen-vari-ops' of github.com:stan-dev/math int…
SteveBronder May 20, 2020
d798420
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 20, 2020
2ba6b27
update tests
SteveBronder May 20, 2020
720946d
merge to remote
SteveBronder May 20, 2020
d38c155
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 20, 2020
4d86285
update debug test with static matrix version
SteveBronder May 20, 2020
a8c5643
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 20, 2020
9f0057e
add static->dynamic vari's
SteveBronder May 22, 2020
ad79be0
remove debugging stuff
SteveBronder May 22, 2020
6412b4a
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 22, 2020
03e9154
tests pass for adj_jac_apply
SteveBronder May 22, 2020
9246a8e
merge to remote
SteveBronder May 22, 2020
1986197
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 22, 2020
23ba578
cpplint
SteveBronder May 22, 2020
f0b7e3f
update to pass tests besides glm
SteveBronder May 23, 2020
d4aca8f
everything passes but prob!
SteveBronder May 23, 2020
2a901f6
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 23, 2020
1b3a982
add require so that operator* for var with eig<double> fails SFINAE
SteveBronder May 23, 2020
231cc53
cpplint fixes
SteveBronder May 23, 2020
2616577
merge to remote
SteveBronder May 23, 2020
2ada805
update docs and remove duplicate test names
SteveBronder May 23, 2020
176b7c1
Merge commit 'd5849314500d88fe04719ec27b45adf5ed3d1ee2' into HEAD
yashikno May 23, 2020
6dce3ec
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 23, 2020
a31d904
fix headers
SteveBronder May 23, 2020
6e2a91f
Merge branch 'feature/eigen-vari-ops' of github.com:stan-dev/math int…
SteveBronder May 23, 2020
52ab679
readd definitions to static and dynamic vari converter
SteveBronder May 24, 2020
2ed755f
fix struct reordering error on windows
SteveBronder May 24, 2020
0907de8
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 24, 2020
ca0620f
Fix conditional_sequence so that it only has one line as needed by cp…
SteveBronder May 26, 2020
7080db5
Merge commit '72b7e4a043724f86a8789862e4f2dfc03e9eb83c' into HEAD
yashikno May 26, 2020
9d6e5ce
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot May 26, 2020
abe4b7f
Fix conversions from vari_value<int>* to vari_value<double>*
SteveBronder May 27, 2020
b372c24
Merge branch 'feature/eigen-vari-ops' of github.com:stan-dev/math int…
SteveBronder May 27, 2020
7ae1ed1
Merge commit '27afd26a854d7be23e6e20b0eaff4dbbbe700b13' into HEAD
yashikno May 27, 2020
a0c7855
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 27, 2020
a39f697
Merge remote-tracking branch 'origin/feature/vari-base-templates' int…
bbbales2 Jun 6, 2020
855a404
Merge commit '1a1111c1f42d60a8005bb9b8189534db86297d2d' into HEAD
yashikno Jun 6, 2020
1cf5672
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot Jun 6, 2020
4723ba3
Merge remote-tracking branch 'origin/feature/vari-base-templates' int…
bbbales2 Jun 6, 2020
c37c78b
Finished merging remote-tracking branch 'origin/feature/vari-base-tem…
bbbales2 Jun 6, 2020
bcacdb4
Merge branch 'feature/eigen-vari-ops' of https://github.com/stan-dev/…
bbbales2 Jun 6, 2020
b0fc343
Merge branch 'feature/vari-base-templates' into feature/eigen-vari-ops
SteveBronder Jun 6, 2020
0282a90
Merge branch 'feature/vari-base-templates' into feature/eigen-vari-ops
SteveBronder Jun 7, 2020
1430e8e
cpplint
SteveBronder Jun 7, 2020
b5ad3f4
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot Jun 7, 2020
f965ba0
use more deduction in op_vari
SteveBronder Jun 8, 2020
0089201
Add correct deduction for mat_mul return type
SteveBronder Jun 8, 2020
c6dfe54
Merge branch 'feature/eigen-vari-ops' of github.com:stan-dev/math int…
SteveBronder Jun 8, 2020
ed7256d
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2 (tag…
stan-buildbot Jun 8, 2020
c7aadf3
fix templates for multiply operator chain method
SteveBronder Jun 30, 2020
7b3ee83
update to include derivatives for matrix scalar in op_vari
SteveBronder Jun 30, 2020
ee820dc
fix mat vec mul
SteveBronder Jul 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup docs
  • Loading branch information
SteveBronder committed May 8, 2020
commit f7e1dae2e32eb83bd0e2a344106482afd895915c
17 changes: 9 additions & 8 deletions stan/math/rev/core/var.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class var_value {
* Pointer to the implementation of this variable.
*
* This value should not be modified, but may be accessed in
* <code>var</code> operators to construct <code>vari</code>
* <code>var</code> operators to construct `vari_type<T>`
* instances.
*/
vari_value<T>* vi_;

/**
* Return <code>true</code> if this variable has been
* Return `true` if this variable has been
* declared, but not been defined. Any attempt to use an
* undefined variable's value or adjoint will result in a
* segmentation fault.
Expand All @@ -78,14 +78,15 @@ class var_value {
var_value(vari_value<T>* vi) : vi_(vi) {} // NOLINT

/**
* Construct a variable from the specified arithmetic argument
* by constructing a new <code>vari</code> with the argument
* cast to <code>double</code>, and a zero adjoint.
* Construct a variable from the specified integral type argument
* by constructing a new `vari_type<T>`. For integral types the
* `vari_type<T>` will hold doubles.
*
* @param x Value of the variable.
*/
template <typename TT, require_not_same_t<T, TT>* = nullptr, require_integral_t<TT>* = nullptr>
var_value(TT x) : vi_(new vari_value<T>(x, false)) {}
template <typename IntegralT, require_not_same_t<T, IntegralT>* = nullptr,
require_integral_t<IntegralT>* = nullptr>
var_value(IntegralT x) : vi_(new vari_value<T>(x, false)) {}

var_value(T x) : vi_(new vari_value<T>(x, false)) {} // NOLINT

Expand All @@ -99,7 +100,7 @@ class var_value {
/**
* Return the derivative of the root expression with
* respect to this expression. This method only works
* after one of the <code>grad()</code> methods has been
* after one of the `grad()` methods has been
* called.
*
* @return Adjoint for this variable.
Expand Down
13 changes: 11 additions & 2 deletions stan/math/rev/core/vari.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ namespace math {
template <typename T>
class var_value;

/**
* Pure virtual class that all `vari_type` and it's derived classes inherit.
*/
class vari_base {
public:
/**
* Apply the chain rule to this variable based on the variables
* on which it depends. The base implementation in this class
* is a no-op.
* on which it depends.
*/
virtual void chain() = 0;

Expand All @@ -37,6 +39,13 @@ class vari_base {
*/
virtual void set_zero_adjoint() = 0;

/**
* Throw an illegal argument exception.
*
* <i>Warning</i>: Destructors should never called for var objects.
*
* @throw Logic exception always.
*/
virtual ~vari_base() {}

};
Expand Down