22 #ifndef _vctFixedSizeMatrixLoopEngines_h
23 #define _vctFixedSizeMatrixLoopEngines_h
43 cmnThrow(std::runtime_error(
"vctFixedSizeMatrixLoopEngines: Output base pointer is same as one of input base pointers."));
77 template<
class _elementOperationType>
80 template<
class _outputMatrixType,
class _input1MatrixType,
class _input2MatrixType>
81 static void Run(_outputMatrixType & outputMatrix,
82 const _input1MatrixType & input1Matrix,
83 const _input2MatrixType & input2Matrix)
85 typedef _outputMatrixType OutputMatrixType;
87 typedef typename OutputMatrixType::pointer OutputPointerType;
89 typedef _input1MatrixType Input1MatrixType;
90 typedef typename Input1MatrixType::const_pointer Input1PointerType;
91 typedef _input2MatrixType Input2MatrixType;
92 typedef typename Input2MatrixType::const_pointer Input2PointerType;
95 ROWS = OutputMatrixType::ROWS,
96 COLS = OutputMatrixType::COLS,
97 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
98 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
99 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
103 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
104 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
105 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE
109 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
110 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
111 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
114 OutputPointerType outputPointer = outputMatrix.Pointer();
115 Input1PointerType input1Pointer = input1Matrix.Pointer();
116 Input2PointerType input2Pointer = input2Matrix.Pointer();
118 size_type rowIndex, colIndex;
119 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
120 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
121 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
122 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
124 for (colIndex = 0; colIndex < COLS; ++colIndex,
125 outputPointer += OUTPUT_COL_STRIDE,
126 input1Pointer += INPUT1_COL_STRIDE,
127 input2Pointer += INPUT2_COL_STRIDE)
129 *outputPointer = _elementOperationType::Operate(*input1Pointer, *input2Pointer);
136 template<
class _elementOperationType>
139 template<
class _outputMatrixType,
class _inputMatrixType>
140 static inline void Run(_outputMatrixType & outputMatrix,
141 const _inputMatrixType & inputMatrix)
143 typedef _outputMatrixType OutputMatrixType;
145 typedef typename OutputMatrixType::pointer OutputPointerType;
147 typedef _inputMatrixType InputMatrixType;
148 typedef typename InputMatrixType::const_pointer InputPointerType;
151 ROWS = OutputMatrixType::ROWS,
152 COLS = OutputMatrixType::COLS,
153 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
154 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
155 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
159 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
160 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
161 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
165 OutputPointerType outputPointer = outputMatrix.Pointer();
166 InputPointerType inputPointer = inputMatrix.Pointer();
168 size_type rowIndex, colIndex;
169 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
170 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
171 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
173 for (colIndex = 0; colIndex < COLS; ++colIndex,
174 outputPointer += OUTPUT_COL_STRIDE,
175 inputPointer += INPUT_COL_STRIDE)
177 *outputPointer = _elementOperationType::Operate(*inputPointer);
184 template<
class _elementOperationType>
187 template<
class _inputOutputMatrixType>
188 static inline void Run(_inputOutputMatrixType & inputOutputMatrix)
190 typedef _inputOutputMatrixType InputOutputMatrixType;
192 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
195 ROWS = InputOutputMatrixType::ROWS,
196 COLS = InputOutputMatrixType::COLS,
197 COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
198 ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
199 STRIDE_TO_NEXT_ROW = ROW_STRIDE - COLS * COL_STRIDE
202 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
204 size_type rowIndex, colIndex;
205 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
206 inputOutputPointer += STRIDE_TO_NEXT_ROW)
208 for (colIndex = 0; colIndex < COLS; ++colIndex,
209 inputOutputPointer += COL_STRIDE)
211 _elementOperationType::Operate(*inputOutputPointer);
218 template<
class _elementOperationType>
221 template<
class _inputOutputMatrixType,
class _inputMatrixType>
222 static inline void Run(_inputOutputMatrixType & inputOutputMatrix,
223 const _inputMatrixType & inputMatrix)
225 typedef _inputOutputMatrixType InputOutputMatrixType;
227 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
229 typedef _inputMatrixType InputMatrixType;
230 typedef typename InputMatrixType::const_pointer InputPointerType;
233 ROWS = InputOutputMatrixType::ROWS,
234 COLS = InputOutputMatrixType::COLS,
235 INPUT_OUTPUT_COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
236 INPUT_OUTPUT_ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
237 INPUT_OUTPUT_STRIDE_TO_NEXT_ROW = INPUT_OUTPUT_ROW_STRIDE - COLS * INPUT_OUTPUT_COL_STRIDE
241 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
242 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
243 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
247 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
248 InputPointerType inputPointer = inputMatrix.Pointer();
250 size_type rowIndex, colIndex;
251 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
252 inputOutputPointer += INPUT_OUTPUT_STRIDE_TO_NEXT_ROW,
253 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
255 for (colIndex = 0; colIndex < COLS; ++colIndex,
256 inputOutputPointer += INPUT_OUTPUT_COL_STRIDE,
257 inputPointer += INPUT_COL_STRIDE)
259 _elementOperationType::Operate(*inputOutputPointer, *inputPointer);
266 template<
class _elementOperationType>
269 template<
class _outputMatrixType,
class _inputMatrixType,
class _inputScalarType>
270 static void Run(_outputMatrixType & outputMatrix,
271 const _inputMatrixType & inputMatrix,
272 const _inputScalarType inputScalar)
274 typedef _outputMatrixType OutputMatrixType;
276 typedef typename OutputMatrixType::pointer OutputPointerType;
278 typedef _inputMatrixType InputMatrixType;
279 typedef typename InputMatrixType::const_pointer InputPointerType;
282 ROWS = OutputMatrixType::ROWS,
283 COLS = OutputMatrixType::COLS,
284 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
285 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
286 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
290 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
291 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
292 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
296 OutputPointerType outputPointer = outputMatrix.Pointer();
297 InputPointerType inputPointer = inputMatrix.Pointer();
299 size_type rowIndex, colIndex;
300 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
301 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
302 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
304 for (colIndex = 0; colIndex < COLS; ++colIndex,
305 outputPointer += OUTPUT_COL_STRIDE,
306 inputPointer += INPUT_COL_STRIDE)
308 *outputPointer = _elementOperationType::Operate(*inputPointer, inputScalar);
315 template<
class _elementOperationType>
318 template<
class _outputMatrixType,
class _inputScalarType,
class _inputMatrixType>
319 static void Run(_outputMatrixType & outputMatrix,
320 const _inputScalarType inputScalar,
321 const _inputMatrixType & inputMatrix)
323 typedef _outputMatrixType OutputMatrixType;
325 typedef typename OutputMatrixType::pointer OutputPointerType;
327 typedef _inputMatrixType InputMatrixType;
328 typedef typename InputMatrixType::const_pointer InputPointerType;
331 ROWS = OutputMatrixType::ROWS,
332 COLS = OutputMatrixType::COLS,
333 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
334 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
335 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
339 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
340 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
341 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
345 OutputPointerType outputPointer = outputMatrix.Pointer();
346 InputPointerType inputPointer = inputMatrix.Pointer();
348 size_type rowIndex, colIndex;
349 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
350 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
351 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
353 for (colIndex = 0; colIndex < COLS; ++colIndex,
354 outputPointer += OUTPUT_COL_STRIDE,
355 inputPointer += INPUT_COL_STRIDE)
357 *outputPointer = _elementOperationType::Operate(inputScalar, *inputPointer);
364 template<
class _elementOperationType>
367 template<
class _inputOutputMatrixType,
class _inputScalarType>
368 static void Run(_inputOutputMatrixType & inputOutputMatrix,
369 const _inputScalarType inputScalar)
371 typedef _inputOutputMatrixType InputOutputMatrixType;
373 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
376 ROWS = InputOutputMatrixType::ROWS,
377 COLS = InputOutputMatrixType::COLS,
378 COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
379 ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
380 STRIDE_TO_NEXT_ROW = ROW_STRIDE - COLS * COL_STRIDE
383 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
385 size_type rowIndex, colIndex;
386 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
387 inputOutputPointer += STRIDE_TO_NEXT_ROW)
389 for (colIndex = 0; colIndex < COLS; ++colIndex,
390 inputOutputPointer += COL_STRIDE)
392 _elementOperationType::Operate(*inputOutputPointer, inputScalar);
399 template<
class _incrementalOperationType,
class _elementOperationType>
402 typedef typename _incrementalOperationType::OutputType
OutputType;
404 template<
class _inputMatrixType>
407 typedef _inputMatrixType InputMatrixType;
409 typedef typename InputMatrixType::const_pointer InputPointerType;
411 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
414 ROWS = InputMatrixType::ROWS,
415 COLS = InputMatrixType::COLS,
416 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
417 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
418 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
421 InputPointerType inputPointer = inputMatrix.Pointer();
423 size_type rowIndex, colIndex;
424 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
425 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
427 for (colIndex = 0; colIndex < COLS; ++colIndex,
428 inputPointer += INPUT_COL_STRIDE)
430 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
431 _elementOperationType::Operate(*inputPointer) );
434 return incrementalResult;
439 template<
class _incrementalOperationType,
class _elementOperationType>
442 typedef typename _incrementalOperationType::OutputType
OutputType;
444 template<
class _input1MatrixType,
class _input2MatrixType>
446 const _input2MatrixType & input2Matrix)
448 typedef _input1MatrixType Input1MatrixType;
450 typedef typename Input1MatrixType::const_pointer Input1PointerType;
451 typedef _input2MatrixType Input2MatrixType;
452 typedef typename Input2MatrixType::const_pointer Input2PointerType;
454 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
457 ROWS = Input1MatrixType::ROWS,
458 COLS = Input1MatrixType::COLS,
459 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
460 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
461 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE
465 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
466 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
467 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
470 Input1PointerType input1Pointer = input1Matrix.Pointer();
471 Input2PointerType input2Pointer = input2Matrix.Pointer();
473 size_type rowIndex, colIndex;
474 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
475 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
476 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
478 for (colIndex = 0; colIndex < COLS; ++colIndex,
479 input1Pointer += INPUT1_COL_STRIDE,
480 input2Pointer += INPUT2_COL_STRIDE)
482 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
483 _elementOperationType::Operate(*input1Pointer, *input2Pointer) );
486 return incrementalResult;
516 template<
class _ioElementOperationType,
class _scalarMatrixElementOperationType>
521 template<
class _ioMatrixType,
class _inputScalarType,
class _inputMatrixType>
522 static inline void Run(_ioMatrixType & ioMatrix,
523 const _inputScalarType & inputScalar,
const _inputMatrixType & inputMatrix)
525 typedef _ioMatrixType IoMatrixType;
527 typedef typename IoMatrixType::pointer IoPointerType;
528 typedef _inputMatrixType InputMatrixType;
529 typedef typename InputMatrixType::const_pointer InputPointerType;
532 ROWS = IoMatrixType::ROWS,
533 COLS = IoMatrixType::COLS,
534 IO_COL_STRIDE = IoMatrixType::COLSTRIDE,
535 IO_ROW_STRIDE = IoMatrixType::ROWSTRIDE,
536 IO_STRIDE_TO_NEXT_ROW = IO_ROW_STRIDE - COLS * IO_COL_STRIDE,
537 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
538 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
539 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
542 IoPointerType ioPointer = ioMatrix.Pointer();
543 InputPointerType inputPointer = inputMatrix.Pointer();
545 size_type rowIndex, colIndex;
546 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
547 ioPointer += IO_STRIDE_TO_NEXT_ROW,
548 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
550 for (colIndex = 0; colIndex < COLS; ++colIndex,
551 ioPointer += IO_COL_STRIDE,
552 inputPointer += INPUT_COL_STRIDE)
554 _ioElementOperationType::Operate(
556 _scalarMatrixElementOperationType::Operate(inputScalar, *inputPointer)
590 template<
class _ioElementOperationType,
class _matrixElementOperationType>
595 template<
class _ioMatrixType,
class _input1MatrixType,
class _input2MatrixType>
596 static inline void Run(_ioMatrixType & ioMatrix,
597 const _input1MatrixType & input1Matrix,
598 const _input2MatrixType & input2Matrix)
600 typedef _ioMatrixType IoMatrixType;
602 typedef typename IoMatrixType::pointer IoPointerType;
603 typedef _input1MatrixType Input1MatrixType;
604 typedef typename Input1MatrixType::const_pointer Input1PointerType;
605 typedef _input2MatrixType Input2MatrixType;
606 typedef typename Input2MatrixType::const_pointer Input2PointerType;
609 ROWS = IoMatrixType::ROWS,
610 COLS = IoMatrixType::COLS,
611 IO_COL_STRIDE = IoMatrixType::COLSTRIDE,
612 IO_ROW_STRIDE = IoMatrixType::ROWSTRIDE,
613 IO_STRIDE_TO_NEXT_ROW = IO_ROW_STRIDE - COLS * IO_COL_STRIDE,
614 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
615 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
616 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE,
617 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
618 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
619 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
622 IoPointerType ioPointer = ioMatrix.Pointer();
623 Input1PointerType input1Pointer = input1Matrix.Pointer();
624 Input2PointerType input2Pointer = input2Matrix.Pointer();
626 size_type rowIndex, colIndex;
627 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
628 ioPointer += IO_STRIDE_TO_NEXT_ROW,
629 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
630 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
632 for (colIndex = 0; colIndex < COLS; ++colIndex,
633 ioPointer += IO_COL_STRIDE,
634 input1Pointer += INPUT1_COL_STRIDE,
635 input2Pointer += INPUT2_COL_STRIDE)
637 _ioElementOperationType::Operate(
639 _matrixElementOperationType::Operate(*input1Pointer, *input2Pointer)
647 template<
class _incrementalOperationType,
class _elementOperationType>
650 typedef typename _incrementalOperationType::OutputType
OutputType;
652 template<
class _inputMatrixType,
class _inputScalarType>
654 const _inputScalarType & inputScalar)
656 typedef _inputMatrixType InputMatrixType;
658 typedef typename InputMatrixType::const_pointer InputPointerType;
660 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
663 ROWS = InputMatrixType::ROWS,
664 COLS = InputMatrixType::COLS,
665 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
666 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
667 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
670 InputPointerType inputPointer = inputMatrix.Pointer();
672 size_type rowIndex, colIndex;
673 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
674 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
676 for (colIndex = 0; colIndex < COLS; ++colIndex,
677 inputPointer += INPUT_COL_STRIDE)
679 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
680 _elementOperationType::Operate(*inputPointer, inputScalar) );
683 return incrementalResult;
689 template<
class _operationType>
692 template<
class _outputMatrixType,
class _input1MatrixType,
class _input2MatrixType>
693 static void Run(_outputMatrixType & outputMatrix,
694 const _input1MatrixType & input1Matrix,
695 const _input2MatrixType & input2Matrix)
697 typedef _outputMatrixType OutputMatrixType;
699 typedef typename OutputMatrixType::pointer OutputPointerType;
701 typedef _input1MatrixType Input1MatrixType;
702 typedef typename Input1MatrixType::const_pointer Input1PointerType;
704 typedef _input2MatrixType Input2MatrixType;
705 typedef typename Input2MatrixType::const_pointer Input2PointerType;
708 ROWS = OutputMatrixType::ROWS,
709 COLS = OutputMatrixType::COLS,
710 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
711 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
712 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
716 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
717 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE
721 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
722 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE
725 OutputPointerType outputPointer = outputMatrix.Pointer();
727 Input1PointerType input1Pointer = input1Matrix.Pointer();
728 Input2PointerType input2Pointer = input2Matrix.Pointer();
730 typename Input1MatrixType::ConstRowRefType input1Row;
731 typename Input2MatrixType::ConstColumnRefType input2Col;
733 if ((outputPointer == input1Pointer) ||
734 (outputPointer == input2Pointer)) {
738 size_type rowIndex, colIndex;
739 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
740 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
741 input1Pointer += INPUT1_ROW_STRIDE,
742 input2Pointer = input2Matrix.Pointer())
744 input1Row.SetRef(input1Pointer);
745 for (colIndex = 0; colIndex < COLS; ++colIndex,
746 outputPointer += OUTPUT_COL_STRIDE,
747 input2Pointer += INPUT2_COL_STRIDE)
749 input2Col.SetRef(input2Pointer);
750 *outputPointer = _operationType::Operate(input1Row, input2Col);
763 template<
class _inputMatrixType>
764 static void Run(
const _inputMatrixType & inputMatrix,
765 typename _inputMatrixType::value_type & minValue,
typename _inputMatrixType::value_type & maxValue)
767 typedef _inputMatrixType InputMatrixType;
769 typedef typename InputMatrixType::const_pointer InputPointerType;
770 typedef typename InputMatrixType::value_type value_type;
773 ROWS = InputMatrixType::ROWS,
774 COLS = InputMatrixType::COLS,
775 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
776 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
777 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
780 InputPointerType inputPointer = inputMatrix.Pointer();
781 if (inputPointer == 0)
784 value_type minElement, maxElement;
785 maxElement = minElement = *inputPointer;
787 size_type rowIndex, colIndex;
788 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
789 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
791 for (colIndex = 0; colIndex < COLS; ++colIndex,
792 inputPointer += INPUT_COL_STRIDE)
794 const value_type element = *inputPointer;
795 if (element < minElement) {
796 minElement = element;
798 else if (maxElement < element) {
799 maxElement = element;
804 minValue = minElement;
805 maxValue = maxElement;
813 template<
class _outputMatrixType,
class _inputMatrixType,
class _indexVectorType>
814 static void Run(_outputMatrixType & outputMatrix,
const _inputMatrixType & inputMatrix,
815 const _indexVectorType & indexVector)
817 typedef _outputMatrixType OutputMatrixType;
819 typedef typename OutputMatrixType::pointer OutputPointerType;
821 typedef _inputMatrixType InputMatrixType;
822 typedef typename InputMatrixType::const_pointer InputPointerType;
823 typedef _indexVectorType IndexVectorType;
824 typedef typename IndexVectorType::const_pointer IndexPointerType;
827 ROWS = OutputMatrixType::ROWS,
828 COLS = OutputMatrixType::COLS,
829 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
830 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
831 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
835 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
839 INDEX_STRIDE = IndexVectorType::STRIDE,
842 OutputPointerType outputPointer = outputMatrix.Pointer();
843 InputPointerType inputPointer = inputMatrix.Pointer();
844 IndexPointerType indexPointer = indexVector.Pointer();
846 size_type rowIndex, colIndex;
847 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
848 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
849 indexPointer += INDEX_STRIDE)
851 inputPointer = inputMatrix.Pointer(*indexPointer, 0);
852 for (colIndex = 0; colIndex < COLS; ++colIndex,
853 outputPointer += OUTPUT_COL_STRIDE,
854 inputPointer += INPUT_COL_STRIDE)
856 *outputPointer = *inputPointer;
866 #endif // _vctFixedSizeMatrixLoopEngines_h
Definition: vctFixedSizeMatrixLoopEngines.h:760
_incrementalOperationType::OutputType OutputType
Definition: vctFixedSizeMatrixLoopEngines.h:402
static void Run(_inputOutputMatrixType &inputOutputMatrix, const _inputScalarType inputScalar)
Definition: vctFixedSizeMatrixLoopEngines.h:368
static void Run(_ioMatrixType &ioMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition: vctFixedSizeMatrixLoopEngines.h:596
static void Run(_ioMatrixType &ioMatrix, const _inputScalarType &inputScalar, const _inputMatrixType &inputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:522
static OutputType Run(const _inputMatrixType &inputMatrix, const _inputScalarType &inputScalar)
Definition: vctFixedSizeMatrixLoopEngines.h:653
static OutputType Run(const _inputMatrixType &inputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:405
static void Run(_outputMatrixType &outputMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition: vctFixedSizeMatrixLoopEngines.h:81
Definition: vctFixedSizeMatrixLoopEngines.h:690
static void Run(_outputMatrixType &outputMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition: vctFixedSizeMatrixLoopEngines.h:693
Definition: vctFixedSizeMatrixLoopEngines.h:137
size_t size_type
Definition: vctContainerTraits.h:35
Container class for the matrix engines.
Definition: vctFixedSizeMatrixLoopEngines.h:35
Definition: vctFixedSizeMatrixLoopEngines.h:810
Definition: vctFixedSizeMatrixLoopEngines.h:440
Definition: vctFixedSizeMatrixLoopEngines.h:267
static void Run(_inputOutputMatrixType &inputOutputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:188
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _indexVectorType &indexVector)
Definition: vctFixedSizeMatrixLoopEngines.h:814
Definition: vctFixedSizeMatrixLoopEngines.h:365
Implement operation of the form for fixed size matrices.
Definition: vctFixedSizeMatrixLoopEngines.h:591
Definition: vctFixedSizeMatrixLoopEngines.h:400
#define cmnThrow(a)
Definition: MinimalCmn.h:4
static OutputType Run(const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition: vctFixedSizeMatrixLoopEngines.h:445
Definition: vctFixedSizeMatrixLoopEngines.h:185
static void Run(_inputOutputMatrixType &inputOutputMatrix, const _inputMatrixType &inputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:222
static void ThrowSharedPointersException(void)
Definition: vctFixedSizeMatrixLoopEngines.h:42
static void Run(const _inputMatrixType &inputMatrix, typename _inputMatrixType::value_type &minValue, typename _inputMatrixType::value_type &maxValue)
Definition: vctFixedSizeMatrixLoopEngines.h:764
_incrementalOperationType::OutputType OutputType
Definition: vctFixedSizeMatrixLoopEngines.h:442
Definition: vctFixedSizeMatrixLoopEngines.h:219
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:140
Definition: vctFixedSizeMatrixLoopEngines.h:648
Definition: vctFixedSizeMatrixLoopEngines.h:78
_incrementalOperationType::OutputType OutputType
Definition: vctFixedSizeMatrixLoopEngines.h:650
Implement operation of the form for fixed size matrices.
Definition: vctFixedSizeMatrixLoopEngines.h:517
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _inputScalarType inputScalar)
Definition: vctFixedSizeMatrixLoopEngines.h:270
static void Run(_outputMatrixType &outputMatrix, const _inputScalarType inputScalar, const _inputMatrixType &inputMatrix)
Definition: vctFixedSizeMatrixLoopEngines.h:319
Definition: vctFixedSizeMatrixLoopEngines.h:316