Spec-Zone.ru › Eigen3

Eigen::VectorwiseOp

template<typename ExpressionType, int Direction>
class Eigen::VectorwiseOp< ExpressionType, Direction >

Псевдовыражение, обеспечивающее операции широковещательной передачи и частичного сокращения.

Параметры шаблона
ExpressionType тип объекта, над которым выполняются частичные сокращения
Direction указывает, над какими столбцами (Вертикаль) или строками (Горизонталь) выполняются операции

Этот класс представляет собой псевдовыражение с возможностями широковещательной передачи и частичного сокращения. Он является типом возвращаемого значения для DenseBase::colwise() и DenseBase::rowwise(), и в большинстве случаев это единственный способ его явного использования.

Чтобы понять логику выражения rowwise/colwise, рассмотрим общий случай A.colwise().foo() где foo — любой метод VectorwiseOp. Это выражение эквивалентно применению foo() к каждому столбцу A и последующему повторному формированию результатов в матричном выражении:

[A.col(0).foo(), A.col(1).foo(), ..., A.col(A.cols()-1).foo()] 

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl;
cout << "Here is the maximum absolute value of each column:"
     << endl << m.cwiseAbs().colwise().maxCoeff() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the sum of each column:
  1.04  0.815 -0.238
Here is the maximum absolute value of each column:
 0.68 0.823 0.536

Методы begin() и end() очевидным образом являются исключениями из предыдущего правила, так как они возвращают итераторы begin/end, совместимые со STL, для строк или столбцов вложенного выражения. Типичные варианты использования включают циклы for-range и вызовы алгоритмов STL:

Пример:

Matrix3i m = Matrix3i::Random();
cout << "Here is the initial matrix m:" << endl << m << endl;
int i = -1;
for(auto c: m.colwise()) {
  c *= i;
  ++i;
}
cout << "Here is the matrix m after the for-range-loop:" << endl << m << endl;
auto cols = m.colwise();
auto it = std::find_if(cols.cbegin(), cols.cend(),
                       [](Matrix3i::ConstColXpr x) { return x.squaredNorm() == 0; });
cout << "The first empty column is: " << distance(cols.cbegin(),it) << endl;

Вывод:

Here is the initial matrix m:
 7  6 -3
-2  9  6
 6 -6 -5
Here is the matrix m after the for-range-loop:
-7  0 -3
 2  0  6
-6  0 -5
The first empty column is: 1

Для частичного сокращения на пустом входе применяются определенные правила. Для ясности рассмотрим вертикальное сокращение:

  • Если количество столбцов равно нулю, возвращается векторное выражение 1x0 в порядке следования строк.
  • В противном случае, если количество строк равно нулю:
    • для сокращений типа sum (сумма, squaredNorm, норма и т. д.) возвращается строковый вектор нулей
    • для сокращения типа product (произведение) возвращается строковый вектор единиц (например, MatrixXd(n,0).colwise().prod())
    • для всех других сокращений (minCoeff, maxCoeff, redux(bin_op)) срабатывает утверждение
