Debian Codegraph @

src/acl/aclMath/aclVectorOfElementsOperations.h

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #ifndef ACLVECTORELEMENTSOPERATIONS_H
25 #define ACLVECTORELEMENTSOPERATIONS_H
26
27 #include "aclVectorOfElementsDef.h"
28
29 namespace acl
30 {
31
32 class ElementBase;
33 class MemBlock;
34 class KernelConfiguration;
35
36
37 typedef std::shared_ptr<ElementBase> Element;
38 typedef std::shared_ptr<MemBlock> ElementData;
39
40 class VectorOfElements;
41
42 typedef shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
43 typedef shared_ptr<VectorOfElements> SPVectorOfElements;
44
45 /// Creates VectorOfElementsData with same structure ElementData objects as \p a
46 /// \relates VectorOfElementsData
47 VectorOfElementsData clone(VectorOfElementsData a);
48
49 /// Creates VectorOfElementsData with same structure ElementData objects as \p a and with \p n numbers of elements
50 /// \relates VectorOfElementsData
51 VectorOfElementsData clone(VectorOfElementsData a, unsigned int n);
52
53
54 /// Writes data from \p initializationValue to \p a
55 /// \relates VectorOfElements
56 void initData(VectorOfElements a,
57 VectorOfElements initializationValue,
58 const KernelConfiguration & kernelConfig);
59
60 /// Writes data from \p initializationValue to \p a
61 /// \relates VectorOfElements
62 void initData(VectorOfElements a,
63 VectorOfElements initializationValue);
64
65
66 /// Copies the VectorOfElements class.
67 /** \relates VectorOfElements
68 the \p destination is resized automaticaly
69 */
70 void copy(const vector<Element> & source,
71 VectorOfElements & destination);
72
73 /// Copies the VectorOfElements class.
74 /** \relates VectorOfElements
75 the \p destination is resized automaticaly
76 */
77 void copy(const vector<ElementData> & source,
78 VectorOfElements & destination);
79
80 /// Copies the VectorOfElements class.
81 /** \relates VectorOfElements
82 the \p destination is resized automaticaly
83 \p start and \p end define elements to copy: [start: end]
84 */
85 void copy(const vector<Element> & source,
86 VectorOfElements & destination, unsigned int start, unsigned int end);
87
88
89 /// Copies the VectorOfElementsData class.
90 /** \relates VectorOfElementsData
91 the \p destination is resized automaticaly
92 */
93 void copy(const VectorOfElementsData & source,
94 VectorOfElementsData & destination);
95
96
97 /// returns VectorOfElements class containing several elements of \p a.
98 /// \relates VectorOfElements
99 VectorOfElements subVE(const VectorOfElements & source,
100 unsigned int start,
101 unsigned int end);
102
103 /// returns VectorOfElements class containing one element \p i of \p a.
104 /// \relates VectorOfElements
105 VectorOfElements subVE(const VectorOfElements & source,
106 unsigned int i);
107
108 /// returns VectorOfElements class containing elements with numbers \p iList of \p source.
109 /// \relates VectorOfElements
110 VectorOfElements subVE(const VectorOfElements & source,
111 const vector<unsigned int> & iList);
112
113 /// returns VectorOfElements class containing several elements of \p a.
114 /// \relates VectorOfElements
115 VectorOfElementsData subVE(const VectorOfElementsData & source,
116 unsigned int start,
117 unsigned int end);
118
119
120 /// Swaps buffers between corresponding
121 /// elements of two VectorOfElementsData classes.
122 /// \relates VectorOfElementsData
123 void swapBuffers(const VectorOfElementsData & a,
124 const VectorOfElementsData & b);
125
126 ///\defgroup VectorOfElementsOp VectorOfElements Operations
127
128 ///\defgroup VectorOfElementsVectorOfElementsOp VectorOfElements-VectorOfElements Operations
129 ///@{
130
131 /// Creates VectorOfElements containing assignment operation result \p a=\p b
132 /// \relates VectorOfElements
133 VectorOfElements assignmentSafe(const VectorOfElements & a,
134 const VectorOfElements & b);
135
136
137 /// Creates VectorOfElements containing operation result of element \p a
138 /// \relates VectorOfElements
139 VectorOfElements operator-(const VectorOfElements & a);
140
141
142 /// Creates VectorOfElements containing
143 /// operation result of elements of \p a and \p b
144 /// \relates VectorOfElements
145 VectorOfElements operator+=(const VectorOfElements & a,
146 const VectorOfElements & b);
147
148
149 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
150 /// \relates VectorOfElements
151 VectorOfElements operator-=(const VectorOfElements & a,
152 const VectorOfElements & b);
153
154
155 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
156 /// \relates VectorOfElements
157 /// It is assumed that size of \p b is 1
158 VectorOfElements operator*=(const VectorOfElements & a,
159 const VectorOfElements & b);
160
161
162 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
163 /// \relates VectorOfElements
164 /// It is supposed that size of \p b is 1
165 VectorOfElements operator/=(const VectorOfElements & a,
166 const VectorOfElements & b);
167
168
169 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
170 /// \relates VectorOfElements
171 VectorOfElements operator+(const VectorOfElements & a,
172 const VectorOfElements & b);
173
174
175 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
176 /// \relates VectorOfElements
177 VectorOfElements operator-(const VectorOfElements & a,
178 const VectorOfElements & b);
179
180
181 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
182 /// \relates VectorOfElements
183 /// In case of sizes of \p a and \p b are equal the product is a scalar (dot)
184 /// product. If one of sizes is 1 than the function results product of a scalar on vector
185 VectorOfElements operator*(const VectorOfElements & a,
186 const VectorOfElements & b);
187
188
189 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
190 /// \relates VectorOfElements
191 VectorOfElements operator/(const VectorOfElements & a,
192 const VectorOfElements & b);
193
194 /// Creates VectorOfElements containing operation result of elements of \p a and \p b
195 /// \relates VectorOfElements
196 VectorOfElements operator%(const VectorOfElements & a,
197 const VectorOfElements & b);
198
199
200 /// Creates VectorOfElements containing operation result of elements \p a and \p b
201 /// \relates VectorOfElements
202 VectorOfElements operator==(const VectorOfElements & a,
203 const VectorOfElements & b);
204
205
206 /// Creates VectorOfElements containing operation result of elements \p a and \p b
207 /// \relates VectorOfElements
208 VectorOfElements operator!=(const VectorOfElements & a,
209 const VectorOfElements & b);
210
211
212 /// Creates VectorOfElements containing operation result of elements \p a and \p b
213 /// \relates VectorOfElements
214 VectorOfElements operator>(const VectorOfElements & a, const VectorOfElements & b);
215
216
217 /// Creates VectorOfElements containing operation result of elements \p a and \p b
218 /// \relates VectorOfElements
219 VectorOfElements operator<(const VectorOfElements & a,
220 const VectorOfElements & b);
221
222 /// Creates VectorOfElements containing operation result of elements \p a and \p b
223 /// \relates VectorOfElements
224 VectorOfElements operator<=(const VectorOfElements & a,
225 const VectorOfElements & b);
226
227 /// Creates VectorOfElements containing operation result of elements \p a and \p b
228 /// \relates VectorOfElements
229 VectorOfElements operator>=(const VectorOfElements & a,
230 const VectorOfElements & b);
231
232 /// Creates VectorOfElements containing operation result of elements \p a && \p b
233 /// \relates VectorOfElements
234 VectorOfElements operator&&(const VectorOfElements & a,
235 const VectorOfElements & b);
236
237 /// Creates VectorOfElements containing operation result of elements \p a || \p b
238 /// \relates VectorOfElements
239 VectorOfElements operator||(const VectorOfElements & a,
240 const VectorOfElements & b);
241
242 /// Creates VectorOfElements containing operation result of element \p a
243 /// \relates VectorOfElements
244 VectorOfElements operator!(const VectorOfElements & a);
245
246
247 /// Creates VectorOfElements \p c which elements are crossproduct of corresponding elements of \p a and \p b
248 /// \relates VectorOfElements
249 /// The function is defined for 2D and 3D cases
250 VectorOfElements crossProduct(const VectorOfElements & a,
251 const VectorOfElements & b);
252
253
254 /// Creates VectorOfElements \p b corresponding to a scala product a*a
255 /// \relates VectorOfElements
256 /// The function is defined for 2D and 3D cases
257 inline VectorOfElements l2(const VectorOfElements & a);
258
259
260 /// Creates VectorOfElements \p c which
261 /// elements are product of corresponding elements of \p a and \p b
262 /// \relates VectorOfElements
263 VectorOfElements productOfElements(const VectorOfElements & a,
264 const VectorOfElements & b);
265
266 /// Creates VectorOfElements \p c which
267 /// element is a product of all elements of \p a
268 /// \relates VectorOfElements
269 VectorOfElements productOfElements(const VectorOfElements & a);
270
271 /// Creates VectorOfElements \p c which elements are division of corresponding elements of \p a and \p b
272 /// \relates VectorOfElements
273 VectorOfElements divisionOfElements(const VectorOfElements & a,
274 const VectorOfElements & b);
275
276 /// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b
277 /// \relates VectorOfElements
278 VectorOfElements min(const VectorOfElements & a,
279 const VectorOfElements & b);
280
281 /// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b with type specification
282 /// \relates VectorOfElements
283 VectorOfElements min(const VectorOfElements & a,
284 const VectorOfElements & b,
285 TypeID type);
286
287 /// Creates VectorOfElements \p c which elements are min of corresponding elements of \p a and \p b
288 /// \relates VectorOfElements
289 VectorOfElements minAbs(const VectorOfElements & a,
290 const VectorOfElements & b);
291
292 /// Creates VectorOfElements \p c which elements are max of corresponding elements of \p a and \p b
293 /// \relates VectorOfElements
294 VectorOfElements max(const VectorOfElements & a,
295 const VectorOfElements & b);
296
297 /// Creates VectorOfElements \p c which elements are max of corresponding elements of \p a and \p b with type specification
298 /// \relates VectorOfElements
299 VectorOfElements max(const VectorOfElements & a,
300 const VectorOfElements & b,
301 TypeID type);
302
303 ///returns a with sign of b copysign(a,b)
304 /// \relates VectorOfElements
305 VectorOfElements copysign(const VectorOfElements & a,
306 const VectorOfElements & b);
307
308 ///returns a with sign of b copysign(a,b) with type specification
309 /// \relates VectorOfElements
310 VectorOfElements copysign(const VectorOfElements & a,
311 const VectorOfElements & b,
312 TypeID t);
313
314 ///returns sign of a
315 /// \relates VectorOfElements
316 VectorOfElements sign(const VectorOfElements & a);
317
318 /// Creates VectorOfElements which elements are result of excerpt
319 /// operation of \p source and \p filter elements
320 /// \relates VectorOfElements
321 /// The \p filter shoule have only 1 component
322 VectorOfElements excerpt(const VectorOfElements & source,
323 const VectorOfElements & filter);
324
325
326 /// Creates VectorOfElements containing operation
327 /// result of elements \p a, \p b and \p c
328 /// For a scalar type, result = c ? b : a
329 /**
330 \relates VectorOfElements
331 The function can operate in two modes: \p c has 1 components and
332 several components.
333 */
334 VectorOfElements select(const VectorOfElements & a,
335 const VectorOfElements & b,
336 const VectorOfElements & c);
337
338 /// Creates VectorOfElements containing operation
339 /// result of elements \p a, \p b and \p c
340 /// For a scalar type, result = c ? b : a, with type specification
341 /**
342 \relates VectorOfElements
343 The function can operate in two modes: \p c has 1 components and
344 several components.
345 */
346 VectorOfElements select(const VectorOfElements & a,
347 const VectorOfElements & b,
348 const VectorOfElements & c,
349 TypeID t);
350
351 /// Creates VectorOfElements containing operation
352 /// result of elements \p a, \p b and \p c
353 /// For a scalar type, result = c ? b : 0, with type specification
354 /**
355 \relates VectorOfElements
356 The function can operate in two modes: \p c has 1 components and
357 several components.
358 */
359 VectorOfElements select(const VectorOfElements & b,
360 const VectorOfElements & c,
361 TypeID t);
362
363 /// Creates VectorOfElements containing operation
364 /// result of elements \p a, \p b and \p c
365 /// For a scalar type, result = a * b + c
366 /// \relates VectorOfElements
367 VectorOfElements mad(const VectorOfElements & a,
368 const VectorOfElements & b,
369 const VectorOfElements & c);
370
371 /// Creates VectorOfElements containing operation
372 /// result of elements \p a, \p b and \p c with type specification
373 /// For a scalar type, result = a * b + c
374 /// \relates VectorOfElements
375 VectorOfElements mad(const VectorOfElements & a,
376 const VectorOfElements & b,
377 const VectorOfElements & c,
378 TypeID t);
379
380 /// Creates VectorOfElements containing result log(a); a should contain only one element
381 /// \relates VectorOfElements
382 VectorOfElements log(const VectorOfElements & a);
383
384
385 /// Creates VectorOfElements containing result log10(a); a should contain only one element
386 /// \relates VectorOfElements
387 VectorOfElements log10(const VectorOfElements & a);
388
389
390 /// Creates VectorOfElements containing result a^i; a should contain only one element
391 /// \relates VectorOfElements
392 VectorOfElements powI(const VectorOfElements & a, unsigned int i);
393
394
395 /// Creates VectorOfElements containing result exp(a); a should contain only one element
396 /// \relates VectorOfElements
397 VectorOfElements exp(const VectorOfElements & a);
398
399 /// Creates VectorOfElements containing result exp(a); a should contain only one element
400 /// \relates VectorOfElements
401 VectorOfElements sqrt(const VectorOfElements & a);
402
403 /// Creates VectorOfElements containing result exp(a); a should contain only one element
404 /// \relates VectorOfElements
405 VectorOfElements rsqrt(const VectorOfElements & a);
406
407 /// Creates VectorOfElements containing result element-wise operation fabs(a);
408 /// \relates VectorOfElements
409 VectorOfElements fabs(const VectorOfElements & a);
410
411 /// Creates VectorOfElements containing result element-wise operation abs(a);
412 /// \relates VectorOfElements
413 VectorOfElements abs(const VectorOfElements & a);
414
415 /// Creates VectorOfElements containing result element-wise operation abs_diff(a, b);
416 /// \relates VectorOfElements
417 VectorOfElements abs_diff(const VectorOfElements & a, const VectorOfElements & b);
418
419 /// Creates VectorOfElements containing result element-wise operation \f$ floor(a_i) \f$
420 /// \relates VectorOfElements
421 VectorOfElements floor(const VectorOfElements & a);
422
423 /// Creates VectorOfElements with openCL type casting;
424 /// \relates VectorOfElements
425 VectorOfElements convert(acl::TypeID type, const VectorOfElements & a, bool strong=true);
426
427 /// Creates VectorOfElements containing a min element
428 /// \relates VectorOfElements
429 VectorOfElements minElement(const VectorOfElements & a);
430
431 /// Creates VectorOfElements containing an element with minimal absolute value
432 /// \relates VectorOfElements
433 VectorOfElements minAbsElement(const VectorOfElements & a);
434
435 /// Creates VectorOfElements containing a min element
436 /// \relates VectorOfElements
437 VectorOfElements maxElement(const VectorOfElements & a);
438
439 /// Creates VectorOfElements containing a sum of elements
440 /// \relates VectorOfElements
441 VectorOfElements sumOfElements(const VectorOfElements & a);
442
443 /// Creates VectorOfElements containing a && operation result of elements
444 /// \relates VectorOfElements
445 VectorOfElements andOfElements(const VectorOfElements & a);
446
447 /// Creates VectorOfElements containing a || operation result of elements
448 /// \relates VectorOfElements
449 VectorOfElements orOfElements(const VectorOfElements & a);
450
451 /// Concatinates two vectors \p a and \p b
452 /// \relates VectorOfElements
453 /** \f$ cat\left(
454 \left[\begin{array}{c}
455 a_1\\a_2\\...\\a_n\\
456 \end{array}\right],
457 \left[\begin{array}{c}
458 b_1\\b_2\\...\\b_m\\
459 \end{array}\right]
460 \right)=
461 \left[\begin{array}{c}
462 a_1\\a_2\\ \vdots \\a_n\\
463 b_1\\b_2\\ \vdots \\b_m\\
464 \end{array}\right]. \f$
465 */
466 VectorOfElements cat(const VectorOfElements & a,
467 const VectorOfElements & b);
468
469 /// Concatinates two vectors \p a and \p b
470 /// \relates VectorOfElements
471 /** \f$ cat\left(
472 \left[\begin{array}{c}
473 a_1\\a_2\\...\\a_n\\
474 \end{array}\right],
475 \left[\begin{array}{c}
476 b_1\\b_2\\...\\b_m\\
477 \end{array}\right]
478 \right)=
479 \left[\begin{array}{c}
480 a_1\\a_2\\ \vdots \\a_n\\
481 b_1\\b_2\\ \vdots \\b_m\\
482 \end{array}\right]. \f$
483 */
484 VectorOfElementsData cat(const VectorOfElementsData & a,
485 const VectorOfElementsData & b);
486
487 /// Concatinates three vectors \p a \p b and \p c
488 /// \relates VectorOfElements
489 /** \f$ cat\left(
490 \left[\begin{array}{c}
491 a_1\\...\\a_n\\
492 \end{array}\right],
493 \left[\begin{array}{c}
494 b_1\\...\\b_m\\
495 \end{array}\right],
496 \left[\begin{array}{c}
497 c_1\\...\\c_l\\
498 \end{array}\right]
499 \right)=
500 \left[\begin{array}{c}
501 a_1\\...\\a_n\\
502 b_1\\...\\b_m\\
503 c_1\\...\\c_l\\
504 \end{array}\right]. \f$
505
506 */
507 VectorOfElements cat(const VectorOfElements & a,
508 const VectorOfElements & b,
509 const VectorOfElements & c);
510
511 /// Concatinates \p n VectorOfElements \p a
512 /// \relates VectorOfElements
513 VectorOfElements cat(const VectorOfElements * a,
514 unsigned int n);
515
516 /// Concatinates VectorOfElements \p a to itself \p n times
517 /// \relates VectorOfElements
518 VectorOfElements catN(const VectorOfElements & a,
519 unsigned int n);
520
521
522 /// Creates VectorOfElements containing operation result of elements of \p a and a double
523 /// \relates VectorOfElements
524 /// The function creates automaticaly a constant of a corresponding type
525 template <typename T> VectorOfElements operator+=(const VectorOfElements & a,
526 const T & b);
527
528
529 /// Creates VectorOfElements containing operation
530 /// result of elements of \p a and a double
531 /// \relates VectorOfElements
532 /// The function creates automaticaly a constant of a corresponding type
533 template <typename T> VectorOfElements operator-=(const VectorOfElements & a,
534 const T & b);
535
536
537 /// Creates VectorOfElements containing operation
538 /// result of elements of \p a and a double
539 /** \relates VectorOfElements
540 The function creates automaticaly a constant of a corresponding type
541 */
542 template <typename T> VectorOfElements operator*=(const VectorOfElements & a,
543 const T & b);
544
545
546 /// Creates VectorOfElements containing operation
547 /// result of elements of \p a and a double
548 /** \relates VectorOfElements
549 The function creates automaticaly a constant of a corresponding type
550 */
551 template <typename T> VectorOfElements operator/=(const VectorOfElements & a,
552 const T & b);
553
554
555 /// Creates VectorOfElements containing operation
556 /// result of elements of \p a and a double
557 /** \relates VectorOfElements
558 The function creates automaticaly a constant of a corresponding type
559 */
560 template <typename T> VectorOfElements operator+(const VectorOfElements & a,
561 const T & b);
562
563
564 /// Creates VectorOfElements containing operation
565 /// result of elements of \p a and a double
566 /** \relates VectorOfElements
567 The function creates automaticaly a constant of a corresponding type
568 */
569 template <typename T> VectorOfElements operator+(const T & a,
570 const VectorOfElements & b);
571
572
573 /// Creates VectorOfElements containing operation
574 /// result of elements of \p a and a double
575 /// \relates VectorOfElements
576 /// The function creates automaticaly a constant of a corresponding type
577 template <typename T> VectorOfElements operator-(const VectorOfElements & a,
578 const T & b);
579
580
581 /// Creates VectorOfElements containing operation
582 /// result of elements of \p a and a double
583 /// \relates VectorOfElements
584 /// The function creates automaticaly a constant of a corresponding type
585 template <typename T> VectorOfElements operator-(const T & a,
586 const VectorOfElements & b);
587
588
589 /// Creates VectorOfElements containing operation
590 /// result of elements of \p a and a double
591 /// \relates VectorOfElements
592 /// The function creates automaticaly a constant of a corresponding type
593 template <typename T> VectorOfElements operator*(const VectorOfElements & a,
594 const T & b);
595
596
597 /// Creates VectorOfElements containing
598 /// operation result of elements of \p a and a double
599 /// \relates VectorOfElements
600 /// The function creates automaticaly a constant of a corresponding type
601 template <typename T> VectorOfElements operator*(const T & a,
602 const VectorOfElements & b);
603
604
605 /// Creates VectorOfElements containing operation
606 /// result of elements of \p a and a double
607 /** \relates VectorOfElements
608 The function creates automaticaly a constant of a corresponding type
609 */
610 template <typename T> VectorOfElements operator/(const VectorOfElements & a,
611 const T & b);
612
613 /// Creates VectorOfElements containing operation
614 /// result of elements of \p a and a double
615 /** \relates VectorOfElements
616 The function creates automaticaly a constant of a corresponding type
617 */
618 template <typename T> VectorOfElements operator%(const VectorOfElements & a,
619 const T & b);
620
621 /// Creates VectorOfElements containing operation
622 /// result of elements of \p a and a double
623 /** \relates VectorOfElements
624 The function creates automaticaly a constant of a corresponding type
625 */
626 template <typename T> VectorOfElements operator/(const T & b,
627 const VectorOfElements & a);
628
629 /// Creates VectorOfElements containing operation
630 /// result of elements of \p a and a double
631 /** \relates VectorOfElements
632 The function creates automaticaly a constant of a corresponding type
633 */
634 template <typename T> VectorOfElements operator%(const T & b,
635 const VectorOfElements & a);
636
637 /// Creates VectorOfElements containing operation
638 /// result of elements of \p a and a double
639 /** \relates VectorOfElements
640 The function creates automaticaly a constant of a corresponding type
641 */
642 template <typename T> VectorOfElements operator>(const VectorOfElements & a,
643 const T & b);
644
645
646 /// Creates VectorOfElements containing operation
647 /// result of elements of \p a and a double
648 /** \relates VectorOfElements
649 The function creates automaticaly a constant of a corresponding type
650 */
651 template <typename T> VectorOfElements operator>(const T & b,
652 const VectorOfElements & a);
653
654
655 /// Creates VectorOfElements containing operation
656 /// result of elements of \p a and a double
657 /** \relates VectorOfElements
658 The function creates automaticaly a constant of a corresponding type
659 */
660 template <typename T> VectorOfElements operator<(const VectorOfElements & a,
661 const T & b);
662
663
664 /// Creates VectorOfElements containing
665 /// operation result of elements of \p a and a double
666 /** \relates VectorOfElements
667 The function creates automaticaly a constant of a corresponding type
668 */
669 template <typename T> VectorOfElements operator<(const T & b,
670 const VectorOfElements & a);
671
672 /// Creates VectorOfElements containing operation
673 /// result of elements of \p a and a double
674 /** \relates VectorOfElements
675 The function creates automaticaly a constant of a corresponding type
676 */
677 template <typename T> VectorOfElements operator>=(const VectorOfElements & a,
678 const T & b);
679
680
681 /// Creates VectorOfElements containing operation
682 /// result of elements of \p a and a double
683 /** \relates VectorOfElements
684 The function creates automaticaly a constant of a corresponding type
685 */
686 template <typename T> VectorOfElements operator>=(const T & b,
687 const VectorOfElements & a);
688
689 /// Creates VectorOfElements containing operation
690 /// result of elements of \p a and a double
691 /** \relates VectorOfElements
692 The function creates automaticaly a constant of a corresponding type
693 */
694 template <typename T> VectorOfElements operator<=(const VectorOfElements & a,
695 const T & b);
696
697
698 /// Creates VectorOfElements containing operation
699 /// result of elements of \p a and a double
700 /** \relates VectorOfElements
701 The function creates automaticaly a constant of a corresponding type
702 */
703 template <typename T> VectorOfElements operator<=(const T & b,
704 const VectorOfElements & a);
705
706 /// Creates VectorOfElements containing
707 /// operation result of elements of \p a and a double
708 /** \relates VectorOfElements
709 The function creates automaticaly a constant of a corresponding type
710 */
711 template <typename T> VectorOfElements operator==(const VectorOfElements & a,
712 const T & b);
713
714
715 /// Creates VectorOfElements containing
716 /// operation result of elements of \p a and a double \p b
717 /** \relates VectorOfElements
718 The function creates automaticaly a constant of a corresponding type
719 */
720 template <typename T> VectorOfElements operator==(const T & b,
721 const VectorOfElements & a);
722
723
724 /// Creates VectorOfElements containing
725 /// operation result of elements of \p a and a double \p b
726 /** \relates VectorOfElements
727 The function creates automaticaly a constant of a corresponding type
728 */
729 template <typename T> VectorOfElements operator!=(const VectorOfElements & a,
730 const T & b);
731
732
733 /// Creates VectorOfElements containing
734 /// operation result of elements of \p a and a double \p b
735 /// \relates VectorOfElements
736 /// The function creates automaticaly a constant of a corresponding type
737 template <typename T> VectorOfElements operator!=(const T & b,
738 const VectorOfElements & a);
739 ///@}
740
741 /// generates code corresponding \f$ \vec a /= |\vec a|\f$
742 vector<Element> gcNormalize(const VectorOfElements & a);
743 /// generates code corresponding \f$ |\vec a|^2 \f$. Result will be stored in \p l2
744 vector<Element> gcLength2(const VectorOfElements & a, const VectorOfElements & l2);
745 /// generates code corresponding \f$ |\vec a| \f$. Result will be stored in \p l
746 vector<Element> gcLength(const VectorOfElements & a, const VectorOfElements & l);
747
748
749 //------------------------------ Implementation ----------------
750
751 inline VectorOfElements l2(const VectorOfElements & a)
752 {
753 return a * a;
754 }
755
756
757 } //namespace acl
758
759 #endif // ACLVECTORELEMENTSOPERATIONS_H