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
26namespace 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<ordinal_type D, class MatrixViewType>
75 KOKKOS_INLINE_FUNCTION
76 static typename MatrixViewType::value_type
77 det( const MatrixViewType inMat );
78
88 template<class MatrixViewType>
89 KOKKOS_INLINE_FUNCTION
90 static typename MatrixViewType::value_type
91 det( const MatrixViewType inMat );
92
93
104 template<typename inVec1ValueType, class ...inVec1Properties,
105 typename inVec2ValueType, class ...inVec2Properties>
106 KOKKOS_INLINE_FUNCTION
107 static inVec1ValueType
108 dot( const Kokkos::DynRankView<inVec1ValueType,inVec1Properties...> inVec1,
109 const Kokkos::DynRankView<inVec2ValueType,inVec2Properties...> inVec2 );
110
111 };
112
119 template<typename outputValueType, class ...outputProperties,
120 typename inputValueType, class ...inputProperties>
121 static void
122 extractScalarValues( Kokkos::DynRankView<outputValueType,outputProperties...> output,
123 const Kokkos::DynRankView<inputValueType, inputProperties...> input );
124
135 template<typename outputValueType, class ...outputProperties,
136 typename inputValueType, class ...inputProperties>
137 static void
138 clone( Kokkos::DynRankView<outputValueType,outputProperties...> output,
139 const Kokkos::DynRankView<inputValueType,inputProperties...> input );
140
150 template<typename absArrayValueType, class ...absArrayProperties,
151 typename inArrayValueType, class ...inArrayProperties>
152 static void
153 absval( Kokkos::DynRankView<absArrayValueType,absArrayProperties...> absArray,
154 const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
155
156
161 template<typename inoutArrayValueType, class ...inoutArrayProperties>
162 static void
163 absval( Kokkos::DynRankView<inoutArrayValueType,inoutArrayProperties...> inoutArray );
164
165
179 template<typename normArrayValueType, class ...normArrayProperties,
180 typename inVecValueType, class ...inVecProperties>
181 static void
182 vectorNorm( Kokkos::DynRankView<normArrayValueType,normArrayProperties...> normArray,
183 const Kokkos::DynRankView<inVecValueType, inVecProperties...> inVecs,
184 const ENorm normType );
185
200 template<typename transposeMatValueType, class ...transposeMatProperties,
201 typename inMatValueType, class ...inMatProperties>
202 static void
203 transpose( Kokkos::DynRankView<transposeMatValueType,transposeMatProperties...> transposeMats,
204 const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats );
205
206 template<ordinal_type D, class MatrixViewType>
207 KOKKOS_INLINE_FUNCTION
208 static typename MatrixViewType::value_type
209 det( const MatrixViewType inMat );
210
226 template<ordinal_type D, class InverseMatrixViewType, class MatrixViewType>
227 static void
228 inverse( InverseMatrixViewType inverseMats, MatrixViewType inMats );
229
245 template<class InverseMatrixViewType, class MatrixViewType>
246 static void
247 inverse( InverseMatrixViewType inverseMats, MatrixViewType inMats );
248
263 template<class DeterminantArrayViewType, class MatrixViewType>
264 static void
265 det( DeterminantArrayViewType detArray, const MatrixViewType inMats );
266
278 template<typename sumArrayValueType, class ...sumArrayProperties,
279 typename inArray1ValueType, class ...inArray1Properties,
280 typename inArray2ValueType, class ...inArray2Properties>
281 static void
282 add( Kokkos::DynRankView<sumArrayValueType,sumArrayProperties...> sumArray,
283 const Kokkos::DynRankView<inArray1ValueType,inArray1Properties...> inArray1,
284 const Kokkos::DynRankView<inArray2ValueType,inArray2Properties...> inArray2 );
285
296 template<typename inoutSumArrayValueType, class ...inoutSumArrayProperties,
297 typename inArrayValueType, class ...inArrayProperties>
298 static void
299 add( Kokkos::DynRankView<inoutSumArrayValueType,inoutSumArrayProperties...> inoutSumArray,
300 const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
301
313 template<typename diffArrayValueType, class ...diffArrayProperties,
314 typename inArray1ValueType, class ...inArray1Properties,
315 typename inArray2ValueType, class ...inArray2Properties>
316 static void
317 subtract( Kokkos::DynRankView<diffArrayValueType,diffArrayProperties...> diffArray,
318 const Kokkos::DynRankView<inArray1ValueType, inArray1Properties...> inArray1,
319 const Kokkos::DynRankView<inArray2ValueType, inArray2Properties...> inArray2 );
320
331 template<typename inoutDiffArrayValueType, class ...inoutDiffArrayProperties,
332 typename inArrayValueType, class ...inArrayProperties>
333 static void
334 subtract( Kokkos::DynRankView<inoutDiffArrayValueType,inoutDiffArrayProperties...> diffArray,
335 const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray );
336
348 template<typename ValueType,
349 typename scaledArrayValueType, class ...scaledArrayProperties,
350 typename inArrayValueType, class ...inArrayProperties>
351 static void
352 scale( Kokkos::DynRankView<scaledArrayValueType,scaledArrayProperties...> scaledArray,
353 const Kokkos::DynRankView<inArrayValueType, inArrayProperties...> inArray,
354 const ValueType alpha );
355
362 template<typename ValueType,
363 typename inoutScaledArrayValueType, class ...inoutScaledArrayProperties>
364 static void
365 scale( Kokkos::DynRankView<inoutScaledArrayValueType,inoutScaledArrayProperties...> inoutScaledArray,
366 const ValueType alpha );
367
368
382 template<typename dotArrayValueType, class ...dotArrayProperties,
383 typename inVec1ValueType, class ...inVec1Properties,
384 typename inVec2ValueType, class ...inVec2Properties>
385 static void
386 dot( Kokkos::DynRankView<dotArrayValueType,dotArrayProperties...> dotArray,
387 const Kokkos::DynRankView<inVec1ValueType, inVec1Properties...> inVecs1,
388 const Kokkos::DynRankView<inVec2ValueType, inVec2Properties...> inVecs2 );
389
408 template<typename matVecValueType, class ...matVecProperties,
409 typename inMatValueType, class ...inMatProperties,
410 typename inVecValueType, class ...inVecProperties>
411 static void
412 matvec( Kokkos::DynRankView<matVecValueType,matVecProperties...> matVecs,
413 const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats,
414 const Kokkos::DynRankView<inVecValueType, inVecProperties...> inVecs );
415
421 template<typename outMatValueType, class ...outMatProperties,
422 typename inMatValueType, class ...inMatProperties>
423 static void
424 AtA( Kokkos::DynRankView<outMatValueType,outMatProperties...> outMats,
425 const Kokkos::DynRankView<inMatValueType, inMatProperties...> inMats);
426
440 template<typename vecProdValueType, class ...vecProdProperties,
441 typename inLeftValueType, class ...inLeftProperties,
442 typename inRightValueType, class ...inRightProperties>
443 static void
444 vecprod( Kokkos::DynRankView<vecProdValueType,vecProdProperties...> vecProd,
445 const Kokkos::DynRankView<inLeftValueType, inLeftProperties...> inLeft,
446 const Kokkos::DynRankView<inRightValueType,inRightProperties...> inRight );
447
448 }; // class RealSpaceTools
449
450} // end namespace Intrepid2
451
452// include templated definitions
454
455#endif
Definition file for utility classes providing basic linear algebra functionality.
Contains definitions of custom data types in Intrepid2.
Header function for Intrepid2::Util class and other utility functions.
Implementation of basic linear algebra functionality in Euclidean space.
static void inverse(InverseMatrixViewType inverseMats, MatrixViewType inMats)
Computes inverses of nonsingular matrices stored in an array of total rank 2 (single matrix),...
static void extractScalarValues(Kokkos::DynRankView< outputValueType, outputProperties... > output, const Kokkos::DynRankView< inputValueType, inputProperties... > input)
Extract scalar type values from Sacado-based array.
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 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 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 absval(Kokkos::DynRankView< absArrayValueType, absArrayProperties... > absArray, const Kokkos::DynRankView< inArrayValueType, inArrayProperties... > inArray)
Computes absolute value of an array.
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 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.
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 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),...
static void absval(Kokkos::DynRankView< inoutArrayValueType, inoutArrayProperties... > inoutArray)
Computes, in place, absolute value of an array.
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 clone(Kokkos::DynRankView< outputValueType, outputProperties... > output, const Kokkos::DynRankView< inputValueType, inputProperties... > input)
Clone input array.
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 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 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.