-
Notifications
You must be signed in to change notification settings - Fork 42
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
Parametrized maps #172
Comments
|
Sorry if I am wrong, but here is what I am expecting.
For a time-dependent linear map, I tried:
What I am doing wrong? Actually
Regarding your question: I would like to perform composition, linear combination, concatenations, etc. operations on time-dependent operators. This would be helpful in manipulating linear time-varying dynamical systems of the form
I just started a new project. In this moment I not yet decided how to define a system object which contains the four matrices and can be easily used for further manipulations (e.g., series, parallel, diagonal, couplings). |
Don't worry, that's what we're all here for. Since using LinearMaps, LinearAlgebra
B = LinearMap(rand(2,2))
a(t) = [cos(t) sin(t); 1 -1]
A(t) = LinearMap((y,x) -> mul!(y, a(t), x), 2, 2; ismutating = true)
A(1)
A(1)*[1;1]
A(1)*B
(A(1)*B)*[1;1]
Awesome, this is music to my ears. I'd still recommend to take a look at https://diffeq.sciml.ai/stable/features/diffeq_operator/ or http://diffeqoperators.sciml.ai/stable/. So, in case you write your own type, you may want to consider subtyping to |
Actually I already used https://diffeq.sciml.ai/stable/features/diffeq_operator/ to implement the function for a particular integration method (Magnus' mthod). I think it will be possible to implement function matrices, as for example I am not sure, but I have the impression that each time-evaluation of the operator |
That's correct. Performancewise this will depend on how much effort it takes to evaluate Conversely, if you have rather fixed ways ("patterns") of combining some maps, you could create your own type for those specific combinations. (I'm making something up) struct SeriesCoupling{T,...} <: LinearMap{T}
A1::A
A2::AA
B1::B
C2::C
end and then write specific multiplication routines for it. Or struct SeriesCoupling{T,As <: NTuple{4,LinearMap} <: LinearMap{T}
maps::As
end Depends on how many patterns you will need. Note that matrix-based |
There is a new project in development, that does what I was considering to do here at some point: make |
Is any way to define linear maps depending on some parameters? For example, I would like to define a time-dependent map
A(t)
or even a mapA(t,p)
depending on time valuest
and some parameters inp
, to be used inDifferentialEquations.jl
to define the function asf(u,p,t) = A(t,p)*u
?The text was updated successfully, but these errors were encountered: