// ArrayMechanisms.cpp
//
// 2003-8-1 Initial code DD
// 2003-80-6 DD major code review and changes
// 2004-4-3 DD testing etc.
// 2004-4-9 DD Code review and final fiat (for time being)
// 2005-6-19 DD print function for Tensor
// 2005-1-8 DD big fix in l2Norm (wrong name)
// 2007-6-25 DD major new update, code
//
// (C) Datasim Education BV 2003-2007
//
#ifndef ArrayMechanisms_cpp
#define ArrayMechanisms_cpp
#include "ArrayMechanisms.hpp"
#include
#include
#include
#include
using namespace std;
///////////////////////////////////////////////////////////////////////////////////////////////
// Sums and averages
template V sum(const Vector& x)
{ // Sum of elements
V ans = x[x.MinIndex()];
for (I j = x.MinIndex()+1; j