Eigen::internal::symm_pack_lhs< Scalar, Index, Pack1, Pack2_dummy, StorageOrder > Struct Template Reference

#include <SelfadjointMatrixMatrix.h>

Public Member Functions

template<int BlockRows>
void pack (Scalar *blockA, const const_blas_data_mapper< Scalar, Index, StorageOrder > &lhs, Index cols, Index i, Index &count)
 
void operator() (Scalar *blockA, const Scalar *lhs_, Index lhsStride, Index cols, Index rows)
 

Member Function Documentation

◆ operator()()

template<typename Scalar , typename Index , int Pack1, int Pack2_dummy, int StorageOrder>
void Eigen::internal::symm_pack_lhs< Scalar, Index, Pack1, Pack2_dummy, StorageOrder >::operator() ( Scalar blockA,
const Scalar lhs_,
Index  lhsStride,
Index  cols,
Index  rows 
)
inline
43  {
44  typedef typename unpacket_traits<typename packet_traits<Scalar>::type>::half HalfPacket;
46  QuarterPacket;
47  enum {
48  PacketSize = packet_traits<Scalar>::size,
49  HalfPacketSize = unpacket_traits<HalfPacket>::size,
50  QuarterPacketSize = unpacket_traits<QuarterPacket>::size,
51  HasHalf = (int)HalfPacketSize < (int)PacketSize,
52  HasQuarter = (int)QuarterPacketSize < (int)HalfPacketSize
53  };
54 
55  const_blas_data_mapper<Scalar, Index, StorageOrder> lhs(lhs_, lhsStride);
56  Index count = 0;
57  // Index peeled_mc3 = (rows/Pack1)*Pack1;
58 
59  const Index peeled_mc3 = Pack1 >= 3 * PacketSize ? (rows / (3 * PacketSize)) * (3 * PacketSize) : 0;
60  const Index peeled_mc2 =
61  Pack1 >= 2 * PacketSize ? peeled_mc3 + ((rows - peeled_mc3) / (2 * PacketSize)) * (2 * PacketSize) : 0;
62  const Index peeled_mc1 =
63  Pack1 >= 1 * PacketSize ? peeled_mc2 + ((rows - peeled_mc2) / (1 * PacketSize)) * (1 * PacketSize) : 0;
64  const Index peeled_mc_half =
65  Pack1 >= HalfPacketSize ? peeled_mc1 + ((rows - peeled_mc1) / (HalfPacketSize)) * (HalfPacketSize) : 0;
66  const Index peeled_mc_quarter =
67  Pack1 >= QuarterPacketSize
68  ? peeled_mc_half + ((rows - peeled_mc_half) / (QuarterPacketSize)) * (QuarterPacketSize)
69  : 0;
70 
71  if (Pack1 >= 3 * PacketSize)
72  for (Index i = 0; i < peeled_mc3; i += 3 * PacketSize) pack<3 * PacketSize>(blockA, lhs, cols, i, count);
73 
74  if (Pack1 >= 2 * PacketSize)
75  for (Index i = peeled_mc3; i < peeled_mc2; i += 2 * PacketSize) pack<2 * PacketSize>(blockA, lhs, cols, i, count);
76 
77  if (Pack1 >= 1 * PacketSize)
78  for (Index i = peeled_mc2; i < peeled_mc1; i += 1 * PacketSize) pack<1 * PacketSize>(blockA, lhs, cols, i, count);
79 
80  if (HasHalf && Pack1 >= HalfPacketSize)
81  for (Index i = peeled_mc1; i < peeled_mc_half; i += HalfPacketSize)
82  pack<HalfPacketSize>(blockA, lhs, cols, i, count);
83 
84  if (HasQuarter && Pack1 >= QuarterPacketSize)
85  for (Index i = peeled_mc_half; i < peeled_mc_quarter; i += QuarterPacketSize)
86  pack<QuarterPacketSize>(blockA, lhs, cols, i, count);
87 
88  // do the same with mr==1
89  for (Index i = peeled_mc_quarter; i < rows; i++) {
90  for (Index k = 0; k < i; k++) blockA[count++] = lhs(i, k); // normal
91 
92  blockA[count++] = numext::real(lhs(i, i)); // real (diagonal)
93 
94  for (Index k = i + 1; k < cols; k++) blockA[count++] = numext::conj(lhs(k, i)); // transposed
95  }
96  }
AnnoyingScalar conj(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:133
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
float real
Definition: datatypes.h:10
return int(ret)+1
char char char int int * k
Definition: level2_impl.h:374
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
@ size
Definition: GenericPacketMath.h:113
T type
Definition: GenericPacketMath.h:135
@ size
Definition: GenericPacketMath.h:139

References cols, conj(), i, int(), k, and rows.

◆ pack()

template<typename Scalar , typename Index , int Pack1, int Pack2_dummy, int StorageOrder>
template<int BlockRows>
void Eigen::internal::symm_pack_lhs< Scalar, Index, Pack1, Pack2_dummy, StorageOrder >::pack ( Scalar blockA,
const const_blas_data_mapper< Scalar, Index, StorageOrder > &  lhs,
Index  cols,
Index  i,
Index count 
)
inline
25  {
26  // normal copy
27  for (Index k = 0; k < i; k++)
28  for (Index w = 0; w < BlockRows; w++) blockA[count++] = lhs(i + w, k); // normal
29  // symmetric copy
30  Index h = 0;
31  for (Index k = i; k < i + BlockRows; k++) {
32  for (Index w = 0; w < h; w++) blockA[count++] = numext::conj(lhs(k, i + w)); // transposed
33 
34  blockA[count++] = numext::real(lhs(k, k)); // real (diagonal)
35 
36  for (Index w = h + 1; w < BlockRows; w++) blockA[count++] = lhs(i + w, k); // normal
37  ++h;
38  }
39  // transposed copy
40  for (Index k = i + BlockRows; k < cols; k++)
41  for (Index w = 0; w < BlockRows; w++) blockA[count++] = numext::conj(lhs(k, i + w)); // transposed
42  }
RowVector3d w
Definition: Matrix_resize_int.cpp:3

References cols, conj(), i, k, and w.


The documentation for this struct was generated from the following file: