42 constexpr size_t dim = 4;
46 for (
size_t mu = 0;
mu < dim; ++
mu) {
47 for (
size_t nu = 0;
nu < dim; ++
nu) {
69 constexpr size_t dim = 4;
71 for (
size_t mu = 0;
mu < dim; ++
mu) {
72 for (
size_t nu = 0;
nu < dim; ++
nu) {
85 constexpr size_t dim = 4;
86 std::cout <<
"\nRicci tensor components:\n";
87 for (
size_t mu = 0;
mu < dim; ++
mu) {
88 for (
size_t nu = 0;
nu < dim; ++
nu) {
90 if (std::abs(val) < threshold)
92 std::cout << std::setw(10) << std::fixed << std::setprecision(6) << val <<
" ";
105 constexpr size_t dim = 4;
106 std::cout << name <<
" tensor components:\n";
107 for (
size_t mu = 0;
mu < dim; ++
mu)
108 for (
size_t nu = 0;
nu < dim; ++
nu) {
109 const T val = R(
mu,
nu);
110 if (std::abs(val) > T(1e-12)) {
111 std::cout << name <<
"[" <<
mu <<
"][" <<
nu <<
"] = " << val <<
"\n";
123 const std::string &name =
"Ricci") {
124 constexpr size_t dim = 4;
125 std::cout << name <<
" tensor components:\n";
126 for (
size_t mu = 0;
mu < dim; ++
mu)
127 for (
size_t nu = 0;
nu < dim; ++
nu) {
128 const T val = R(
mu,
nu);
129 if (std::abs(val) > T(1e-12)) {
130 std::cout << name <<
"[" <<
mu <<
"][" <<
nu <<
"] = " << val <<
"\n";
142 constexpr size_t dim = 4;
144 std::cout <<
"Ricci scalar R = " << R <<
"\n";
Numerical differentiation operators using SIMD.
Multi-dimensional tensor class with fixed rank and SIMD support.
Definition Tensor.hpp:25
void fill(K value)
Fill tensor with a constant value.
Definition Tensor.hpp:125
Computes the Ricci tensor and Ricci scalar from a 4D Riemann tensor.
Definition RicciTensor.hpp:26
static void print(const Tensor2D &R, const std::string &name="Ricci")
Prints only the non-zero components of the Ricci tensor.
Definition RicciTensor.hpp:104
static void print_ricci_scalar(const Tensor2D &Ricci, const tensorium::Tensor< T, 2 > &g_inv)
Computes and prints the Ricci scalar from the tensor and metric.
Definition RicciTensor.hpp:141
static void print(const Tensor2D &R, const tensorium::Tensor< T, 2 > &g_inv, const std::string &name="Ricci")
Prints non-zero components using both Ricci and inverse metric.
Definition RicciTensor.hpp:122
static void print_componentwise(const Tensor2D &R, T threshold=1e-12)
Prints the Ricci tensor components with optional zero threshold.
Definition RicciTensor.hpp:84
static double compute_ricci_scalar(const Tensor2D &Ricci, const tensorium::Tensor< T, 2 > &g_inv)
Computes the Ricci scalar curvature.
Definition RicciTensor.hpp:67
static tensorium::Tensor< T, 2 > contract_to_ricci(const Tensor4D &Riemann, const tensorium::Tensor< T, 2 > &g_inv)
Contracts a 4D Riemann tensor into the 2D Ricci tensor.
Definition RicciTensor.hpp:40
Definition BSSNAtildeTensor.hpp:10