sub_row.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_FUN_SUB_ROW_HPP
#define STAN_MATH_PRIM_MAT_FUN_SUB_ROW_HPP
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/err/check_row_index.hpp>
#include <stan/math/prim/mat/err/check_column_index.hpp>
namespace stan {
namespace math {
template <typename T>
inline
Eigen::Matrix<T, 1, Eigen::Dynamic>
sub_row(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& m,
size_t i, size_t j, size_t ncols) {
check_row_index("sub_row", "i", m, i);
check_column_index("sub_row", "j", m, j);
if (ncols > 0)
check_column_index("sub_col", "j+ncols-1", m, j+ncols-1);
return m.block(i - 1, j - 1, 1, ncols);
}
}
}
#endif
stan
Definition: log_sum_exp.hpp:8
stan::math::sub_row
Eigen::Matrix< T, 1, Eigen::Dynamic > sub_row(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m, size_t i, size_t j, size_t ncols)
Return a 1 x nrows subrow starting at (i-1, j-1).
Definition: sub_row.hpp:23
check_column_index.hpp
check_row_index.hpp
stan::math::check_column_index
void check_column_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
Check if the specified index is a valid column of the matrix.
Definition: check_column_index.hpp:35
stan::math::check_row_index
void check_row_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
Check if the specified index is a valid row of the matrix.
Definition: check_row_index.hpp:30
Eigen.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.