C++
C#
VB
JScript
All

External Function sub


Copyright (C) 2005 IENT-RWTH Aachen

template<class G> inline typename SubArray<      Vector<G> >::self sub(      Vector<G> &X, const typename Vector<G>::index_type &p)
template<class G> inline typename SubArray<const Vector<G> >::self sub(const Vector<G> &X, const typename Vector<G>::index_type &p)
template<class G> inline typename SubArray<      Matrix<G> >::self sub(      Matrix<G> &X, const typename Matrix<G>::index_type &p)
template<class G> inline typename SubArray<const Matrix<G> >::self sub(const Matrix<G> &X, const typename Matrix<G>::index_type &p)
template<class G> inline typename SubArray<      Vector<G> >::self sub(      Vector<G> &X, const typename Vector<G>::index_type &p, const typename Vector<G>::size_type &s)
template<class G> inline typename SubArray<const Vector<G> >::self sub(const Vector<G> &X, const typename Vector<G>::index_type &p, const typename Vector<G>::size_type &s)
template<class G> inline typename SubArray<      Matrix<G> >::self sub(      Matrix<G> &X, const typename Matrix<G>::index_type &p, const typename Matrix<G>::size_type &s)
template<class G> inline typename SubArray<const Matrix<G> >::self sub(const Matrix<G> &X, const typename Matrix<G>::index_type &p, const typename Matrix<G>::size_type &s)
template<class G> inline typename SubArray<      Matrix<G> >::self sub(      Matrix<G> &X, typename Matrix<G>::index_type::int_type i, typename Matrix<G>::index_type::int_type j, typename Matrix<G>::size_type::int_type m,typename Matrix<G>::size_type::int_type n)
template<class G> inline typename SubArray<const Matrix<G> >::self sub(const Matrix<G> &X, typename Matrix<G>::index_type::int_type i, typename Matrix<G>::index_type::int_type j, typename Matrix<G>::size_type::int_type m,typename Matrix<G>::size_type::int_type n)

gives a part of an array

Parameters

p

Position index

s

Size

X

The array to cut out

i

Vertical position

j

Hoirizontal position

m

Height

n

Width

Returns

An array representing the part of X

Example

DenseVector<int>::self X(8,"0 1 2 3 4 5 6 7");
cout << sub(X,4,2) << endl; // [4 5]
cout << sub<2>(X,4) << endl; // [4 5] size fixed to 2
DenseMatrix<int>::self Y(4,4,"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15");
typedef DenseMatrix<int>::index_type index_type;
typedef DenseMatrix<int>::size_type  size_type;
cout << sub(Y,index_type(1,0),size_type(2,2)) << endl; // [4 5; 8 9]
cout << sub<2,2>(Y,1,0) << endl; // [4 5; 8 9] size fixed to (2,2)

See Also

extract