Skip to content

Commit bd134c8

Browse files
author
Martin D. Weinberg
committed
Use slices when possible rather than element-by-element assignment
1 parent e37e26d commit bd134c8

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

expui/BiorthBasis.H

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ namespace BasisClasses
273273
return varray;
274274
}
275275

276+
//!! Sample counts, masses, coefficients, and covariance
277+
SubsampleCovariance::CovarData getCoefCovariance(double time)
278+
{ return covarStore->getCoefCovariance(time); }
279+
276280
//! Write coefficient covariance data to an HDF5 file
277281
virtual void writeCoefCovariance(const std::string& compname, const std::string& runtag,
278282
double time=0.0)

exputil/EmpCylSL.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,6 +4965,7 @@ EmpCylSL::getCoefCovariance()
49654965
std::get<0>(ret) = Eigen::Tensor<std::complex<double>, 3>(sampT, MMAX+1, NMAX);
49664966
std::get<1>(ret) = Eigen::Tensor<std::complex<double>, 4>(sampT, MMAX+1, NMAX, NMAX);
49674967

4968+
/*
49684969
for (unsigned T=0; T<sampT; T++) {
49694970
for (int M=0; M<=MMAX; M++) {
49704971
for (int n1=0; n1<NMAX; n1++) {
@@ -4974,6 +4975,15 @@ EmpCylSL::getCoefCovariance()
49744975
}
49754976
}
49764977
}
4978+
*/
4979+
4980+
for (unsigned T=0; T<sampT; T++) {
4981+
for (int M=0; M<=MMAX; M++) {
4982+
std::get<0>(ret).chip(T, 0).chip(M, 0) = Eigen::TensorMap<Eigen::Tensor<std::complex<double>, 1>>(VC[0][T][M].data(), NMAX);
4983+
std::get<1>(ret).chip(T, 0).chip(M, 0) = Eigen::TensorMap<Eigen::Tensor<std::complex<double>, 2>>(MV[0][T][M].data(), NMAX, NMAX);
4984+
}
4985+
}
4986+
49774987
}
49784988

49794989
return ret;

src/Cube.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ PotAccel::CovarData Cube::getSubsample()
10401040

10411041
// Fill the covariance structure with subsamples
10421042
for (int T=0; T<sampT; T++) {
1043+
/*
10431044
for (int n1=0; n1<osize; n1++) {
10441045
std::get<2>(elem)(T, 0, n1) = meanV[T](n1);
10451046
for (int n2=0; n2<osize; n2++)
@@ -1048,6 +1049,16 @@ PotAccel::CovarData Cube::getSubsample()
10481049
else
10491050
std::get<3>(elem)(T, 0, n1, n2) = 0.0;
10501051
}
1052+
*/
1053+
1054+
std::get<2>(elem).chip(T, 0).chip(0, 0) =
1055+
Eigen::TensorMap<Eigen::Tensor<std::complex<double>, 1>>
1056+
(meanV[T].data(), osize);
1057+
1058+
std::get<3>(elem).chip(T, 0).chip(0, 0) =
1059+
Eigen::TensorMap<Eigen::Tensor<std::complex<double>, 2>>
1060+
(covrV[T].data(), osize, osize);
1061+
10511062
}
10521063

10531064
return elem;

0 commit comments

Comments
 (0)