本文整理汇总了C++中vector_type::map方法的典型用法代码示例。如果您正苦于以下问题:C++ vector_type::map方法的具体用法?C++ vector_type::map怎么用?C++ vector_type::map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector_type
的用法示例。
在下文中一共展示了vector_type::map方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prod
void prod( sparse_matrix_type const& A,
vector_type const& x,
vector_type& b ) const
{
int ierr = 0;
petsc_sparse_matrix_type const& _A = dynamic_cast<petsc_sparse_matrix_type const&>( A );
petsc_vector_type const& _x = dynamic_cast<petsc_vector_type const&>( x );
petsc_vector_type const& _b = dynamic_cast<petsc_vector_type const&>( b );
if ( _A.mapCol().worldComm().globalSize() == x.map().worldComm().globalSize() )
{
//std::cout << "BackendPetsc::prod STANDART"<< std::endl;
ierr = MatMult( _A.mat(), _x.vec(), _b.vec() );
CHKERRABORT( _A.comm().globalComm(),ierr );
}
else
{
//std::cout << "BackendPetsc::prod with convert"<< std::endl;
auto x_convert = petscMPI_vector_type(_A.mapColPtr());
x_convert.duplicateFromOtherPartition(x);
x_convert.close();
ierr = MatMult( _A.mat(), x_convert.vec(), _b.vec() );
CHKERRABORT( _A.comm().globalComm(),ierr );
}
b.close();
}
示例2: u
MatrixEpetra::real_type
MatrixEpetra::energy ( vector_type const& v1, vector_type const& v2, bool transpose ) const
{
this->close();
real_type res;
if ( dynamic_cast<epetra_vector_type const*>( &v1 ) != ( epetra_vector_type const* )0 )
{
epetra_vector_type const& ev1( dynamic_cast<epetra_vector_type const&>( v1 ) );
epetra_vector_type const& ev2( dynamic_cast<epetra_vector_type const&>( v2 ) );
epetra_vector_type ev3( this->getRowMap() );
M_mat->Multiply( transpose, ev2.vec(), ev3.vec() );
ev3.vec().Dot( ev1.vec(), &res );
}
else
{
Epetra_BlockMap bmap1( detail::epetraMap( v1.map() ) );
VectorEpetra<value_type> u( bmap1 );
{
size_type s = u.localSize();
size_type start = u.firstLocalIndex();
for ( size_type i = 0; i < s; ++i )
u.set( start + i, v1( start + i ) );
}
Epetra_BlockMap bmap2( detail::epetraMap( v2.map() ) );
VectorEpetra<value_type> v( bmap2 );
{
size_type s = v.localSize();
size_type start = v.firstLocalIndex();
for ( size_type i = 0; i < s; ++i )
v.set( start + i, v2( start + i ) );
}
VectorEpetra<value_type> z( bmap1 );
M_mat->Multiply( transpose, v.vec(), z.vec() );
z.vec().Dot( u.vec(), &res );
}
return res;
}
示例3: Ax
Real
SolverAztecOO::computeResidual ( vector_type& solution, vector_type& rhs )
{
vector_type Ax ( solution.map() );
vector_type res ( rhs );
M_solver.GetUserMatrix()->Apply ( solution.epetraVector(), Ax.epetraVector() );
res.epetraVector().Update ( 1, Ax.epetraVector(), -1 );
Real residual;
res.norm2 ( &residual );
return residual;
}