MTL vector L1 norm calculation example

xiaoxiao2021-03-06  45

#include #include "mtl / utils.h" #include "mtl / mtl.h" #include "mtl / tinalg_vec.h"

/ * Sample Output;

X: [1, 2, 3, 4,] The L-1 Norm OF X IS 10 * /

Using namespace MTL;

INTMAIN () {Double X_ [5] = {1, 2, 3, 4, 5};

Double s = one_norm (array_to_vec (x_));

Std :: cout << "x:"; print_vector (array_to_vec (x_));

Std :: cout << "The L-1 Norm of X IS" << S << std :: endl;}

Output:

X: [1, 2, 3, 4] The L-1 Norm OF X IS 10

转载请注明原文地址:https://www.9cbs.com/read-51323.html

New Post(0)