Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_MatrixAdapter_def.hpp
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Amesos2: Templated Direct Sparse Solver Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 //
42 // @HEADER
43 
44 
45 #ifndef AMESOS2_MATRIXADAPTER_DEF_HPP
46 #define AMESOS2_MATRIXADAPTER_DEF_HPP
47 #include <Tpetra_Util.hpp>
48 #include "Amesos2_MatrixAdapter_decl.hpp"
49 #include "Amesos2_ConcreteMatrixAdapter_def.hpp"
50 //#include "Amesos2_ConcreteMatrixAdapter.hpp"
51 
52 
53 namespace Amesos2 {
54 
55 
56  template < class Matrix >
57  MatrixAdapter<Matrix>::MatrixAdapter(const Teuchos::RCP<Matrix> m)
58  : mat_(m)
59  {
60  comm_ = static_cast<const adapter_t*>(this)->getComm_impl();
61  col_map_ = static_cast<const adapter_t*>(this)->getColMap_impl();
62  row_map_ = static_cast<const adapter_t*>(this)->getRowMap_impl();
63  }
64 
65  template < class Matrix >
66  void
67  MatrixAdapter<Matrix>::getCrs(const Teuchos::ArrayView<scalar_t> nzval,
68  const Teuchos::ArrayView<global_ordinal_t> colind,
69  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
70  typename MatrixAdapter<Matrix>::global_size_t& nnz,
71  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t, global_ordinal_t, node_t> > rowmap,
72  EStorage_Ordering ordering,
73  EDistribution distribution) const
74  {
75  help_getCrs(nzval, colind, rowptr,
76  nnz, rowmap, distribution, ordering,
77  typename adapter_t::get_crs_spec());
78  }
79 
80  template < class Matrix >
81  void
82  MatrixAdapter<Matrix>::getCrs(const Teuchos::ArrayView<scalar_t> nzval,
83  const Teuchos::ArrayView<global_ordinal_t> colind,
84  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
85  typename MatrixAdapter<Matrix>::global_size_t& nnz,
86  EDistribution distribution,
87  EStorage_Ordering ordering) const
88  {
89  const Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap
90  = Util::getDistributionMap<local_ordinal_t,global_ordinal_t,global_size_t,node_t>(distribution,
91  this->getGlobalNumRows(),
92  this->getComm());
93  this->getCrs(nzval, colind, rowptr, nnz, Teuchos::ptrInArg(*rowmap), ordering, distribution);
94  }
95 
96  template < class Matrix >
97  void
98  MatrixAdapter<Matrix>::getCcs(const Teuchos::ArrayView<scalar_t> nzval,
99  const Teuchos::ArrayView<global_ordinal_t> rowind,
100  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
101  typename MatrixAdapter<Matrix>::global_size_t& nnz,
102  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t, global_ordinal_t, node_t> > colmap,
103  EStorage_Ordering ordering,
104  EDistribution distribution) const
105  {
106  help_getCcs(nzval, rowind, colptr,
107  nnz, colmap, distribution, ordering,
108  typename adapter_t::get_ccs_spec());
109  }
110 
111  template < class Matrix >
112  void
113  MatrixAdapter<Matrix>::getCcs(const Teuchos::ArrayView<scalar_t> nzval,
114  const Teuchos::ArrayView<global_ordinal_t> rowind,
115  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
116  typename MatrixAdapter<Matrix>::global_size_t& nnz,
117  EDistribution distribution,
118  EStorage_Ordering ordering) const
119  {
120  const Teuchos::RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap
121  = Util::getDistributionMap<local_ordinal_t,global_ordinal_t,global_size_t,node_t>(distribution,
122  this->getGlobalNumCols(),
123  this->getComm());
124  this->getCcs(nzval, rowind, colptr, nnz, Teuchos::ptrInArg(*colmap), ordering, distribution);
125  }
126 
127  template < class Matrix >
128  typename MatrixAdapter<Matrix>::global_size_t
130  {
131  return static_cast<const adapter_t*>(this)->getGlobalNumRows_impl();
132  }
133 
134  template < class Matrix >
135  typename MatrixAdapter<Matrix>::global_size_t
137  {
138  return static_cast<const adapter_t*>(this)->getGlobalNumCols_impl();
139  }
140 
141  template < class Matrix >
142  typename MatrixAdapter<Matrix>::global_size_t
144  {
145  return row_map_->getIndexBase();
146  }
147 
148  template < class Matrix >
149  typename MatrixAdapter<Matrix>::global_size_t
151  {
152  return col_map_->getIndexBase();
153  }
154 
155  template < class Matrix >
156  typename MatrixAdapter<Matrix>::global_size_t
158  {
159  return static_cast<const adapter_t*>(this)->getGlobalNNZ_impl();
160  }
161 
162  template < class Matrix >
163  size_t
165  {
166  return row_map_->getNodeNumElements(); // TODO: verify
167  }
168 
169  template < class Matrix >
170  size_t
172  {
173  return col_map_->getNodeNumElements();
174  }
175 
176  template < class Matrix >
177  size_t
179  {
180  return static_cast<const adapter_t*>(this)->getLocalNNZ_impl();
181  }
182 
183  // NDE: This is broken for Epetra_CrsMatrix
184  template < class Matrix >
185  std::string
187  {
188  std::ostringstream oss;
189  oss << "Amesos2::MatrixAdapter wrapping: ";
190  oss << mat_->description(); // NDE: This is not defined in Epetra_CrsMatrix, only in Tpetra::CrsMatrix
191  return oss.str();
192  }
193 
194  template < class Matrix >
195  void
196  MatrixAdapter<Matrix>::describe(Teuchos::FancyOStream &out,
197  const Teuchos::EVerbosityLevel verbLevel) const
198  {}
199 
200  template < class Matrix >
201  typename MatrixAdapter<Matrix>::spmtx_ptr_t
203  {
204  return static_cast<const adapter_t*>(this)->getSparseRowPtr();
205  }
206 
207  template < class Matrix >
208  typename MatrixAdapter<Matrix>::spmtx_idx_t
210  {
211  return static_cast<const adapter_t*>(this)->getSparseColInd();
212  }
213 
214  template < class Matrix >
215  typename MatrixAdapter<Matrix>::spmtx_vals_t
217  {
218  return static_cast<const adapter_t*>(this)->getSparseValues();
219  }
220 
221 
222  /******************************
223  * Private method definitions *
224  ******************************/
225 
226  template < class Matrix >
227  void
228  MatrixAdapter<Matrix>::help_getCrs(const Teuchos::ArrayView<scalar_t> nzval,
229  const Teuchos::ArrayView<global_ordinal_t> colind,
230  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
231  typename MatrixAdapter<Matrix>::global_size_t& nnz,
232  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
233  EDistribution distribution,
234  EStorage_Ordering ordering,
235  has_special_impl hsi) const
236  {
237  hsi.set = false;
238  static_cast<const adapter_t*>(this)->getCrs_spec(nzval, colind, rowptr,
239  nnz, rowmap, ordering);
240  }
241 
242  template < class Matrix >
243  void
244  MatrixAdapter<Matrix>::help_getCrs(const Teuchos::ArrayView<scalar_t> nzval,
245  const Teuchos::ArrayView<global_ordinal_t> colind,
246  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
247  typename MatrixAdapter<Matrix>::global_size_t& nnz,
248  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
249  EDistribution distribution,
250  EStorage_Ordering ordering,
251  no_special_impl nsi) const
252  {
253 
254  //Added void to remove parameter not used warning
255  ((void)nsi);
256  do_getCrs(nzval, colind, rowptr,
257  nnz, rowmap, distribution, ordering,
258  typename adapter_t::major_access());
259  }
260 
261  template < class Matrix >
262  void
263  MatrixAdapter<Matrix>::do_getCrs(const Teuchos::ArrayView<scalar_t> nzval,
264  const Teuchos::ArrayView<global_ordinal_t> colind,
265  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
266  typename MatrixAdapter<Matrix>::global_size_t& nnz,
267  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
268  EDistribution distribution,
269  EStorage_Ordering ordering,
270  row_access ra) const
271  {
272  using Teuchos::rcp;
273  using Teuchos::RCP;
274  using Teuchos::ArrayView;
275  using Teuchos::OrdinalTraits;
276 
277 
278  ((void) ra);
279 
280  RCP<const type> get_mat;
281  if( *rowmap == *this->row_map_ ){
282  // No need to redistribute
283  get_mat = rcp(this,false); // non-owning
284  } else {
285  get_mat = get(rowmap, distribution);
286  }
287  // RCP<const type> get_mat = get(rowmap);
288 
289  // rmap may not necessarily check same as rowmap because rmap may
290  // have been constructued with Tpetra's "expert" constructor,
291  // which assumes that the map points are non-contiguous.
292  //
293  // TODO: There may be some more checking between the row map
294  // compatibility, but things are working fine now.
295 
296  RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rmap = get_mat->getRowMap();
297  ArrayView<const global_ordinal_t> node_elements = rmap->getNodeElementList();
298  if( node_elements.size() == 0 ) return; // no more contribution
299 
300  typename ArrayView<const global_ordinal_t>::iterator row_it, row_end;
301  row_end = node_elements.end();
302 
303  size_t rowptr_ind = OrdinalTraits<size_t>::zero();
304  global_ordinal_t rowInd = OrdinalTraits<global_ordinal_t>::zero();
305  for( row_it = node_elements.begin(); row_it != row_end; ++row_it ){
306  rowptr[rowptr_ind++] = rowInd;
307  size_t rowNNZ = get_mat->getGlobalRowNNZ(*row_it);
308  size_t nnzRet = OrdinalTraits<size_t>::zero();
309  ArrayView<global_ordinal_t> colind_view = colind.view(rowInd,rowNNZ);
310  ArrayView<scalar_t> nzval_view = nzval.view(rowInd,rowNNZ);
311 
312  get_mat->getGlobalRowCopy(*row_it, colind_view, nzval_view, nnzRet);
313  for (size_t rr = 0; rr < nnzRet ; rr++)
314  {
315  colind_view[rr] = colind_view[rr] - rmap->getIndexBase();
316  }
317 
318  // It was suggested that instead of sorting each row's indices
319  // individually, that we instead do a double-transpose at the
320  // end, which would also lead to the indices being sorted.
321  if( ordering == SORTED_INDICES ){
322  Tpetra::sort2(colind_view.begin(), colind_view.end(), nzval_view.begin());
323  }
324 
325  TEUCHOS_TEST_FOR_EXCEPTION( rowNNZ != nnzRet,
326  std::runtime_error,
327  "Number of values returned different from "
328  "number of values reported");
329  rowInd += rowNNZ;
330  }
331  rowptr[rowptr_ind] = nnz = rowInd;
332  }
333 
334  // TODO: This may not work with distributed matrices.
335  template < class Matrix >
336  void
337  MatrixAdapter<Matrix>::do_getCrs(const Teuchos::ArrayView<scalar_t> nzval,
338  const Teuchos::ArrayView<global_ordinal_t> colind,
339  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> rowptr,
340  typename MatrixAdapter<Matrix>::global_size_t& nnz,
341  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rowmap,
342  EDistribution distribution,
343  EStorage_Ordering ordering,
344  col_access ca) const
345  {
346  using Teuchos::Array;
347  // get the ccs and transpose
348 
349  Array<scalar_t> nzval_tmp(nzval.size(), 0);
350  Array<global_ordinal_t> rowind(colind.size(), 0);
351  Array<global_size_t> colptr(this->getGlobalNumCols() + 1);
352  this->getCcs(nzval_tmp(), rowind(), colptr(), nnz, rowmap, ordering, distribution);
353 
354  if( !nzval.is_null() && !colind.is_null() && !rowptr.is_null() )
355  Util::transpose(nzval_tmp(), rowind(), colptr(), nzval, colind, rowptr);
356  }
357 
358  template < class Matrix >
359  void
360  MatrixAdapter<Matrix>::help_getCcs(const Teuchos::ArrayView<scalar_t> nzval,
361  const Teuchos::ArrayView<global_ordinal_t> rowind,
362  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
363  typename MatrixAdapter<Matrix>::global_size_t& nnz,
364  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
365  EDistribution distribution,
366  EStorage_Ordering ordering,
367  has_special_impl hsi) const
368  {
369  static_cast<const adapter_t*>(this)->getCcs_spec(nzval, rowind, colptr,
370  nnz, colmap, ordering);
371  }
372 
373  template < class Matrix >
374  void
375  MatrixAdapter<Matrix>::help_getCcs(const Teuchos::ArrayView<scalar_t> nzval,
376  const Teuchos::ArrayView<global_ordinal_t> rowind,
377  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
378  typename MatrixAdapter<Matrix>::global_size_t& nnz,
379  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
380  EDistribution distribution,
381  EStorage_Ordering ordering,
382  no_special_impl nsi) const
383  {
384  ((void)nsi);
385 
386  do_getCcs(nzval, rowind, colptr,
387  nnz, colmap, distribution, ordering,
388  typename adapter_t::major_access());
389  }
390 
391  template < class Matrix >
392  void
393  MatrixAdapter<Matrix>::do_getCcs(const Teuchos::ArrayView<scalar_t> nzval,
394  const Teuchos::ArrayView<global_ordinal_t> rowind,
395  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
396  typename MatrixAdapter<Matrix>::global_size_t& nnz,
397  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
398  EDistribution distribution,
399  EStorage_Ordering ordering,
400  row_access ra) const
401  {
402  using Teuchos::Array;
403  // get the crs and transpose
404 
405  ((void) ra);
406 
407  Array<scalar_t> nzval_tmp(nzval.size(), 0);
408  Array<global_ordinal_t> colind(rowind.size(), 0);
409  Array<global_size_t> rowptr(this->getGlobalNumRows() + 1);
410  this->getCrs(nzval_tmp(), colind(), rowptr(), nnz, colmap, ordering, distribution);
411 
412  if( !nzval.is_null() && !rowind.is_null() && !colptr.is_null() )
413  Util::transpose(nzval_tmp(), colind(), rowptr(), nzval, rowind, colptr);
414  }
415 
416  template < class Matrix >
417  void
418  MatrixAdapter<Matrix>::do_getCcs(const Teuchos::ArrayView<scalar_t> nzval,
419  const Teuchos::ArrayView<global_ordinal_t> rowind,
420  const Teuchos::ArrayView<typename MatrixAdapter<Matrix>::global_size_t> colptr,
421  typename MatrixAdapter<Matrix>::global_size_t& nnz,
422  const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > colmap,
423  EDistribution distribution,
424  EStorage_Ordering ordering,
425  col_access ca) const
426  {
427  using Teuchos::RCP;
428  using Teuchos::ArrayView;
429  using Teuchos::OrdinalTraits;
430 
431  RCP<const type> get_mat;
432  if( *colmap == *this->col_map_ ){
433  // No need to redistribute
434  get_mat = rcp(this,false); // non-owning
435  } else {
436  get_mat = get(colmap, distribution);
437  }
438 
439  // If all is well and good, then colmap == cmap
440  RCP<const Tpetra::Map<scalar_t,local_ordinal_t,global_ordinal_t> > cmap = get_mat->getColMap();
441  TEUCHOS_ASSERT( *colmap == *cmap );
442 
443  ArrayView<global_ordinal_t> node_elements = cmap->getNodeElementList();
444  if( node_elements.size() == 0 ) return; // no more contribution
445 
446  typename ArrayView<global_ordinal_t>::iterator col_it, col_end;
447  col_end = node_elements.end();
448 
449  size_t colptr_ind = OrdinalTraits<size_t>::zero();
450  global_ordinal_t colInd = OrdinalTraits<global_ordinal_t>::zero();
451  for( col_it = node_elements.begin(); col_it != col_end; ++col_it ){
452  colptr[colptr_ind++] = colInd;
453  size_t colNNZ = getGlobalColNNZ(*col_it);
454  size_t nnzRet = 0;
455  ArrayView<global_ordinal_t> rowind_view = rowind.view(colInd,colNNZ);
456  ArrayView<scalar_t> nzval_view = nzval.view(colInd,colNNZ);
457  getGlobalColCopy(*col_it, rowind_view, nzval_view, nnzRet);
458 
459  // It was suggested that instead of sorting each row's indices
460  // individually, that we instead do a double-transpose at the
461  // end, which would also lead to the indices being sorted.
462  if( ordering == SORTED_INDICES ){
463  Tpetra::sort2(rowind_view.begin(), rowind_view.end(), nzval_view.begin());
464  }
465 
466  TEUCHOS_TEST_FOR_EXCEPTION( colNNZ != nnzRet,
467  std::runtime_error,
468  "Number of values returned different from "
469  "number of values reported");
470  colInd += colNNZ;
471  }
472  colptr[colptr_ind] = nnz = colInd;
473  }
474 
475 
476  // These will link to concrete implementations
477  template < class Matrix >
478  void
480  const Teuchos::ArrayView<global_ordinal_t>& indices,
481  const Teuchos::ArrayView<scalar_t>& vals,
482  size_t& nnz) const
483  {
484  static_cast<const adapter_t*>(this)->getGlobalRowCopy_impl(row, indices, vals, nnz);
485  }
486 
487  template < class Matrix >
488  void
490  const Teuchos::ArrayView<global_ordinal_t>& indices,
491  const Teuchos::ArrayView<scalar_t>& vals,
492  size_t& nnz) const
493  {
494  static_cast<const adapter_t*>(this)->getGlobalColCopy_impl(col, indices, vals, nnz);
495  }
496 
497  template < class Matrix >
498  size_t
500  {
501  return static_cast<const adapter_t*>(this)->getMaxRowNNZ_impl();
502  }
503 
504  template < class Matrix >
505  size_t
507  {
508  return static_cast<const adapter_t*>(this)->getMaxColNNZ_impl();
509  }
510 
511  template < class Matrix >
512  size_t
513  MatrixAdapter<Matrix>::getGlobalRowNNZ(global_ordinal_t row) const
514  {
515  return static_cast<const adapter_t*>(this)->getGlobalRowNNZ_impl(row);
516  }
517 
518  template < class Matrix >
519  size_t
520  MatrixAdapter<Matrix>::getLocalRowNNZ(local_ordinal_t row) const
521  {
522  return static_cast<const adapter_t*>(this)->getLocalRowNNZ_impl(row);
523  }
524 
525  template < class Matrix >
526  size_t
527  MatrixAdapter<Matrix>::getGlobalColNNZ(global_ordinal_t col) const
528  {
529  return static_cast<const adapter_t*>(this)->getGlobalColNNZ_impl(col);
530  }
531 
532  template < class Matrix >
533  size_t
534  MatrixAdapter<Matrix>::getLocalColNNZ(local_ordinal_t col) const
535  {
536  return static_cast<const adapter_t*>(this)->getLocalColNNZ_impl(col);
537  }
538 
539  template < class Matrix >
540  bool
542  {
543  return static_cast<const adapter_t*>(this)->isLocallyIndexed_impl();
544  }
545 
546  template < class Matrix >
547  bool
549  {
550  return static_cast<const adapter_t*>(this)->isGloballyIndexed_impl();
551  }
552 
553 
554  template < class Matrix >
555  Teuchos::RCP<const MatrixAdapter<Matrix> >
556  MatrixAdapter<Matrix>::get(const Teuchos::Ptr<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map, EDistribution distribution) const
557  {
558  return static_cast<const adapter_t*>(this)->get_impl(map, distribution);
559  }
560 
561 
562  template <class Matrix>
563  Teuchos::RCP<MatrixAdapter<Matrix> >
564  createMatrixAdapter(Teuchos::RCP<Matrix> m){
565  using Teuchos::rcp;
566  using Teuchos::rcp_const_cast;
567 
568  if(m.is_null()) return Teuchos::null;
569  return( rcp(new ConcreteMatrixAdapter<Matrix>(m)) );
570  }
571 
572  template <class Matrix>
573  Teuchos::RCP<const MatrixAdapter<Matrix> >
574  createConstMatrixAdapter(Teuchos::RCP<const Matrix> m){
575  using Teuchos::rcp;
576  using Teuchos::rcp_const_cast;
577 
578  if(m.is_null()) return Teuchos::null;
579  return( rcp(new ConcreteMatrixAdapter<Matrix>(rcp_const_cast<Matrix,const Matrix>(m))).getConst() );
580  }
581 
582 } // end namespace Amesos2
583 
584 #endif // AMESOS2_MATRIXADAPTER_DEF_HPP
Definition: Amesos2_TypeDecl.hpp:142
EStorage_Ordering
Definition: Amesos2_TypeDecl.hpp:141
Indicates that the concrete class has a special implementation that should be called.
Definition: Amesos2_TypeDecl.hpp:82
void transpose(ArrayView< Scalar > vals, ArrayView< GlobalOrdinal > indices, ArrayView< GlobalSizeT > ptr, ArrayView< Scalar > trans_vals, ArrayView< GlobalOrdinal > trans_indices, ArrayView< GlobalSizeT > trans_ptr)
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
Indicates that the object of an adapter provides row access to its data.
Definition: Amesos2_TypeDecl.hpp:100
A Matrix adapter interface for Amesos2.
Definition: Amesos2_MatrixAdapter_decl.hpp:76
std::string description() const
Returns a short description of this Solver.
Definition: Amesos2_MatrixAdapter_def.hpp:186
Indicates that the concrete class can use the generic getC{c|r}s methods implemented in MatrixAdapter...
Definition: Amesos2_TypeDecl.hpp:91
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
Indicates that the object of an adapter provides column access to its data.
Definition: Amesos2_TypeDecl.hpp:109