См. также
DenseBase::colwise(), DenseBase::rowwise(), класс PartialReduxExpr
typedef Eigen::Index Index
const ВсеВозвращаемыеЗначения all () const
const ЛюбоеВозвращаемоеЗначение any () const
Итератор begin ()
КонстантныйИтератор begin () const
const ВозвращаемоеЗначениеДляBlueНормы blueNorm () const
КонстантныйИтератор cbegin () const
КонстантныйИтератор cend () const
const ВозвращаемоеЗначениеДляПодсчета count () const
ОбратныйКонстантныйИтератор crbegin () const
ОбратныйКонстантныйИтератор crend () const
шаблон<typename ДругойПроизводный >
const ВозвращаемоеЗначениеДляПерекрестногоПроизведения cross (const МатрицаБаза< ДругойПроизводный > &other) const
Итератор end ()
КонстантныйИтератор end () const
const ВозвращаемоеЗначениеДляНормализацииH hnormalized () const
Однородная нормализация по столбцам или строкам Подробнее...
ВозвращаемоеЗначениеДляОднородныхКоординат homogeneous () const
const ВозвращаемоеЗначениеДляНормыГипотенузы hypotNorm () const
шаблон<int p>
const LpNormReturnType< p >::Type lpNorm () const
const ВозвращаемоеЗначениеДляМаксимальногоКоэффициента maxCoeff () const
const ВозвращаемоеЗначениеДляСреднегоЗначения mean () const
const ВозвращаемоеЗначениеДляМинимальногоКоэффициента minCoeff () const
const ВозвращаемоеЗначениеДляНормы norm () const
void normalize ()
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType< ВозвращаемоеЗначениеДляНормы >::Type > normalized () const
шаблон<typename ДругойПроизводный >
CwiseBinaryOp< internal::scalar_product_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< ДругойПроизводный >::Type > operator* (const ПлотнаяБаза< ДругойПроизводный > &other) const
шаблон<typename ДругойПроизводный >
ExpressionType & operator*= (const ПлотнаяБаза< ДругойПроизводный > &other)
шаблон<typename ДругойПроизводный >
CwiseBinaryOp< internal::scalar_sum_op< Scalar, typename ДругойПроизводный::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< ДругойПроизводный >::Type > operator+ (const ПлотнаяБаза< ДругойПроизводный > &other) const
шаблон<typename ДругойПроизводный >
ExpressionType & operator+= (const ПлотнаяБаза< ДругойПроизводный > &other)
шаблон<typename ДругойПроизводный >
CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename ДругойПроизводный::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< ДругойПроизводный >::Type > operator- (const ПлотнаяБаза< ДругойПроизводный > &other) const
шаблон<typename ДругойПроизводный >
ExpressionType & operator-= (const ПлотнаяБаза< ДругойПроизводный > &other)
шаблон<typename ДругойПроизводный >
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< ДругойПроизводный >::Type > operator/ (const ПлотнаяБаза< ДругойПроизводный > &other) const
шаблон<typename ДругойПроизводный >
ExpressionType & operator/= (const ПлотнаяБаза< ДругойПроизводный > &other)
шаблон<typename ДругойПроизводный >
ExpressionType & operator= (const ПлотнаяБаза< ДругойПроизводный > &other)
const ВозвращаемоеЗначениеДляПроизведения prod () const
ОбратныйИтератор rbegin ()
ОбратныйКонстантныйИтератор rbegin () const
шаблон<typename БинарнаяОперация >
const ReduxReturnType< БинарнаяОперация >::Type redux (const БинарнаяОперация &func=БинарнаяОперация()) const
ОбратныйИтератор rend ()
const_reverse_iterator rend () const
const ReplicateReturnType replicate (Index factor) const
template<int Factor>
const Replicate< ExpressionType, isVertical *Factor+isHorizontal, isHorizontal *Factor+isVertical > replicate (Index factor=Factor) const
ReverseReturnType reverse ()
const ConstReverseReturnType reverse () const
void reverseInPlace ()
const SquaredNormReturnType squaredNorm () const
const StableNormReturnType stableNorm () const
const SumReturnType sum () const
random_access_iterator_type const_iterator
random_access_iterator_type iterator

Индекс

template<typename ExpressionType , int Direction>
typedef Eigen::Index Eigen::VectorwiseOp< ExpressionType, Direction >::Index
Устарело:
с версии Eigen 3.3

all()

template<typename ExpressionType , int Direction>
const AllReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::all ( ) const
inline
Возвращает
векторное выражение строки (или столбца), представляющее, являются ли все коэффициенты каждого соответствующего столбца (или строки) true. Это выражение можно присвоить вектору с элементами типа bool.
См. также
DenseBase::all()

any()

template<typename ExpressionType , int Direction>
const AnyReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::any ( ) const
inline
Возвращает
векторное выражение строки (или столбца), представляющее, является ли хотя бы один коэффициент каждого соответствующего столбца (или строки) true. Это выражение можно присвоить вектору с элементами типа bool.
См. также
DenseBase::any()

begin() [1/2]

template<typename ExpressionType , int Direction>
iterator Eigen::VectorwiseOp< ExpressionType, Direction >::begin ( )
inline

