Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_Dense3TensorImp.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 template <typename ordinal_type, typename value_type>
13  l(sz),
14  Cijk_values(l*l*l)
15 {
16 }
17 
18 template <typename ordinal_type, typename value_type>
21 {
22 }
23 
24 template <typename ordinal_type, typename value_type>
27 size() const
28 {
29  return l;
30 }
31 
32 template <typename ordinal_type, typename value_type>
33 const value_type&
36 {
37  return Cijk_values[ l*(l*k + j) + i ];
38 }
39 
40 template <typename ordinal_type, typename value_type>
44 {
45  return Cijk_values[ l*(l*k + j) + i ];
46 }
47 
48 template <typename ordinal_type, typename value_type>
52 {
53  return l*l;
54 }
55 
56 template <typename ordinal_type, typename value_type>
57 void
60  ordinal_type& i, ordinal_type& j, value_type& c) const
61 {
62  j = ll/l;
63  i = ll-j*l;
64  c = triple_value(i,j,k);
65 }
66 
67 template <typename ordinal_type, typename value_type>
68 void
70 print(std::ostream& os) const
71 {
72  for (ordinal_type i=0; i<l; i++)
73  for (ordinal_type j=0; j<l; j++)
74  for (ordinal_type k=0; k<l; k++)
75  os << "i = " << i << ", j = " << j << ", k = " << k << ", Dijk = "
76  << operator()(i,j,k) << std::endl;
77 }
void print(std::ostream &os) const
Print tensor.
ordinal_type size() const
Return size.
ordinal_type num_values(ordinal_type k) const
Return number of non-zero&#39;s in Cijk for a given k.
const value_type & operator()(ordinal_type i, ordinal_type j, ordinal_type k) const
Get value (i,j,k)
Dense3Tensor(ordinal_type sz)
Constructor.
void value(ordinal_type k, ordinal_type l, ordinal_type &i, ordinal_type &j, value_type &c) const
Get value (i,j,k) using sparse access.