#include <cmath>#include <algorithm>#include <iostream>#include <limits>#include <type_traits>#include <vector>#include "Array-oct.h"#include "CColVector.h"#include "CMatrix.h"#include "CRowVector.h"#include "CSparse.h"#include "MArray.h"#include "blas-proto.h"#include "dColVector.h"#include "dDiagMatrix.h"#include "dMatrix.h"#include "dRowVector.h"#include "dSparse.h"#include "f77-fcn.h"#include "fCColVector.h"#include "fCMatrix.h"#include "fCRowVector.h"#include "fColVector.h"#include "fDiagMatrix.h"#include "fMatrix.h"#include "fRowVector.h"#include "lapack-proto.h"#include "lo-ieee.h"#include "mappers.h"#include "mx-cm-s.h"#include "mx-fcm-fs.h"#include "mx-fs-fcm.h"#include "mx-s-cm.h"#include "oct-cmplx.h"#include "oct-error.h"#include "oct-norm.h"#include "quit.h"#include "svd.h"#include "eigs-base.h"Go to the source code of this file.
Macros | |
| #define | DEFINE_COLROW_DISPATCHER(FCN_NAME, ARG_TYPE, RES_TYPE) |
| #define | DEFINE_COLROW_NORM_FCNS(PREFIX, RPREFIX, RTYPE) |
| #define | DEFINE_XNORM_FCNS(PREFIX, RTYPE) |
| #define | DEFINE_XNORM_SPARSE_FCNS(PREFIX, RTYPE) |
Typedefs | |
| template<typename R > | |
| using | accum_type = std::conditional_t< std::is_same_v< R, float >, double, R > |
Functions | |
| template<typename T , typename R > | |
| void | array_norm_2 (const T *v, octave_idx_type n, R &res) |
| double | blas_nrm2 (octave_idx_type n, const Complex *x, octave_idx_type incx) |
| double | blas_nrm2 (octave_idx_type n, const double *x, octave_idx_type incx) |
| float | blas_nrm2 (octave_idx_type n, const float *x, octave_idx_type incx) |
| float | blas_nrm2 (octave_idx_type n, const FloatComplex *x, octave_idx_type incx) |
| template<typename T , typename R , typename ACC > | |
| void | column_norms (const MArray< T > &m, MArray< R > &res, ACC acc) |
| template<typename T , typename R > | |
| MArray< R > | column_norms (const MArray< T > &v, R p) |
| template<typename T , typename R , typename ACC > | |
| void | column_norms (const MSparse< T > &m, MArray< R > &res, ACC acc) |
| template<typename T , typename R > | |
| MArray< R > | column_norms (const MSparse< T > &v, R p) |
| template<typename VectorT , typename R > | |
| VectorT | dual_p (const VectorT &x, R p, R q) |
| template<typename T , typename R > | |
| T | elem_dual_p (T x, R p) |
| template<typename MatrixT , typename VectorT , typename R > | |
| R | higham (const MatrixT &m, R p, R tol, int maxiter, VectorT &x) |
| double | lange (char norm_type, const ComplexMatrix &m) |
| float | lange (char norm_type, const FloatComplexMatrix &m) |
| float | lange (char norm_type, const FloatMatrix &m) |
| double | lange (char norm_type, const Matrix &m) |
| template<typename T , typename R > | |
| R | lange_inf_fixup (R result, const T *data, octave_idx_type numel) |
| template<typename MatrixT , typename VectorT , typename R > | |
| R | matrix_norm (const MatrixT &m, R p, VectorT) |
| template<typename T , typename R , typename ACC > | |
| void | row_norms (const MArray< T > &m, MArray< R > &res, ACC acc) |
| template<typename T , typename R > | |
| MArray< R > | row_norms (const MArray< T > &v, R p) |
| template<typename T , typename R , typename ACC > | |
| void | row_norms (const MSparse< T > &m, MArray< R > &res, ACC acc) |
| template<typename T , typename R > | |
| MArray< R > | row_norms (const MSparse< T > &v, R p) |
| template<typename T > | |
| constexpr T | safe_conj (T x) |
| template<typename MatrixT , typename VectorT , typename R > | |
| R | sparse_2norm (const MatrixT &m, R tol, int maxiter, VectorT) |
| double | sparse_2norm_arpack (const SparseComplexMatrix &m, double tol, int maxiter) |
| double | sparse_2norm_arpack (const SparseMatrix &m, double tol, int maxiter) |
| template<typename MatrixT , typename VectorT , typename R > | |
| R | sparse_2norm_power (const MatrixT &m, R tol, int maxiter, VectorT) |
| template<typename MatrixT , typename VectorT , typename R > | |
| R | svd_matrix_norm (const MatrixT &m, R p, VectorT) |
| template<typename VectorT > | |
| auto | vector_dot (const VectorT &x, const VectorT &y) |
| template<typename T , typename R , typename ACC > | |
| void | vector_norm (const Array< T > &v, R &res, ACC acc) |
| template<typename T , typename R > | |
| R | vector_norm (const MArray< T > &v, R p) |
| template<typename T , typename R , typename ACC > | |
| void | vector_norm (const MSparse< T > &v, R &res, ACC acc) |
| template<typename T , typename R > | |
| R | vector_norm (const MSparse< T > &v, R p) |
| template<typename T , typename R > | |
| R | vector_norm_2_blas (const MArray< T > &v) |
| RowVector | xcolnorms (const ComplexMatrix &m, double p) |
| FloatRowVector | xcolnorms (const FloatComplexMatrix &m, float p) |
| FloatRowVector | xcolnorms (const FloatMatrix &m, float p) |
| RowVector | xcolnorms (const Matrix &m, double p) |
| RowVector | xcolnorms (const SparseComplexMatrix &m, double p) |
| RowVector | xcolnorms (const SparseMatrix &m, double p) |
| double | xfrobnorm (const ComplexMatrix &x) |
| float | xfrobnorm (const FloatComplexMatrix &x) |
| float | xfrobnorm (const FloatMatrix &x) |
| double | xfrobnorm (const Matrix &x) |
| double | xfrobnorm (const SparseComplexMatrix &x) |
| double | xfrobnorm (const SparseMatrix &x) |
| double | xnorm (const ColumnVector &x, double p) |
| double | xnorm (const ComplexColumnVector &x, double p) |
| double | xnorm (const ComplexMatrix &x, double p) |
| double | xnorm (const ComplexRowVector &x, double p) |
| float | xnorm (const FloatColumnVector &x, float p) |
| float | xnorm (const FloatComplexColumnVector &x, float p) |
| float | xnorm (const FloatComplexMatrix &x, float p) |
| float | xnorm (const FloatComplexRowVector &x, float p) |
| float | xnorm (const FloatMatrix &x, float p) |
| float | xnorm (const FloatRowVector &x, float p) |
| double | xnorm (const Matrix &x, double p) |
| double | xnorm (const RowVector &x, double p) |
| double | xnorm (const SparseComplexMatrix &x, double p) |
| double | xnorm (const SparseMatrix &x, double p) |
| ColumnVector | xrownorms (const ComplexMatrix &m, double p) |
| FloatColumnVector | xrownorms (const FloatComplexMatrix &m, float p) |
| FloatColumnVector | xrownorms (const FloatMatrix &m, float p) |
| ColumnVector | xrownorms (const Matrix &m, double p) |
| ColumnVector | xrownorms (const SparseComplexMatrix &m, double p) |
| ColumnVector | xrownorms (const SparseMatrix &m, double p) |
Variables | |
| constexpr int | max_norm_iter = 256 |
| constexpr const char * | p_less1_gripe = "xnorm: p must be >= 1" |
| #define DEFINE_COLROW_DISPATCHER | ( | FCN_NAME, | |
| ARG_TYPE, | |||
| RES_TYPE | |||
| ) |
Definition at line 598 of file oct-norm.cc.
| #define DEFINE_COLROW_NORM_FCNS | ( | PREFIX, | |
| RPREFIX, | |||
| RTYPE | |||
| ) |
Definition at line 1096 of file oct-norm.cc.
| #define DEFINE_XNORM_FCNS | ( | PREFIX, | |
| RTYPE | |||
| ) |
Definition at line 1047 of file oct-norm.cc.
| #define DEFINE_XNORM_SPARSE_FCNS | ( | PREFIX, | |
| RTYPE | |||
| ) |
Definition at line 1081 of file oct-norm.cc.
| using accum_type = std::conditional_t<std::is_same_v<R, float>, double, R> |
Definition at line 225 of file oct-norm.cc.
|
inline |
Definition at line 1072 of file oct-norm.cc.
|
inline |
Definition at line 100 of file oct-norm.cc.
References F77_CONST_DBLE_CMPLX_ARG, F77_FUNC(), x, and xdznrm2().
|
inline |
Definition at line 80 of file oct-norm.cc.
References F77_FUNC(), x, and xdnrm2().
Referenced by vector_norm_2_blas().
|
inline |
Definition at line 90 of file oct-norm.cc.
References F77_FUNC(), x, and xsnrm2().
|
inline |
Definition at line 110 of file oct-norm.cc.
References F77_CONST_CMPLX_ARG, F77_FUNC(), x, and xscnrm2().
| void column_norms | ( | const MArray< T > & | m, |
| MArray< R > & | res, | ||
| ACC | acc | ||
| ) |
Definition at line 476 of file oct-norm.cc.
References Array< T, Alloc >::columns(), Array< T, Alloc >::rows(), and Array< T, Alloc >::xelem().
Definition at line 623 of file oct-norm.cc.
| void column_norms | ( | const MSparse< T > & | m, |
| MArray< R > & | res, | ||
| ACC | acc | ||
| ) |
Definition at line 508 of file oct-norm.cc.
References Sparse< T, Alloc >::cidx(), Sparse< T, Alloc >::columns(), Sparse< T, Alloc >::data(), and Array< T, Alloc >::xelem().
Definition at line 625 of file oct-norm.cc.
| VectorT dual_p | ( | const VectorT & | x, |
| R | p, | ||
| R | q | ||
| ) |
Definition at line 718 of file oct-norm.cc.
References elem_dual_p(), vector_norm(), and x.
Referenced by higham().
|
inline |
| R higham | ( | const MatrixT & | m, |
| R | p, | ||
| R | tol, | ||
| int | maxiter, | ||
| VectorT & | x | ||
| ) |
Definition at line 729 of file oct-norm.cc.
References dual_p(), gamma(), vector_norm(), and x.
Referenced by matrix_norm(), and svd_matrix_norm().
|
inline |
Definition at line 181 of file oct-norm.cc.
References Array< T, Alloc >::cols(), Array< T, Alloc >::data(), F77_CONST_DBLE_CMPLX_ARG, F77_FUNC(), lange_inf_fixup(), Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, Array< T, Alloc >::rows(), and xzlange().
|
inline |
Definition at line 198 of file oct-norm.cc.
References Array< T, Alloc >::cols(), Array< T, Alloc >::data(), F77_CONST_CMPLX_ARG, F77_FUNC(), lange_inf_fixup(), Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, Array< T, Alloc >::rows(), and xclange().
|
inline |
Definition at line 165 of file oct-norm.cc.
References Array< T, Alloc >::cols(), Array< T, Alloc >::data(), F77_FUNC(), lange_inf_fixup(), Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, Array< T, Alloc >::rows(), and xslange().
Definition at line 149 of file oct-norm.cc.
References Array< T, Alloc >::cols(), Array< T, Alloc >::data(), F77_FUNC(), lange_inf_fixup(), Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, Array< T, Alloc >::rows(), and xdlange().
Referenced by svd_matrix_norm().
|
inline |
| R matrix_norm | ( | const MatrixT & | m, |
| R | p, | ||
| VectorT | |||
| ) |
Definition at line 1020 of file oct-norm.cc.
References current_liboctave_error_handler, higham(), ColumnVector::max(), RowVector::max(), max_norm_iter, p_less1_gripe, sparse_2norm(), x, xcolnorms(), and xrownorms().
| void row_norms | ( | const MArray< T > & | m, |
| MArray< R > & | res, | ||
| ACC | acc | ||
| ) |
Definition at line 491 of file oct-norm.cc.
References Array< T, Alloc >::columns(), Array< T, Alloc >::rows(), and Array< T, Alloc >::xelem().
Definition at line 624 of file oct-norm.cc.
| void row_norms | ( | const MSparse< T > & | m, |
| MArray< R > & | res, | ||
| ACC | acc | ||
| ) |
Definition at line 523 of file oct-norm.cc.
References Sparse< T, Alloc >::cidx(), Sparse< T, Alloc >::columns(), Sparse< T, Alloc >::data(), Sparse< T, Alloc >::ridx(), Sparse< T, Alloc >::rows(), and Array< T, Alloc >::xelem().
Definition at line 626 of file oct-norm.cc.
References vector_norm().
|
constexpr |
| R sparse_2norm | ( | const MatrixT & | m, |
| R | tol, | ||
| int | maxiter, | ||
| VectorT | |||
| ) |
Definition at line 1004 of file oct-norm.cc.
References sparse_2norm_arpack(), and sparse_2norm_power().
Referenced by matrix_norm().
| double sparse_2norm_arpack | ( | const SparseComplexMatrix & | m, |
| double | tol, | ||
| int | maxiter | ||
| ) |
Definition at line 953 of file oct-norm.cc.
References B, Sparse< T, Alloc >::cols(), EigsComplexNonSymmetricMatrix(), SparseComplexMatrix::hermitian(), SparseComplexMatrix::insert(), Array< T, Alloc >::numel(), and Sparse< T, Alloc >::rows().
| double sparse_2norm_arpack | ( | const SparseMatrix & | m, |
| double | tol, | ||
| int | maxiter | ||
| ) |
Definition at line 904 of file oct-norm.cc.
References B, Sparse< T, Alloc >::cols(), EigsRealSymmetricMatrix(), SparseMatrix::insert(), Array< T, Alloc >::numel(), Sparse< T, Alloc >::rows(), and SparseMatrix::transpose().
Referenced by sparse_2norm().
| R sparse_2norm_power | ( | const MatrixT & | m, |
| R | tol, | ||
| int | maxiter, | ||
| VectorT | |||
| ) |
Definition at line 842 of file oct-norm.cc.
References vector_dot(), vector_norm(), and x.
Referenced by sparse_2norm().
| R svd_matrix_norm | ( | const MatrixT & | m, |
| R | p, | ||
| VectorT | |||
| ) |
Definition at line 790 of file oct-norm.cc.
References current_liboctave_error_handler, higham(), lange(), max_norm_iter, p_less1_gripe, and x.
| auto vector_dot | ( | const VectorT & | x, |
| const VectorT & | y | ||
| ) |
Definition at line 827 of file oct-norm.cc.
References safe_conj(), and x.
Referenced by sparse_2norm_power().
|
inline |
Definition at line 453 of file oct-norm.cc.
References Array< T, Alloc >::numel().
Referenced by dual_p(), higham(), row_norms(), sparse_2norm_power(), vector_norm(), and vector_norm().
| R vector_norm | ( | const MArray< T > & | v, |
| R | p | ||
| ) |
Definition at line 548 of file oct-norm.cc.
References vector_norm().
|
inline |
Definition at line 464 of file oct-norm.cc.
References Sparse< T, Alloc >::data(), and Sparse< T, Alloc >::nnz().
| R vector_norm | ( | const MSparse< T > & | v, |
| R | p | ||
| ) |
Definition at line 574 of file oct-norm.cc.
References vector_norm().
|
inline |
Definition at line 540 of file oct-norm.cc.
References blas_nrm2(), Array< T, Alloc >::data(), and Array< T, Alloc >::numel().
| RowVector xcolnorms | ( | const ComplexMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1109 of file oct-norm.cc.
| FloatRowVector xcolnorms | ( | const FloatComplexMatrix & | m, |
| float | p | ||
| ) |
Definition at line 1111 of file oct-norm.cc.
| FloatRowVector xcolnorms | ( | const FloatMatrix & | m, |
| float | p | ||
| ) |
Definition at line 1110 of file oct-norm.cc.
Definition at line 1108 of file oct-norm.cc.
Referenced by F__icholt__(), F__iluc__(), F__ilutp__(), Fnorm(), and matrix_norm().
| RowVector xcolnorms | ( | const SparseComplexMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1114 of file oct-norm.cc.
| RowVector xcolnorms | ( | const SparseMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1113 of file oct-norm.cc.
| double xfrobnorm | ( | const ComplexMatrix & | x | ) |
Definition at line 1066 of file oct-norm.cc.
| float xfrobnorm | ( | const FloatComplexMatrix & | x | ) |
Definition at line 1068 of file oct-norm.cc.
| float xfrobnorm | ( | const FloatMatrix & | x | ) |
Definition at line 1067 of file oct-norm.cc.
Definition at line 1065 of file oct-norm.cc.
| double xfrobnorm | ( | const SparseComplexMatrix & | x | ) |
Definition at line 1094 of file oct-norm.cc.
| double xfrobnorm | ( | const SparseMatrix & | x | ) |
Definition at line 1093 of file oct-norm.cc.
| double xnorm | ( | const ColumnVector & | x, |
| double | p | ||
| ) |
Definition at line 1065 of file oct-norm.cc.
Referenced by Fnorm().
| double xnorm | ( | const ComplexColumnVector & | x, |
| double | p | ||
| ) |
Definition at line 1066 of file oct-norm.cc.
| double xnorm | ( | const ComplexMatrix & | x, |
| double | p | ||
| ) |
Definition at line 1066 of file oct-norm.cc.
| double xnorm | ( | const ComplexRowVector & | x, |
| double | p | ||
| ) |
Definition at line 1066 of file oct-norm.cc.
| float xnorm | ( | const FloatColumnVector & | x, |
| float | p | ||
| ) |
Definition at line 1067 of file oct-norm.cc.
| float xnorm | ( | const FloatComplexColumnVector & | x, |
| float | p | ||
| ) |
Definition at line 1068 of file oct-norm.cc.
| float xnorm | ( | const FloatComplexMatrix & | x, |
| float | p | ||
| ) |
Definition at line 1068 of file oct-norm.cc.
| float xnorm | ( | const FloatComplexRowVector & | x, |
| float | p | ||
| ) |
Definition at line 1068 of file oct-norm.cc.
| float xnorm | ( | const FloatMatrix & | x, |
| float | p | ||
| ) |
Definition at line 1067 of file oct-norm.cc.
| float xnorm | ( | const FloatRowVector & | x, |
| float | p | ||
| ) |
Definition at line 1067 of file oct-norm.cc.
Definition at line 1065 of file oct-norm.cc.
Definition at line 1065 of file oct-norm.cc.
| double xnorm | ( | const SparseComplexMatrix & | x, |
| double | p | ||
| ) |
Definition at line 1094 of file oct-norm.cc.
| double xnorm | ( | const SparseMatrix & | x, |
| double | p | ||
| ) |
Definition at line 1093 of file oct-norm.cc.
| ColumnVector xrownorms | ( | const ComplexMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1109 of file oct-norm.cc.
| FloatColumnVector xrownorms | ( | const FloatComplexMatrix & | m, |
| float | p | ||
| ) |
Definition at line 1111 of file oct-norm.cc.
| FloatColumnVector xrownorms | ( | const FloatMatrix & | m, |
| float | p | ||
| ) |
Definition at line 1110 of file oct-norm.cc.
| ColumnVector xrownorms | ( | const Matrix & | m, |
| double | p | ||
| ) |
Definition at line 1108 of file oct-norm.cc.
Referenced by F__iluc__(), F__ilutp__(), Fnorm(), and matrix_norm().
| ColumnVector xrownorms | ( | const SparseComplexMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1114 of file oct-norm.cc.
| ColumnVector xrownorms | ( | const SparseMatrix & | m, |
| double | p | ||
| ) |
Definition at line 1113 of file oct-norm.cc.
|
constexpr |
Definition at line 785 of file oct-norm.cc.
Referenced by matrix_norm(), and svd_matrix_norm().
|
constexpr |
Definition at line 780 of file oct-norm.cc.
Referenced by matrix_norm(), and svd_matrix_norm().