euclid_norm.cc

来自「MTL C++ Numeric Library」· CC 代码 · 共 31 行

CC
31
字号
#include <iostream>#include "mtl/mtl.h"#include "mtl/utils.h"#include "mtl/linalg_vec.h"/*  Sample output;X: [1,5,3,1,]The L-2 norm of X is 6    */using namespace mtl;typedef external_vec<double> Vec;intmain(){  double data[] = {1,5,3,1};  Vec x(data, 4);   double s = two_norm(x);  std::cout << "X: ";  print_vector(x);  std::cout << "The L-2 norm of X is " << s << std::endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?