32 assert(full.rows() == full.cols() &&
"Input matrix not quadratic");
34 for (
Index i = 0; i < full.rows(); ++i) {
35 for (
Index j = 0; j <= i; ++j) {
45 for (
Index j = 0; j <= i; ++j) {
58 assert(
data.size() == a.
data.size() &&
"Matrices do not have same size");
66 const Index start = (i * (i + 1)) / 2;
67 for (
Index j = 0; j < i; ++j) {
68 result += 2 *
data[start + j] * a.
data[start + j];
75 double factor)
const {
76 for (
Index j = 0; j < full.cols(); ++j) {
77 const Index start = (j * (j + 1)) / 2;
78 for (
Index i = 0; i <= j; ++i) {
79 full(i, j) += factor *
data[start + i];
82 for (
Index i = j + 1; i < full.rows(); ++i) {
91 Eigen::SelfAdjointView<Eigen::MatrixXd, Eigen::Upper>& upper,
92 double factor)
const {
93 for (
Index j = 0; j < upper.cols(); ++j) {
94 const Index start = (j * (j + 1)) / 2;
95 for (
Index i = 0; i <= j; ++i) {
96 upper(i, j) += factor *
data[start + i];
104 for (
Index j = 0; j < result.cols(); ++j) {
105 const Index start = (j * (j + 1)) / 2;
106 for (
Index i = 0; i <= j; ++i) {
107 result(i, j) =
data[start + i];
110 for (
Index i = j + 1; i < result.rows(); ++i) {
120 for (
Index j = 0; j < result.cols(); ++j) {
121 const Index start = (j * (j + 1)) / 2;
122 for (
Index i = 0; i <= j; ++i) {
123 result(i, j) =
data[start + i];
132 index = (i * (i + 1)) / 2 + j;
134 index = (j * (j + 1)) / 2 + i;
Index index(Index i, Index j) const
void AddtoEigenUpperMatrix(Eigen::SelfAdjointView< Eigen::MatrixXd, Eigen::Upper > &upper, double factor=1.0) const
Symmetric_Matrix()=default
double TraceofProd(const Symmetric_Matrix &a) const
Eigen::MatrixXd FullMatrix() const
double & operator()(Index i, Index j)
std::vector< double > data
void AddtoEigenMatrix(Eigen::MatrixXd &full, double factor=1.0) const
Eigen::MatrixXd UpperMatrix() const
Charge transport classes.
Provides a means for comparing floating point numbers.