MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MatrixSparseCOORSerial.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #include <assert.h>
43 
50 #include "Teuchos_Assert.hpp"
51 #include "Teuchos_dyn_cast.hpp"
52 
53 namespace AbstractLinAlgPack {
54 
56 {
57  if(owns_mem_) {
58  if(val_) delete [] val_;
59  if(row_i_) delete [] row_i_;
60  if(col_j_) delete [] col_j_;
61  }
62 }
63 
65 {
66  return val_ != NULL;
67 }
68 
69 // static members
70 
73 
74 // Constructors / initializers
75 
77  :rows_(0)
78  ,cols_(0)
79  ,max_nz_(0)
80  ,nz_(0)
81  ,val_(NULL)
82  ,row_i_(NULL)
83  ,col_j_(NULL)
84  ,self_allocate_(true)
85 {}
86 
88  size_type max_nz
89  ,value_type *val
90  ,index_type *row_i
91  ,index_type *col_j
92  ,const release_resource_ptr_t &release_resource
95  ,size_type nz
96  ,bool check_input
97  )
98 {
99 #ifdef TEUCHOS_DEBUG
100  const char msg_err[] = "MatrixSparseCOORSerial::set_buffer(...) : Error,!";
101  TEUCHOS_TEST_FOR_EXCEPTION( max_nz <= 0, std::invalid_argument, msg_err );
102  TEUCHOS_TEST_FOR_EXCEPTION( val == NULL || row_i == NULL || col_j == NULL, std::invalid_argument, msg_err );
103  TEUCHOS_TEST_FOR_EXCEPTION( rows > 0 && cols <= 0 , std::invalid_argument, msg_err );
104  TEUCHOS_TEST_FOR_EXCEPTION( rows > 0 && (nz < 0 || nz > max_nz), std::invalid_argument, msg_err );
105 #endif
106  max_nz_ = max_nz;
107  val_ = val;
108  row_i_ = row_i;
109  col_j_ = col_j;
111  self_allocate_ = false;
112  if(rows) {
113  rows_ = rows;
114  cols_ = cols;
115  nz_ = nz;
116  space_cols_.initialize(rows);
117  space_rows_.initialize(cols);
118  if( nz && check_input ) {
119  TEUCHOS_TEST_FOR_EXCEPT(true); // Todo: Check that row_i[] and col_j[] are in bounds
120  }
121  }
122  else {
123  rows_ = 0;
124  cols_ = 0;
125  nz_ = 0;
128  }
129 }
130 
132 {
133  max_nz_ = 0;
134  val_ = NULL;
135  row_i_ = NULL;
136  col_j_ = NULL;
138  self_allocate_ = true;
139  rows_ = 0;
140  cols_ = 0;
141  nz_ = 0;
144 }
145 
146 // Overridden from MatrixBase
147 
149 {
150  return rows_;
151 }
152 
154 {
155  return cols_;
156 }
157 
159 {
160  return nz_;
161 }
162 
163 // Overridden from MatrixOp
164 
166 {
167  return space_cols_;
168 }
169 
171 {
172  return space_rows_;
173 }
174 
176 {
177  using Teuchos::dyn_cast;
179  &Mc = dyn_cast<const MatrixSparseCOORSerial>(M);
180  if( this == &Mc )
181  return *this; // assignment to self
182  // A shallow copy is fine as long as we are carefull.
183  max_nz_ = Mc.max_nz_;
184  val_ = Mc.val_;
185  row_i_ = Mc.row_i_;
186  col_j_ = Mc.col_j_;
189  rows_ = Mc.rows_;
190  cols_ = Mc.cols_;
191  nz_ = Mc.nz_;
194  return *this;
195 }
196 
197 std::ostream& MatrixSparseCOORSerial::output(std::ostream& out) const
198 {
199  const size_type
200  rows = this->rows(),
201  cols = this->cols(),
202  nz = this->nz();
203  out
204  << "Sparse " << rows << " x " << cols << " matrix with "
205  << nz << " nonzero entries:\n";
206  const value_type
207  *itr_val = &val_[0],
208  *itr_val_end = itr_val + nz_;
209  const index_type
210  *itr_ivect = &row_i_[0],
211  *itr_jvect = &col_j_[0];
212  for(; itr_val != itr_val_end; ++itr_val, ++itr_ivect, ++itr_jvect)
213  out << *itr_val << ":" << *itr_ivect << ":" << *itr_jvect << " ";
214  out << "\n";
215 
216  if( rows * cols <= 400 ) {
217  out << "Converted to dense =\n";
218  MatrixOp::output(out);
219  }
220 
221  return out;
222 }
223 
226  , const Vector& x, value_type b
227  ) const
228 {
229  AbstractLinAlgPack::Vp_MtV_assert_compatibility( y, *this, M_trans, x );
230  VectorDenseMutableEncap y_d(*y);
231  VectorDenseEncap x_d(x);
232  DenseLinAlgPack::Vt_S(&y_d(),b);
233  Vp_StCOOMtV(
236  ,M_trans, x_d()
237  );
238 }
239 
240 // Overridden from MatrixLoadSparseElements
241 
244  ,size_type cols
245  ,size_type max_nz
246  ,EAssumeElementUniqueness element_uniqueness
247  )
248 {
249  namespace rcp = MemMngPack;
250 #ifdef TEUCHOS_DEBUG
251  const char msg_err_head[] = "MatrixSparseCOORSerial::reinitialize(...) : Error";
252  TEUCHOS_TEST_FOR_EXCEPTION( max_nz <= 0, std::invalid_argument, msg_err_head<<"!" );
253  TEUCHOS_TEST_FOR_EXCEPTION( rows <= 0 || cols <= 0 , std::invalid_argument, msg_err_head<<"!" );
254 #endif
255  rows_ = rows;
256  cols_ = cols;
257  element_uniqueness_ = element_uniqueness;
258  if( self_allocate_ ) {
259  if(max_nz_ < max_nz) {
262  val_ = new value_type[max_nz]
263  ,row_i_ = new index_type[max_nz]
264  ,col_j_ = new index_type[max_nz]
265  )
266  );
267  max_nz_ = max_nz;
268  }
269 
270  }
271  else {
272 #ifdef TEUCHOS_DEBUG
274  max_nz <= max_nz_, std::invalid_argument
275  ,msg_err_head << "Buffers set up by client in set_buffers() only allows storage for "
276  "max_nz_ = " << max_nz_ << " nonzero entries while client requests storage for "
277  "max_nz = " << max_nz << " nonzero entries!" );
278 #endif
279  }
280  reload_val_only_ = false;
282  nz_ = 0;
283  max_nz_load_ = 0;
284 }
285 
287 {
288 #ifdef TEUCHOS_DEBUG
290  rows_ == 0 || cols_ == 0, std::invalid_argument
291  ,"MatrixSparseCOORSerial::reset_to_load_values(...) : Error, "
292  "this matrix is not initialized so it can't be rest to load "
293  "new values for nonzero entries." );
294 #endif
295  reload_val_only_ = true;
297  nz_ = 0;
298  max_nz_load_ = 0;
299 }
300 
302  size_type max_nz_load
303  ,value_type **val
304  ,index_type **row_i
305  ,index_type **col_j
306  )
307 {
308 #ifdef TEUCHOS_DEBUG
310  max_nz_load_ != 0 , std::logic_error
311  ,"MatrixSparseCOORSerial::get_load_nonzeros_buffers(...) : Error, "
312  "You must call commit_load_nonzeros_buffers() between calls to this method!" );
314  max_nz_load <= 0 || max_nz_load > max_nz_ - nz_, std::invalid_argument
315  ,"MatrixSparseCOORSerial::get_load_nonzeros_buffers(...) : Error, "
316  "The number of nonzeros to load max_nz_load = " << max_nz_load << " can not "
317  "be greater than max_nz - nz = " << max_nz_ << " - " << nz_ << " = " << (max_nz_-nz_) <<
318  " entries!" );
320  reload_val_only_ && (row_i != NULL || col_j != NULL), std::invalid_argument
321  ,"MatrixSparseCOORSerial::get_load_nonzeros_buffers(...) : Error, "
322  "reset_to_load_values() was called and therefore the structure of the matrix "
323  "can not be set!" );
325  !reload_val_only_ && (row_i == NULL || col_j == NULL), std::invalid_argument
326  ,"MatrixSparseCOORSerial::get_load_nonzeros_buffers(...) : Error, "
327  "both *row_i and *col_j must be non-NULL since reinitialize() was called" );
328 #endif
329  max_nz_load_ = max_nz_load;
330  *val = val_ + nz_;
331  if(!reload_val_only_)
332  *row_i = row_i_ + nz_;
333  if(!reload_val_only_)
334  *col_j = col_j_ + nz_;
335 }
336 
338  size_type nz_commit
339  ,value_type **val
340  ,index_type **row_i
341  ,index_type **col_j
342  )
343 {
344 #ifdef TEUCHOS_DEBUG
346  max_nz_load_ == 0 , std::logic_error
347  ,"MatrixSparseCOORSerial::commit_load_nonzeros_buffers(...) : Error, "
348  "You must call get_load_nonzeros_buffers() before calling this method!" );
350  nz_commit > max_nz_load_ , std::logic_error
351  ,"MatrixSparseCOORSerial::commit_load_nonzeros_buffers(...) : Error, "
352  "You can not commit more nonzero entries than you requested buffer space for in "
353  "get_load_nonzeros_buffers(...)!" );
355  *val != val_ + nz_
356  , std::logic_error
357  ,"MatrixSparseCOORSerial::commit_load_nonzeros_buffers(...) : Error, "
358  "This is not the buffer I give you in get_load_nonzeros_buffers(...)!" );
360  reload_val_only_ && (row_i != NULL || col_j != NULL), std::invalid_argument
361  ,"MatrixSparseCOORSerial::commit_load_nonzeros_buffers(...) : Error, "
362  "reset_to_load_values() was called and therefore the structure of the matrix "
363  "can not be set!" );
364 #endif
365  nz_ += nz_commit;
366  max_nz_load_ = 0;
367 }
368 
370 {
372  reload_val_only_ == true && reload_val_only_nz_last_ != nz_, std::logic_error
373  ,"MatrixSparseCOORSerial::finish_construction() : Error, the number of nonzeros on"
374  " the initial load with row and column indexes was = " << reload_val_only_nz_last_ <<
375  " and does not agree with the number of nonzero values = " << nz_ << " loaded this time!" );
376  if( test_setup ) {
377  for( size_type k = 0; k < nz_; ++k ) {
378  const index_type
379  i = row_i_[k],
380  j = col_j_[k];
382  i < 1 || rows_ < i, std::logic_error
383  ,"MatrixSparseCOORSerial::finish_construction(true) : Error, "
384  "row_i[" << k << "] = " << i << " is not in the range [1,rows] = [1,"<<rows_<<"]!" );
386  j < 1 || cols_ < j, std::logic_error
387  ,"MatrixSparseCOORSerial::finish_construction(true) : Error, "
388  "col_j[" << k << "] = " << j << " is not in the range [1,cols] = [1,"<<cols_<<"]!" );
389  }
390  }
393 }
394 
395 // Overridden from MatrixExtractSparseElements
396 
397 #ifdef TEUCHOS_DEBUG
398 #define VALIDATE_ROW_COL_IN_RANGE() \
399 TEUCHOS_TEST_FOR_EXCEPTION( \
400  i < 1 || rows_ < i, std::invalid_argument \
401  ,err_msg_head<<", i = inv_row_perm[(row_i["<<k<<"]=="<<*row_i<<")-1] = "<<i<<" > rows = "<<rows_ ); \
402 TEUCHOS_TEST_FOR_EXCEPTION( \
403  j < 1 || cols_ < j, std::invalid_argument \
404  ,err_msg_head<<", j = inv_col_perm[(col_j["<<k<<"]=="<<*col_j<<")-1] = "<<j<<" > rows = "<<cols_ );
405 #else
406 #define VALIDATE_ROW_COL_IN_RANGE()
407 #endif
408 
410  EElementUniqueness element_uniqueness
411  ,const index_type inv_row_perm[]
412  ,const index_type inv_col_perm[]
413  ,const Range1D &row_rng_in
414  ,const Range1D &col_rng_in
415  ,index_type dl
416  ,index_type du
417  ) const
418 {
419 #ifdef TEUCHOS_DEBUG
420  const char err_msg_head[] = "MatrixSparseCOORSerial::count_nonzeros(...): Error";
423  ,std::logic_error
424  ,err_msg_head << ", the client requests a count for unique "
425  "elements but this sparse matrix object is not allowed to assume this!" );
426 #endif
427  const Range1D
428  row_rng = RangePack::full_range(row_rng_in,1,rows_),
429  col_rng = RangePack::full_range(col_rng_in,1,rows_),
430  row_rng_full(1,rows_),
431  col_rng_full(1,cols_);
432  const index_type
433  *row_i = row_i_,
434  *col_j = col_j_;
435  index_type
436  cnt_nz = 0,
437  k = 0;
438  if( dl == -row_rng.ubound() + col_rng.lbound() && du == +col_rng.ubound() - row_rng.lbound() ) {
439  // The diagonals are not limiting so we can ignore them
440  if( row_rng == row_rng_full && col_rng == col_rng_full ) {
441  // The row and column ranges are not limiting either
442  cnt_nz = nz_; // Just return the count of all the elements!
443  }
444  else {
445  // The row or column range is limiting
446  if( inv_row_perm == NULL && inv_col_perm == NULL ) {
447  // Neither the rows nor columns are permuted
448  for( k = 0; k < nz_; ++row_i, ++col_j, ++k ) {
449  const index_type
450  i = (*row_i),
451  j = (*col_j);
453  cnt_nz += row_rng.in_range(i) && col_rng.in_range(j) ? 1 : 0;
454  }
455  }
456  else if ( inv_row_perm != NULL && inv_col_perm == NULL ) {
457  // Only the rows are permuted
458  for( k = 0; k < nz_; ++row_i, ++col_j, ++k ) {
459  const index_type
460  i = inv_row_perm[(*row_i)-1],
461  j = (*col_j);
463  cnt_nz += row_rng.in_range(i) && col_rng.in_range(j) ? 1 : 0;
464  }
465  }
466  else if ( inv_row_perm == NULL && inv_col_perm != NULL ) {
467  // Only the columns are permuted
468  for( k = 0; k < nz_; ++row_i, ++col_j, ++k ) {
469  const index_type
470  i = (*row_i),
471  j = inv_col_perm[(*col_j)-1];
473  cnt_nz += row_rng.in_range(i) && col_rng.in_range(j) ? 1 : 0;
474  }
475  }
476  else {
477  // Both the rows and columns are permuted!
478  for( k = 0; k < nz_; ++row_i, ++col_j, ++k ) {
479  const index_type
480  i = inv_row_perm[(*row_i)-1],
481  j = inv_col_perm[(*col_j)-1];
483  cnt_nz += row_rng.in_range(i) && col_rng.in_range(j) ? 1 : 0;
484  }
485  }
486  }
487  }
488  else {
489  // We have to consider the diagonals dl and du
490  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement!
491  }
492  return cnt_nz;
493 }
494 
496  EElementUniqueness element_uniqueness
497  ,const index_type inv_row_perm[]
498  ,const index_type inv_col_perm[]
499  ,const Range1D &row_rng_in
500  ,const Range1D &col_rng_in
501  ,index_type dl
502  ,index_type du
503  ,value_type alpha
504  ,const index_type len_Aval
505  ,value_type Aval[]
506  ,const index_type len_Aij
507  ,index_type Arow[]
508  ,index_type Acol[]
509  ,const index_type row_offset
510  ,const index_type col_offset
511  ) const
512 {
513 #ifdef TEUCHOS_DEBUG
514  const char err_msg_head[] = "MatrixSparseCOORSerial::count_nonzeros(...): Error";
517  ,std::logic_error
518  ,err_msg_head << ", the client requests extraction of unique "
519  "elements but this sparse matrix object can not guarantee this!" );
520 #endif
521  const Range1D
522  row_rng = RangePack::full_range(row_rng_in,1,rows_),
523  col_rng = RangePack::full_range(col_rng_in,1,rows_),
524  row_rng_full(1,rows_),
525  col_rng_full(1,cols_);
526  value_type
527  *val = val_;
528  const index_type
529  *row_i = row_i_,
530  *col_j = col_j_;
531  index_type
532  cnt_nz = 0,
533  k = 0;
534  if( dl == -row_rng.ubound() + col_rng.lbound() && du == +col_rng.ubound() - row_rng.lbound() ) {
535  // The diagonals are not limiting so we can ignore them
536  if( row_rng == row_rng_full && col_rng == col_rng_full ) {
537  // The row and column ranges are not limiting either
538  if( inv_row_perm == NULL && inv_col_perm == NULL ) {
539  // We are just extracting the whole, unpermuted matrix
540  for( k = 0; k < nz_; ++val, ++row_i, ++col_j, ++k ) {
541  ++cnt_nz;
542  if( len_Aval )
543  *Aval++ = *val; // ToDo: Split into different loops (no inner if())
544  if( len_Aij ) {
545  *Arow++ = *row_i + row_offset;
546  *Acol++ = *col_j + col_offset;
547  }
548  }
549  }
550  else {
551  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement!
552  }
553  }
554  else {
555  // The row or column range is limiting
556  if( inv_row_perm == NULL && inv_col_perm == NULL ) {
557  // There are no permutations to consider
558  for( k = 0; k < nz_; ++val, ++row_i, ++col_j, ++k ) {
559  const index_type
560  i = (*row_i),
561  j = (*col_j);
563  if( row_rng.in_range(i) && col_rng.in_range(j) ) {
564  ++cnt_nz;
565  if( len_Aval )
566  *Aval++ = *val; // ToDo: Split into different loops (no inner if())
567  if( len_Aij ) {
568  *Arow++ = i + row_offset;
569  *Acol++ = j + col_offset;
570  }
571  }
572  }
573  }
574  else if( inv_row_perm != NULL && inv_col_perm == NULL ) {
575  // We must consider only row permutations
576  for( k = 0; k < nz_; ++val, ++row_i, ++col_j, ++k ) {
577  const index_type
578  i = inv_row_perm[(*row_i)-1],
579  j = (*col_j);
581  if( row_rng.in_range(i) && col_rng.in_range(j) ) {
582  ++cnt_nz;
583  if( len_Aval )
584  *Aval++ = *val; // ToDo: Split into different loops (no inner if())
585  if( len_Aij ) {
586  *Arow++ = i + row_offset;
587  *Acol++ = j + col_offset;
588  }
589  }
590  }
591  }
592  else if( inv_row_perm == NULL && inv_col_perm != NULL ) {
593  // We must consider only column permutations
594  for( k = 0; k < nz_; ++val, ++row_i, ++col_j, ++k ) {
595  const index_type
596  i = (*row_i),
597  j = inv_col_perm[(*col_j)-1];
599  if( row_rng.in_range(i) && col_rng.in_range(j) ) {
600  ++cnt_nz;
601  if( len_Aval )
602  *Aval++ = *val; // ToDo: Split into different loops (no inner if())
603  if( len_Aij ) {
604  *Arow++ = i + row_offset;
605  *Acol++ = j + col_offset;
606  }
607  }
608  }
609  }
610  else {
611  // We must consider row and column permutations
612  for( k = 0; k < nz_; ++val, ++row_i, ++col_j, ++k ) {
613  const index_type
614  i = inv_row_perm[(*row_i)-1],
615  j = inv_col_perm[(*col_j)-1];
617  if( row_rng.in_range(i) && col_rng.in_range(j) ) {
618  ++cnt_nz;
619  if( len_Aval )
620  *Aval++ = *val; // ToDo: Split into different loops (no inner if())
621  if( len_Aij ) {
622  *Arow++ = i + row_offset;
623  *Acol++ = j + col_offset;
624  }
625  }
626  }
627  }
628  }
629  }
630  else {
631  // We have to consider the diagonals dl and du
632  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement!
633  }
634  TEUCHOS_TEST_FOR_EXCEPT( !( len_Aval == 0 || len_Aval == cnt_nz ) );
635  TEUCHOS_TEST_FOR_EXCEPT( !( len_Aij == 0 || len_Aij == cnt_nz ) );
636 }
637 
638 // private
639 
641 {
642  if( release_resource_.total_count() > 1 ) {
643  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Allocate new storage and copy this memory.
644  self_allocate_ = true;
645  }
646 }
647 
648 } // end namespace AbstractLinAlgPack
void reset_to_load_values()
Reinitialize internal counter to load new nonzero values.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void commit_load_nonzeros_buffers(size_type nz_commit, value_type **val, index_type **row_i, index_type **col_j)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Index ubound() const
Return upper bound of the range.
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
virtual std::ostream & output(std::ostream &out) const
Virtual output function.
void Vp_StMtV(VectorMutable *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
Templated class that supports the COOMatrixTemplateInterface template interface.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
. One-based subregion index range class.
void set_buffers(size_type max_nz, value_type *val, index_type *row_i, index_type *col_j, const release_resource_ptr_t &release_resource, size_type rows=0, size_type cols=0, size_type nz=0, bool check_input=false)
Give memory to use to store nonzero elements.
Abstract interface for objects that represent a space for mutable coordinate vectors.
T_To & dyn_cast(T_From &from)
Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object.
void coor_extract_nonzeros(EElementUniqueness element_uniqueness, const index_type inv_row_perm[], const index_type inv_col_perm[], const Range1D &row_rng, const Range1D &col_rng, index_type dl, index_type du, value_type alpha, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset, const index_type col_offset) const
std::ostream * out
const LAPACK_C_Decl::f_int & M
void get_load_nonzeros_buffers(size_type max_nz_load, value_type **val, index_type **row_i, index_type **col_j)
bool in_range(Index i) const
Return true if the index is in range.
Base class for all matrices that support basic matrix operations.
void Vp_StCOOMtV(DVectorSlice *vs_lhs, value_type alpha, const T_COOM &coom_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
vs_lhs += alpha * op(coom_rhs1) * vs_rhs2 (BLAS xGEMV) (time = O(coom_rhs.nz(), space = O(1)) ...
Index lbound() const
Return lower bound of the range.
Entries allowed with duplicate row and column indexes with the understanding that the values are summ...
void initialize(size_type dim)
Initialize given the dimension of the vector space.
void Vt_S(DVectorSlice *vs_lhs, value_type alpha)
vs_lhs *= alpha (BLAS xSCAL) (*** Note that alpha == 0.0 is handeled as vs_lhs = 0.0)
Abstract interface for mutable coordinate vectors {abstract}.
void Vp_MtV_assert_compatibility(VectorMutable *v_lhs, const MatrixOp &m_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs += op(m_rhs1) * v_rhs2
Extract a non-const DenseLinAlgPack::DVectorSlice view of a VectorMutable object. ...
void set_uninitialized()
Release all owned memory and make uninitialized.
Transp
TRANS.
void reinitialize(size_type rows, size_type cols, size_type max_nz, EAssumeElementUniqueness element_uniqueness)
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
int total_count() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
index_type count_nonzeros(EElementUniqueness element_uniqueness, const index_type inv_row_perm[], const index_type inv_col_perm[], const Range1D &row_rng, const Range1D &col_rng, index_type dl, index_type du) const