level1_impl.h File Reference
#include "common.h"

Go to the source code of this file.

Functions

if incx make_vector (y, *n)+
 
else if incx make_vector (y, *n, *incy)+ = alpha * make_vector(x, *n, -*incx).reverse()
 
else if incx make_vector (y, *n, - *incy).reverse()+ = alpha * make_vector(x, *n, -*incx).reverse()
 
EIGEN_BLAS_FUNC() copy (int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
 
EIGEN_BLAS_FUNC() rotg (RealScalar *pa, RealScalar *pb, RealScalar *pc, RealScalar *ps)
 
EIGEN_BLAS_FUNC() scal (int *n, RealScalar *palpha, RealScalar *px, int *incx)
 
EIGEN_BLAS_FUNC() swap (int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
 

Variables

const int * n
 
const int const RealScalar * palpha
 
const int const RealScalar const RealScalar * px
 
const int const RealScalar const RealScalar const int * incx
 
const int const RealScalar const RealScalar const int RealScalar * py
 
const int const RealScalar const RealScalar const int RealScalar const int * incy
 
Scalar * y = reinterpret_cast<Scalar *>(py)
 
Scalar alpha = *reinterpret_cast<const Scalar *>(palpha)
 
if n return
 

Function Documentation

◆ copy()

EIGEN_BLAS_FUNC() copy ( int *  n,
RealScalar *  px,
int *  incx,
RealScalar *  py,
int *  incy 
)
32  {
33  if (*n <= 0) return;
34 
35  Scalar *x = reinterpret_cast<Scalar *>(px);
36  Scalar *y = reinterpret_cast<Scalar *>(py);
37 
38  // be careful, *incx==0 is allowed !!
39  if (*incx == 1 && *incy == 1)
40  make_vector(y, *n) = make_vector(x, *n);
41  else {
42  if (*incx < 0) x = x - (*n - 1) * (*incx);
43  if (*incy < 0) y = y - (*n - 1) * (*incy);
44  for (int i = 0; i < *n; ++i) {
45  *y = *x;
46  x += *incx;
47  y += *incy;
48  }
49  }
50 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
SCALAR Scalar
Definition: bench_gemm.cpp:45
if incx make_vector(y, *n)+
const int const RealScalar const RealScalar const int RealScalar const int * incy
Definition: level1_impl.h:13
Scalar * y
Definition: level1_impl.h:15
const int const RealScalar const RealScalar const int RealScalar * py
Definition: level1_impl.h:13
const int const RealScalar const RealScalar const int * incx
Definition: level1_impl.h:13
const int * n
Definition: level1_impl.h:13
const int const RealScalar const RealScalar * px
Definition: level1_impl.h:13
list x
Definition: plotDoE.py:28

References i, incx, incy, make_vector(), n, px, py, plotDoE::x, and y.

Referenced by Eigen::BlockSparseMatrix< Scalar_, _BlockAtCompileTime, Options_, StorageIndex_ >::BlockSparseMatrix(), oomph::DoubleVector::build(), construct_vector(), oomph::CRDoubleMatrix::CRDoubleMatrix(), oomph::CRDoubleMatrixHelpers::deep_copy(), eiToGmm(), Eigen::internal::kissfft_impl< Scalar_ >::fwd(), oomph::RefineableQElement< 2 >::get_boundaries(), oomph::DoubleVector::initialise(), Eigen::internal::kissfft_impl< Scalar_ >::inv(), main(), SmallMatrix< numberOfRows, numberOfColumns >::operator=(), SmallVector< numberOfRows >::operator=(), Eigen::internal::smart_copy_helper< T, false >::run(), Eigen::internal::smart_memmove_helper< T, false >::run(), SmallMatrix< numberOfRows, numberOfColumns >::SmallMatrix(), SmallVector< numberOfRows >::SmallVector(), rapidjson::GenericDocument< Encoding, Allocator >::String(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::String(), rapidjson::Writer< Stream, Encoding, Allocator >::String(), test_0d(), test_1d(), and test_empty_slice().

◆ make_vector() [1/3]

if incx make_vector ( y  ,
*  n 
)

Referenced by copy(), scal(), and swap().

◆ make_vector() [2/3]

else if incx make_vector ( y  ,
*  n,
*  incy 
) = alpha * make_vector(x, *n, -*incx).reverse()

◆ make_vector() [3/3]

else if incx make_vector ( y  ,
*  n,
- *  incy 
) = alpha * make_vector(x, *n, -*incx).reverse()

◆ rotg()

EIGEN_BLAS_FUNC() rotg ( RealScalar *  pa,
RealScalar *  pb,
RealScalar *  pc,
RealScalar *  ps 
)
52  {
53  using std::abs;
54  using std::sqrt;
55 
56  Scalar &a = *reinterpret_cast<Scalar *>(pa);
57  Scalar &b = *reinterpret_cast<Scalar *>(pb);
58  RealScalar *c = pc;
59  Scalar *s = reinterpret_cast<Scalar *>(ps);
60 
61 #if !ISCOMPLEX
62  Scalar r, z;
63  Scalar aa = abs(a);
64  Scalar ab = abs(b);
65  if ((aa + ab) == Scalar(0)) {
66  *c = 1;
67  *s = 0;
68  r = 0;
69  z = 0;
70  } else {
71  r = sqrt(a * a + b * b);
72  Scalar amax = aa > ab ? a : b;
73  r = amax > 0 ? r : -r;
74  *c = a / r;
75  *s = b / r;
76  z = 1;
77  if (aa > ab) z = *s;
78  if (ab > aa && *c != RealScalar(0)) z = Scalar(1) / *c;
79  }
80  *pa = r;
81  *pb = z;
82 #else
83  Scalar alpha;
84  RealScalar norm, scale;
85  if (abs(a) == RealScalar(0)) {
86  *c = RealScalar(0);
87  *s = Scalar(1);
88  a = b;
89  } else {
90  scale = abs(a) + abs(b);
91  norm = scale * sqrt((Eigen::numext::abs2(a / scale)) + (Eigen::numext::abs2(b / scale)));
92  alpha = a / abs(a);
93  *c = abs(a) / norm;
94  *s = alpha * Eigen::numext::conj(b) / norm;
95  a = alpha * norm;
96  }
97 #endif
98 
99  // JacobiRotation<Scalar> r;
100  // r.makeGivens(a,b);
101  // *c = r.c();
102  // *s = r.s();
103 }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar conj(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:133
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Scalar * b
Definition: benchVecAdd.cpp:17
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
RealScalar s
Definition: level1_cplx_impl.h:130
int RealScalar int RealScalar int RealScalar RealScalar * ps
Definition: level1_cplx_impl.h:124
int RealScalar int RealScalar int RealScalar * pc
Definition: level1_cplx_impl.h:124
Scalar alpha
Definition: level1_impl.h:16
const Scalar * a
Definition: level2_cplx_impl.h:32
const char const int const RealScalar const RealScalar * pa
Definition: level2_cplx_impl.h:20
const char const int const int const RealScalar const RealScalar const int const RealScalar * pb
Definition: level2_impl.h:28
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1102
r
Definition: UniformPSDSelfTest.py:20
int c
Definition: calibrate.py:100
#define amax(a, b)
Definition: oomph_metis_from_parmetis_3.1.1/macros.h:21

References a, abs(), Eigen::numext::abs2(), alpha, amax, b, calibrate::c, conj(), pa, pb, pc, ps, UniformPSDSelfTest::r, s, and sqrt().

◆ scal()

EIGEN_BLAS_FUNC() scal ( int *  n,
RealScalar *  palpha,
RealScalar *  px,
int *  incx 
)
105  {
106  if (*n <= 0) return;
107 
108  Scalar *x = reinterpret_cast<Scalar *>(px);
109  Scalar alpha = *reinterpret_cast<Scalar *>(palpha);
110 
111  if (*incx == 1)
112  make_vector(x, *n) *= alpha;
113  else
114  make_vector(x, *n, std::abs(*incx)) *= alpha;
115 }
const int const RealScalar * palpha
Definition: level1_impl.h:13

References abs(), alpha, incx, make_vector(), n, palpha, px, and plotDoE::x.

◆ swap()

EIGEN_BLAS_FUNC() swap ( int *  n,
RealScalar *  px,
int *  incx,
RealScalar *  py,
int *  incy 
)
117  {
118  if (*n <= 0) return;
119 
120  Scalar *x = reinterpret_cast<Scalar *>(px);
121  Scalar *y = reinterpret_cast<Scalar *>(py);
122 
123  if (*incx == 1 && *incy == 1)
124  make_vector(y, *n).swap(make_vector(x, *n));
125  else if (*incx > 0 && *incy > 0)
126  make_vector(y, *n, *incy).swap(make_vector(x, *n, *incx));
127  else if (*incx > 0 && *incy < 0)
128  make_vector(y, *n, -*incy).reverse().swap(make_vector(x, *n, *incx));
129  else if (*incx < 0 && *incy > 0)
130  make_vector(y, *n, *incy).swap(make_vector(x, *n, -*incx).reverse());
131  else if (*incx < 0 && *incy < 0)
132  make_vector(y, *n, -*incy).reverse().swap(make_vector(x, *n, -*incx).reverse());
133 }
void reverse(const MatrixType &m)
Definition: array_reverse.cpp:17

References incx, incy, make_vector(), n, px, py, reverse(), plotDoE::x, and y.

Referenced by IcoSphere::_subdivide(), Eigen::BDCSVD< MatrixType_, Options_ >::allocate(), Eigen::PermutationBase< Derived >::applyTranspositionOnTheRight(), Eigen::internal::swap_assign_op< Scalar >::assignCoeff(), Eigen::JacobiSVD< MatrixType_, Options_ >::compute_impl(), Eigen::ColPivHouseholderQR< MatrixType_, PermutationIndex_ >::computeInPlace(), Eigen::BDCSVD< MatrixType_, Options_ >::computeSingVals(), Eigen::BDCSVD< MatrixType_, Options_ >::computeSVDofM(), SCoupling< M, O >::createDPMWallsFromFiniteElems(), Eigen::BDCSVD< MatrixType_, Options_ >::deflation(), Eigen::DynamicSGroup::DynamicSGroup(), EIGEN_DECLARE_TEST(), Eigen::SparseQR< MatrixType_, OrderingType_ >::factorize(), Eigen::IncompleteLUT< Scalar_, StorageIndex_ >::factorize(), oomph::QuadTree::gteq_edge_neighbour(), initSparse(), Eigen::internal::matrix_function_permute_schur(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::operator=(), Eigen::DynamicSGroup::operator=(), Eigen::internal::permute_symm_to_fullsymm(), Eigen::internal::permute_symm_to_symm(), Eigen::internal::SparseLUImpl< Scalar, StorageIndex >::pivotL(), Eigen::internal::SparseLUImpl< MatrixType_::Scalar, MatrixType_::StorageIndex >::pruneL(), Eigen::internal::QuickSplit(), Eigen::randomPermutationVector(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::reserveInnerVectors(), Eigen::TensorEvaluator< const TensorFFTOp< FFT, ArgType, FFTResultType, FFTDir >, Device >::scramble_FFT(), Eigen::ComplexEigenSolver< MatrixType_ >::sortEigenvalues(), Eigen::internal::sortWithPermutation(), Eigen::internal::CompressedStorage< Scalar_, StorageIndex_ >::swap(), Eigen::PlainObjectBase< Derived >::swap(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::swap(), Eigen::SparseVector< Scalar_, Options_, StorageIndex_ >::swap(), test_shuffle_unshuffle(), test_stl_iterators(), test_tensor_randacc(), testVectorType(), Eigen::internal::ldlt_inplace< Lower >::unblocked(), SCoupling< M, O >::updateDPMWallsFromFiniteElems(), and Eigen::IncompleteCholesky< Scalar, UpLo_, OrderingType_ >::updateList().

Variable Documentation

◆ alpha

Scalar alpha = *reinterpret_cast<const Scalar *>(palpha)

Referenced by rotg(), and scal().

◆ incx

const int const RealScalar const RealScalar const int* incx

Referenced by copy(), scal(), and swap().

◆ incy

const int const RealScalar const RealScalar const int RealScalar const int* incy
Initial value:
{
const Scalar *x = reinterpret_cast<const Scalar *>(px)

Referenced by copy(), and swap().

◆ n

const int* n

Referenced by copy(), scal(), and swap().

◆ palpha

const int const RealScalar* palpha

Referenced by scal().

◆ px

const int const RealScalar const RealScalar* px

Referenced by copy(), scal(), and swap().

◆ py

const int const RealScalar const RealScalar const int RealScalar* py

Referenced by copy(), and swap().

◆ return

if n return

◆ y

Scalar* y = reinterpret_cast<Scalar *>(py)

Referenced by copy(), and swap().