Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
msg_left_permutation_apply.h
Go to the documentation of this file.
1#ifndef _RHEO_MSG_LEFT_PERMUTATION_APPLY_H
2#define _RHEO_MSG_LEFT_PERMUTATION_APPLY_H
23namespace rheolef {
24/*F:
25NAME: msg_left_permutation_apply -- sequentail apply (@PACKAGE@ @VERSION@)
26DESCRIPTION:
27 Applies a left permutation to an array.
28ALGORITHM:
29 msg_left_permutation_apply
30
31 "input": the length array
32 | x(0:nx-1), py(0:n-1)
33 "output": the pointer array and the total size
34 | y(0:n)
35 begin
36 | for i := 0 to n-1 do
37 | y(py(i)) := x(i)
38 | endfor
39 end
40COMPLEXITY:
41 Time and memory complexity is O(n).
42METHODS: @msg_left_permutation_apply
43AUTHORS:
44 LMC-IMAG, 38041 Grenoble cedex 9, France
45 | Pierre.Saramito@imag.fr
46DATE: 6 january 1999
47END:
48*/
49
50//<msg_left_permutation_apply:
51template <
52 class InputIterator1,
53 class InputIterator2,
54 class SetOp,
55 class OutputRandomIterator>
56void
58 InputIterator1 x,
59 SetOp op,
60 InputIterator2 py,
61 InputIterator2 last_py,
62 OutputRandomIterator y)
63{
64 while (py != last_py)
65 op(y[*py++], *x++);
66}
67//>msg_left_permutation_apply:
68} // namespace rheolef
69#endif // _RHEO_MSG_LEFT_PERMUTATION_APPLY_H
This file is part of Rheolef.
void msg_left_permutation_apply(InputIterator1 x, SetOp op, InputIterator2 py, InputIterator2 last_py, OutputRandomIterator y)