возвращает итератор на первую строку (строчно) или столбец (столбцово) вложенного выражения.

См. также
end(), cbegin()

begin() [2/2]

template<typename ExpressionType , int Direction>
const_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::begin ( ) const
inline

постоянная версия begin()

blueNorm()

template<typename ExpressionType , int Direction>
const BlueNormReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::blueNorm ( ) const
inline
Возвращает
векторное выражение строки (или столбца) нормы каждого столбца (или строки) указанного выражения, используя алгоритм Blue. Это вектор с вещественными элементами, даже если исходная матрица имеет комплексные элементы.
См. также
DenseBase::blueNorm()

cbegin()

template<typename ExpressionType , int Direction>
const_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::cbegin ( ) const
inline

постоянная версия begin()

cend()

template<typename ExpressionType , int Direction>
const_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::cend ( ) const
inline

постоянная версия end()

count()

template<typename ExpressionType , int Direction>
const CountReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::count ( ) const
inline
Возвращает
векторное выражение строки (или столбца), представляющее количество true коэффициентов каждого соответствующего столбца (или строки). Это выражение может быть присвоено вектору, элементы которого имеют тот же тип, что и используется для индексации элементов исходной матрицы; для плотных матриц это std::ptrdiff_t.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Matrix<ptrdiff_t, 3, 1> res = (m.array() >= 0.5).rowwise().count();
cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl;
cout << res << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the count of elements larger or equal than 0.5 of each row:
2
2
1
См. также
DenseBase::count()

crbegin()

template<typename ExpressionType , int Direction>
const_reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::crbegin ( ) const
inline

постоянная версия rbegin()

crend()

template<typename ExpressionType , int Direction>
const_reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::crend ( ) const
inline

постоянная версия rend()

end() [1/2]

template<typename ExpressionType , int Direction>
iterator Eigen::VectorwiseOp< ExpressionType, Direction >::end ( )
inline

возвращает итератор на строку (соответственно столбец), следующую за последней строкой (соответственно столбцом) вложенного выражения

См. также
begin(), cend()

end() [2/2]

template<typename ExpressionType , int Direction>
const_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::end ( ) const
inline

постоянная версия end()

hypotNorm()

template<typename ExpressionType , int Direction>
const HypotNormReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::hypotNorm ( ) const
inline
Возвращает
векторное выражение строки (или столбца) нормы каждого столбца (или строки) выражения, избегая потерь точности и переполнения с помощью конкатенации вызовов hypot(). Это вектор с вещественными элементами, даже если исходная матрица имеет комплексные элементы.
См. также
DenseBase::hypotNorm()

lpNorm()

template<typename ExpressionType , int Direction>
template<int p>
const LpNormReturnType<p>::Type Eigen::VectorwiseOp< ExpressionType, Direction >::lpNorm ( ) const
inline
Возвращает
векторное выражение строки (или столбца) нормы каждого столбца (или строки) выражения. Это вектор с вещественными элементами, даже если исходная матрица имеет комплексные элементы.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the norm of each column:
 0.91  1.18 0.771
См. также
DenseBase::norm()

maxCoeff()

template<typename ExpressionType , int Direction>
const MaxCoeffReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::maxCoeff ( ) const
inline
Возвращает
векторное выражение строки (или столбца) наибольшего коэффициента каждого столбца (или строки) исходного выражения.
Предупреждение
размер по направлению сведения должен быть строго положительным, в противном случае срабатывает утверждение.
результат не определен, если *this содержит NaN.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the maximum of each column:
 0.68 0.823 0.536
См. также
DenseBase::maxCoeff()

mean()

template<typename ExpressionType , int Direction>
const MeanReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::mean ( ) const
inline
Возвращает
векторное выражение строки (или столбца) среднего значения каждого столбца (или строки) выражения.
См. также
DenseBase::mean()

minCoeff()

