本文整理汇总了C++中FVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::size方法的具体用法?C++ FVector::size怎么用?C++ FVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector
的用法示例。
在下文中一共展示了FVector::size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inner_product
FValue inner_product(const FVector& lhs, const FVector& rhs)
{
if (lhs.size() >= rhs.size()) {
return rhs.inner_product(lhs);
} else {
return lhs.inner_product(rhs);
}
}
示例2: fabs
void
SvmSgd::get_delta_w(FVector w2, map <double, int> & delta_w)
{
double value;
cout << "w2.size(): " << w2.size() << endl;
cout << "w2[0] value: " << w2[0] << endl;
for(int i = 1; i < w2.size(); i++){
value = fabs(w2[i] - w[i]);
delta_w.insert(pair<double, int>(value, i - 1));
}
}
示例3: output_w
void SvmSgd::output_w(const char* filename)
{
//TODO: output parameter w!!!
VFloat *f1 = w;
cout << "\n Prepare to output w: \n" ;
int m = w.size();
cout << "size of m: " << m << endl;
ofstream outwfd(filename);
if(outwfd){
outwfd << t << endl;
outwfd << wDivisor << endl;
outwfd << wBias << endl;
while(--m >= 0){
outwfd << *f1++ << "\t" ;
}
}
else{
cout << t << endl;
cout << wDivisor << endl;
cout << wBias << endl;
while(--m >= 0){
cout << *f1++ << "\t" ;
}
}
}
示例4: c
void
SvmSgd::calibrate(int imin, int imax,
const xvec_t &xp, const yvec_t &yp)
{
cout << "Estimating sparsity and bscale." << endl;
int j;
// compute average gradient size
double n = 0;
double m = 0;
double r = 0;
FVector c(w.size());
for (j=imin; j<=imax && m<=1000; j++,n++)
{
const SVector &x = xp.at(j);
n += 1;
r += x.npairs();
const SVector::Pair *p = x;
while (p->i >= 0 && p->i < c.size())
{
double z = c.get(p->i) + fabs(p->v);
c.set(p->i, z);
m = max(m, z);
p += 1;
}
}
// bias update scaling
bscale = m/n;
// compute weight decay skip
skip = (int) ((8 * n * w.size()) / r);
cout << " using " << n << " examples." << endl;
cout << " skip: " << skip
<< " bscale: " << setprecision(6) << bscale << endl;
}
示例5: assert
static void
dLogSum(double g, const FVector &v, FVector &r)
{
assert(v.size() <= r.size());
dLogSum(g, v, r, v.size());
}
示例6: logSum
static double
logSum(const FVector &v)
{
return logSum(v, v.size());
}