differential_geometry.dense_utils.dense_compute_volume_element#
- differential_geometry.dense_utils.dense_compute_volume_element(metric_field: ndarray, metric_type: str) ndarray [source]#
Compute the volume element (√|det(g)|) from a metric tensor field.
- Parameters:
metric_field (
numpy.ndarray
) –The metric tensor field. Depending on metric_type, expected shape is:
”full”: shape (…, L, L), representing a full rank-2 metric tensor.
”diag”: shape (…, L), representing a diagonal metric tensor.
metric_type (
str
) – One of {“full”, “diag”}. Specifies whether the metric is full or diagonal.
- Returns:
A scalar field of shape (…), representing the volume element √|det(g)| at each point.
- Return type:
- Raises:
ValueError – If the input does not match the specified metric type or shape is invalid.