当前位置: 首页>>代码示例>>C++>>正文


C++ FVector::load方法代码示例

本文整理汇总了C++中FVector::load方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::load方法的具体用法?C++ FVector::load怎么用?C++ FVector::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FVector的用法示例。


在下文中一共展示了FVector::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main() {
  FVector fv;
  FName g3("L", "1");
  FName g4("L", "2");
  FName t1("T", "1");
  FName p2("P", "2");
  
  fv[g3] = 2.0;
  fv[g4] = 1.3;
  cerr << "fv=" << fv << endl;
  

  
  FVector fv2;
  fv2[g3] = 1.5;
  fv2[t1] = 3.0;
  
  FVector fvsum = fv + fv2;
  FVector fvdiff = fv - fv2;
  FVector fvprod = fv * 1.4;
  FVector fvdiv = fv  / 4.0;
  
  cerr << "fv2=" << fv2 << endl;
  cerr << "fvsum=" << fvsum << endl;
  cerr << "fvdiff=" << fvdiff << endl;
  cerr << "fvprod=" << fvprod << endl;
  cerr << "fvdiv=" << fvdiv << endl;
  cerr << "fv.fvprod=" <<  inner_product(fv,fvprod) << endl;
  cerr << "fvprod.fv=" <<  inner_product(fvprod,fv) << endl;
  
  cerr << "fv * fv2 = " << (fv*fv2) << endl;
  cerr << "fv / fv2 = " << (fv/fv2) << endl;
  
  FVector fvp2 = fv + 2.0;
  cerr << "fv + 2 = " << fvp2 << endl;
  //cerr << "(fv+2)[" << g3 << "] = " << fvp2[g3] << " (fv+2)[" << g4 << "] = " << fvp2[g4] << " (fv+2)[" << t1 << "] = " << fvp2[t1] <<  endl;
  
  FVector fv2m1 = fv2 - 1.0;
  cerr << "(fv + 2) + (fv2 -1) = " << (fvp2 + fv2m1) << endl;
  cerr << "(fv + 2) - (fv2 -1) = " << (fvp2 - fv2m1) << endl;
  cerr << "(fv + 2) * (fv2 -1) = " << (fvp2 * fv2m1) << endl;
  cerr << "(fv + 2) / (fv2 -1) = " << (fvp2 / fv2m1) << endl;
  cerr << "max((fv + 2),(fv2 -1)) = " << fvmax(fvp2,fv2m1) << endl;
  
  cerr << "(fv + 2) + (fv2) = " << (fvp2 + fv2) << endl;
  cerr << "(fv + 2) - (fv2) = " << (fvp2 - fv2) << endl;
  cerr << "(fv + 2) * (fv2) = " << (fvp2 * fv2) << endl;
  cerr << "fv2 / (fv + 2) = " << (fv2 / fvp2) << endl;
  cerr << "max((fv + 2),(fv2)) = " << fvmax(fv2,fvp2) << endl;
  //fv2[g4] = 3.1; //error
  
  cerr << "fv2 . (fv + 2) = " << inner_product(fv2,fv+2) << endl;
  cerr << "(fv2-1) . (fv) = " << inner_product(fv2-1,fv) << endl;
  
  cerr << "(fv -1)[p2] = " << (fv -1)[p2] << endl;
  
  cerr << "fvp2 = " << fvp2 << endl;
  cerr << "++fvp2[g3] = " << ++fvp2[g3] << endl;
  //cerr << "fvp2[g3] = " << ++fvp2[g3] << endl;
  cerr << "fvp2 = " << fvp2 << endl;
  fvp2[p2] += 5;
  cerr << "fvp2 = " << fvp2 << endl;

  
  FVector loaded;
  loaded.load("weights.txt");
  cerr << "loaded=" << loaded << endl;
  

  return 0;
}
开发者ID:bhaddow,项目名称:gibbler,代码行数:71,代码来源:FV.cpp


注:本文中的FVector::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。