Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
agrad
rev
operator_unary_negative.hpp
Go to the documentation of this file.
1
#ifndef __STAN__AGRAD__REV__OPERATOR_UNARY_NEGATIVE_HPP__
2
#define __STAN__AGRAD__REV__OPERATOR_UNARY_NEGATIVE_HPP__
3
4
#include <
stan/agrad/rev/var.hpp
>
5
#include <
stan/agrad/rev/op/v_vari.hpp
>
6
7
namespace
stan {
8
namespace
agrad {
9
10
namespace
{
11
class
neg_vari :
public
op_v_vari {
12
public
:
13
neg_vari(vari* avi) :
14
op_v_vari(-(avi->val_), avi) {
15
}
16
void
chain() {
17
avi_
->adj_ -= adj_;
18
}
19
};
20
}
21
30
inline
var
operator-
(
const
var& a) {
31
return
var(
new
neg_vari(a.vi_));
32
}
33
34
}
35
}
36
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.