Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ block_zero_based()

template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto stan::math::block_zero_based ( T &&  a,
int  start_row,
int  start_col,
int  rows,
int  cols 
)
inline

Block of a kernel generator expression.

This version uses zero-based indices in contrast to the 1-based block(), which is exposed to the Stan language.

Block operation modifies how its argument is indexed. If a matrix is both an argument and result of such an operation (such as in block_zero_based(a, row1, col1, rows, cols) = block_zero_based(a, row2, col2, rows, cols); ), the result can be wrong due to aliasing. In such case the expression should be evaluating in a temporary by doing block_zero_based(a, row1, col1, rows, cols) = block_zero_based(a, row2, col2, rows, cols).eval();. This is not necessary if the blocks do not overlap or if they are the same block.

Template Parameters
Ttype of argument
Parameters
ainput argument
start_rowfirst row of block
start_colfirst column of a block
rowsnumber of rows in block
colsnumber of columns in block
Returns
Block of given expression

Definition at line 340 of file block_zero_based.hpp.