C++
C#
VB
JScript
All

External Function middle_shift


Copyright (C) 2005 IENT-RWTH Aachen

template<class G> inline typename shiftArray<      Vector<G> >::self middle_shift(      Vector<G> &X)
template<class G> inline typename shiftArray<const Vector<G> >::self middle_shift(const Vector<G> &X)
template<class G> inline typename shiftArray<      Matrix<G> >::self middle_shift(      Matrix<G> &X)
template<class G> inline typename shiftArray<const Matrix<G> >::self middle_shift(const Matrix<G> &X)

Shifts the indexes of the half size

Parameters

X

The array to shift

Returns

An array representing the shifted array

Example

DenseVector<int>::self X(4, "0 1 2 3");
cout << middle_shift(X)[-1] << endl; // 1
cout << middle_shift(X)[ 0] << endl; // 2
DenseMatrix<int>::self X(4,4, "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15");
cout << middle_shift(X)(-1,-1) << endl; // 5
cout << middle_shift(X)( 0, 0) << endl; // 10

See Also

shift, no_shift