Comments (7)
Do you mean when b
is a matrix? For me the program stops because of KrylovSubspace
(not dot
), which would require some change in the internals.
julia> x = rand(20,20); A = rand(20,20); b = rand(20,20);
julia> cg(A,b)
ERROR: DimensionMismatch("dimensions must match")
in promote_shape at ./operators.jl:211
julia> cg!(x,A,b)
ERROR: MethodError: `init!` has no method matching init!(::IterativeSolvers.KrylovSubspace{Float64,Array{Float64,2}}, ::Array{Float64,2})
Closest candidates are:
init!{T}(::IterativeSolvers.KrylovSubspace{T,OpT}, ::Array{T,1})
from differentialequations.jl.
Yes, that's the error which stops it from working. Either cg
needs to be changed in IterativeSolvers, or an alternative version needs to be implemented just for this.
from differentialequations.jl.
I don't really know what the future plan for KrylovSubspace
should be for handling matrices.
from differentialequations.jl.
Now that I think about, if I'm not mistaken, this can just be done with a comprehension over the iterative solvers. For example, when solving AX=B
with X
a matrix, the values of X[i,:]
only depend on B[i,:]
(think about the way it multiplies). So actually this is just shorthand for n
independent Ax=b problems, where the A
happens to be the same each time. So a comprehension or loop over the columns with cg
calls solves it.
(Would there be any efficiency gains by handling it somewhat similarly inside the cg
loop? I can't see a reason why there would be)
Should there be type annotation on the b
and x
in cg
then to clarify that it's for vectors? And would this wrapper for matrices be welcomed in IterativeSolvers.jl itself, or should I make it and keep it here?
from differentialequations.jl.
Does the stopping criteria change for matrices? Yeah what you are saying could be done easily in a patch, but at the moment the pull request are merging slowly (might take some time).
from differentialequations.jl.
I think the stopping criteria can be done either way. Theoretically there is none so it's just what's practical. In practice, by doing a loop over cg
it will go until the tolerance is satisfied for each, whereas if it was implemented in the loop it could check the convergence of the whole B-AX
in some suitable norm. By the Triangle Inequality the second form would be a weaker condition, though one could always adjust the tolerances to account for it.
However, in the case of PDEs it may be more practical to allow the different columns to have the errors/tolerances applied separately because they may differ vastly in their values (one case where this may come up is a PDE where the components are kept in the columns of X
, but some substances have much higher values, and thus would dominate the norm allowing for a lot of error in the other values. This could be terrible in cases where relative tolerance dominates).
from differentialequations.jl.
It works. However, I wasn't able to use views, so it has some extra allocations. Noted in #33
from differentialequations.jl.
Related Issues (20)
- LoadError: TypeError: in setfield! HOT 1
- oneunit(::Type{Any} HOT 1
- Failed to precompile LoadError: UndefVarError: `OperatorAssumptions` not defined HOT 2
- ImplicitEuler fails to solve a nonlinear spring-damper problem HOT 5
- Plotting ODESolution using plot(sol) fails when using ODEFunction in combination with 'syms' keyword HOT 4
- SciML UDE tutorial code breaks in Julia 1.10 HOT 1
- StackOverflowError when passing tuple of parameters containing an `ODESolution` HOT 3
- Type-instability when using nested structs HOT 2
- I/O: Example of interface to `IterableTables` errors when trying to predefine column names HOT 1
- Unable to get full matrix whose columns is the solution to an ODE with newer version of RecursiveArrayTools. HOT 2
- Unexpected behavior with `PresetTimeCallback`
- Type-instability arising from initial condition HOT 5
- Error in ContinuousCallback event handling HOT 1
- autodiff in default algorithm HOT 5
- Seems idxs not working for EnsembleSummary plot HOT 2
- DAE with continuous callback and `DImplicitEuler` results in incorrect `integrator.u` in `affect!()`
- Failed to precompile BoundaryValueDiffEq HOT 2
- Alignment between “Recommended Methods” and the polyalgorithms HOT 3
- tstops should give meaningful error if given duals
- Permit setting `seed` for multiple stochastic ensemble simulations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from differentialequations.jl.