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
math
matrix
mdivide_right.hpp
Go to the documentation of this file.
1
#ifndef __STAN__MATH__MATRIX__MDIVIDE_RIGHT_HPP__
2
#define __STAN__MATH__MATRIX__MDIVIDE_RIGHT_HPP__
3
4
#include <boost/math/tools/promotion.hpp>
5
#include <
stan/math/matrix/Eigen.hpp
>
6
#include <
stan/math/matrix/mdivide_left.hpp
>
7
#include <
stan/math/matrix/transpose.hpp
>
8
#include <
stan/math/matrix/validate_multiplicable.hpp
>
9
#include <
stan/math/matrix/validate_square.hpp
>
10
11
namespace
stan {
12
namespace
math {
13
22
template
<
typename
T1,
typename
T2,
int
R1,
int
C1,
int
R2,
int
C2>
23
inline
24
Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type,R1,C2>
25
mdivide_right
(
const
Eigen::Matrix<T1,R1,C1> &b,
26
const
Eigen::Matrix<T2,R2,C2> &A) {
27
stan::math::validate_square
(A,
"mdivide_right"
);
28
stan::math::validate_multiplicable
(b,A,
"mdivide_right"
);
29
// FIXME: This is nice and general but likely slow.
30
return
transpose
(
mdivide_left
(
transpose
(A),
transpose
(b)));
31
// return promote_common<Eigen::Matrix<T1,R2,C2>,
32
// Eigen::Matrix<T2,R2,C2> >(A)
33
// .transpose()
34
// .lu()
35
// .solve(promote_common<Eigen::Matrix<T1,R1,C1>,
36
// Eigen::Matrix<T2,R1,C1> >(b)
37
// .transpose())
38
// .transpose();
39
}
40
41
}
42
}
43
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.