Intrepid
Intrepid_ArrayToolsDefTensorTEMP.hpp
1  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
2  struct ArrayTools::matmatProductDataDataTempSpecRight<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,-1>{
3  matmatProductDataDataTempSpecRight(ArrayOutData& outputData,
4  ArrayInDataLeft& inputDataLeft,
5  ArrayInDataRight& inputDataRight,
6  const char transpose){
7 
8  ArrayTools::matmatProductDataDataTempSpecLeft<Scalar,ArrayOutData, ArrayInDataLeft, ArrayInDataRight, Rank<ArrayInDataLeft>::value,Rank<ArrayInDataRight>::value>(outputData, inputDataLeft, inputDataRight,transpose);
9 
10  }
11  };
12  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
13  struct ArrayTools::matmatProductDataDataTempSpecRight<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,3>{
14  matmatProductDataDataTempSpecRight(ArrayOutData& outputData,
15  ArrayInDataLeft& inputDataLeft,
16  ArrayInDataRight& inputDataRight,
17  const char transpose){
18  ArrayTools::matmatProductDataDataTempSpecLeft<Scalar,ArrayOutData, ArrayInDataLeft, ArrayInDataRight, Rank<ArrayInDataLeft>::value,3>(outputData, inputDataLeft, inputDataRight,transpose);
19 
20  }
21  };
22  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
23  struct ArrayTools::matmatProductDataDataTempSpecRight<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,4>{
24  matmatProductDataDataTempSpecRight(ArrayOutData& outputData,
25  ArrayInDataLeft& inputDataLeft,
26  ArrayInDataRight& inputDataRight,
27  const char transpose){
28 
29  ArrayTools::matmatProductDataDataTempSpecLeft<Scalar,ArrayOutData, ArrayInDataLeft, ArrayInDataRight, Rank<ArrayInDataLeft>::value,4>(outputData, inputDataLeft, inputDataRight,transpose);
30 
31 
32  }
33  };
34  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
35  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,-1,-1>{
36  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
37  ArrayInDataLeft& inputDataLeft,
38  ArrayInDataRight& inputDataRight,
39  const char transpose){
40  int dataLeftRank = inputDataLeft.rank();
41 
42  int dataRightRank = inputDataRight.rank();
43  switch(dataLeftRank){
44  case 2:
45  if(dataRightRank==3){
47 
48  }else if(dataRightRank==4){
50 
51  }
52  break;
53  case 3:
54  if(dataRightRank==3){
56 
57  }else if(dataRightRank==4){
59 
60  }
61  break;
62  case 4:
63  if(dataRightRank==3){
65 
66  }else if(dataRightRank==4){
68 
69  }
70  break;
71 
72  }
73  }
74 
75  };
76  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
77  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,2,-1>{
78  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
79  ArrayInDataLeft& inputDataLeft,
80  ArrayInDataRight& inputDataRight,
81  const char transpose){
82 
83 
84  int dataRightRank = inputDataRight.rank();
85  switch(dataRightRank){
86  case 3:
88 
89  break;
90 
91  case 4:
93 
94  break;
95 
96 
97  }
98  }
99  };
100  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
101  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,2,3>{
102  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
103  ArrayInDataLeft& inputDataLeft,
104  ArrayInDataRight& inputDataRight,
105  const char transpose){
106  int dataLeftRank = inputDataLeft.rank();
107  int numDataLeftPts = inputDataLeft.dimension(1);
108  int dataRightRank = inputDataRight.rank();
109  int numCells = outputData.dimension(0);
110  int numPoints = outputData.dimension(1);
111  int matDim = outputData.dimension(2);
112  if(numDataLeftPts != 1){
113  for(int cell = 0; cell < numCells; cell++) {
114  for(int point = 0; point < numPoints; point++) {
115  for( int row = 0; row < matDim; row++) {
116  for( int col = 0; col < matDim; col++) {
117  outputData(cell, point, row, col) = \
118  inputDataLeft(cell, point)*inputDataRight(point, row, col);
119  }// Col-loop
120  } // Row-loop
121  } // P-loop
122  }// C-loop
123  }else{
124  for(int cell = 0; cell < numCells; cell++) {
125  for(int point = 0; point < numPoints; point++) {
126  for( int row = 0; row < matDim; row++) {
127  for( int col = 0; col < matDim; col++) {
128  outputData(cell, point, row, col) = \
129  inputDataLeft(cell, 0)*inputDataRight(point, row, col);
130  }// Col-loop
131  } // Row-loop
132  } // P-loop
133  }// C-loop
134 
135  }
136 
137 
138 
139  }
140  };
141  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
142  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,2,4>{
143  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
144  ArrayInDataLeft& inputDataLeft,
145  ArrayInDataRight& inputDataRight,
146  const char transpose){
147  int dataLeftRank = inputDataLeft.rank();
148  int numDataLeftPts = inputDataLeft.dimension(1);
149  int dataRightRank = inputDataRight.rank();
150  int numCells = outputData.dimension(0);
151  int numPoints = outputData.dimension(1);
152  int matDim = outputData.dimension(2);
153 
154  if(numDataLeftPts != 1){
155  for(int cell = 0; cell < numCells; cell++) {
156  for(int point = 0; point < numPoints; point++) {
157  for( int row = 0; row < matDim; row++) {
158  for( int col = 0; col < matDim; col++) {
159  outputData(cell, point, row, col) = \
160  inputDataLeft(cell, point)*inputDataRight(cell, point, row, col);
161  }// Col-loop
162  } // Row-loop
163  } // P-loop
164  }// C-loop
165  }else{
166  for(int cell = 0; cell < numCells; cell++) {
167  for(int point = 0; point < numPoints; point++) {
168  for( int row = 0; row < matDim; row++) {
169  for( int col = 0; col < matDim; col++) {
170  outputData(cell, point, row, col) = \
171  inputDataLeft(cell, 0)*inputDataRight(cell, point, row, col);
172  }// Col-loop
173  } // Row-loop
174  } // P-loop
175  }// C-loop
176  }
177 
178 
179  }
180  };
181  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
182  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,3,-1>{
183  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
184  ArrayInDataLeft& inputDataLeft,
185  ArrayInDataRight& inputDataRight,
186  const char transpose){
187  int dataRightRank = inputDataRight.rank();
188  switch(dataRightRank){
189  case 3:
191 
192  break;
193 
194  case 4:
196 
197  break;
198 
199 
200  }
201 
202 
203 
204  }
205  };
206  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
207  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,3,3>{
208  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
209  ArrayInDataLeft& inputDataLeft,
210  ArrayInDataRight& inputDataRight,
211  const char transpose){
212 
213  int dataLeftRank = inputDataLeft.rank();
214  int numDataLeftPts = inputDataLeft.dimension(1);
215  int dataRightRank = inputDataRight.rank();
216  int numCells = outputData.dimension(0);
217  int numPoints = outputData.dimension(1);
218  int matDim = outputData.dimension(2);
219  if(numDataLeftPts != 1){
220  for(int cell = 0; cell < numCells; cell++) {
221  for(int point = 0; point < numPoints; point++) {
222  for( int row = 0; row < matDim; row++) {
223  for( int col = 0; col < matDim; col++) {
224  outputData(cell, point, row, col) = \
225  inputDataLeft(cell, point, row)*inputDataRight(point, row, col);
226  }// Col-loop
227  } // Row-loop
228  } // P-loop
229  }// C-loop
230  }else{
231  for(int cell = 0; cell < numCells; cell++) {
232  for(int point = 0; point < numPoints; point++) {
233  for( int row = 0; row < matDim; row++) {
234  for( int col = 0; col < matDim; col++) {
235  outputData(cell, point, row, col) = \
236  inputDataLeft(cell, 0, row)*inputDataRight(point, row, col);
237  }// Col-loop
238  } // Row-loop
239  } // P-loop
240  }// C-loop
241 
242  }
243 
244  }
245  };
246  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
247  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,3,4>{
248  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
249  ArrayInDataLeft& inputDataLeft,
250  ArrayInDataRight& inputDataRight,
251  const char transpose){
252 
253  int dataLeftRank = inputDataLeft.rank();
254  int numDataLeftPts = inputDataLeft.dimension(1);
255  int dataRightRank = inputDataRight.rank();
256  int numCells = outputData.dimension(0);
257  int numPoints = outputData.dimension(1);
258  int matDim = outputData.dimension(2);
259  if(numDataLeftPts != 1){
260  for(int cell = 0; cell < numCells; cell++) {
261  for(int point = 0; point < numPoints; point++) {
262  for( int row = 0; row < matDim; row++) {
263  for( int col = 0; col < matDim; col++) {
264  outputData(cell, point, row, col) = \
265  inputDataLeft(cell, point, row)*inputDataRight(cell, point, row, col);
266  }// Col-loop
267  } // Row-loop
268  } // P-loop
269  }// C-loop
270  }else{
271  for(int cell = 0; cell < numCells; cell++) {
272  for(int point = 0; point < numPoints; point++) {
273  for( int row = 0; row < matDim; row++) {
274  for( int col = 0; col < matDim; col++) {
275  outputData(cell, point, row, col) = \
276  inputDataLeft(cell, 0, row)*inputDataRight(cell, point, row, col);
277  }// Col-loop
278  } // Row-loop
279  } // P-loop
280  }// C-loop
281  }
282 
283 
284  }
285  };
286  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
287  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,4,-1>{
288  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
289  ArrayInDataLeft& inputDataLeft,
290  ArrayInDataRight& inputDataRight,
291  const char transpose){
292 
293  int dataRightRank = inputDataRight.rank();
294  switch(dataRightRank){
295  case 3:
297 
298  break;
299 
300  case 4:
302 
303  break;
304 
305 
306  }
307 
308 
309 
310  }
311  };
312  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
313  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,4,3>{
314  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
315  ArrayInDataLeft& inputDataLeft,
316  ArrayInDataRight& inputDataRight,
317  const char transpose){
318  int dataLeftRank = inputDataLeft.rank();
319  int numDataLeftPts = inputDataLeft.dimension(1);
320  int dataRightRank = inputDataRight.rank();
321  int numCells = outputData.dimension(0);
322  int numPoints = outputData.dimension(1);
323  int matDim = outputData.dimension(2);
324  if(numDataLeftPts != 1){
325  if ((transpose == 'n') || (transpose == 'N')) {
326  for(int cell = 0; cell < numCells; cell++){
327  for(int point = 0; point < numPoints; point++){
328  for(int row = 0; row < matDim; row++){
329  for(int col = 0; col < matDim; col++){
330  outputData(cell, point, row, col) = 0.0;
331  for(int i = 0; i < matDim; i++){
332  outputData(cell, point, row, col) += \
333  inputDataLeft(cell, point, row, i)*inputDataRight(point, i, col);
334  }// i
335  } // col
336  } //row
337  }// point
338  }// cell
339  } // no transpose
340  else if ((transpose == 't') || (transpose == 'T')) {
341  for(int cell = 0; cell < numCells; cell++){
342  for(int point = 0; point < numPoints; point++){
343  for(int row = 0; row < matDim; row++){
344  for(int col = 0; col < matDim; col++){
345  outputData(cell, point, row, col) = 0.0;
346  for(int i = 0; i < matDim; i++){
347  outputData(cell, point, row, col) += \
348  inputDataLeft(cell, point, i, row)*inputDataRight(point, i, col);
349  }// i
350  } // col
351  } //row
352  }// point
353  }// cell
354  } //transpose
355  }else{
356  if ((transpose == 'n') || (transpose == 'N')) {
357  for(int cell = 0; cell < numCells; cell++){
358  for(int point = 0; point < numPoints; point++){
359  for(int row = 0; row < matDim; row++){
360  for(int col = 0; col < matDim; col++){
361  outputData(cell, point, row, col) = 0.0;
362  for(int i = 0; i < matDim; i++){
363  outputData(cell, point, row, col) += \
364  inputDataLeft(cell, 0, row, i)*inputDataRight(point, i, col);
365  }// i
366  } // col
367  } //row
368  }// point
369  }// cell
370  } // no transpose
371  else if ((transpose == 't') || (transpose == 'T')) {
372  for(int cell = 0; cell < numCells; cell++){
373  for(int point = 0; point < numPoints; point++){
374  for(int row = 0; row < matDim; row++){
375  for(int col = 0; col < matDim; col++){
376  outputData(cell, point, row, col) = 0.0;
377  for(int i = 0; i < matDim; i++){
378  outputData(cell, point, row, col) += \
379  inputDataLeft(cell, 0, i, row)*inputDataRight(point, i, col);
380  }// i
381  } // col
382  } //row
383  }// point
384  }// cell
385 
386  }
387  }
388  }
389  };
390  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
391  struct ArrayTools::matmatProductDataDataTempSpecLeft<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,4,4>{
392  matmatProductDataDataTempSpecLeft(ArrayOutData& outputData,
393  ArrayInDataLeft& inputDataLeft,
394  ArrayInDataRight& inputDataRight,
395  const char transpose){
396  int dataLeftRank = inputDataLeft.rank();
397  int numDataLeftPts = inputDataLeft.dimension(1);
398  int dataRightRank = inputDataRight.rank();
399  int numCells = outputData.dimension(0);
400  int numPoints = outputData.dimension(1);
401  int matDim = outputData.dimension(2);
402  if(numDataLeftPts != 1){
403  if ((transpose == 'n') || (transpose == 'N')) {
404  for(int cell = 0; cell < numCells; cell++){
405  for(int point = 0; point < numPoints; point++){
406  for(int row = 0; row < matDim; row++){
407  for(int col = 0; col < matDim; col++){
408  outputData(cell, point, row, col) = 0.0;
409  for(int i = 0; i < matDim; i++){
410  outputData(cell, point, row, col) += \
411  inputDataLeft(cell, point, row, i)*inputDataRight(cell, point, i, col);
412  }// i
413  } // col
414  } //row
415  }// point
416  }// cell
417  } // no transpose
418  else if ((transpose == 't') || (transpose == 'T')) {
419  for(int cell = 0; cell < numCells; cell++){
420  for(int point = 0; point < numPoints; point++){
421  for(int row = 0; row < matDim; row++){
422  for(int col = 0; col < matDim; col++){
423  outputData(cell, point, row, col) = 0.0;
424  for(int i = 0; i < matDim; i++){
425  outputData(cell, point, row, col) += \
426  inputDataLeft(cell, point, i, row)*inputDataRight(cell, point, i, col);
427  }// i
428  } // col
429  } //row
430  }// point
431  }// cell
432  } //transpose
433  }else{
434  if ((transpose == 'n') || (transpose == 'N')) {
435  for(int cell = 0; cell < numCells; cell++){
436  for(int point = 0; point < numPoints; point++){
437  for(int row = 0; row < matDim; row++){
438  for(int col = 0; col < matDim; col++){
439  outputData(cell, point, row, col) = 0.0;
440  for(int i = 0; i < matDim; i++){
441  outputData(cell, point, row, col) += \
442  inputDataLeft(cell, 0, row, i)*inputDataRight(cell, point, i, col);
443  }// i
444  } // col
445  } //row
446  }// point
447  }// cell
448  } // no transpose
449  else if ((transpose == 't') || (transpose == 'T')) {
450  for(int cell = 0; cell < numCells; cell++){
451  for(int point = 0; point < numPoints; point++){
452  for(int row = 0; row < matDim; row++){
453  for(int col = 0; col < matDim; col++){
454  outputData(cell, point, row, col) = 0.0;
455  for(int i = 0; i < matDim; i++){
456  outputData(cell, point, row, col) += \
457  inputDataLeft(cell, 0, i, row)*inputDataRight(cell, point, i, col);
458  }// i
459  } // col
460  } //row
461  }// point
462  }// cell
463  } //transpose
464 
465  }
466  }
467  };
468  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
469  void ArrayTools::matmatProductDataDataTemp(ArrayOutData & outputData,
470  const ArrayInDataLeft & inputDataLeft,
471  const ArrayInDataRight & inputDataRight,
472  const char transpose){
473  ArrayTools::matmatProductDataDataTempSpecRight<Scalar,ArrayOutData, ArrayInDataLeft, ArrayInDataRight, Rank<ArrayInDataRight>::value>(outputData, inputDataLeft, inputDataRight,transpose);
474 
475 
476 
477  }
478 
479 
480 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
481 #ifdef __GNUC__
482 #warning "The Intrepid package is deprecated"
483 #endif
484 #endif
485