template<typename ExpressionType , int Direction>
const MinCoeffReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::minCoeff ( ) const
inline
Возвращает
векторное выражение строки (или столбца) наименьшего коэффициента каждого столбца (или строки) выражения.
Предупреждение
размер по направлению сведения должен быть строго положительным, в противном случае срабатывает утверждение.
результат не определен, если *this содержит NaN.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the minimum of each column:
-0.211 -0.605 -0.444
См. также
DenseBase::minCoeff()

norm()

template<typename ExpressionType , int Direction>
const NormReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::norm ( ) const
inline
Возвращает
векторное выражение строки (или столбца) нормы каждого столбца (или строки) выражения. Это вектор с вещественными элементами, даже если исходная матрица имеет комплексные элементы.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the norm of each column:
 0.91  1.18 0.771
См. также
DenseBase::norm()

normalize()

template<typename ExpressionType , int Direction>
void Eigen::VectorwiseOp< ExpressionType, Direction >::normalize ( )
inline

Нормализует на месте каждую строку или столбец указанной матрицы.

См. также
MatrixBase::normalize(), normalized()

normalized()

template<typename ExpressionType , int Direction>
CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType<NormReturnType>::Type> Eigen::VectorwiseOp< ExpressionType, Direction >::normalized ( ) const
inline
Возвращает
выражение, где каждый столбец (или строка) указанной матрицы нормализован. Исходная матрица не изменяется.
См. также
MatrixBase::normalized(), normalize()

operator*()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
CwiseBinaryOp<internal::scalar_product_op<Scalar>, const ExpressionTypeNestedCleaned, const typename ExtendedType<OtherDerived>::Type> Eigen::VectorwiseOp< ExpressionType, Direction >::operator* ( const DenseBase< OtherDerived > & other ) const
inline

Возвращает выражение, где каждый подвектор является произведением вектора other на соответствующий подвектор *this.

operator*=()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
ExpressionType& Eigen::VectorwiseOp< ExpressionType, Direction >::operator*= ( const DenseBase< OtherDerived > & other )
inline

Умножает каждый подвектор *this на вектор other

operator+()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
CwiseBinaryOp<internal::scalar_sum_op<Scalar,typename OtherDerived::Scalar>, const ExpressionTypeNestedCleaned, const typename ExtendedType<OtherDerived>::Type> Eigen::VectorwiseOp< ExpressionType, Direction >::operator+ ( const DenseBase< OtherDerived > & other ) const
inline

Возвращает выражение суммы вектора other к каждому подвектору *this.

operator+=()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
ExpressionType& Eigen::VectorwiseOp< ExpressionType, Direction >::operator+= ( const DenseBase< OtherDerived > & other )
inline

Добавляет вектор other к каждой подвектору *this

operator-()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
CwiseBinaryOp<internal::scalar_difference_op<Scalar,typename OtherDerived::Scalar>, const ExpressionTypeNestedCleaned, const typename ExtendedType<OtherDerived>::Type> Eigen::VectorwiseOp< ExpressionType, Direction >::operator- ( const DenseBase< OtherDerived > & other ) const
inline

Возвращает выражение разности между каждой подвектором *this и вектором other

operator-=()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
ExpressionType& Eigen::VectorwiseOp< ExpressionType, Direction >::operator-= ( const DenseBase< OtherDerived > & other )
inline

Вычитает вектор other из каждой подвектора *this

operator/()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const ExpressionTypeNestedCleaned, const typename ExtendedType<OtherDerived>::Type> Eigen::VectorwiseOp< ExpressionType, Direction >::operator/ ( const DenseBase< OtherDerived > & other ) const
inline

Возвращает выражение, где каждый подвeктор представляет частное соответствующего подвектора *this и вектора other

operator/=()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
ExpressionType& Eigen::VectorwiseOp< ExpressionType, Direction >::operator/= ( const DenseBase< OtherDerived > & other )
inline

Делит каждый подвeктор *this на вектор other

operator=()

template<typename ExpressionType , int Direction>
template<typename OtherDerived >
ExpressionType& Eigen::VectorwiseOp< ExpressionType, Direction >::operator= ( const DenseBase< OtherDerived > & other )
inline

Копирует вектор other в каждый подвeктор *this

prod()

