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
Add a function to convert a FieldMatrix where each matrix entry
has an eltype of some struct into a FieldMatrix where each entry
has an eltype of a scalar.
Add additional tests for scalar_matrixfields
Use @test_all in tests
Make suggested changes to tests and field_name_dict.jl
Revert unrolled_findfirst
Clean up field matrix tests and add support for DiagonalMatrixRows
CamelCase struct name
Clean up tests and get_scalar_keys
wip backup
Minimal working with allocs
WIP1
WIP more allocs fix
Assorted cleanup
Fix dx/dx case
reduce code duplication; fix example
Add gpu test
further cleanup, extend diagonalrow
fix names test and comments
Add docs
docs bugfix
remvoe bad refs
fix docs formatting
Copy file name to clipboardExpand all lines: docs/src/matrix_fields.md
+80Lines changed: 80 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,10 @@ preconditioner_cache
89
89
check_preconditioner
90
90
lazy_or_concrete_preconditioner
91
91
apply_preconditioner
92
+
get_scalar_keys
93
+
get_field_first_index_offset
94
+
broadcasted_get_field_type
95
+
inner_type_ignore_adjoint
92
96
```
93
97
94
98
## Utilities
@@ -98,4 +102,80 @@ column_field2array
98
102
column_field2array_view
99
103
field2arrays
100
104
field2arrays_view
105
+
scalar_fieldmatrix
101
106
```
107
+
108
+
## Indexing a FieldMatrix
109
+
110
+
A FieldMatrix entry can be:
111
+
112
+
- An `UniformScaling`, which contains a `Number`
113
+
- A `DiagonalMatrixRow`, which can contain aything
114
+
- A `ColumnwiseBandMatrixField`, where each row is a [`BandMatrixRow`](@ref) where the band element type is representable with the space's base number type.
115
+
116
+
If an entry contains a composite type, the fields of that type can be extracted.
Currently, internal values cannot be extracted in all situations. Extracting interal values
163
+
works when:
164
+
165
+
- The second name in the internal key is empty, and the first name in the internal key accesses internal values for the type of element contained in each row of the entry. This does not work when the element type of each row is a 2d tensor.
166
+
167
+
- The first name in the internal key is empty, and the type of element contained in each row of the entry is an `AxisVector` or the adjoint of an `AxisVector`. In this case, the second name must access inernal values for the type of `AxisVector` contained in each row.
168
+
169
+
- The element type of each row in the entry is a 2d tensor, and the internal key is of the form `(@name(components.data.:(1)), @name(components.data.:(2)))`, but possibly with different numbers to index into the 2d tensor
170
+
171
+
- The element type of each row in the entry is some number of nested `Tuple`s and `NamedTuple`s, and the first name in the internal key accesses an `AxisVector` or the adjoint of an `AxisVector` from the outer `Tuple`/`NamedTuple`, and the second name in the inernal key accesses a component of the `AxisVector`
172
+
173
+
If the `FieldMatrix` represents a Jacobian, then extracting internal values works when an entry represents:
174
+
175
+
- The partial derrivative of an `AxisVector`, `Tuple`, or `NamedTuple` with respect to a scalar.
176
+
177
+
- The partial derrivative of a scalar with respect to an `AxisVector`.
178
+
179
+
- 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.
180
+
181
+
- 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`
0 commit comments