Beispiel #1
0
	void operate(array<T1, S1>& u, array <array <T2, S21>, S22>& p, sep,
					 const array<T3, S3>& a, const size_array& idx = size_array())  // f only used internally!
	{
		if (a.empty()) { u.init(); p.init(); return; }
		size_array first = find(arr(true).cat(diff(a) != 0));
		u = a[first];
		if (idx.empty()) (_, p) = partition++(size_array((0, _, a.length() - 1)), first);  // TODO: remove size_array copy
		else             (_, p) = partition++(idx, first);
	}
Beispiel #2
0
	void operate(array<T1, S1>& u, array <T2, S2>& p, sep,
					 const array<T3, S3>& a, const size_array& idx = size_array())  // f only used internally!
	{
		if (a.empty()) { u.init(); p.init(); return; }
		if (FIRST) (_, p) = find++(arr(true).cat(diff(a) != 0));  // TODO: check speed of cat()
		else       (_, p) = find++((diff(a) != 0).cat(arr(true)));
		u = a[p];
		if (!idx.empty()) force(p) = idx[p];
	}
Beispiel #3
0
	void operate(array<T1, S1>& u, array <T2, S2>& p, array <T3, S3>& q, sep,
					 const array<T4, S4>& a, const size_array& idx = size_array())  // idx only used internally!
	{
		if (a.empty()) { u.init(); p.init(); q.init(); return; }
		q = arr(true).cat(diff(a) != 0);
		if (FIRST) (_, p) = find++(q);
		else       (_, p) = find++(cshift(q, -1));
		u = a[p];
		if (!idx.empty()) force(p) = idx[p];
		q[0] = T3();
		q = cumsum(q);
	}