Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francesco Brarda
stan-math-petsc
Commits
9c17e4ba
Commit
9c17e4ba
authored
6 years ago
by
Andrew Johnson
Browse files
Options
Download
Email Patches
Plain Diff
Revert pull to only replace Boost functions not needing error checking
parent
7319007d
stan-petsc
bugfix/1152-algebra_solver-lambdas
bugfix/issue-1250-lgamma
bugfix/issue-1270-add-check-for-meta-includes
code-cleanup/chain-final
code-cleanup/issue-937-flatten
develop
feature/1258-ad-test-core
feature/automatic-autodiff-testing
feature/concept-chainable-allocator
feature/eigen-aligned-malloc
feature/faster-ad-tls
feature/faster-ad-tls-v2
feature/faster-ad-tls-v3
feature/faster-ad-tls-v4
feature/faster-ad-tls-v4-windows
feature/faster-ad-tls-v6
feature/intel-tbb-lib
feature/issue-1012-binorm-copula-cdf
feature/issue-1115-newton_solver
feature/issue-123-complex
feature/issue-1257-diff_algebra_solver
feature/issue-755-laplace
feature/issue-937-flatten-meta-again
feature/issue-937-flatten-meta-the-third
feature/issue-937-flatten-meta-third
feature/issue-962-bivar-norm
feature/issue-989-rev-mat-eig
feature/lambertw
feature/map_rect-cpp17
feature/map_rect-fail-windows
feature/matrix_sqrt
feature/parallel_for_each
feature/python-test-math-dependencies
feature/refactor-nested
feature/sparse-cholesky
internal/no-assert
issue-static-init-order
master
mpi_errors
parallel-ad-tape-3
release/v2.19.0
release/v2.19.1
release/v2.20.0
seantest/faster-ad-tls-v3
stancon/syclik
syclik/forward-mode
v2.20.0
v2.19.1
v2.19.0
No related merge requests found
Changes
153
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
stan/math/prim/scal/prob/inv_gamma_lccdf.hpp
+1
-2
stan/math/prim/scal/prob/inv_gamma_lccdf.hpp
stan/math/rev/mat/fun/matrix_exp_multiply.hpp
+7
-383
stan/math/rev/mat/fun/matrix_exp_multiply.hpp
stan/math/rev/mat/fun/scale_matrix_exp_multiply.hpp
+11
-8
stan/math/rev/mat/fun/scale_matrix_exp_multiply.hpp
stan/math/rev/scal.hpp
+1
-1
stan/math/rev/scal.hpp
stan/math/rev/scal/fun/boost_isfinite.hpp
+27
-0
stan/math/rev/scal/fun/boost_isfinite.hpp
stan/math/rev/scal/fun/fdim.hpp
+2
-4
stan/math/rev/scal/fun/fdim.hpp
stan/math/rev/scal/fun/fma.hpp
+6
-12
stan/math/rev/scal/fun/fma.hpp
stan/math/rev/scal/fun/fmax.hpp
+2
-4
stan/math/rev/scal/fun/fmax.hpp
stan/math/rev/scal/fun/fmin.hpp
+2
-4
stan/math/rev/scal/fun/fmin.hpp
stan/math/rev/scal/fun/gamma_p.hpp
+1
-1
stan/math/rev/scal/fun/gamma_p.hpp
stan/math/rev/scal/fun/hypot.hpp
+2
-4
stan/math/rev/scal/fun/hypot.hpp
stan/math/rev/scal/fun/ibeta.hpp
+4
-4
stan/math/rev/scal/fun/ibeta.hpp
test/unit/math/fwd/mat/fun/distance_test.cpp
+8
-8
test/unit/math/fwd/mat/fun/distance_test.cpp
test/unit/math/fwd/mat/fun/squared_distance_test.cpp
+8
-8
test/unit/math/fwd/mat/fun/squared_distance_test.cpp
test/unit/math/fwd/scal/fun/asinh_test.cpp
+2
-2
test/unit/math/fwd/scal/fun/asinh_test.cpp
test/unit/math/fwd/scal/fun/cbrt_test.cpp
+2
-2
test/unit/math/fwd/scal/fun/cbrt_test.cpp
test/unit/math/fwd/scal/fun/erf_test.cpp
+2
-2
test/unit/math/fwd/scal/fun/erf_test.cpp
test/unit/math/fwd/scal/fun/erfc_test.cpp
+2
-2
test/unit/math/fwd/scal/fun/erfc_test.cpp
test/unit/math/fwd/scal/fun/round_test.cpp
+2
-2
test/unit/math/fwd/scal/fun/round_test.cpp
test/unit/math/fwd/scal/fun/trunc_test.cpp
+1
-1
test/unit/math/fwd/scal/fun/trunc_test.cpp
with
93 additions
and
454 deletions
+93
-454
stan/math/prim/scal/prob/inv_gamma_lccdf.hpp
View file @
9c17e4ba
...
...
@@ -16,7 +16,6 @@
#include <stan/math/prim/scal/fun/lgamma.hpp>
#include <stan/math/prim/scal/fun/gamma_p.hpp>
#include <stan/math/prim/scal/fun/digamma.hpp>
#include <stan/math/prim/scal/fun/tgamma.hpp>
#include <stan/math/prim/scal/meta/length.hpp>
#include <stan/math/prim/scal/meta/is_constant_struct.hpp>
#include <stan/math/prim/scal/meta/scalar_seq_view.hpp>
...
...
@@ -68,7 +67,7 @@ typename return_type<T_y, T_shape, T_scale>::type inv_gamma_lccdf(
return
ops_partials
.
build
(
0.0
);
}
using
st
an
::
math
::
tgamma
;
using
boo
st
::
math
::
tgamma
;
using
std
::
exp
;
using
std
::
log
;
using
std
::
pow
;
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/mat/fun/matrix_exp_multiply.hpp
View file @
9c17e4ba
#ifndef STAN_MATH_REV_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP
#define STAN_MATH_REV_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP
#include <stan/math/rev/mat.hpp>
#include <stan/math/rev/core.hpp>
#include <stan/math/prim/mat/fun/matrix_exp_action_handler.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/rev/mat/fun/to_var.hpp>
#include <stan/math/prim/mat/fun/matrix_exp.hpp>
#include <stan/math/prim/arr/err/check_nonzero_size.hpp>
#include <stan/math/prim/mat/err/check_multiplicable.hpp>
#include <stan/math/prim/
scal
/err/check_
not_nan
.hpp>
#include <
boo
st/math/
tools/promotion
.hpp>
#include <
boost/utility/enable_if
.hpp>
#include <
boost/type_traits
.hpp>
#include <
vector
>
#include <stan/math/prim/
mat
/err/check_
square
.hpp>
#include <st
an
/math/
prim/mat/fun/matrix_exp
.hpp>
#include <
stan/math/prim/scal/meta/return_type
.hpp>
#include <
stan/math/rev/mat/fun/multiply
.hpp>
#include <
stan/math/rev/core.hpp
>
namespace
stan
{
namespace
math
{
/**
* Calculate adjoint of matrix exponential action
* exp(At)*B when A is data and B is var, used for chaining action.
*
* @param Ad double array pointer to the data of matrix A
* @param n dim of square matrix A
* @param adjexpAB MatrixXd adjoint of exp(At)*B
* @param t double time data
* @return MatrixXd The adjoint of B.
*/
inline
Eigen
::
MatrixXd
exp_action_chain_dv
(
double
*
Ad
,
const
int
&
n
,
const
Eigen
::
MatrixXd
&
adjexpAB
,
const
double
t
)
{
using
Eigen
::
Map
;
matrix_exp_action_handler
handle
;
return
handle
.
action
(
Map
<
Eigen
::
MatrixXd
>
(
Ad
,
n
,
n
).
transpose
(),
adjexpAB
,
t
);
}
/**
* Calculate adjoint of matrix exponential action
* exp(At)*B when A is var and B is data, used for chaining action.
*
* @param Ad double array pointer to the data of matrix A
* @param Bd double array pointer to the data of matrix B
* @param n dim(nb. of rows) of square matrix A
* @param m nb. of cols of matrix B
* @param adjexpAB MatrixXd adjoint of exp(At)*B
* @param t double time data
* @return MatrixXd The adjoint of A.
*/
inline
Eigen
::
MatrixXd
exp_action_chain_vd
(
double
*
Ad
,
double
*
Bd
,
const
int
&
n
,
const
int
&
m
,
const
Eigen
::
MatrixXd
&
adjexpAB
,
const
double
t
)
{
using
Eigen
::
Map
;
using
Eigen
::
Matrix
;
using
Eigen
::
MatrixXd
;
Eigen
::
MatrixXd
adjexpA
=
Eigen
::
MatrixXd
::
Zero
(
n
,
n
);
Eigen
::
MatrixXd
adjA
=
Eigen
::
MatrixXd
::
Zero
(
n
,
n
);
// TODO(yizhang): a better way such as complex step approximation
try
{
start_nested
();
adjexpA
=
adjexpAB
*
Map
<
MatrixXd
>
(
Bd
,
n
,
m
).
transpose
();
Eigen
::
Matrix
<
stan
::
math
::
var
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>
Av
(
n
,
n
);
for
(
int
i
=
0
;
i
<
Av
.
size
();
++
i
)
{
Av
(
i
)
=
to_var
(
Ad
[
i
]);
}
std
::
vector
<
stan
::
math
::
var
>
Avec
(
Av
.
data
(),
Av
.
data
()
+
Av
.
size
());
Eigen
::
Matrix
<
stan
::
math
::
var
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>
expA
=
matrix_exp
(
Av
);
std
::
vector
<
double
>
g
;
for
(
size_type
i
=
0
;
i
<
expA
.
size
();
++
i
)
{
stan
::
math
::
set_zero_all_adjoints_nested
();
expA
.
coeffRef
(
i
).
grad
(
Avec
,
g
);
for
(
size_type
j
=
0
;
j
<
adjA
.
size
();
++
j
)
{
adjA
(
j
)
+=
adjexpA
(
i
)
*
g
[
j
];
}
}
}
catch
(
const
std
::
exception
&
e
)
{
recover_memory_nested
();
throw
;
}
recover_memory_nested
();
return
adjA
;
}
/**
* This is a subclass of the vari class for matrix
* exponential action exp(At) * B where A is a double
* NxN matrix and B is a NxCb matrix.
*
* The class stores the structure of each matrix,
* the double values of A and B, and pointers to
* the varis for A and B if A or B is a var. It
* also instantiates and stores pointers to
* varis for all elements of A * B.
*
* @tparam Ta Scalar type of matrix A
* @tparam N rows and cols of A
* @tparam Tb Scalar type for matrix B
* @tparam Cb cols for matrix B
*/
template
<
typename
Ta
,
int
N
,
typename
Tb
,
int
Cb
>
class
matrix_exp_action_vari
:
public
vari
{
public:
int
n_
;
int
B_cols_
;
int
A_size_
;
int
B_size_
;
double
t_
;
double
*
Ad_
;
double
*
Bd_
;
vari
**
variRefA_
;
vari
**
variRefB_
;
vari
**
variRefexpAB_
;
/**
* Constructor: vari child-class of matrix_exp_action_vari.
* @param A statically-sized matirx
* @param B statically-sized matirx
* @param t double scalar time.
*/
matrix_exp_action_vari
(
const
Eigen
::
Matrix
<
Ta
,
N
,
N
>&
A
,
const
Eigen
::
Matrix
<
Tb
,
N
,
Cb
>&
B
,
const
double
&
t
)
:
vari
(
0.0
),
n_
(
A
.
rows
()),
B_cols_
(
B
.
cols
()),
A_size_
(
A
.
size
()),
B_size_
(
B
.
size
()),
t_
(
t
),
Ad_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
A_size_
)),
Bd_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
B_size_
)),
variRefA_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
A_size_
)),
variRefB_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
B_size_
)),
variRefexpAB_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
B_size_
))
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
for
(
size_type
i
=
0
;
i
<
A
.
size
();
++
i
)
{
variRefA_
[
i
]
=
A
.
coeffRef
(
i
).
vi_
;
Ad_
[
i
]
=
A
.
coeffRef
(
i
).
val
();
}
for
(
size_type
i
=
0
;
i
<
B
.
size
();
++
i
)
{
variRefB_
[
i
]
=
B
.
coeffRef
(
i
).
vi_
;
Bd_
[
i
]
=
B
.
coeffRef
(
i
).
val
();
}
matrix_exp_action_handler
handle
;
MatrixXd
expAB
=
handle
.
action
(
Map
<
MatrixXd
>
(
Ad_
,
n_
,
n_
),
Map
<
MatrixXd
>
(
Bd_
,
n_
,
B_cols_
),
t_
);
for
(
size_type
i
=
0
;
i
<
expAB
.
size
();
++
i
)
variRefexpAB_
[
i
]
=
new
vari
(
expAB
.
coeffRef
(
i
),
false
);
}
/**
* Chain command for the adjoint of matrix exp action.
*/
virtual
void
chain
()
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
MatrixXd
adjexpAB
(
n_
,
B_cols_
);
for
(
size_type
i
=
0
;
i
<
adjexpAB
.
size
();
++
i
)
adjexpAB
(
i
)
=
variRefexpAB_
[
i
]
->
adj_
;
MatrixXd
adjA
=
exp_action_chain_vd
(
Ad_
,
Bd_
,
n_
,
B_cols_
,
adjexpAB
,
t_
);
MatrixXd
adjB
=
exp_action_chain_dv
(
Ad_
,
n_
,
adjexpAB
,
t_
);
for
(
size_type
i
=
0
;
i
<
A_size_
;
++
i
)
{
variRefA_
[
i
]
->
adj_
+=
adjA
(
i
);
}
for
(
size_type
i
=
0
;
i
<
B_size_
;
++
i
)
{
variRefB_
[
i
]
->
adj_
+=
adjB
(
i
);
}
}
};
/**
* This is a subclass of the vari class for matrix
* exponential action exp(At) * B where A is an N by N
* matrix of double, B is N by Cb, and t is data(time)
*
* The class stores the structure of each matrix,
* the double values of A and B, and pointers to
* the varis for A and B if B is a var. It
* also instantiates and stores pointers to
* varis for all elements of exp(At) * B.
*
* @tparam N Rows and cols for matrix A, also rows for B
* @tparam Tb Scalar type for matrix B
* @tparam Cb Columns for matrix B
*/
template
<
int
N
,
typename
Tb
,
int
Cb
>
class
matrix_exp_action_vari
<
double
,
N
,
Tb
,
Cb
>
:
public
vari
{
public:
int
n_
;
int
B_cols_
;
int
A_size_
;
int
B_size_
;
double
t_
;
double
*
Ad_
;
double
*
Bd_
;
vari
**
variRefB_
;
vari
**
variRefexpAB_
;
/**
* Constructor for matrix_exp_action_vari.
*
* All memory allocated in
* ChainableStack's stack_alloc arena.
*
* It is critical for the efficiency of this object
* that the constructor create new varis that aren't
* popped onto the var_stack_, but rather are
* popped onto the var_nochain_stack_. This is
* controlled to the second argument to
* vari's constructor.
*
* @param A matrix
* @param B matrix
* @param t double
*/
matrix_exp_action_vari
(
const
Eigen
::
Matrix
<
double
,
N
,
N
>&
A
,
const
Eigen
::
Matrix
<
Tb
,
N
,
Cb
>&
B
,
const
double
&
t
)
:
vari
(
0.0
),
n_
(
A
.
rows
()),
B_cols_
(
B
.
cols
()),
A_size_
(
A
.
size
()),
B_size_
(
B
.
size
()),
t_
(
t
),
Ad_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
A_size_
)),
Bd_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
B_size_
)),
variRefB_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
B_size_
)),
variRefexpAB_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
B_size_
))
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
for
(
size_type
i
=
0
;
i
<
A
.
size
();
++
i
)
Ad_
[
i
]
=
A
.
coeffRef
(
i
);
for
(
size_type
i
=
0
;
i
<
B
.
size
();
++
i
)
{
variRefB_
[
i
]
=
B
.
coeffRef
(
i
).
vi_
;
Bd_
[
i
]
=
B
.
coeffRef
(
i
).
val
();
}
matrix_exp_action_handler
handle
;
MatrixXd
expAB
=
handle
.
action
(
Map
<
MatrixXd
>
(
Ad_
,
n_
,
n_
),
Map
<
MatrixXd
>
(
Bd_
,
n_
,
B_cols_
),
t_
);
for
(
size_type
i
=
0
;
i
<
expAB
.
size
();
++
i
)
variRefexpAB_
[
i
]
=
new
vari
(
expAB
.
coeffRef
(
i
),
false
);
}
/**
* Chain for matrix_exp_action_vari.
*/
virtual
void
chain
()
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
MatrixXd
adjexpAB
(
n_
,
B_cols_
);
// MatrixXd adjB(n_, B_cols_);
for
(
size_type
i
=
0
;
i
<
adjexpAB
.
size
();
++
i
)
adjexpAB
(
i
)
=
variRefexpAB_
[
i
]
->
adj_
;
MatrixXd
adjB
=
exp_action_chain_dv
(
Ad_
,
n_
,
adjexpAB
,
t_
);
for
(
size_type
i
=
0
;
i
<
B_size_
;
++
i
)
{
variRefB_
[
i
]
->
adj_
+=
adjB
(
i
);
}
}
};
/**
* This is a subclass of the vari class for matrix
* exponential action exp(At) * B where A is an N by N
* matrix of var, B is N by Cb matrix of double, and t is data(time)
*
* The class stores the structure of each matrix,
* the double values of A and B, and pointers to
* the varis for A and B if B is a var. It
* also instantiates and stores pointers to
* varis for all elements of exp(At) * B.
*
* @tparam Ta Scalar type for matrix A
* @tparam N Rows and cols for matrix A, also rows for B
* @tparam Cb Columns for matrix B
*/
template
<
typename
Ta
,
int
N
,
int
Cb
>
class
matrix_exp_action_vari
<
Ta
,
N
,
double
,
Cb
>
:
public
vari
{
public:
int
n_
;
int
B_cols_
;
int
A_size_
;
int
B_size_
;
double
t_
;
double
*
Ad_
;
double
*
Bd_
;
vari
**
variRefA_
;
vari
**
variRefexpAB_
;
/**
* Constructor for matrix_exp_action_vari.
*
* All memory allocated in
* ChainableStack's stack_alloc arena.
*
* It is critical for the efficiency of this object
* that the constructor create new varis that aren't
* popped onto the var_stack_, but rather are
* popped onto the var_nochain_stack_. This is
* controlled to the second argument to
* vari's constructor.
*
* @param A matrix
* @param B matrix
* @param t double
*/
matrix_exp_action_vari
(
const
Eigen
::
Matrix
<
Ta
,
N
,
N
>&
A
,
const
Eigen
::
Matrix
<
double
,
N
,
Cb
>&
B
,
const
double
&
t
)
:
vari
(
0.0
),
n_
(
A
.
rows
()),
B_cols_
(
B
.
cols
()),
A_size_
(
A
.
size
()),
B_size_
(
B
.
size
()),
t_
(
t
),
Ad_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
A_size_
)),
Bd_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
double
>
(
B_size_
)),
variRefA_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
A_size_
)),
variRefexpAB_
(
ChainableStack
::
instance
().
memalloc_
.
alloc_array
<
vari
*>
(
B_size_
))
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
for
(
size_type
i
=
0
;
i
<
A
.
size
();
++
i
)
{
variRefA_
[
i
]
=
A
.
coeffRef
(
i
).
vi_
;
Ad_
[
i
]
=
A
.
coeffRef
(
i
).
val
();
}
for
(
size_type
i
=
0
;
i
<
B
.
size
();
++
i
)
{
Bd_
[
i
]
=
B
.
coeffRef
(
i
);
}
matrix_exp_action_handler
handle
;
MatrixXd
expAB
=
handle
.
action
(
Map
<
MatrixXd
>
(
Ad_
,
n_
,
n_
),
Map
<
MatrixXd
>
(
Bd_
,
n_
,
B_cols_
),
t_
);
for
(
size_type
i
=
0
;
i
<
expAB
.
size
();
++
i
)
variRefexpAB_
[
i
]
=
new
vari
(
expAB
.
coeffRef
(
i
),
false
);
}
virtual
void
chain
()
{
using
Eigen
::
Map
;
using
Eigen
::
MatrixXd
;
MatrixXd
adjexpAB
(
n_
,
B_cols_
);
for
(
size_type
i
=
0
;
i
<
adjexpAB
.
size
();
++
i
)
adjexpAB
(
i
)
=
variRefexpAB_
[
i
]
->
adj_
;
MatrixXd
adjA
=
exp_action_chain_vd
(
Ad_
,
Bd_
,
n_
,
B_cols_
,
adjexpAB
,
t_
);
for
(
size_type
i
=
0
;
i
<
A_size_
;
++
i
)
{
variRefA_
[
i
]
->
adj_
+=
adjA
(
i
);
}
}
};
/**
* Return product of exp(At) and B, where A is a NxN matrix,
* B is a NxCb matrix, and t is a double
* @tparam Ta scalar type matrix A
* @tparam N Rows and cols matrix A, also rows of matrix B
* @tparam Tb scalar type matrix B
* @tparam Cb Columns matrix B
* @param[in] A Matrix
* @param[in] B Matrix
* @param[in] t double
* @return exponential of At multiplies B
*/
template
<
typename
Ta
,
int
N
,
typename
Tb
,
int
Cb
>
inline
typename
boost
::
enable_if_c
<
boost
::
is_same
<
Ta
,
var
>::
value
||
boost
::
is_same
<
Tb
,
var
>::
value
,
Eigen
::
Matrix
<
var
,
N
,
Cb
>
>::
type
matrix_exp_action
(
const
Eigen
::
Matrix
<
Ta
,
N
,
N
>&
A
,
const
Eigen
::
Matrix
<
Tb
,
N
,
Cb
>&
B
,
const
double
&
t
=
1.0
)
{
matrix_exp_action_vari
<
Ta
,
N
,
Tb
,
Cb
>*
baseVari
=
new
matrix_exp_action_vari
<
Ta
,
N
,
Tb
,
Cb
>
(
A
,
B
,
t
);
Eigen
::
Matrix
<
var
,
N
,
Cb
>
expAB_v
(
A
.
rows
(),
B
.
cols
());
for
(
size_type
i
=
0
;
i
<
expAB_v
.
size
();
++
i
)
{
expAB_v
.
coeffRef
(
i
).
vi_
=
baseVari
->
variRefexpAB_
[
i
];
}
return
expAB_v
;
}
/**
* Wrapper of matrix_exp_action function for a more literal name
* @tparam Ta scalar type matrix A
...
...
@@ -406,7 +30,7 @@ matrix_exp_multiply(const Eigen::Matrix<Ta, -1, -1>& A,
check_nonzero_size
(
"matrix_exp_multiply"
,
"input matrix"
,
B
);
check_multiplicable
(
"matrix_exp_multiply"
,
"A"
,
A
,
"B"
,
B
);
check_square
(
"matrix_exp_multiply"
,
"input matrix"
,
A
);
return
matrix_exp
_action
(
A
,
B
);
return
multiply
(
matrix_exp
(
A
)
,
B
);
}
}
// namespace math
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/mat/fun/scale_matrix_exp_multiply.hpp
View file @
9c17e4ba
#ifndef STAN_MATH_REV_MAT_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP
#define STAN_MATH_REV_MAT_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP
#include <stan/math/prim/mat.hpp>
#include <stan/math/rev/mat/fun/matrix_exp_multiply.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
#include <vector>
#include <stan/math/prim/arr/err/check_nonzero_size.hpp>
#include <stan/math/prim/mat/err/check_multiplicable.hpp>
#include <stan/math/prim/mat/err/check_square.hpp>
#include <stan/math/prim/mat/fun/matrix_exp.hpp>
#include <stan/math/prim/scal/meta/return_type.hpp>
#include <stan/math/rev/mat/fun/multiply.hpp>
#include <stan/math/rev/core.hpp>
namespace
stan
{
namespace
math
{
/**
* Wrapper of matrix_exp_action function for a more literal name.
* Return product of exp(At) and B, where A is a NxN matrix,
* B is a NxCb matrix, and t is a double
*
* @tparam Ta scalar type matrix A
* @tparam Tb scalar type matrix B
* @tparam Cb Columns matrix B
...
...
@@ -30,7 +33,7 @@ scale_matrix_exp_multiply(const double& t, const Eigen::Matrix<Ta, -1, -1>& A,
check_nonzero_size
(
"scale_matrix_exp_multiply"
,
"input matrix"
,
B
);
check_multiplicable
(
"scale_matrix_exp_multiply"
,
"A"
,
A
,
"B"
,
B
);
check_square
(
"scale_matrix_exp_multiply"
,
"input matrix"
,
A
);
return
m
atrix_exp_action
(
A
,
B
,
t
);
return
m
ultiply
(
matrix_exp
(
multiply
(
A
,
t
))
,
B
);
}
}
// namespace math
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal.hpp
View file @
9c17e4ba
...
...
@@ -22,6 +22,7 @@
#include <stan/math/rev/scal/fun/bessel_second_kind.hpp>
#include <stan/math/rev/scal/fun/binary_log_loss.hpp>
#include <stan/math/rev/scal/fun/boost_fpclassify.hpp>
#include <stan/math/rev/scal/fun/boost_isfinite.hpp>
#include <stan/math/rev/scal/fun/boost_isnormal.hpp>
#include <stan/math/rev/scal/fun/calculate_chain.hpp>
#include <stan/math/rev/scal/fun/cbrt.hpp>
...
...
@@ -58,7 +59,6 @@
#include <stan/math/rev/scal/fun/is_inf.hpp>
#include <stan/math/rev/scal/fun/is_nan.hpp>
#include <stan/math/rev/scal/fun/is_uninitialized.hpp>
#include <stan/math/rev/scal/fun/ldexp.hpp>
#include <stan/math/rev/scal/fun/lgamma.hpp>
#include <stan/math/rev/scal/fun/lmgamma.hpp>
#include <stan/math/rev/scal/fun/log.hpp>
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/boost_isfinite.hpp
0 → 100644
View file @
9c17e4ba
#ifndef STAN_MATH_REV_SCAL_FUN_BOOST_ISFINITE_HPP
#define STAN_MATH_REV_SCAL_FUN_BOOST_ISFINITE_HPP
#include <boost/math/special_functions/fpclassify.hpp>
#include <stan/math/rev/core.hpp>
namespace
boost
{
namespace
math
{
/**
* Checks if the given number has finite value.
*
* Return <code>true</code> if the specified variable's
* value is finite.
*
* @param v Variable to test.
* @return <code>true</code> if variable is finite.
*/
template
<
>
inline
bool
isfinite
(
const
stan
::
math
::
var
&
v
)
{
return
(
boost
::
math
::
isfinite
)(
v
.
val
());
}
}
// namespace math
}
// namespace boost
#endif
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/fdim.hpp
View file @
9c17e4ba
...
...
@@ -104,8 +104,7 @@ inline var fdim(const var& a, const var& b) {
* @return The positive difference between the first and second
* arguments.
*/
template
<
typename
Ta
>
inline
var
fdim
(
const
Ta
&
a
,
const
var
&
b
)
{
inline
var
fdim
(
double
a
,
const
var
&
b
)
{
// reversed test to get NaN vals automatically in second case
return
a
<=
b
.
vi_
->
val_
?
var
(
new
vari
(
0.0
))
:
var
(
new
fdim_dv_vari
(
a
,
b
.
vi_
));
...
...
@@ -122,8 +121,7 @@ inline var fdim(const Ta& a, const var& b) {
* @param b Second variable.
* @return The positive difference between the first and second arguments.
*/
template
<
typename
Tb
>
inline
var
fdim
(
const
var
&
a
,
const
Tb
&
b
)
{
inline
var
fdim
(
const
var
&
a
,
double
b
)
{
// reversed test to get NaN vals automatically in second case
return
a
.
vi_
->
val_
<=
b
?
var
(
new
vari
(
0.0
))
:
var
(
new
fdim_vd_vari
(
a
.
vi_
,
b
));
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/fma.hpp
View file @
9c17e4ba
...
...
@@ -123,8 +123,7 @@ inline var fma(const var& a, const var& b, const var& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Tc
>
inline
var
fma
(
const
var
&
a
,
const
var
&
b
,
const
Tc
&
c
)
{
inline
var
fma
(
const
var
&
a
,
const
var
&
b
,
double
c
)
{
return
var
(
new
fma_vvd_vari
(
a
.
vi_
,
b
.
vi_
,
c
));
}
...
...
@@ -144,8 +143,7 @@ inline var fma(const var& a, const var& b, const Tc& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Tb
>
inline
var
fma
(
const
var
&
a
,
const
Tb
&
b
,
const
var
&
c
)
{
inline
var
fma
(
const
var
&
a
,
double
b
,
const
var
&
c
)
{
return
var
(
new
fma_vdv_vari
(
a
.
vi_
,
b
,
c
.
vi_
));
}
...
...
@@ -167,8 +165,7 @@ inline var fma(const var& a, const Tb& b, const var& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Tb
,
typename
Tc
>
inline
var
fma
(
const
var
&
a
,
const
Tb
&
b
,
const
Tc
&
c
)
{
inline
var
fma
(
const
var
&
a
,
double
b
,
double
c
)
{
return
var
(
new
fma_vdd_vari
(
a
.
vi_
,
b
,
c
));
}
...
...
@@ -186,8 +183,7 @@ inline var fma(const var& a, const Tb& b, const Tc& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Ta
,
typename
Tc
>
inline
var
fma
(
const
Ta
&
a
,
const
var
&
b
,
const
Tc
&
c
)
{
inline
var
fma
(
double
a
,
const
var
&
b
,
double
c
)
{
return
var
(
new
fma_vdd_vari
(
b
.
vi_
,
a
,
c
));
}
...
...
@@ -205,8 +201,7 @@ inline var fma(const Ta& a, const var& b, const Tc& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Ta
,
typename
Tb
>
inline
var
fma
(
const
Ta
&
a
,
const
Tb
&
b
,
const
var
&
c
)
{
inline
var
fma
(
double
a
,
double
b
,
const
var
&
c
)
{
return
var
(
new
fma_ddv_vari
(
a
,
b
,
c
.
vi_
));
}
...
...
@@ -226,8 +221,7 @@ inline var fma(const Ta& a, const Tb& b, const var& c) {
* @param c Summand.
* @return Product of the multiplicands plus the summand, ($a * $b) + $c.
*/
template
<
typename
Ta
>
inline
var
fma
(
const
Ta
&
a
,
const
var
&
b
,
const
var
&
c
)
{
inline
var
fma
(
double
a
,
const
var
&
b
,
const
var
&
c
)
{
return
var
(
new
fma_vdv_vari
(
b
.
vi_
,
a
,
c
.
vi_
));
// a-b symmetry
}
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/fmax.hpp
View file @
9c17e4ba
...
...
@@ -84,8 +84,7 @@ inline var fmax(const var& a, const var& b) {
* to the second value, the first variable, otherwise the second
* value promoted to a fresh variable.
*/
template
<
typename
Tb
>
inline
var
fmax
(
const
var
&
a
,
const
Tb
&
b
)
{
inline
var
fmax
(
const
var
&
a
,
double
b
)
{
if
(
unlikely
(
is_nan
(
a
)))
{
if
(
unlikely
(
is_nan
(
b
)))
return
var
(
new
precomp_v_vari
(
NOT_A_NUMBER
,
a
.
vi_
,
NOT_A_NUMBER
));
...
...
@@ -110,8 +109,7 @@ inline var fmax(const var& a, const Tb& b) {
* return the first value promoted to a variable, otherwise return the
* second variable.
*/
template
<
typename
Ta
>
inline
var
fmax
(
const
Ta
&
a
,
const
var
&
b
)
{
inline
var
fmax
(
double
a
,
const
var
&
b
)
{
if
(
unlikely
(
is_nan
(
b
)))
{
if
(
unlikely
(
is_nan
(
a
)))
return
var
(
new
precomp_v_vari
(
NOT_A_NUMBER
,
b
.
vi_
,
NOT_A_NUMBER
));
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/fmin.hpp
View file @
9c17e4ba
...
...
@@ -80,8 +80,7 @@ inline var fmin(const var& a, const var& b) {
* value, the first variable, otherwise the second value promoted to a fresh
* variable.
*/
template
<
typename
Tb
>
inline
var
fmin
(
const
var
&
a
,
const
Tb
&
b
)
{
inline
var
fmin
(
const
var
&
a
,
double
b
)
{
if
(
unlikely
(
is_nan
(
a
)))
{
if
(
unlikely
(
is_nan
(
b
)))
return
var
(
new
precomp_v_vari
(
NOT_A_NUMBER
,
a
.
vi_
,
NOT_A_NUMBER
));
...
...
@@ -106,8 +105,7 @@ inline var fmin(const var& a, const Tb& b) {
* return the first value promoted to a variable, otherwise return the
* second variable.
*/
template
<
typename
Ta
>
inline
var
fmin
(
const
Ta
&
a
,
const
var
&
b
)
{
inline
var
fmin
(
double
a
,
const
var
&
b
)
{
if
(
unlikely
(
is_nan
(
b
)))
{
if
(
unlikely
(
is_nan
(
a
)))
return
var
(
new
precomp_v_vari
(
NOT_A_NUMBER
,
b
.
vi_
,
NOT_A_NUMBER
));
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/gamma_p.hpp
View file @
9c17e4ba
...
...
@@ -20,7 +20,7 @@ class gamma_p_vv_vari : public op_vv_vari {
gamma_p_vv_vari
(
vari
*
avi
,
vari
*
bvi
)
:
op_vv_vari
(
gamma_p
(
avi
->
val_
,
bvi
->
val_
),
avi
,
bvi
)
{}
void
chain
()
{
using
st
an
::
math
::
lgamma
;
using
boo
st
::
math
::
lgamma
;
using
std
::
exp
;
using
std
::
fabs
;
using
std
::
log
;
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/hypot.hpp
View file @
9c17e4ba
...
...
@@ -57,8 +57,7 @@ inline var hypot(const var& a, const var& b) {
* @param[in] b Length of second side.
* @return Length of hypoteneuse.
*/
template
<
typename
Tb
>
inline
var
hypot
(
const
var
&
a
,
const
Tb
&
b
)
{
inline
var
hypot
(
const
var
&
a
,
double
b
)
{
return
var
(
new
hypot_vd_vari
(
a
.
vi_
,
b
));
}
...
...
@@ -101,8 +100,7 @@ inline var hypot(const var& a, const Tb& b) {
* @param[in] b Length of second side.
* @return Length of hypoteneuse.
*/
template
<
typename
Ta
>
inline
var
hypot
(
const
Ta
&
a
,
const
var
&
b
)
{
inline
var
hypot
(
double
a
,
const
var
&
b
)
{
return
var
(
new
hypot_vd_vari
(
b
.
vi_
,
a
));
}
...
...
This diff is collapsed.
Click to expand it.
stan/math/rev/scal/fun/ibeta.hpp
View file @
9c17e4ba
...
...
@@ -94,7 +94,7 @@ class ibeta_vdv_vari : public op_vdv_vari {
using
boost
::
math
::
constants
::
pi
;
using
boost
::
math
::
digamma
;
using
boost
::
math
::
ibeta
;
using
st
an
::
math
::
tgamma
;
using
boo
st
::
math
::
tgamma
;
using
std
::
log
;
using
std
::
pow
;
using
std
::
sin
;
...
...
@@ -117,7 +117,7 @@ class ibeta_vdd_vari : public op_vdd_vari {
using
boost
::
math
::
constants
::
pi
;
using
boost
::
math
::
digamma
;
using
boost
::
math
::
ibeta
;
using
st
an
::
math
::
tgamma
;
using
boo
st
::
math
::
tgamma
;
using
std
::
log
;
using
std
::
pow
;
using
std
::
sin
;
...
...
@@ -139,7 +139,7 @@ class ibeta_dvv_vari : public op_dvv_vari {
using
boost
::
math
::
constants
::
pi
;
using
boost
::
math
::
digamma
;
using
boost
::
math
::
ibeta
;
using
st
an
::
math
::
tgamma
;
using
boo
st
::
math
::
tgamma
;
using
std
::
log
;
using
std
::
pow
;
using
std
::
sin
;
...
...
@@ -164,7 +164,7 @@ class ibeta_dvd_vari : public op_dvd_vari {
using
boost
::
math
::
constants
::
pi
;
using
boost
::
math
::
digamma
;
using
boost
::
math
::
ibeta
;
using
st
an
::
math
::
tgamma
;
using
boo
st
::
math
::
tgamma
;
using
std
::
log
;
using
std
::
pow
;
using
std
::
sin
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/mat/fun/distance_test.cpp
View file @
9c17e4ba
...
...
@@ -109,8 +109,8 @@ TEST(AgradFwdMatrixDistance, special_values_fd) {
v1
<<
0
;
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v2
,
v1
)));
v1
<<
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
...
...
@@ -119,8 +119,8 @@ TEST(AgradFwdMatrixDistance, special_values_fd) {
v1
<<
-
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v2
,
v1
)));
}
TEST
(
AgradFwdMatrixDistance
,
vector_ffd_vector_ffd
)
{
...
...
@@ -227,8 +227,8 @@ TEST(AgradFwdMatrixDistance, special_values_ffd) {
v1
<<
0
;
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v2
,
v1
)));
v1
<<
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
...
...
@@ -237,6 +237,6 @@ TEST(AgradFwdMatrixDistance, special_values_ffd) {
v1
<<
-
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
distance
(
v2
,
v1
)));
}
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/mat/fun/squared_distance_test.cpp
View file @
9c17e4ba
...
...
@@ -109,8 +109,8 @@ TEST(AgradFwdMatrixSquaredDistance, special_values_fd) {
v1
<<
0
;
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
v1
<<
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
...
...
@@ -119,8 +119,8 @@ TEST(AgradFwdMatrixSquaredDistance, special_values_fd) {
v1
<<
-
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
}
TEST
(
AgradFwdMatrixSquaredDistance
,
vector_ffd_vector_ffd
)
{
...
...
@@ -227,8 +227,8 @@ TEST(AgradFwdMatrixSquaredDistance, special_values_ffd) {
v1
<<
0
;
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
v1
<<
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
...
...
@@ -237,6 +237,6 @@ TEST(AgradFwdMatrixSquaredDistance, special_values_ffd) {
v1
<<
-
std
::
numeric_limits
<
double
>::
infinity
();
v2
<<
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
boo
st
::
math
::
isinf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v1
,
v2
)));
EXPECT_TRUE
(
st
an
::
math
::
is
_
inf
(
stan
::
math
::
squared_distance
(
v2
,
v1
)));
}
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/asinh_test.cpp
View file @
9c17e4ba
...
...
@@ -8,7 +8,7 @@ class AgradFwdAsinh : public testing::Test {
};
TEST_F
(
AgradFwdAsinh
,
Fvar
)
{
using
boo
st
::
math
::
asinh
;
using
st
an
::
math
::
asinh
;
using
stan
::
math
::
fvar
;
using
std
::
sqrt
;
...
...
@@ -30,7 +30,7 @@ TEST_F(AgradFwdAsinh, Fvar) {
}
TEST_F
(
AgradFwdAsinh
,
FvarFvarDouble
)
{
using
boo
st
::
math
::
asinh
;
using
st
an
::
math
::
asinh
;
using
stan
::
math
::
fvar
;
fvar
<
fvar
<
double
>
>
x
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/cbrt_test.cpp
View file @
9c17e4ba
...
...
@@ -4,7 +4,7 @@
#include <test/unit/math/fwd/scal/fun/nan_util.hpp>
TEST
(
AgradFwdCbrt
,
Fvar
)
{
using
boo
st
::
math
::
cbrt
;
using
st
an
::
math
::
cbrt
;
using
stan
::
math
::
fvar
;
using
std
::
isnan
;
...
...
@@ -37,7 +37,7 @@ TEST(AgradFwdCbrt, Fvar) {
}
TEST
(
AgradFwdCbrt
,
FvarFvarDouble
)
{
using
boo
st
::
math
::
cbrt
;
using
st
an
::
math
::
cbrt
;
using
stan
::
math
::
fvar
;
fvar
<
fvar
<
double
>
>
x
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/erf_test.cpp
View file @
9c17e4ba
...
...
@@ -4,7 +4,7 @@
#include <test/unit/math/fwd/scal/fun/nan_util.hpp>
TEST
(
AgradFwdErf
,
Fvar
)
{
using
boo
st
::
math
::
erf
;
using
st
an
::
math
::
erf
;
using
stan
::
math
::
fvar
;
using
std
::
exp
;
using
std
::
sqrt
;
...
...
@@ -23,7 +23,7 @@ TEST(AgradFwdErf, Fvar) {
}
TEST
(
AgradFwdErf
,
FvarFvarDouble
)
{
using
boo
st
::
math
::
erf
;
using
st
an
::
math
::
erf
;
using
stan
::
math
::
fvar
;
using
std
::
exp
;
using
std
::
sqrt
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/erfc_test.cpp
View file @
9c17e4ba
...
...
@@ -4,7 +4,7 @@
#include <test/unit/math/fwd/scal/fun/nan_util.hpp>
TEST
(
AgradFwdErfc
,
Fvar
)
{
using
boo
st
::
math
::
erfc
;
using
st
an
::
math
::
erfc
;
using
stan
::
math
::
fvar
;
using
std
::
exp
;
using
std
::
sqrt
;
...
...
@@ -23,7 +23,7 @@ TEST(AgradFwdErfc, Fvar) {
}
TEST
(
AgradFwdErfc
,
FvarFvarDouble
)
{
using
boo
st
::
math
::
erfc
;
using
st
an
::
math
::
erfc
;
using
stan
::
math
::
fvar
;
using
std
::
exp
;
using
std
::
sqrt
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/round_test.cpp
View file @
9c17e4ba
...
...
@@ -4,7 +4,7 @@
#include <test/unit/math/fwd/scal/fun/nan_util.hpp>
TEST
(
AgradFwdRound
,
Fvar
)
{
using
boo
st
::
math
::
round
;
using
st
an
::
math
::
round
;
using
stan
::
math
::
fvar
;
fvar
<
double
>
x
(
0.5
,
1.0
);
...
...
@@ -30,7 +30,7 @@ TEST(AgradFwdRound, Fvar) {
}
TEST
(
AgradFwdRound
,
FvarFvarDouble
)
{
using
boo
st
::
math
::
round
;
using
st
an
::
math
::
round
;
using
stan
::
math
::
fvar
;
fvar
<
fvar
<
double
>
>
x
;
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/fwd/scal/fun/trunc_test.cpp
View file @
9c17e4ba
...
...
@@ -3,7 +3,7 @@
#include <test/unit/math/fwd/scal/fun/nan_util.hpp>
TEST
(
AgradFwdTrunc
,
Fvar
)
{
using
boo
st
::
math
::
trunc
;
using
st
an
::
math
::
trunc
;
using
stan
::
math
::
fvar
;
fvar
<
double
>
x
(
0.5
,
1.0
);
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
6
7
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help