-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tensor_view function and show usage in 2D-1 benchmark example. #4
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
# Tensor Description | ||
|
||
To be able to construct [reshaped views](@ref "Reshaped views") | ||
of the test functions and their derivates, we can describe the | ||
shape of the view through a [`TensorDescription{R,D}`](@ref ExtendableFEM.TensorDescription{R,D}) | ||
where `R` is the *rank* of the tensor and `D` is the dimension | ||
or extent of the tensor in each of the `R` directions. | ||
That means a real valued `R`-tensor is an element of | ||
``\underbrace{\mathbb{R}^D\times\cdots\times\mathbb{R}^D}_{R \text{ times}}``. | ||
Specifically, we can identify the following mathematical objects with | ||
tensors of different ranks: | ||
|
||
| math. object | `R`-Tensor | | ||
| :------------------------------------------- | :--------- | | ||
| scalar ``\in\mathbb{R}`` | 0-Tensor | | ||
| vector ``\in\mathbb{R}^D`` | 1-Tensor | | ||
| matrix ``\in\mathbb{R}^D\times\mathbb{R}^D`` | 2-Tensor | | ||
|
||
For finite elements, `D` usually matches the spatial dimension of | ||
the problem we want to solve, i.e. `D=2` for 2D and `D=3` for 3D. | ||
|
||
## Tensor Types | ||
|
||
```@docs | ||
ExtendableFEM.TensorDescription | ||
ExtendableFEM.TDScalar | ||
ExtendableFEM.TDVector | ||
ExtendableFEM.TDMatrix | ||
ExtendableFEM.TDRank3 | ||
ExtendableFEM.TDRank4 | ||
``` | ||
|
||
|
||
## Reshaped views | ||
|
||
```@autodocs | ||
Modules = [ExtendableFEM] | ||
Pages = ["tensors.jl"] | ||
Order = [:function] | ||
``` | ||
|
||
## Which tensor for which unknown? | ||
For an unknown variable `u` of tensor rank `r` | ||
a derivative of order `n` has rank `r+n`, | ||
i.e. the hessian (n=2) of a scalar unknown (rank 0) | ||
and the gradient (n=1) of a vector valued (rank 1) | ||
variable are both matrices (rank 2). | ||
|
||
For a more comprehensive list see the following table | ||
|
||
| derivative order | scalar-valued | vector-valued | matrix-valued | | ||
| :----------------- | :--------------- | :----------------------- | :----------------------- | | ||
| 0 (value/`id`) | `TDScalar(D)` | `TDVector(D)` | `TDMatrix(D)` | | ||
| 1 (`grad`) | `TDVector(D)` | `TDMatrix(D)` | `TDRank3(D)` | | ||
| 2 (`hessian`) | `TDMatrix(D)` | `TDRank3(D)` | `TDRank4(D)` | | ||
| 3 | `TDRank3(D)` | `TDRank4(D)` | `TensorDescription(5,D)` | | ||
| 4 | `TDRank4(D)` | `TensorDescription(5,D)` | `TensorDescription(6,D)` | | ||
| ``\vdots`` | ``\vdots`` | ``\vdots`` | ``\vdots`` | | ||
|
||
|
||
|
||
## Helpers | ||
|
||
|
||
```@docs | ||
tmul! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If think you look for
LinearAlgebra.BLAS.gemv!('T', alpha, A, x, beta, y)
? It does not to any allocations in my tests.