5#include <cusp/coo_matrix.h>
6#include <cusp/multiply.h>
32 unsigned n = op1.
size();
34 for(
unsigned i=0; i<n; i++)
35 for(
unsigned j=0; j<n; j++)
36 for(
unsigned k=0; k<n; k++)
37 for(
unsigned l=0; l<n; l++)
38 prod(i*n+k, j*n+l) = op1(i,j)*op2(k,l);
65 unsigned n = op.
size();
67 unsigned number = n*n;
69 cusp::coo_matrix<int, T, cusp::host_memory> A(n*N, n*N, N*number);
71 for(
unsigned k=0; k<N; k++)
72 for(
unsigned i=0; i<n; i++)
73 for(
unsigned j=0; j<n; j++)
76 A.row_indices[number] = k*n+i;
77 A.column_indices[number] = k*n+j;
78 A.values[number] = op(i,j);
97cusp::coo_matrix<int, T, cusp::host_memory>
sandwich(
const Operator<T>& left,
const cusp::coo_matrix<int, T, cusp::host_memory>& m,
const Operator<T>& right)
99 assert( left.
size() == right.
size());
100 typedef cusp::coo_matrix<int, T, cusp::host_memory> Matrix;
101 unsigned n = left.
size();
102 unsigned N = m.num_rows/n;
105 Matrix mr(m ), lmr(m);
107 cusp::multiply( m, r, mr);
108 cusp::multiply( l, mr, lmr);
A square nxn matrix.
Definition: operator.h:28
unsigned size() const
Size n of the Operator.
Definition: operator.h:113
Operator< T > tensorproduct(const Operator< T > &op1, const Operator< T > &op2)
Form the tensor product between two operators.
Definition: operator_tensor.h:27
cusp::coo_matrix< int, T, cusp::host_memory > sandwich(const Operator< T > &left, const cusp::coo_matrix< int, T, cusp::host_memory > &m, const Operator< T > &right)
Multiply 1d matrices by diagonal block matrices from left and right.
Definition: operator_tensor.h:97
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...