9 std::cout << xi <<
' ';
10 std::cout << std::endl;
41 assert(x.size() == y.size());
46 for(
size_t i = 0; i != n; i++)
59 for (
size_t i = 0; i != n; ++i)
79 for(
size_t i = 0; i != n; i++)
80 val += std::fabs(x[i]);
99 for(
size_t i = 0; i != n; i++)
102 return std::sqrt(val);
118 for(
size_t i = 0; i != n; i++)
119 val += std::max(std::fabs(x[i]), val);
137 for(
size_t i = 0; i != n; i++)
138 val += std::pow(std::fabs(x[i]), p);
140 return std::pow(val, 1./p);
146 assert(a.size() == b.size());
147 VecDbl result(a.size(), 0.0);
149 for (
size_t i=0; i<a.size(); ++i)
150 result[i] = a[i] + b[i];
158 assert(a.size() == b.size());
159 VecDbl result(a.size(), 0.0);
161 for (
size_t i=0; i<a.size(); ++i)
162 result[i] = a[i] - b[i];
std::vector< double > VecDbl
void PrintVector(const VecDbl &x)
double Vec1Norm(const VecDbl &x)
VecDbl operator-(const VecDbl &a, const VecDbl &b)
void Scale(VecDbl &x, const double &val)
VecDbl VecMul(const VecDbl &x, const double &val)
void Set(VecDbl &x, const double &val)
double VecInfinityNorm(const VecDbl &x)
VecDbl operator+(const VecDbl &a, const VecDbl &b)
double Dot(const VecDbl &x, const VecDbl &y)
double VecPNorm(const VecDbl &x, const double &p)
double Vec2Norm(const VecDbl &x)