SOPT
Sparse OPTimisation
l1_norm.cc
Go to the documentation of this file.
1 #include "sopt/maths.h"
2 #include "sopt/types.h"
3 
4 int main(int, char const **) {
6  sopt::Image<std::complex<int>> weights(2, 2);
7  input << 1, -2, 3, -4;
8  weights << 5, 6, 7, 8;
9 
10  if (sopt::l1_norm(input, weights) != 1 * 5 + 2 * 6 + 3 * 7 + 4 * 8) throw std::exception();
11 
12  return 0;
13 }
int main(int, char const **)
Definition: l1_norm.cc:4
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
Definition: types.h:39
real_type< typename T0::Scalar >::type l1_norm(Eigen::ArrayBase< T0 > const &input, Eigen::ArrayBase< T1 > const &weights)
Computes weighted L1 norm.
Definition: maths.h:116