> For the complete documentation index, see [llms.txt](https://applied-physics.gitbook.io/warp-factory/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://applied-physics.gitbook.io/warp-factory/modules/analyzer-module/changetensorindex.md).

# changeTensorIndex

## Description

The index of the tensors can be changed using raising and lowering operations.

<details>

<summary>Metric Tensor</summary>

The metric tensor can be in either covariant or contravariant form, this is transformed between each by doing a matrix inverse transformation.

</details>

<details>

<summary>Stress-energy Tensor</summary>

The stress-energy tensor can be either covariant, contravariant or a mixed-form. Transformations for covariant or contravariant are just raising/lowering operations given as:

$$T^{\mu\nu} = g^{\mu\alpha} g^{\nu\beta} T\_{\alpha \beta}$$ or $$T\_{\mu\nu} = g\_{\mu\alpha} g\_{\nu\beta} T^{\alpha \beta}$$

Likewise, the mixed form is found by:

$$T^{\mu}*{\ \ \nu} = g^{\mu\alpha} T*{\alpha \nu}$$&#x20;

</details>

## Method

The index-changing operations occur at each point in the spacetime doing the index summations for the stress-energy tensor or inverse operations on the metric tensor.

## Syntax

`[`<mark style="color:green;">`outputTensor`</mark>`] = changeTensorIndex(`<mark style="color:blue;">`inputTensor`</mark>`,`` `<mark style="color:blue;">`index`</mark>`,`` `<mark style="color:orange;">`metricTensor`</mark>`)`

### Input Arguments

{% hint style="info" %} <mark style="color:blue;">blue</mark> are required inputs.

<mark style="color:orange;">orange</mark> are optional inputs with native default values.
{% endhint %}

<table><thead><tr><th width="182">Inputs</th><th width="94">Format</th><th width="85">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>inputTensor</code></mark> </td><td>struct</td><td>object</td><td>Input tensor, metric if transforming the metric or stress-energy tensor. <strong>If a stress-energy tensor object is an input, then the </strong><mark style="color:orange;"><strong><code>metricTensor</code></strong></mark><strong> is required as an input.</strong></td></tr><tr><td><mark style="color:blue;"><code>index</code></mark> </td><td>1x1 array</td><td>string</td><td>The selected target index. Can be either: "<em>covariant</em>", "<em>contravariant</em>" for both the metric or stress-energy tensor. If transforming a stress-energy tensor then "<em>mixedupdown</em>", "<em>mixeddownup</em>". index transformations can also be done, <strong>but only on the stress-energy tensor</strong>. </td></tr><tr><td><mark style="color:orange;"><code>metricTensor</code></mark></td><td>struct</td><td>object</td><td>Metric tensor object. <strong>This</strong> <strong>is</strong> <strong>only needed if transforming the stress-energy tensor index, which is input in </strong><mark style="color:blue;"><strong><code>inputTensor</code></strong></mark> .</td></tr></tbody></table>

### Output Arguments

<table><thead><tr><th width="176">Outputs</th><th width="94.33333333333331">Format</th><th width="81">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>outputTensor</code></mark></td><td>struct</td><td>object</td><td>Returns tensor with new index, can be either metric or stress-energy depending on <mark style="color:blue;"><code>inputTensor</code></mark> .</td></tr></tbody></table>
