本文整理汇总了C++中vector3d::norm方法的典型用法代码示例。如果您正苦于以下问题:C++ vector3d::norm方法的具体用法?C++ vector3d::norm怎么用?C++ vector3d::norm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector3d
的用法示例。
在下文中一共展示了vector3d::norm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rotation_vec_to_matrix
/// turns a 3D rotation angle into a rotation matrix
matrix3d rotation_vec_to_matrix(vector3d angles)
{
// Rodrigues' formula
matrix3d r = matrix3d::Identity();
double len = angles.norm();
if (len>0) {
angles /= len; // normalized rotation axis
matrix3d const t1 = cross(angles);
matrix3d const t2 = t1*t1;
r.noalias() += sin(len) * t1 + (1-cos(len)) * t2;
}
return r;
}
示例2: main
//.........这里部分代码省略.........
{"lenz", '\0', POPT_ARG_DOUBLE, &sw.len[z], 0,
"Relative cell size in z dimension", "DOUBLE"},
{"filename", '\0', POPT_ARG_STRING | POPT_ARGFLAG_SHOW_DEFAULT, &filename, 0,
"Base of output file names", "STRING"},
{"dir", '\0', POPT_ARG_STRING | POPT_ARGFLAG_SHOW_DEFAULT, &dir, 0,
"Save directory", "dir"},
{"neighbor_scale", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&neighbor_scale, 0, "Ratio of neighbor sphere radius to interaction scale "
"times ball radius. Drastically reduces collision detections","DOUBLE"},
{"translation_scale", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&translation_scale, 0, "Standard deviation for translations of balls, "
"relative to ball radius", "DOUBLE"},
{"seed", '\0', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT, &seed, 0,
"Seed for the random number generator", "INT"},
{"acceptance_goal", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&acceptance_goal, 0, "Goal to set the acceptance rate", "DOUBLE"},
{"nw", '\0', POPT_ARG_NONE, &no_weights, 0, "Don't use weighing method "
"to get better statistics on low entropy states", "BOOLEAN"},
{"kT", '\0', POPT_ARG_DOUBLE, &fix_kT, 0, "Use a fixed temperature of kT"
" rather than adjusted weights", "DOUBLE"},
{"flat", '\0', POPT_ARG_NONE, &flat_histogram, 0,
"Use a flat histogram method", "BOOLEAN"},
{"gaussian", '\0', POPT_ARG_NONE, &gaussian_fit, 0,
"Use gaussian weights for flat histogram", "BOOLEAN"},
{"walkers", '\0', POPT_ARG_NONE, &walker_weights, 0,
"Use a walker optimization weight histogram method", "BOOLEAN"},
{"wang_landau", '\0', POPT_ARG_NONE, &wang_landau, 0,
"Use Wang-Landau histogram method", "BOOLEAN"},
{"wl_factor", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT, &wl_factor,
0, "Initial value of Wang-Landau factor", "DOUBLE"},
{"wl_fmod", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT, &wl_fmod, 0,
"Wang-Landau factor modifiction parameter", "DOUBLE"},
{"wl_threshold", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&wl_threshold, 0, "Threhold for normalized standard deviation in "
"energy histogram at which to adjust Wang-Landau factor", "DOUBLE"},
{"wl_cutoff", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&wl_cutoff, 0, "Cutoff for Wang-Landau factor", "DOUBLE"},
{"time", '\0', POPT_ARG_INT, &totime, 0,
"Timing of display information (seconds)", "INT"},
{"R", '\0', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT,
&R, 0, "Ball radius (for testing purposes; should always be 1)", "DOUBLE"},
{"test_weights", '\0', POPT_ARG_NONE, &test_weights, 0,
"Periodically print weight histogram during initialization", "BOOLEAN"},
{"debug", '\0', POPT_ARG_NONE, &debug, 0, "Debug mode", "BOOLEAN"},
POPT_AUTOHELP
POPT_TABLEEND
};
optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
poptSetOtherOptionHelp(optCon, "[OPTION...]\nNumber of balls and filling "
"fraction or cell dimensions are required arguments.");
int c = 0;
// go through arguments, set them based on optionsTable
while((c = poptGetNextOpt(optCon)) >= 0);
if (c < -1) {
fprintf(stderr, "\n%s: %s\n", poptBadOption(optCon, 0), poptStrerror(c));
return 1;
}
poptFreeContext(optCon);
// ----------------------------------------------------------------------------
// Verify we have reasonable arguments and set secondary parameters
// ----------------------------------------------------------------------------
// check that only one method is used
if(bool(no_weights) + bool(flat_histogram) + bool(gaussian_fit)