template<typename ExpressionType , int Direction>
const ProdReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::prod ( ) const
inline
Возвращает
вектор-выражение строки (или столбца) произведения каждого столбца (или строки) указанного выражения.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the product of each row:" << endl << m.rowwise().prod() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the product of each row:
 -0.134
-0.0933
  0.152
См. также
DenseBase::prod()

rbegin() [1/2]

template<typename ExpressionType , int Direction>
reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::rbegin ( )
inline

Возвращает обратный итератор к последней строке (строчно) или столбцу (столбцово) вложенного выражения.

См. также
rend(), crbegin()

rbegin() [2/2]

template<typename ExpressionType , int Direction>
const_reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::rbegin ( ) const
inline

Постоянная версия rbegin()

redux()

template<typename ExpressionType , int Direction>
template<typename BinaryOp >
const ReduxReturnType<BinaryOp>::Type Eigen::VectorwiseOp< ExpressionType, Direction >::redux ( const BinaryOp & func = BinaryOp() ) const
inline
Возвращает
выражение строки или столбца *this с reduxed с помощью func

Шаблонный параметр BinaryOp — тип функтора пользовательского оператора redux. Обратите внимание, что func должен быть ассоциативным оператором.

Предупреждение
размер вдоль направления сокращения должен быть строго положительным, в противном случае срабатывает утверждение.
См. также
класс VectorwiseOp, DenseBase::colwise(), DenseBase::rowwise()

rend() [1/2]

template<typename ExpressionType , int Direction>
reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::rend ( )
inline

Возвращает обратный итератор к строке (соответственно столбцу) перед первой строкой (соответственно столбцом) вложенного выражения

См. также
begin(), cend()

rend() [2/2]

template<typename ExpressionType , int Direction>
const_reverse_iterator Eigen::VectorwiseOp< ExpressionType, Direction >::rend ( ) const
inline

Постоянная версия rend()

replicate() [1/2]

template<typename ExpressionType , int Direction>
const VectorwiseOp< ExpressionType, Direction >::ReplicateReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::replicate ( Index factor ) const
Возвращает
выражение тиражирования каждого столбца (или строки) *this

Пример:

Vector3i v = Vector3i::Random();
cout << "Here is the vector v:" << endl << v << endl;
cout << "v.rowwise().replicate(5) = ..." << endl;
cout << v.rowwise().replicate(5) << endl;

Вывод:

Here is the vector v:
 7
-2
 6
v.rowwise().replicate(5) = ...
 7  7  7  7  7
-2 -2 -2 -2 -2
 6  6  6  6  6
См. также
VectorwiseOp::replicate(), DenseBase::replicate(), класс Replicate

replicate() [2/2]

шаблон<typename ExpressionType , int Direction>
шаблон<int Factor>
постоянный Replicate<ExpressionType,isVertical*Factor+isHorizontal,isHorizontal*Factor+isVertical> Eigen::VectorwiseOp< ExpressionType, Direction >::replicate ( Index factor = Factor ) постоянный
inline
Возвращает
выражение, представляющее копирование каждой колонки (или строки) *this

Пример:

MatrixXi m = MatrixXi::Random(2,3);
cout << "Here is the matrix m:" << endl << m << endl;
cout << "m.colwise().replicate<3>() = ..." << endl;
cout << m.colwise().replicate<3>() << endl;

Вывод:

Here is the matrix m:
 7  6  9
-2  6 -6
m.colwise().replicate<3>() = ...
 7  6  9
-2  6 -6
 7  6  9
-2  6 -6
 7  6  9
-2  6 -6
См. также
VectorwiseOp::replicate(Index), DenseBase::replicate(), класс Replicate

reverse() [1/2]

шаблон<typename ExpressionType , int Direction>
ReverseReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::reverse ( )
inline
Возвращает
записываемое выражение матрицы, где каждая колонка (или строка) инвертирована.
См. также
reverse() const

reverse() [2/2]

шаблон<typename ExpressionType , int Direction>
постоянный ConstReverseReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::reverse ( ) постоянный
inline
Возвращает
выражение матрицы, где каждая колонка (или строка) инвертирована.

