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
block.hpp
Go to the documentation of this file.
1
#ifndef __STAN__MATH__MATRIX__BLOCK_HPP__
2
#define __STAN__MATH__MATRIX__BLOCK_HPP__
3
4
#include <
stan/math/matrix/Eigen.hpp
>
5
#include <
stan/math/matrix/validate_row_index.hpp
>
6
7
namespace
stan {
8
namespace
math {
9
19
template
<
typename
T>
20
inline
21
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>
22
block
(
const
Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>& m,
23
size_t
i,
size_t
j,
size_t
nrows,
size_t
ncols) {
24
validate_row_index
(m,i,
"block"
);
25
validate_row_index
(m,i+nrows-1,
"block"
);
26
validate_column_index
(m,j,
"block"
);
27
validate_column_index
(m,j+ncols-1,
"block"
);
28
return
m.block(i - 1,j - 1,nrows,ncols);
29
}
30
31
}
32
}
33
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.