20#ifndef _vctFixedSizeMatrixLoopEngines_h
21#define _vctFixedSizeMatrixLoopEngines_h
41 cmnThrow(std::runtime_error(
"vctFixedSizeMatrixLoopEngines: Output base pointer is same as one of input base pointers."));
75 template<
class _elementOperationType>
78 template<
class _outputMatrixType,
class _input1MatrixType,
class _input2MatrixType>
79 static void Run(_outputMatrixType & outputMatrix,
80 const _input1MatrixType & input1Matrix,
81 const _input2MatrixType & input2Matrix)
83 typedef _outputMatrixType OutputMatrixType;
84 typedef typename OutputMatrixType::size_type size_type;
85 typedef typename OutputMatrixType::pointer OutputPointerType;
87 typedef _input1MatrixType Input1MatrixType;
88 typedef typename Input1MatrixType::const_pointer Input1PointerType;
89 typedef _input2MatrixType Input2MatrixType;
90 typedef typename Input2MatrixType::const_pointer Input2PointerType;
93 ROWS = OutputMatrixType::ROWS,
94 COLS = OutputMatrixType::COLS,
95 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
96 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
97 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
101 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
102 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
103 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE
107 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
108 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
109 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
112 OutputPointerType outputPointer = outputMatrix.Pointer();
113 Input1PointerType input1Pointer = input1Matrix.Pointer();
114 Input2PointerType input2Pointer = input2Matrix.Pointer();
116 size_type rowIndex, colIndex;
117 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
118 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
119 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
120 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
122 for (colIndex = 0; colIndex < COLS; ++colIndex,
123 outputPointer += OUTPUT_COL_STRIDE,
124 input1Pointer += INPUT1_COL_STRIDE,
125 input2Pointer += INPUT2_COL_STRIDE)
127 *outputPointer = _elementOperationType::Operate(*input1Pointer, *input2Pointer);
134 template<
class _elementOperationType>
137 template<
class _outputMatrixType,
class _inputMatrixType>
138 static inline void Run(_outputMatrixType & outputMatrix,
139 const _inputMatrixType & inputMatrix)
141 typedef _outputMatrixType OutputMatrixType;
142 typedef typename OutputMatrixType::size_type size_type;
143 typedef typename OutputMatrixType::pointer OutputPointerType;
145 typedef _inputMatrixType InputMatrixType;
146 typedef typename InputMatrixType::const_pointer InputPointerType;
149 ROWS = OutputMatrixType::ROWS,
150 COLS = OutputMatrixType::COLS,
151 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
152 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
153 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
157 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
158 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
159 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
163 OutputPointerType outputPointer = outputMatrix.Pointer();
164 InputPointerType inputPointer = inputMatrix.Pointer();
166 size_type rowIndex, colIndex;
167 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
168 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
169 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
171 for (colIndex = 0; colIndex < COLS; ++colIndex,
172 outputPointer += OUTPUT_COL_STRIDE,
173 inputPointer += INPUT_COL_STRIDE)
175 *outputPointer = _elementOperationType::Operate(*inputPointer);
182 template<
class _elementOperationType>
185 template<
class _inputOutputMatrixType>
186 static inline void Run(_inputOutputMatrixType & inputOutputMatrix)
188 typedef _inputOutputMatrixType InputOutputMatrixType;
189 typedef typename InputOutputMatrixType::size_type size_type;
190 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
193 ROWS = InputOutputMatrixType::ROWS,
194 COLS = InputOutputMatrixType::COLS,
195 COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
196 ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
197 STRIDE_TO_NEXT_ROW = ROW_STRIDE - COLS * COL_STRIDE
200 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
202 size_type rowIndex, colIndex;
203 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
204 inputOutputPointer += STRIDE_TO_NEXT_ROW)
206 for (colIndex = 0; colIndex < COLS; ++colIndex,
207 inputOutputPointer += COL_STRIDE)
209 _elementOperationType::Operate(*inputOutputPointer);
216 template<
class _elementOperationType>
219 template<
class _inputOutputMatrixType,
class _inputMatrixType>
220 static inline void Run(_inputOutputMatrixType & inputOutputMatrix,
221 const _inputMatrixType & inputMatrix)
223 typedef _inputOutputMatrixType InputOutputMatrixType;
224 typedef typename InputOutputMatrixType::size_type size_type;
225 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
227 typedef _inputMatrixType InputMatrixType;
228 typedef typename InputMatrixType::const_pointer InputPointerType;
231 ROWS = InputOutputMatrixType::ROWS,
232 COLS = InputOutputMatrixType::COLS,
233 INPUT_OUTPUT_COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
234 INPUT_OUTPUT_ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
235 INPUT_OUTPUT_STRIDE_TO_NEXT_ROW = INPUT_OUTPUT_ROW_STRIDE - COLS * INPUT_OUTPUT_COL_STRIDE
239 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
240 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
241 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
245 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
246 InputPointerType inputPointer = inputMatrix.Pointer();
248 size_type rowIndex, colIndex;
249 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
250 inputOutputPointer += INPUT_OUTPUT_STRIDE_TO_NEXT_ROW,
251 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
253 for (colIndex = 0; colIndex < COLS; ++colIndex,
254 inputOutputPointer += INPUT_OUTPUT_COL_STRIDE,
255 inputPointer += INPUT_COL_STRIDE)
257 _elementOperationType::Operate(*inputOutputPointer, *inputPointer);
264 template<
class _elementOperationType>
267 template<
class _outputMatrixType,
class _inputMatrixType,
class _inputScalarType>
268 static void Run(_outputMatrixType & outputMatrix,
269 const _inputMatrixType & inputMatrix,
270 const _inputScalarType inputScalar)
272 typedef _outputMatrixType OutputMatrixType;
273 typedef typename OutputMatrixType::size_type size_type;
274 typedef typename OutputMatrixType::pointer OutputPointerType;
276 typedef _inputMatrixType InputMatrixType;
277 typedef typename InputMatrixType::const_pointer InputPointerType;
280 ROWS = OutputMatrixType::ROWS,
281 COLS = OutputMatrixType::COLS,
282 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
283 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
284 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
288 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
289 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
290 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
294 OutputPointerType outputPointer = outputMatrix.Pointer();
295 InputPointerType inputPointer = inputMatrix.Pointer();
297 size_type rowIndex, colIndex;
298 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
299 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
300 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
302 for (colIndex = 0; colIndex < COLS; ++colIndex,
303 outputPointer += OUTPUT_COL_STRIDE,
304 inputPointer += INPUT_COL_STRIDE)
306 *outputPointer = _elementOperationType::Operate(*inputPointer, inputScalar);
313 template<
class _elementOperationType>
316 template<
class _outputMatrixType,
class _inputScalarType,
class _inputMatrixType>
317 static void Run(_outputMatrixType & outputMatrix,
318 const _inputScalarType inputScalar,
319 const _inputMatrixType & inputMatrix)
321 typedef _outputMatrixType OutputMatrixType;
322 typedef typename OutputMatrixType::size_type size_type;
323 typedef typename OutputMatrixType::pointer OutputPointerType;
325 typedef _inputMatrixType InputMatrixType;
326 typedef typename InputMatrixType::const_pointer InputPointerType;
329 ROWS = OutputMatrixType::ROWS,
330 COLS = OutputMatrixType::COLS,
331 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
332 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
333 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
337 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
338 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
339 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
343 OutputPointerType outputPointer = outputMatrix.Pointer();
344 InputPointerType inputPointer = inputMatrix.Pointer();
346 size_type rowIndex, colIndex;
347 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
348 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
349 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
351 for (colIndex = 0; colIndex < COLS; ++colIndex,
352 outputPointer += OUTPUT_COL_STRIDE,
353 inputPointer += INPUT_COL_STRIDE)
355 *outputPointer = _elementOperationType::Operate(inputScalar, *inputPointer);
362 template<
class _elementOperationType>
365 template<
class _inputOutputMatrixType,
class _inputScalarType>
366 static void Run(_inputOutputMatrixType & inputOutputMatrix,
367 const _inputScalarType inputScalar)
369 typedef _inputOutputMatrixType InputOutputMatrixType;
370 typedef typename InputOutputMatrixType::size_type size_type;
371 typedef typename InputOutputMatrixType::pointer InputOutputPointerType;
374 ROWS = InputOutputMatrixType::ROWS,
375 COLS = InputOutputMatrixType::COLS,
376 COL_STRIDE = InputOutputMatrixType::COLSTRIDE,
377 ROW_STRIDE = InputOutputMatrixType::ROWSTRIDE,
378 STRIDE_TO_NEXT_ROW = ROW_STRIDE - COLS * COL_STRIDE
381 InputOutputPointerType inputOutputPointer = inputOutputMatrix.Pointer();
383 size_type rowIndex, colIndex;
384 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
385 inputOutputPointer += STRIDE_TO_NEXT_ROW)
387 for (colIndex = 0; colIndex < COLS; ++colIndex,
388 inputOutputPointer += COL_STRIDE)
390 _elementOperationType::Operate(*inputOutputPointer, inputScalar);
397 template<
class _incrementalOperationType,
class _elementOperationType>
400 typedef typename _incrementalOperationType::OutputType
OutputType;
402 template<
class _inputMatrixType>
405 typedef _inputMatrixType InputMatrixType;
406 typedef typename InputMatrixType::size_type size_type;
407 typedef typename InputMatrixType::const_pointer InputPointerType;
409 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
412 ROWS = InputMatrixType::ROWS,
413 COLS = InputMatrixType::COLS,
414 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
415 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
416 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
419 InputPointerType inputPointer = inputMatrix.Pointer();
421 size_type rowIndex, colIndex;
422 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
423 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
425 for (colIndex = 0; colIndex < COLS; ++colIndex,
426 inputPointer += INPUT_COL_STRIDE)
428 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
429 _elementOperationType::Operate(*inputPointer) );
432 return incrementalResult;
437 template<
class _incrementalOperationType,
class _elementOperationType>
440 typedef typename _incrementalOperationType::OutputType
OutputType;
442 template<
class _input1MatrixType,
class _input2MatrixType>
444 const _input2MatrixType & input2Matrix)
446 typedef _input1MatrixType Input1MatrixType;
447 typedef typename Input1MatrixType::size_type size_type;
448 typedef typename Input1MatrixType::const_pointer Input1PointerType;
449 typedef _input2MatrixType Input2MatrixType;
450 typedef typename Input2MatrixType::const_pointer Input2PointerType;
452 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
455 ROWS = Input1MatrixType::ROWS,
456 COLS = Input1MatrixType::COLS,
457 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
458 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
459 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE
463 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
464 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
465 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
468 Input1PointerType input1Pointer = input1Matrix.Pointer();
469 Input2PointerType input2Pointer = input2Matrix.Pointer();
471 size_type rowIndex, colIndex;
472 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
473 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
474 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
476 for (colIndex = 0; colIndex < COLS; ++colIndex,
477 input1Pointer += INPUT1_COL_STRIDE,
478 input2Pointer += INPUT2_COL_STRIDE)
480 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
481 _elementOperationType::Operate(*input1Pointer, *input2Pointer) );
484 return incrementalResult;
514 template<
class _ioElementOperationType,
class _scalarMatrixElementOperationType>
519 template<
class _ioMatrixType,
class _inputScalarType,
class _inputMatrixType>
520 static inline void Run(_ioMatrixType & ioMatrix,
521 const _inputScalarType & inputScalar,
const _inputMatrixType & inputMatrix)
523 typedef _ioMatrixType IoMatrixType;
524 typedef typename IoMatrixType::size_type size_type;
525 typedef typename IoMatrixType::pointer IoPointerType;
526 typedef _inputMatrixType InputMatrixType;
527 typedef typename InputMatrixType::const_pointer InputPointerType;
530 ROWS = IoMatrixType::ROWS,
531 COLS = IoMatrixType::COLS,
532 IO_COL_STRIDE = IoMatrixType::COLSTRIDE,
533 IO_ROW_STRIDE = IoMatrixType::ROWSTRIDE,
534 IO_STRIDE_TO_NEXT_ROW = IO_ROW_STRIDE - COLS * IO_COL_STRIDE,
535 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
536 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
537 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
540 IoPointerType ioPointer = ioMatrix.Pointer();
541 InputPointerType inputPointer = inputMatrix.Pointer();
543 size_type rowIndex, colIndex;
544 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
545 ioPointer += IO_STRIDE_TO_NEXT_ROW,
546 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
548 for (colIndex = 0; colIndex < COLS; ++colIndex,
549 ioPointer += IO_COL_STRIDE,
550 inputPointer += INPUT_COL_STRIDE)
552 _ioElementOperationType::Operate(
554 _scalarMatrixElementOperationType::Operate(inputScalar, *inputPointer)
588 template<
class _ioElementOperationType,
class _matrixElementOperationType>
593 template<
class _ioMatrixType,
class _input1MatrixType,
class _input2MatrixType>
594 static inline void Run(_ioMatrixType & ioMatrix,
595 const _input1MatrixType & input1Matrix,
596 const _input2MatrixType & input2Matrix)
598 typedef _ioMatrixType IoMatrixType;
599 typedef typename IoMatrixType::size_type size_type;
600 typedef typename IoMatrixType::pointer IoPointerType;
601 typedef _input1MatrixType Input1MatrixType;
602 typedef typename Input1MatrixType::const_pointer Input1PointerType;
603 typedef _input2MatrixType Input2MatrixType;
604 typedef typename Input2MatrixType::const_pointer Input2PointerType;
607 ROWS = IoMatrixType::ROWS,
608 COLS = IoMatrixType::COLS,
609 IO_COL_STRIDE = IoMatrixType::COLSTRIDE,
610 IO_ROW_STRIDE = IoMatrixType::ROWSTRIDE,
611 IO_STRIDE_TO_NEXT_ROW = IO_ROW_STRIDE - COLS * IO_COL_STRIDE,
612 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
613 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE,
614 INPUT1_STRIDE_TO_NEXT_ROW = INPUT1_ROW_STRIDE - COLS * INPUT1_COL_STRIDE,
615 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
616 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE,
617 INPUT2_STRIDE_TO_NEXT_ROW = INPUT2_ROW_STRIDE - COLS * INPUT2_COL_STRIDE
620 IoPointerType ioPointer = ioMatrix.Pointer();
621 Input1PointerType input1Pointer = input1Matrix.Pointer();
622 Input2PointerType input2Pointer = input2Matrix.Pointer();
624 size_type rowIndex, colIndex;
625 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
626 ioPointer += IO_STRIDE_TO_NEXT_ROW,
627 input1Pointer += INPUT1_STRIDE_TO_NEXT_ROW,
628 input2Pointer += INPUT2_STRIDE_TO_NEXT_ROW)
630 for (colIndex = 0; colIndex < COLS; ++colIndex,
631 ioPointer += IO_COL_STRIDE,
632 input1Pointer += INPUT1_COL_STRIDE,
633 input2Pointer += INPUT2_COL_STRIDE)
635 _ioElementOperationType::Operate(
637 _matrixElementOperationType::Operate(*input1Pointer, *input2Pointer)
645 template<
class _incrementalOperationType,
class _elementOperationType>
648 typedef typename _incrementalOperationType::OutputType
OutputType;
650 template<
class _inputMatrixType,
class _inputScalarType>
652 const _inputScalarType & inputScalar)
654 typedef _inputMatrixType InputMatrixType;
655 typedef typename InputMatrixType::size_type size_type;
656 typedef typename InputMatrixType::const_pointer InputPointerType;
658 OutputType incrementalResult = _incrementalOperationType::NeutralElement();
661 ROWS = InputMatrixType::ROWS,
662 COLS = InputMatrixType::COLS,
663 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
664 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
665 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
668 InputPointerType inputPointer = inputMatrix.Pointer();
670 size_type rowIndex, colIndex;
671 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
672 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
674 for (colIndex = 0; colIndex < COLS; ++colIndex,
675 inputPointer += INPUT_COL_STRIDE)
677 incrementalResult = _incrementalOperationType::Operate(incrementalResult,
678 _elementOperationType::Operate(*inputPointer, inputScalar) );
681 return incrementalResult;
687 template<
class _operationType>
690 template<
class _outputMatrixType,
class _input1MatrixType,
class _input2MatrixType>
691 static void Run(_outputMatrixType & outputMatrix,
692 const _input1MatrixType & input1Matrix,
693 const _input2MatrixType & input2Matrix)
695 typedef _outputMatrixType OutputMatrixType;
696 typedef typename OutputMatrixType::size_type size_type;
697 typedef typename OutputMatrixType::pointer OutputPointerType;
699 typedef _input1MatrixType Input1MatrixType;
700 typedef typename Input1MatrixType::const_pointer Input1PointerType;
702 typedef _input2MatrixType Input2MatrixType;
703 typedef typename Input2MatrixType::const_pointer Input2PointerType;
706 ROWS = OutputMatrixType::ROWS,
707 COLS = OutputMatrixType::COLS,
708 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
709 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
710 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
714 INPUT1_COL_STRIDE = Input1MatrixType::COLSTRIDE,
715 INPUT1_ROW_STRIDE = Input1MatrixType::ROWSTRIDE
719 INPUT2_COL_STRIDE = Input2MatrixType::COLSTRIDE,
720 INPUT2_ROW_STRIDE = Input2MatrixType::ROWSTRIDE
723 OutputPointerType outputPointer = outputMatrix.Pointer();
725 Input1PointerType input1Pointer = input1Matrix.Pointer();
726 Input2PointerType input2Pointer = input2Matrix.Pointer();
728 typename Input1MatrixType::ConstRowRefType input1Row;
729 typename Input2MatrixType::ConstColumnRefType input2Col;
731 if ((outputPointer == input1Pointer) ||
732 (outputPointer == input2Pointer)) {
736 size_type rowIndex, colIndex;
737 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
738 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
739 input1Pointer += INPUT1_ROW_STRIDE,
740 input2Pointer = input2Matrix.Pointer())
742 input1Row.SetRef(input1Pointer);
743 for (colIndex = 0; colIndex < COLS; ++colIndex,
744 outputPointer += OUTPUT_COL_STRIDE,
745 input2Pointer += INPUT2_COL_STRIDE)
747 input2Col.SetRef(input2Pointer);
748 *outputPointer = _operationType::Operate(input1Row, input2Col);
761 template<
class _inputMatrixType>
762 static void Run(
const _inputMatrixType & inputMatrix,
763 typename _inputMatrixType::value_type & minValue,
typename _inputMatrixType::value_type & maxValue)
765 typedef _inputMatrixType InputMatrixType;
766 typedef typename InputMatrixType::size_type size_type;
767 typedef typename InputMatrixType::const_pointer InputPointerType;
768 typedef typename InputMatrixType::value_type
value_type;
771 ROWS = InputMatrixType::ROWS,
772 COLS = InputMatrixType::COLS,
773 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
774 INPUT_ROW_STRIDE = InputMatrixType::ROWSTRIDE,
775 INPUT_STRIDE_TO_NEXT_ROW = INPUT_ROW_STRIDE - COLS * INPUT_COL_STRIDE
778 InputPointerType inputPointer = inputMatrix.Pointer();
779 if (inputPointer == 0)
783 maxElement = minElement = *inputPointer;
785 size_type rowIndex, colIndex;
786 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
787 inputPointer += INPUT_STRIDE_TO_NEXT_ROW)
789 for (colIndex = 0; colIndex < COLS; ++colIndex,
790 inputPointer += INPUT_COL_STRIDE)
793 if (element < minElement) {
794 minElement = element;
796 else if (maxElement < element) {
797 maxElement = element;
802 minValue = minElement;
803 maxValue = maxElement;
811 template<
class _outputMatrixType,
class _inputMatrixType,
class _indexVectorType>
812 static void Run(_outputMatrixType & outputMatrix,
const _inputMatrixType & inputMatrix,
813 const _indexVectorType & indexVector)
815 typedef _outputMatrixType OutputMatrixType;
816 typedef typename OutputMatrixType::size_type size_type;
817 typedef typename OutputMatrixType::pointer OutputPointerType;
819 typedef _inputMatrixType InputMatrixType;
820 typedef typename InputMatrixType::const_pointer InputPointerType;
821 typedef _indexVectorType IndexVectorType;
822 typedef typename IndexVectorType::const_pointer IndexPointerType;
825 ROWS = OutputMatrixType::ROWS,
826 COLS = OutputMatrixType::COLS,
827 OUTPUT_COL_STRIDE = OutputMatrixType::COLSTRIDE,
828 OUTPUT_ROW_STRIDE = OutputMatrixType::ROWSTRIDE,
829 OUTPUT_STRIDE_TO_NEXT_ROW = OUTPUT_ROW_STRIDE - COLS * OUTPUT_COL_STRIDE
833 INPUT_COL_STRIDE = InputMatrixType::COLSTRIDE,
837 INDEX_STRIDE = IndexVectorType::STRIDE,
840 OutputPointerType outputPointer = outputMatrix.Pointer();
841 InputPointerType inputPointer = inputMatrix.Pointer();
842 IndexPointerType indexPointer = indexVector.Pointer();
844 size_type rowIndex, colIndex;
845 for (rowIndex = 0; rowIndex < ROWS; ++rowIndex,
846 outputPointer += OUTPUT_STRIDE_TO_NEXT_ROW,
847 indexPointer += INDEX_STRIDE)
849 inputPointer = inputMatrix.Pointer(*indexPointer, 0);
850 for (colIndex = 0; colIndex < COLS; ++colIndex,
851 outputPointer += OUTPUT_COL_STRIDE,
852 inputPointer += INPUT_COL_STRIDE)
854 *outputPointer = *inputPointer;
Definition vctFixedSizeMatrixLoopEngines.h:759
static void Run(const _inputMatrixType &inputMatrix, typename _inputMatrixType::value_type &minValue, typename _inputMatrixType::value_type &maxValue)
Definition vctFixedSizeMatrixLoopEngines.h:762
Definition vctFixedSizeMatrixLoopEngines.h:183
static void Run(_inputOutputMatrixType &inputOutputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:186
Definition vctFixedSizeMatrixLoopEngines.h:217
static void Run(_inputOutputMatrixType &inputOutputMatrix, const _inputMatrixType &inputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:220
Implement operation of the form for fixed size matrices.
Definition vctFixedSizeMatrixLoopEngines.h:590
static void Run(_ioMatrixType &ioMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition vctFixedSizeMatrixLoopEngines.h:594
Definition vctFixedSizeMatrixLoopEngines.h:363
static void Run(_inputOutputMatrixType &inputOutputMatrix, const _inputScalarType inputScalar)
Definition vctFixedSizeMatrixLoopEngines.h:366
Implement operation of the form for fixed size matrices.
Definition vctFixedSizeMatrixLoopEngines.h:516
static void Run(_ioMatrixType &ioMatrix, const _inputScalarType &inputScalar, const _inputMatrixType &inputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:520
Definition vctFixedSizeMatrixLoopEngines.h:135
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:138
Definition vctFixedSizeMatrixLoopEngines.h:76
static void Run(_outputMatrixType &outputMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition vctFixedSizeMatrixLoopEngines.h:79
Definition vctFixedSizeMatrixLoopEngines.h:265
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _inputScalarType inputScalar)
Definition vctFixedSizeMatrixLoopEngines.h:268
Definition vctFixedSizeMatrixLoopEngines.h:314
static void Run(_outputMatrixType &outputMatrix, const _inputScalarType inputScalar, const _inputMatrixType &inputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:317
Definition vctFixedSizeMatrixLoopEngines.h:688
static void Run(_outputMatrixType &outputMatrix, const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition vctFixedSizeMatrixLoopEngines.h:691
Definition vctFixedSizeMatrixLoopEngines.h:809
static void Run(_outputMatrixType &outputMatrix, const _inputMatrixType &inputMatrix, const _indexVectorType &indexVector)
Definition vctFixedSizeMatrixLoopEngines.h:812
Definition vctFixedSizeMatrixLoopEngines.h:398
_incrementalOperationType::OutputType OutputType
Definition vctFixedSizeMatrixLoopEngines.h:400
static OutputType Run(const _inputMatrixType &inputMatrix)
Definition vctFixedSizeMatrixLoopEngines.h:403
Definition vctFixedSizeMatrixLoopEngines.h:438
static OutputType Run(const _input1MatrixType &input1Matrix, const _input2MatrixType &input2Matrix)
Definition vctFixedSizeMatrixLoopEngines.h:443
_incrementalOperationType::OutputType OutputType
Definition vctFixedSizeMatrixLoopEngines.h:440
Definition vctFixedSizeMatrixLoopEngines.h:646
static OutputType Run(const _inputMatrixType &inputMatrix, const _inputScalarType &inputScalar)
Definition vctFixedSizeMatrixLoopEngines.h:651
_incrementalOperationType::OutputType OutputType
Definition vctFixedSizeMatrixLoopEngines.h:648
Container class for the matrix engines.
Definition vctFixedSizeMatrixLoopEngines.h:33
static void ThrowSharedPointersException(void) CISST_THROW(std
Definition vctFixedSizeMatrixLoopEngines.h:40
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76