You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, internal values cannot be extracted in all situations. Extracting interal values
161
-
works when indexing an object of type `eltype(entry)` with the
162
-
second key of the internal key pair appended to the first results in a scalar.
163
-
If the internal keys index to a non-scalar `Field`, a broadcasted object is returned.
158
+
Let key `(@name(name1), @name(name2))` correspond to entry `sample_entry` in `FieldMatrix``A`.
159
+
An example of this is:
164
160
165
-
When the entry is a `Field` of `Axis2Tensor`s, and both internal names are numbers that would index
166
-
an `Axis2Tensor` with the same axis.
167
-
168
-
This does not work when the internal keys index to a `Field` of sliced tensors.
169
-
170
-
Extracting internal values from a `DiagonalMatrixRow` works in all cases, except when
171
-
172
-
If the `FieldMatrix` represents a Jacobian, then extracting internal values works when an entry represents:
173
-
174
-
- The partial derrivative of an `AxisVector`, `Tuple`, or `NamedTuple` with respect to a scalar.
175
-
176
-
- The partial derrivative of a scalar with respect to an `AxisVector`.
177
-
178
-
- The partial derrivative of a `Tuple`, or `NamedTuple` with respect to an `AxisVector`. In this case, the first name of the internal key must index into the tuple and result in a scalar.
161
+
```julia
162
+
A = MatrixFields.FieldMatrix((@name(name1), @name(name2)) => sample_entry)
163
+
```
179
164
180
-
- The partial derrivative of an `AxisVector` with respect to an `AxisVector`. In this case, the partial derrivative of a component of the first `AxisVector` with respect to a component of the second `AxisVector` can be extracted, but not an entire `AxisVector` with respect to a component, or a component with respect to an entire `AxisVector`
165
+
Now consider what happens indexing `A` with the key `(@name(name1.foo.bar.buz), @name(name2.biz.bop.fud))`.
166
+
167
+
First, a function searches the keys of `A` for a key that `(@name(foo.bar.buz), @name(biz.bop.fud))`
168
+
is a child of. In this example, `(@name(foo.bar.buz), @name(biz.bop.fud))` is a child of
169
+
the key `(@name(name1), @name(name2))`, and
170
+
`(@name(foo.bar.buz), @name(biz.bop.fud))` is referred to as the internal key.
171
+
172
+
Next, the entry that `(@name(name1), @name(name2))` is paired with is recursively indexed
173
+
by the internal key.
174
+
175
+
The recursive indexing of an internal entry given some entry `entry` and internal_key `internal_name_pair`
176
+
works as follows:
177
+
178
+
1. If the `internal_name_pair` is blank, return `entry`
179
+
2. If each row of `entry` contains an `Axis2Tensor`, and `internal_name_pair` is of the form
180
+
`(@name(components.data.1...), @name(components.data.2...))` (potentially with different numbers),
181
+
then extract the specified component, and recurse on it with the remaining `internal_name_pair`. Note that if
182
+
`entry` is not a `DiagonalMatrixRow`, then `internal_name_pair` cannot slice the tensor.
183
+
3. If each row of `entry` is a `Geometry.AdjointAxisVector`, then recurse on the parent of the adjoint.
184
+
4. If `internal_name_pair[1]` is not empty, and the first name in it is a field of the element type of each row of `entry`,
185
+
extract that field from `entry`, and recurse on the it with the remaining names of `internal_name_pair[1]` and all of `internal_name_pair[2]`
186
+
5. If `internal_name_pair[2]` is not empty, and the first name in it is a field of the element type of each row of `entry`,
187
+
extract that field from `entry`, and recurse on the it with all of `internal_name_pair[1]` and the remaining names of `internal_name_pair[2]`
188
+
6. At this point, if none of the previous cases are true, both `internal_name_pair[1]` and `internal_name_pair[2]` should be
189
+
non-empty, and it is assumed that `entry` is being used to implicitally represent some tensor structure. If the first name in
190
+
`internal_name_pair[1]` is equivalent to ``internal_name_pair[2]`, then both the first names are dropped, and entry is recursed onto.
191
+
If the first names are different, both the first names are dropped, and the zero of entry is recursed onto.
192
+
193
+
When the entry is a `ColumnWiseBandMatrixField`, indexing it will return a broadcasted object in
194
+
the following situations:
195
+
196
+
1. The internal key indexes to a type different than the basetype of the entry
0 commit comments