Пример:

MatrixXi m = MatrixXi::Random(3,4);
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the rowwise reverse of m:" << endl << m.rowwise().reverse() << endl;
cout << "Here is the colwise reverse of m:" << endl << m.colwise().reverse() << endl;
 
cout << "Here is the coefficient (1,0) in the rowise reverse of m:" << endl
<< m.rowwise().reverse()(1,0) << endl;
cout << "Let us overwrite this coefficient with the value 4." << endl;
//m.colwise().reverse()(1,0) = 4;
cout << "Now the matrix m is:" << endl << m << endl;

Вывод:

Here is the matrix m:
 7  6 -3  1
-2  9  6  0
 6 -6 -5  3
Here is the rowwise reverse of m:
 1 -3  6  7
 0  6  9 -2
 3 -5 -6  6
Here is the colwise reverse of m:
 6 -6 -5  3
-2  9  6  0
 7  6 -3  1
Here is the coefficient (1,0) in the rowise reverse of m:
0
Let us overwrite this coefficient with the value 4.
Now the matrix m is:
 7  6 -3  1
-2  9  6  0
 6 -6 -5  3
См. также
DenseBase::reverse()

reverseInPlace()

шаблон<typename ExpressionType , int Direction>
void Eigen::VectorwiseOp< ExpressionType, Direction >::reverseInPlace
inline

Это версия «на месте» VectorwiseOp::reverse: она инвертирует каждую колонку или строку *this.

В большинстве случаев, вероятно, лучше просто использовать инвертированное выражение матрицы. Однако, когда требуется инвертировать данные матрицы непосредственно, эта версия «на месте» является лучшим выбором, так как она предоставляет следующие дополнительные преимущества:

  • меньше ошибок: выполнение той же операции с .reverse() требует особых мер предосторожности:
    m = m.reverse().eval(); 
    
  • этот API позволяет выполнять обратные операции без временной переменной
См. также
DenseBase::reverseInPlace(), reverse()

squaredNorm()

шаблон<typename ExpressionType , int Direction>
постоянный SquaredNormReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::squaredNorm ( ) постоянный
inline
Возвращает
выражение вектора строки (или колонки) квадратной нормы каждой колонки (или строки) исходного выражения. Это вектор с действительными значениями, даже если исходная матрица содержит комплексные значения.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the square norm of each row:" << endl << m.rowwise().squaredNorm() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the square norm of each row:
0.928
 1.01
0.884
См. также
DenseBase::squaredNorm()

stableNorm()

шаблон<typename ExpressionType , int Direction>
постоянный StableNormReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::stableNorm ( ) постоянный
inline
Возвращает
выражение вектора строки (или колонки) нормы каждой колонки (или строки) исходного выражения, избегая подпотоков и переполнений. Это вектор с действительными значениями, даже если исходная матрица содержит комплексные значения.
См. также
DenseBase::stableNorm()

sum()

шаблон<typename ExpressionType , int Direction>
постоянный SumReturnType Eigen::VectorwiseOp< ExpressionType, Direction >::sum ( ) постоянный
inline
Возвращает
выражение вектора строки (или колонки) суммы каждой колонки (или строки) исходного выражения.

Пример:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;

Вывод:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the sum of each row:
 0.948
  1.15
-0.483
См. также
DenseBase::sum()

const_iterator

шаблон<typename ExpressionType , int Direction>
random_access_iterator_type Eigen::VectorwiseOp< ExpressionType, Direction >::const_iterator

Это версия iterator с константой (т.е. только чтение)

iterator

шаблон<typename ExpressionType , int Direction>
random_access_iterator_type Eigen::VectorwiseOp< ExpressionType, Direction >::iterator

Итератор типа RandomAccessIterator для столбцов или строк, возвращаемый методами begin() и end().


The documentation for this class was generated from the following files:
  • VectorwiseOp.h
  • Replicate.h
  • Reverse.h
  • Homogeneous.h
  • OrthoMethods.h

© Eigen.
Licensed under the MPL2 License.
https://eigen.tuxfamily.org/dox/classEigen_1_1VectorwiseOp.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API