MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstrainedOptPack_MatrixHessianSuperBasic.cpp
Go to the documentation of this file.
1 #if 0
2 
3 // @HEADER
4 // ***********************************************************************
5 //
6 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
7 // Copyright (2003) Sandia Corporation
8 //
9 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10 // license for use of this work by or on behalf of the U.S. Government.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
40 //
41 // ***********************************************************************
42 // @HEADER
43 
47 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
49 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOpOut.hpp"
53 
54 namespace LinAlgOpPack {
56 }
57 
58 namespace ConstrainedOptPack {
59 
61  : n_(0)
62 {}
63 
65  size_type n
66  ,size_type n_R
67  ,const size_type i_x_free[]
68  ,const size_type i_x_fixed[]
69  ,const EBounds bnd_fixed[]
70  ,const B_RR_ptr_t& B_RR_ptr
71  ,const B_RX_ptr_t& B_RX_ptr
72  ,BLAS_Cpp::Transp B_RX_trans
73  ,const B_XX_ptr_t& B_XX_ptr
74  )
75 {
77  using BLAS_Cpp::no_trans;
78 
79  const size_type
80  n_X = n - n_R;
81 
82  // Validate input arguments
83 
84  // i_x_free
85  if( 0 < n_R && n_R < n && i_x_free == NULL ) {
86  throw std::invalid_argument(
87  "MatrixHessianSuperBasic::initialize(...) : Error, "
88  "i_x_free can not be NULL when 0 < n_R < n" );
89  }
90  // i_x_fixed
91  if( 0 < n_X && n_X < n && i_x_fixed == NULL ) {
92  throw std::invalid_argument(
93  "MatrixHessianSuperBasic::initialize(...) : Error, "
94  "i_x_fixed can not be NULL when 0 < n-n_R < n" );
95  }
96  // bnd_fixed
97  if( 0 < n_X && bnd_fixed == NULL ) {
98  throw std::invalid_argument(
99  "MatrixHessianSuperBasic::initialize(...) : Error, "
100  "bnd_fixed can not be NULL when 0 < n-n_R" );
101  }
102  // B_RR
103  if(n_R > 0 ) {
104  if( !B_RR_ptr.get() )
105  throw std::invalid_argument(
106  "MatrixHessianSuperBasic::initialize(...) : Error, "
107  "B_RR_ptr.get() can not be NULL when n_R > 0" );
108  Mp_M_assert_sizes( n_R, n_R, no_trans, B_RR_ptr->rows(), B_RR_ptr->cols(), no_trans );
109  }
110  // op(B_RX)
111  if( n_R < n ) {
112  if( B_RX_ptr.get() ) {
113  Mp_M_assert_sizes( n_R, n_X, no_trans, B_RX_ptr->rows(), B_RX_ptr->cols(), B_RX_trans );
114  }
115  }
116  // B_XX
117  if( n_R < n ) {
118  if( !B_XX_ptr.get() )
119  throw std::invalid_argument(
120  "MatrixHessianSuperBasic::initialize(...) : Error, "
121  "B_XX_ptr.get() can not be NULL if n_R < n" );
122  Mp_M_assert_sizes( n_X, n_X, no_trans, B_XX_ptr->rows(), B_XX_ptr->cols(), no_trans );
123  }
124 
125  // Setup Q_R and Q_X and validate i_x_free[] and i_x_fixed[]
126  const bool Q_R_is_idenity = (n_R == n && i_x_fixed == NULL );
127  if( Q_R_is_idenity ) {
128  Q_R_row_i_.resize(0);
129  Q_R_col_j_.resize(0);
130  }
131  else {
132  Q_R_row_i_.resize(n_R);
133  Q_R_col_j_.resize(n_R);
134  }
135  Q_X_row_i_.resize(n_X);
136  Q_X_col_j_.resize(n_X);
137  bool test_setup = true; // ToDo: Make this an input parameter!
139  n_R,n_X,i_x_free,i_x_fixed,test_setup
140  ,!Q_R_is_idenity ? &Q_R_row_i_[0] : NULL
141  ,!Q_R_is_idenity ? &Q_R_col_j_[0] : NULL
142  ,&Q_R_
143  ,n_X ? &Q_X_row_i_[0] : NULL
144  ,n_X ? &Q_X_col_j_[0] : NULL
145  ,&Q_X_
146  );
147 
148  // Setup bnd_fixed
149  bnd_fixed_.resize(n_X);
150  {for(size_type i = 0; i < n_X; ++i) bnd_fixed_[i] = bnd_fixed[i]; }
151 
152  // Set the rest of the arguments
153  n_ = n;
154  n_R_ = n_R;
159 
160 }
161 
162 // Overridden from Matrix
163 
165 {
166  return n_;
167 }
168 
169 // Overridden from MatrixOp
170 
173  , const DVectorSlice& x, value_type b
174  ) const
175 {
176  using BLAS_Cpp::no_trans;
177  using BLAS_Cpp::trans;
178  using BLAS_Cpp::trans_not;
180  using LinAlgOpPack::V_MtV;
182  DenseLinAlgPack::Vp_MtV_assert_sizes( y->size(), n_, n_, B_trans, x.size() );
183  if( n_ == n_R_ ) {
184  //
185  // B = Q_R*B_RR*Q_R'
186  //
187  // y = b*y + a*Q_R*B_RR*Q_R'*x
188  //
189  if( Q_R().is_identity() ) {
191  }
192  else {
193  DVector Q_R_x;
194  V_MtV( &Q_R_x, Q_R(), trans, x );
195  AbstractLinAlgPack::Vp_StPtMtV(y,a,Q_R(),no_trans,*this->B_RR_ptr(),no_trans,Q_R_x(),b);
196  }
197  }
198  else if( n_R_ == 0 ) {
199  //
200  // B = Q_X *B_XX * Q_X'
201  //
202  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement this!
203  }
204  else {
205  //
206  // B = [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ]
207  // [ op(B_RX') B_XX ] [ Q_X' ]
208  //
209  // y = b*y + a*op(B)*x
210  //
211  // y = b*y + a * [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ] * x
212  // [ op(B_RX') B_XX ] [ Q_X' ]
213  //
214  // y = b*y + a*Q_R*B_RR*x_R + a*Q_R*op(B_RX)*x_X
215  // + a*Q_X*op(B_RX')*x_R + a*Q_X*B_XX*x_X
216  // where:
217  // x_R = Q_R'*x
218  // x_X = Q_X'*x
219  //
220  SpVector
221  x_R,
222  x_X;
223  // x_R = Q_R'*x
224  V_MtV( &x_R, Q_R(), trans, x );
225  // x_X = Q_X'*x
226  V_MtV( &x_X, Q_X(), trans, x );
227  // y = b*y + a*Q_R*B_RR*x_R
229  y, a, Q_R(), no_trans, *B_RR_ptr(), no_trans, x_R(), b );
230  // y += a*Q_R*op(B_RX)*x_X + a*Q_X*op(B_RX')*x_R
231  if( B_RX_ptr().get() ) {
233  y, a, Q_R(), no_trans, *B_RX_ptr(), B_RX_trans(), x_X() );
235  y, a, Q_X(), no_trans, *B_RX_ptr(), trans_not(B_RX_trans()), x_R() );
236  }
237  // y += a*Q_X*B_XX*x_X
239  y, a, Q_X(), no_trans, *B_XX_ptr(), no_trans, x_X() );
240  }
241 }
242 
245  , const SpVectorSlice& x, value_type b
246  ) const
247 {
248  using BLAS_Cpp::no_trans;
249  using BLAS_Cpp::trans;
250  using BLAS_Cpp::trans_not;
252  using LinAlgOpPack::V_MtV;
254  DenseLinAlgPack::Vp_MtV_assert_sizes( y->size(), n_, n_, B_trans, x.size() );
255  if( n_ == n_R_ ) {
256  //
257  // B = Q_R*B_RR*Q_R'
258  //
259  // y = b*y + a*Q_R*B_RR*Q_R'*x
260  //
261  if( Q_R().is_identity() ) {
263  }
264  else {
265  SpVector Q_R_x;
266  AbstractLinAlgPack::V_MtV( &Q_R_x, Q_R(), trans, x );
267  AbstractLinAlgPack::Vp_StPtMtV(y,a,Q_R(),no_trans,*this->B_RR_ptr(),no_trans,Q_R_x(),b);
268  }
269  }
270  else if( n_R_ == 0 ) {
271  //
272  // B = Q_X *B_XX * Q_X'
273  //
274  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement this!
275  }
276  else {
277  //
278  // B = [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ]
279  // [ op(B_RX') B_XX ] [ Q_X' ]
280  //
281  // y = b*y + a*op(B)*x
282  //
283  // y = b*y + a * [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ] * x
284  // [ op(B_RX') B_XX ] [ Q_X' ]
285  //
286  // y = b*y + a*Q_R*B_RR*x_R + a*Q_R*op(B_RX)*x_X
287  // + a*Q_X*op(B_RX')*x_R + a*Q_X*B_XX*x_X
288  // where:
289  // x_R = Q_R'*x
290  // x_X = Q_X'*x
291  //
292  SpVector
293  x_R,
294  x_X;
295  // x_R = Q_R'*x
296  V_MtV( &x_R, Q_R(), trans, x );
297  // x_X = Q_X'*x
298  V_MtV( &x_X, Q_X(), trans, x );
299  // y = b*y + a*Q_R*B_RR*x_R
301  y, a, Q_R(), no_trans, *B_RR_ptr(), no_trans, x_R(), b );
302  // y += a*Q_R*op(B_RX)*x_X + a*Q_X*op(B_RX')*x_R
303  if( B_RX_ptr().get() ) {
305  y, a, Q_R(), no_trans, *B_RX_ptr(), B_RX_trans(), x_X() );
307  y, a, Q_X(), no_trans, *B_RX_ptr(), trans_not(B_RX_trans()), x_R() );
308  }
309  // y += a*Q_X*B_XX*x_X
311  y, a, Q_X(), no_trans, *B_XX_ptr(), no_trans, x_X() );
312  }
313 }
314 
317  , const GenPermMatrixSlice& P, BLAS_Cpp::Transp P_trans
318  , BLAS_Cpp::Transp M_trans
319  , const DVectorSlice& x, value_type b ) const
320 {
321  using BLAS_Cpp::no_trans;
322  using BLAS_Cpp::trans;
323  using BLAS_Cpp::trans_not;
325  using DenseLinAlgPack::Vt_S;
326  using LinAlgOpPack::V_MtV;
327  namespace slap = AbstractLinAlgPack;
328 
330 
331  //
332  // y = b*y + a * op(P) * B * x
333  //
334  // =>
335  //
336  // y = b*y + a * op(P)*(Q_R*B_RR*Q_R' + Q_R*op(B_RX)*Q_X' + Q_X*op(B_RX')*Q_R + Q_X*B_XX*Q_X')*x
337  //
338  // = b*y + a*op(P)*Q_R*B_RR*Q_R'*x + a*op(P)*Q_R*op(B_RX)*Q_X'*x
339  // + a*op(P)*Q_X*op(B_RX')*Q_R*x + a*op(P)*Q_X*B_XX*Q_X'*x
340  //
341  // In order to implement the above as efficiently as possible we need to minimize the
342  // computations with the constituent matrices. First off we will compute
343  // Q_RT_x = Q_R'*x (O(n_R)) and Q_XT_x = Q_X'*x (O(n_R)) neglect any terms where
344  // Q_RT_x.nz() == 0 or Q_XT_x.nz() == 0. We will also determine if op(P)*Q_R == 0 (O(n_R))
345  // or op(P)*Q_X == 0 (O(n_X)) and neglect these terms if the are zero.
346  // Hopefully this work will allow us to skip as many computations as possible.
347  //
348  LinAlgOpPack::Vp_MtV_assert_sizes(y->size(),P.rows(),P.cols(),P_trans
349  , BLAS_Cpp::rows( rows(), cols(), M_trans) );
350  LinAlgOpPack::Vp_MtV_assert_sizes( BLAS_Cpp::cols( P.rows(), P.cols(), P_trans)
351  ,rows(),cols(),M_trans,x.size());
352  // Q_R'*x
353  SpVector Q_RT_x;
354  if(n_R_) {
355  slap::V_MtV( &Q_RT_x, Q_R(), trans, x );
356  }
357  // Q_X'*x
358  SpVector Q_XT_x;
359  if(n_ > n_R_) {
360  slap::V_MtV( &Q_XT_x, Q_X(), trans, x );
361  }
362  // op(P)*Q_R overlap
363  size_type P_Q_R_nz = 0;
364  AbstractLinAlgPack::intersection( P, P_trans, Q_R(), no_trans, &P_Q_R_nz );
365  // op(P)*Q_X overlap
366  size_type P_Q_X_nz = 0;
367  AbstractLinAlgPack::intersection( P, P_trans, Q_X(), no_trans, &P_Q_X_nz );
368  // y = b*y
369  if(b==0.0) *y = 0.0;
370  else if(b!=1.0) Vt_S(y,b);
371  //
372  DVector t; // ToDo: use workspace
373  // y += a*op(P)*Q_R*B_RR*Q_R'*x
374  if( P_Q_R_nz && Q_RT_x.nz() ) {
375  t.resize(n_);
376  slap::Vp_StPtMtV( &t(), 1.0, Q_R(), no_trans, *B_RR_ptr(), no_trans, Q_RT_x() );
377  slap::Vp_StMtV( y, a, P, P_trans, t() );
378  }
379  // y += a*op(P)*Q_R*op(B_RX)*Q_X'*x
380  if( P_Q_R_nz && B_RX_ptr().get() && Q_XT_x.nz() ) {
381  t.resize(n_);
382  slap::Vp_StPtMtV( &t(), 1.0, Q_R(), no_trans, *B_RX_ptr(), B_RX_trans(), Q_XT_x() );
383  slap::Vp_StMtV( y, a, P, P_trans, t() );
384  }
385  // y += a*op(P)*Q_X*op(B_RX')*Q_R*x
386  if( P_Q_X_nz && B_RX_ptr().get() && Q_RT_x.nz() ) {
387  t.resize(n_);
388  slap::Vp_StPtMtV( &t(), 1.0, Q_X(), no_trans, *B_RX_ptr(), trans_not(B_RX_trans()), Q_RT_x() );
389  slap::Vp_StMtV( y, a, P, P_trans, t() );
390  }
391  // y += a*op(P)*Q_X*B_XX*Q_X'*x
392  if( P_Q_X_nz && Q_XT_x.nz() ) {
393  t.resize(n_);
394  slap::Vp_StPtMtV( &t(), 1.0, Q_X(), no_trans, *B_XX_ptr(), no_trans, Q_XT_x() );
395  slap::Vp_StMtV( y, a, P, P_trans, t() );
396  }
397 }
398 
400  const SpVectorSlice& x1, BLAS_Cpp::Transp B_trans
401  , const SpVectorSlice& x2 ) const
402 {
403  using BLAS_Cpp::no_trans;
404  using BLAS_Cpp::trans;
406  DenseLinAlgPack::Vp_MtV_assert_sizes( x1.size(), rows(), cols(), B_trans, x1.size() );
407  if( n_ == n_R_ ) {
408  //
409  // B = Q_R*B_RR*Q_R'
410  //
411  // a = x1'*Q_R*B_RR*Q_R'*x2
412  //
413  if( Q_R().is_identity() ) {
414  return AbstractLinAlgPack::transVtMtV( x1, *B_RR_ptr(), no_trans, x2 );
415  }
416  else {
417  if( x1.overlap(x2) == DenseLinAlgPack::SAME_MEM ) {
418  SpVector Q_RT_x2;
419  AbstractLinAlgPack::V_MtV( &Q_RT_x2, Q_R(), trans, x2 );
420  SpVectorSlice Q_RT_x2_slc = Q_RT_x2();
422  Q_RT_x2_slc, *B_RR_ptr(), no_trans, Q_RT_x2_slc );
423  }
424  else {
425  SpVector Q_RT_x2;
426  AbstractLinAlgPack::V_MtV( &Q_RT_x2, Q_R(), trans, x2 );
427  SpVector Q_RT_x1;
428  AbstractLinAlgPack::V_MtV( &Q_RT_x1, Q_R(), trans, x1 );
430  Q_RT_x1(), *B_RR_ptr(), no_trans, Q_RT_x2() );
431  }
432  }
433  }
434  else if( n_R_ == 0 ) {
435  //
436  // B = Q_X *B_XX * Q_X'
437  //
438  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement this!
439  }
440  else {
441  //
442  // B = [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ]
443  // [ op(B_RX') B_XX ] [ Q_X' ]
444  //
445  //
446  // a = x1'*B*x2
447  // =>
448  // a = x1' * [ Q_R Q_X ] * [ B_RR op(B_RX) ] * [ Q_R' ] * x2
449  // [ op(B_RX') B_XX ] [ Q_X' ]
450  //
451  // a = x1'*Q_R*B_RR*Q_R'*x2 + 2*x1'*Q_R*op(B_RX)*Q_X'*x2 + x1'*Q_X*B_XX*Q_X'*x2
452  //
453  if( x1.overlap(x2) == DenseLinAlgPack::SAME_MEM ) {
454  // a = x1'*Q_R*B_RR*Q_R'*x1 + 2*x1'*Q_R*op(B_RX)*Q_X'*x1 + x1'*Q_X*B_XX*Q_X'*x1
455  SpVector Q_RT_x1;
456  if( Q_R().nz() )
457  AbstractLinAlgPack::V_MtV( &Q_RT_x1, Q_R(), trans, x1 );
458  SpVector Q_XT_x1;
459  if( Q_X().nz() )
460  AbstractLinAlgPack::V_MtV( &Q_XT_x1, Q_X(), trans, x1 );
461  SpVectorSlice Q_RT_x1_slc = Q_RT_x1();
462  SpVectorSlice Q_XT_x1_slc = Q_XT_x1();
463  return
464  ( Q_R().nz()
466  Q_RT_x1_slc, *B_RR_ptr(), no_trans, Q_RT_x1_slc )
467  : 0.0
468  )
469  + 2*( B_RX_ptr().get() && Q_R().nz() && Q_X().nz()
471  Q_RT_x1_slc, *B_RX_ptr(), B_RX_trans(), Q_XT_x1_slc )
472  : 0.0
473  )
474  + ( Q_X().nz()
475  ? AbstractLinAlgPack::transVtMtV(
476  Q_XT_x1_slc, *B_XX_ptr(), no_trans, Q_XT_x1_slc )
477  : 0.0
478  );
479  }
480  else {
481  TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement this!
482  }
483  }
484  return 0.0; // Will never be executed!
485 }
486 
487 // Private
488 
490 {
491  if( !n_ )
492  throw std::logic_error(
493  "MatrixHessianSuperBasic::assert_initialized() : Error, "
494  "The matrix is not initialized yet" );
495 }
496 
497 } // end namespace ConstrainedOptPack
498 
499 #endif // 0
virtual void initialize(size_type n, size_type n_R, const size_type i_x_free[], const size_type i_x_fixed[], const EBounds bnd_fixed[], const B_RR_ptr_t &B_RR_ptr, const B_RX_ptr_t &B_RX_ptr, BLAS_Cpp::Transp B_RX_trans, const B_XX_ptr_t &B_XX_ptr)
Initialize the matrix.
AbstractLinAlgPack::size_type size_type
value_type transVtMtV(const SpVectorSlice &sv_rhs1, BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice &sv_rhs3) const
MatrixHessianSuperBasic()
Constructs to uninitialized.
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
SparseVector< SparseElement< index_type, value_type >, std::allocator< SparseElement< index_type, value_type > > > SpVector
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs2, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta=1.0)
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs
void Vp_StPtMtV(DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const DVectorSlice &sv_rhs3, value_type beta) const
size_type rows(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return rows of a possible transposed matrix.
int resize(OrdinalType length_in)
T * get() const
void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs, size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs)
op(m_lhs) += op op(m_rhs)
Transposed.
value_type transVtMtV(const Vector &v_rhs1, const MatrixOp &M_rhs2, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3)
result = v_rhs1' * op(M_rhs2) * v_rhs3
Not transposed.
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
void initialize_Q_R_Q_X(size_type n_R, size_type n_X, const size_type i_x_free[], const size_type i_x_fixed[], bool test_setup, size_type Q_R_row_i[], size_type Q_R_col_j[], GenPermMatrixSlice *Q_R, size_type Q_X_row_i[], size_type Q_X_col_j[], GenPermMatrixSlice *Q_X)
Initialize GenPermMatrixSlice mapping matrices for Q_R and Q_X.
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
Transp trans_not(Transp _trans)
Return the opposite of the transpose argument.
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
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)
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
AbstractLinAlgPack::value_type value_type
void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
v_lhs += op(m_rhs1) * v_rhs2
void intersection(const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, size_type *Q_nz, const size_type Q_max_nz=0, size_type Q_row_i[]=NULL, size_type Q_col_j[]=NULL, GenPermMatrixSlice *Q=NULL)
Find the intersection between two GenPermMatrixSlice objects.
Transp
TRANS.
size_type cols(size_type rows, size_type cols, BLAS_Cpp::Transp _trans)
Return columns of a possible transposed matrix.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void V_MtV(DVector &v_lhs, const T_Matrix &gm_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
v_lhs = T_M * vs_lhs (templated matrix type T_M)