本文整理汇总了C++中elem函数的典型用法代码示例。如果您正苦于以下问题:C++ elem函数的具体用法?C++ elem怎么用?C++ elem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elem
/**
* Description not yet available.
* \param
*/
void dmatrix::colfill_randu_ni(const int &j,long int &n)
{
long int nn;
nn=n;
for (int i=rowmin(); i<=rowmax(); i++)
{
elem(i,j)=auto_rand(nn,1);
}
}
示例2: get_sizeoftype
int get_sizeoftype(AST ty) {
switch (nodetype(ty)) {
case tFUNC: return 0;
case tARRAY:
return get_ival(ty) * get_sizeoftype(elem(ty));
default:
return 1;
}
}
示例3: ad_exit
/**
* Description not yet available.
* \param
*/
const dmatrix& d5_array::operator()(int i, int j, int k) const
{
if (i<indexmin()||i>indexmax())
{ cerr << "Error index out of bounds in\n"
"d3_array& d5_array::operator ( )" << endl;
ad_exit(1);
}
return elem(i)(j,k);
}
示例4: transpose
FgMatrixC<T,ncols,nrows>
transpose() const
{
FgMatrixC<T,ncols,nrows> tMat;
for (uint ii=0; ii<nrows; ii++)
for (uint jj=0; jj<ncols; jj++)
tMat.elem(jj,ii) = elem(ii,jj);
return tMat;
}
示例5: ad_exit
/**
* Description not yet available.
* \param
*/
const dvar_matrix& dvar6_array::operator()(int i, int j, int k, int l) const
{
if (i<indexmin()||i>indexmax())
{ cerr << "Error hslice index out of bounds in\n"
"dvar-vector& dvar4_array::operator ( )" << endl;
ad_exit(1);
}
return elem(i)(j,k,l);
}
示例6: fill_matrix_data
/**
* Helper function to fill a matrix with arbitrary data.
*/
void fill_matrix_data(matrix_t *M, precision_t data[][M->cols])
{
int i, j;
for ( i = 0; i < M->rows; i++ ) {
for ( j = 0; j < M->cols; j++ ) {
elem(M, i, j) = data[i][j];
}
}
}
示例7: search
void search(Trav *t) {
ElemList *idx;
int i;
ElemId id;
unmatch(&elem(t->match));
t->match = 0;
for (i=t->cur; i<=t->last; i++) {
idx = index(gsp, searchSpaces[i]);
id = traverse(idx, t, t->p);
if (success) {
match( &elem(id) );
t->match = id;
t->cur = i;
return;
}
}
}
示例8: ad_exit
/**
* Description not yet available.
* \param
*/
const dvar3_array& dvar5_array::operator()(int i, int j) const
{
if (i<indexmin()||i>indexmax())
{ cerr << "Error index out of bounds in\n"
"dvar3_array& dvar5_array::operator ( )" << endl;
ad_exit(1);
}
return elem(i)(j);
}
示例9: print
static void print(Rcpp::NumericMatrix A)
{
for (int i = 0; i < A.nrow(); i++) {
for (int j = 0; j < A.ncol(); j++) {
printf("%9f ", elem(A, i, j));
}
putchar('\n');
}
}
示例10: domain
namespace boost { namespace hana {
struct Function {
struct hana {
struct operators
: boost::hana::operators::of<Comparable>
{ };
};
};
template <typename Domain, typename Codomain, typename F, typename = operators::adl>
struct function_type {
struct hana { using datatype = Function; };
Domain dom;
Codomain cod;
F def;
friend constexpr auto domain(function_type f)
{ return f.dom; }
friend constexpr auto codomain(function_type f)
{ return f.cod; }
template <typename X>
constexpr auto operator()(X x) const {
if (!elem(domain(*this), x))
throw std::domain_error{"use of a hana::function with an argument out of the domain"};
return def(x);
}
};
BOOST_HANA_CONSTEXPR_LAMBDA auto function = [](auto domain, auto codomain) {
return [=](auto definition) {
return function_type<decltype(domain), decltype(codomain), decltype(definition)>{
domain, codomain, definition
};
};
};
BOOST_HANA_CONSTEXPR_LAMBDA auto frange = [](auto f) {
// Note: that would be better handled by a set data structure, but
// whatever for now.
return foldl(transform(domain(f), f), make<Tuple>(), [](auto xs, auto x) {
return if_(elem(xs, x), xs, prepend(x, xs));
});
};
template <>
struct equal_impl<Function, Function> {
template <typename F, typename G>
static constexpr auto apply(F f, G g) {
return domain(f) == domain(g) && all_of(domain(f), demux(equal)(f, g));
}
};
}} // end namespace boost::hana
示例11: fijaElemento
int fijaElemento(matriz * mtz, int fila, int columna, long double _Complex valor)
{
if (!mtz) return -1;
assert(mtz->datos);
if (fila<=0 || fila > mtz->filas || columna<=0 || columna > mtz->columnas)
return -2;
elem(mtz,fila,columna)=valor;
return 0;
}
示例12: elem
void updatefunct_t::execute( const size_t& myidx, global_store& globals )
{
for(size_t c=0; c<lines.size(); ++c)
{
vector<elemptr> trace;
elemptr elem( model, myidx );
trace.push_back( elem );
DOCMD( lines[c], trace, *cmds, globals );
}
}
示例13: showDebug
/*
Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
AccessibleElement elem(varID.lVal, accessible);
const bool res = elem.iface ? elem.iface->doAction(DefaultAction, elem.entry, QVariantList()) : false;
return res ? S_OK : S_FALSE;
}
示例14: ADMB_ARRAY_BOUNDS_ERROR
/**
* Description not yet available.
* \param
*/
d4_array& d5_array::operator ( ) (int i)
{
if (i < indexmin() || i > indexmax())
{
ADMB_ARRAY_BOUNDS_ERROR("index out of bounds",
"d4_array& d5_array::operator()(int i)", indexmin(), indexmax(), i);
}
//return t[i];
return elem(i);
}
示例15: ADMB_ARRAY_BOUNDS_ERROR
/**
* Description not yet available.
* \param
*/
dvar3_array& dvar6_array::operator ( ) (int i,int j,int k)
{
if (i < indexmin() || i > indexmax())
{
ADMB_ARRAY_BOUNDS_ERROR("hslice index out of bounds",
"dvar5_array& dvar6_array::operator()(int i, int j, int k)",
indexmin(), indexmax(), i);
}
return elem(i)(j,k);
}