Intrepid2
Intrepid2_RealSpaceTools.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Intrepid2 Package
4 //
5 // Copyright 2007 NTESS and the Intrepid2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
16 #ifndef __INTREPID2_REALSPACETOOLS_HPP__
17 #define __INTREPID2_REALSPACETOOLS_HPP__
18 
19 #include "Intrepid2_ConfigDefs.hpp"
20 
21 #include "Intrepid2_Types.hpp"
22 #include "Intrepid2_Utils.hpp"
23 
24 #include "Kokkos_Core.hpp"
25 
26 namespace Intrepid2 {
27 
45  template<typename DeviceType = void>
47  public:
48 
49  struct Serial {
59  template<typename inVecValueType, class ...inVecProperties>
60  KOKKOS_INLINE_FUNCTION
61  static inVecValueType
62  vectorNorm( const Kokkos::DynRankView<inVecValueType,inVecProperties...> inVec,
63  const ENorm normType );
64 
74  template<class MatrixViewType>
75  KOKKOS_INLINE_FUNCTION
76  static typename MatrixViewType::value_type
77  det( const MatrixViewType inMat );
78 
89  template<typename inVec1ValueType, class ...inVec1Properties,
90  typename inVec2ValueType, class ...inVec2Properties>
91  KOKKOS_INLINE_FUNCTION
92  static inVec1ValueType
93  dot( const Kokkos::DynRankView<inVec1ValueType,inVec1Properties...> inVec1,
94  const Kokkos::DynRankView<inVec2ValueType,inVec2Properties...> inVec2 );
95 
96  };
97 
104  template<typename outputValueType, class ...outputProperties,
105  typename inputValueType, class ...inputProperties>
106  static void
107  extractScalarValues( Kokkos::DynRankView<outputValueType,outputProperties...> output,
108  const Kokkos::DynRankView<inputValueType, inputProperties...> input );
109 
120  template<typename outputValueType, class ...outputProperties,
121  typename inputValueType, class ...inputProperties>
122  static void
123  clone( Kokkos::DynRankView<outputValueType,outputProperties...> output,
124  const Kokkos::DynRankView<inputValueType,inputProperties...> input );
125 
135  template<typename absArrayValueType, class ...absArrayProperties,
136  typename inArrayValueType, class ...inArrayProperties>
137  static void
138  absval( Kokkos::DynRankView<absArrayValueType,absArrayProperties...> absArray,
139  const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
140 
141 
146  template<typename inoutArrayValueType, class ...inoutArrayProperties>
147  static void
148  absval( Kokkos::DynRankView<inoutArrayValueType,inoutArrayProperties...> inoutArray );
149 
150 
164  template<typename normArrayValueType, class ...normArrayProperties,
165  typename inVecValueType, class ...inVecProperties>
166  static void
167  vectorNorm( Kokkos::DynRankView<normArrayValueType,normArrayProperties...> normArray,
168  const Kokkos::DynRankView<inVecValueType, inVecProperties...> inVecs,
169  const ENorm normType );
170 
185  template<typename transposeMatValueType, class ...transposeMatProperties,
186  typename inMatValueType, class ...inMatProperties>
187  static void
188  transpose( Kokkos::DynRankView<transposeMatValueType,transposeMatProperties...> transposeMats,
189  const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats );
190 
206  template<class InverseMatrixViewType, class MatrixViewType>
207  static void
208  inverse( InverseMatrixViewType inverseMats, MatrixViewType inMats );
209 
224  template<class DeterminantArrayViewType, class MatrixViewType>
225  static void
226  det( DeterminantArrayViewType detArray, const MatrixViewType inMats );
227 
239  template<typename sumArrayValueType, class ...sumArrayProperties,
240  typename inArray1ValueType, class ...inArray1Properties,
241  typename inArray2ValueType, class ...inArray2Properties>
242  static void
243  add( Kokkos::DynRankView<sumArrayValueType,sumArrayProperties...> sumArray,
244  const Kokkos::DynRankView<inArray1ValueType,inArray1Properties...> inArray1,
245  const Kokkos::DynRankView<inArray2ValueType,inArray2Properties...> inArray2 );
246 
257  template<typename inoutSumArrayValueType, class ...inoutSumArrayProperties,
258  typename inArrayValueType, class ...inArrayProperties>
259  static void
260  add( Kokkos::DynRankView<inoutSumArrayValueType,inoutSumArrayProperties...> inoutSumArray,
261  const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
262 
274  template<typename diffArrayValueType, class ...diffArrayProperties,
275  typename inArray1ValueType, class ...inArray1Properties,
276  typename inArray2ValueType, class ...inArray2Properties>
277  static void
278  subtract( Kokkos::DynRankView<diffArrayValueType,diffArrayProperties...> diffArray,
279  const Kokkos::DynRankView<inArray1ValueType, inArray1Properties...> inArray1,
280  const Kokkos::DynRankView<inArray2ValueType, inArray2Properties...> inArray2 );
281 
292  template<typename inoutDiffArrayValueType, class ...inoutDiffArrayProperties,
293  typename inArrayValueType, class ...inArrayProperties>
294  static void
295  subtract( Kokkos::DynRankView<inoutDiffArrayValueType,inoutDiffArrayProperties...> diffArray,
296  const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
297 
309  template<typename ValueType,
310  typename scaledArrayValueType, class ...scaledArrayProperties,
311  typename inArrayValueType, class ...inArrayProperties>
312  static void
313  scale( Kokkos::DynRankView<scaledArrayValueType,scaledArrayProperties...> scaledArray,
314  const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray,
315  const ValueType alpha );
316 
323  template<typename ValueType,
324  typename inoutScaledArrayValueType, class ...inoutScaledArrayProperties>
325  static void
326  scale( Kokkos::DynRankView<inoutScaledArrayValueType,inoutScaledArrayProperties...> inoutScaledArray,
327  const ValueType alpha );
328 
329 
343  template<typename dotArrayValueType, class ...dotArrayProperties,
344  typename inVec1ValueType, class ...inVec1Properties,
345  typename inVec2ValueType, class ...inVec2Properties>
346  static void
347  dot( Kokkos::DynRankView<dotArrayValueType,dotArrayProperties...> dotArray,
348  const Kokkos::DynRankView<inVec1ValueType, inVec1Properties...> inVecs1,
349  const Kokkos::DynRankView<inVec2ValueType, inVec2Properties...> inVecs2 );
350 
369  template<typename matVecValueType, class ...matVecProperties,
370  typename inMatValueType, class ...inMatProperties,
371  typename inVecValueType, class ...inVecProperties>
372  static void
373  matvec( Kokkos::DynRankView<matVecValueType,matVecProperties...> matVecs,
374  const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats,
375  const Kokkos::DynRankView<inVecValueType, inVecProperties...> inVecs );
376 
382  template<typename outMatValueType, class ...outMatProperties,
383  typename inMatValueType, class ...inMatProperties>
384  static void
385  AtA( Kokkos::DynRankView<outMatValueType,outMatProperties...> outMats,
386  const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats);
387 
401  template<typename vecProdValueType, class ...vecProdProperties,
402  typename inLeftValueType, class ...inLeftProperties,
403  typename inRightValueType, class ...inRightProperties>
404  static void
405  vecprod( Kokkos::DynRankView<vecProdValueType,vecProdProperties...> vecProd,
406  const Kokkos::DynRankView<inLeftValueType, inLeftProperties...> inLeft,
407  const Kokkos::DynRankView<inRightValueType,inRightProperties...> inRight );
408 
409  }; // class RealSpaceTools
410 
411 } // end namespace Intrepid2
412 
413 // include templated definitions
415 
416 #endif
static void transpose(Kokkos::DynRankView< transposeMatValueType, transposeMatProperties...> transposeMats, const Kokkos::DynRankView< inMatValueType, inMatProperties...> inMats)
Computes transposes of square matrices stored in an array of total rank 2 (single matrix)...
static void vectorNorm(Kokkos::DynRankView< normArrayValueType, normArrayProperties...> normArray, const Kokkos::DynRankView< inVecValueType, inVecProperties...> inVecs, const ENorm normType)
Computes norms (1, 2, infinity) of vectors stored in a array of total rank 2 (array of vectors)...
static void det(DeterminantArrayViewType detArray, const MatrixViewType inMats)
Computes determinants of matrices stored in an array of total rank 3 (array of matrices), indexed by (i0, D, D), or 4 (array of arrays of matrices), indexed by (i0, i1, D, D).
static void AtA(Kokkos::DynRankView< outMatValueType, outMatProperties...> outMats, const Kokkos::DynRankView< inMatValueType, inMatProperties...> inMats)
Computes the matrix-matrix product , for an input rectangular matrix .
static KOKKOS_INLINE_FUNCTION inVecValueType vectorNorm(const Kokkos::DynRankView< inVecValueType, inVecProperties...> inVec, const ENorm normType)
Computes norm (1, 2, infinity) of a single vector stored in an array of rank 1.
static void extractScalarValues(Kokkos::DynRankView< outputValueType, outputProperties...> output, const Kokkos::DynRankView< inputValueType, inputProperties...> input)
Extract scalar type values from Sacado-based array.
static void vecprod(Kokkos::DynRankView< vecProdValueType, vecProdProperties...> vecProd, const Kokkos::DynRankView< inLeftValueType, inLeftProperties...> inLeft, const Kokkos::DynRankView< inRightValueType, inRightProperties...> inRight)
Vector product using multidimensional arrays: vecProd = inVecLeft x inVecRight
static void subtract(Kokkos::DynRankView< diffArrayValueType, diffArrayProperties...> diffArray, const Kokkos::DynRankView< inArray1ValueType, inArray1Properties...> inArray1, const Kokkos::DynRankView< inArray2ValueType, inArray2Properties...> inArray2)
Subtracts inArray2 from inArray1: diffArray = inArray1 - inArray2.
Header function for Intrepid2::Util class and other utility functions.
static void clone(Kokkos::DynRankView< outputValueType, outputProperties...> output, const Kokkos::DynRankView< inputValueType, inputProperties...> input)
Clone input array.
static KOKKOS_INLINE_FUNCTION inVec1ValueType dot(const Kokkos::DynRankView< inVec1ValueType, inVec1Properties...> inVec1, const Kokkos::DynRankView< inVec2ValueType, inVec2Properties...> inVec2)
Computes dot product of two vectors stored in arrays of rank 1.
static void inverse(InverseMatrixViewType inverseMats, MatrixViewType inMats)
Computes inverses of nonsingular matrices stored in an array of total rank 2 (single matrix)...
static void scale(Kokkos::DynRankView< scaledArrayValueType, scaledArrayProperties...> scaledArray, const Kokkos::DynRankView< inArrayValueType, inArrayProperties...> inArray, const ValueType alpha)
Multiplies array inArray by the scalar scalar (componentwise): scaledArray = scalar * inArray...
static KOKKOS_INLINE_FUNCTION MatrixViewType::value_type det(const MatrixViewType inMat)
Computes determinant of a single square matrix stored in an array of rank 2.
static void dot(Kokkos::DynRankView< dotArrayValueType, dotArrayProperties...> dotArray, const Kokkos::DynRankView< inVec1ValueType, inVec1Properties...> inVecs1, const Kokkos::DynRankView< inVec2ValueType, inVec2Properties...> inVecs2)
Computes dot product of vectors stored in an array of total rank 2 (array of vectors), indexed by (i0, D), or 3 (array of arrays of vectors), indexed by (i0, i1, D).
Contains definitions of custom data types in Intrepid2.
Implementation of basic linear algebra functionality in Euclidean space.
Definition file for utility classes providing basic linear algebra functionality. ...
static void matvec(Kokkos::DynRankView< matVecValueType, matVecProperties...> matVecs, const Kokkos::DynRankView< inMatValueType, inMatProperties...> inMats, const Kokkos::DynRankView< inVecValueType, inVecProperties...> inVecs)
Matrix-vector left multiply using multidimensional arrays: matVec = inMat * inVec.
static void add(Kokkos::DynRankView< sumArrayValueType, sumArrayProperties...> sumArray, const Kokkos::DynRankView< inArray1ValueType, inArray1Properties...> inArray1, const Kokkos::DynRankView< inArray2ValueType, inArray2Properties...> inArray2)
Adds arrays inArray1 and inArray2: sumArray = inArray1 + inArray2.
static void absval(Kokkos::DynRankView< absArrayValueType, absArrayProperties...> absArray, const Kokkos::DynRankView< inArrayValueType, inArrayProperties...> inArray)
Computes absolute value of an array.