Mercurial > octave
changeset 29873:1420d471e942
oct-norm.h: Eliminate macros.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Jul 2021 15:30:07 -0400 |
parents | df2cdf42a909 |
children | 92662b17ef7e |
files | liboctave/numeric/oct-norm.h |
diffstat | 1 files changed, 57 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/numeric/oct-norm.h Tue Jul 13 13:21:52 2021 -0400 +++ b/liboctave/numeric/oct-norm.h Tue Jul 13 15:30:07 2021 -0400 @@ -30,40 +30,67 @@ #include "oct-cmplx.h" -#define DECLARE_XNORM_FUNCS(PREFIX, RTYPE) \ - class PREFIX##Matrix; \ - class PREFIX##ColumnVector; \ - class PREFIX##RowVector; \ - \ - extern OCTAVE_API RTYPE \ - xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ - extern OCTAVE_API RTYPE \ - xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ - extern OCTAVE_API RTYPE \ - xnorm (const PREFIX##Matrix&, RTYPE p = 2); \ - extern OCTAVE_API RTYPE \ - xfrobnorm (const PREFIX##Matrix&); +class Matrix; +class ColumnVector; +class RowVector; + +class ComplexMatrix; +class ComplexColumnVector; +class ComplexRowVector; + +class FloatMatrix; +class FloatColumnVector; +class FloatRowVector; + +class FloatComplexMatrix; +class FloatComplexColumnVector; +class FloatComplexRowVector; + +class SparseMatrix; +class SparseComplexMatrix; + +extern OCTAVE_API double xnorm (const ColumnVector&, double p = 2); +extern OCTAVE_API double xnorm (const RowVector&, double p = 2); +extern OCTAVE_API double xnorm (const Matrix&, double p = 2); +extern OCTAVE_API double xfrobnorm (const Matrix&); + +extern OCTAVE_API double xnorm (const ComplexColumnVector&, double p = 2); +extern OCTAVE_API double xnorm (const ComplexRowVector&, double p = 2); +extern OCTAVE_API double xnorm (const ComplexMatrix&, double p = 2); +extern OCTAVE_API double xfrobnorm (const ComplexMatrix&); -DECLARE_XNORM_FUNCS(, double) -DECLARE_XNORM_FUNCS(Complex, double) -DECLARE_XNORM_FUNCS(Float, float) -DECLARE_XNORM_FUNCS(FloatComplex, float) +extern OCTAVE_API float xnorm (const FloatColumnVector&, float p = 2); +extern OCTAVE_API float xnorm (const FloatRowVector&, float p = 2); +extern OCTAVE_API float xnorm (const FloatMatrix&, float p = 2); +extern OCTAVE_API float xfrobnorm (const FloatMatrix&); -DECLARE_XNORM_FUNCS(Sparse, double) -DECLARE_XNORM_FUNCS(SparseComplex, double) +extern OCTAVE_API float xnorm (const FloatComplexColumnVector&, float p = 2); +extern OCTAVE_API float xnorm (const FloatComplexRowVector&, float p = 2); +extern OCTAVE_API float xnorm (const FloatComplexMatrix&, float p = 2); +extern OCTAVE_API float xfrobnorm (const FloatComplexMatrix&); + +extern OCTAVE_API double xnorm (const SparseMatrix&, double p = 2); +extern OCTAVE_API double xfrobnorm (const SparseMatrix&); + +extern OCTAVE_API double xnorm (const SparseComplexMatrix&, double p = 2); +extern OCTAVE_API double xfrobnorm (const SparseComplexMatrix&); -#define DECLARE_COLROW_NORM_FUNCS(PREFIX, RPREFIX, RTYPE) \ - extern OCTAVE_API RPREFIX##RowVector \ - xcolnorms (const PREFIX##Matrix&, RTYPE p = 2); \ - extern OCTAVE_API RPREFIX##ColumnVector \ - xrownorms (const PREFIX##Matrix&, RTYPE p = 2); \ +extern OCTAVE_API RowVector xcolnorms (const Matrix&, double p = 2); +extern OCTAVE_API ColumnVector xrownorms (const Matrix&, double p = 2); + +extern OCTAVE_API RowVector xcolnorms (const ComplexMatrix&, double p = 2); +extern OCTAVE_API ColumnVector xrownorms (const ComplexMatrix&, double p = 2); + +extern OCTAVE_API FloatRowVector xcolnorms (const FloatMatrix&, float p = 2); +extern OCTAVE_API FloatColumnVector xrownorms (const FloatMatrix&, float p = 2); -DECLARE_COLROW_NORM_FUNCS(, , double) -DECLARE_COLROW_NORM_FUNCS(Complex, , double) -DECLARE_COLROW_NORM_FUNCS(Float, Float, float) -DECLARE_COLROW_NORM_FUNCS(FloatComplex, Float, float) +extern OCTAVE_API FloatRowVector xcolnorms (const FloatComplexMatrix&, float p = 2); +extern OCTAVE_API FloatColumnVector xrownorms (const FloatComplexMatrix&, float p = 2); -DECLARE_COLROW_NORM_FUNCS(Sparse, , double) -DECLARE_COLROW_NORM_FUNCS(SparseComplex, , double) +extern OCTAVE_API RowVector xcolnorms (const SparseMatrix&, double p = 2); +extern OCTAVE_API ColumnVector xrownorms (const SparseMatrix&, double p = 2); + +extern OCTAVE_API RowVector xcolnorms (const SparseComplexMatrix&, double p = 2); +extern OCTAVE_API ColumnVector xrownorms (const SparseComplexMatrix&, double p = 2); #endif