Comments (15)
this seems to fix it:
function recursivecopy!(b::AbstractMultiScaleArray, a::AbstractMultiScaleArray)
@inbounds for i in eachindex(a.nodes)
recursivecopy!(b.nodes[i], a.nodes[i])
end
@inbounds for i in eachindex(a.values)
#recursivecopy!(b.values[i], a.values[i])
copyto!(b.values,a.values)
end
end
from multiscalearrays.jl.
What's the type of values? The better solution is just to add a dispatch to recursivecopy!
to that way it does copyto!
in this case.
from multiscalearrays.jl.
At that point its Float64’s
from multiscalearrays.jl.
If the values is an array of Float64 then this
’’’recursivecopy!(b.values[i], a.values[i])’’’
should dispatch on Float64’s
from multiscalearrays.jl.
oh, it should just be recursivecopy!(b.values, a.values)
.
from multiscalearrays.jl.
Ah, right.
Also: i tried to use namedTuples instead of an array of float64 but wasn’t sure if 1) it should work or 2) how to change the typeParsmetrization. Any quick ideas? Don’t want to waste your time though
from multiscalearrays.jl.
It should work the same way we have tuples working. If not, we'll need an example.
from multiscalearrays.jl.
this is what I am trying to do
struct scale1{B,V<:NamedTuple{Vararg{<:Array{<:Number}}},P,N<:Tuple{Vararg{<:AbstractMultiScaleArrayLeaf{<:Number}}}} <: AbstractMultiScaleArray{B}
nodes::N
values::V
end_idxs::Vector{Int}
params::P
end
so I can construct it with
s1A = construct(scale1, (deepcopy(t1), deepcopy(t2)), (a=0.1,b=2.0), [0.1,0.2])
where t1 and t2 are lower level nodes
But this gives type-error
from multiscalearrays.jl.
How does it give a type error? Where? I need an example.
from multiscalearrays.jl.
already when running the above definition of the struct:
TypeError: in Type, in parameter, expected Type, got Type{Vararg{#s37,N} where N where #s37<:(Array{#s36,N} where N where #s36<:Number)}
Stacktrace:
[1] top-level scope at none:0
from multiscalearrays.jl.
Closing, don't worry reg the named tuple question, I have to read up on how type parametrizations work. As always, thanks for the great package.
from multiscalearrays.jl.
So it had to do with the struct definition?
from multiscalearrays.jl.
yes. but I also realize I wanted the named tuple as an array for the values which have to be mutable for the ode solver so that doesnt work. I mostly thought it would be neat to be able to write things like
u[:energy] in the differential equations instead of e.g. u[3].
but named tuples are are immutable of course so that doesn't make sense. But I have what I need now I think. Thanks
from multiscalearrays.jl.
I'm working towards a solution: https://github.com/JuliaDiffEq/LabelledArrays.jl
from multiscalearrays.jl.
Oh, that would make it super pretty to write down the equations.
I remember Tom Breloff had this cool macro (I think it was called @with) so that if used you didn't even have to write A.second (he used if for structs) but you could just write second or :second and it would fill out the rest at compile time. I gues sone could do that for
@with a
that would turn
: second -> a[:second]
making it even prettier. This is awesome. I guess if you have the map between names and indicies the macro could do that right away too....
julia sure is amazing!
from multiscalearrays.jl.
Related Issues (20)
- Efficient broadcast iteration
- Package causing "unsatisfiable package requirements" error HOT 1
- Pictures HOT 1
- Solving a MultiScaleArrays which leafs contain additional information (e.g. celltype::Symbol) HOT 5
- Does this package overlap with HierarchicalMatrices.jl? HOT 16
- Stiff solvers cannot resize
- ERROR: UndefVarError: dims not defined using custom fields HOT 3
- Fast path for broadcasting with an array HOT 1
- Addat deleteat on a vector HOT 1
- All resize testing is disabled and broken
- Package compatibility caps
- Indexing Issues with MultiScaleArrays.jl on v0.7 HOT 3
- Register HOT 29
- add_node! not outputting expected result with integrator input HOT 1
- TagBot trigger issue HOT 6
- no stable docs
- Segfault on 1.10 due to invalid getrs! inputs
- Improve docstrings
- MultiScaleModels Profiling HOT 7
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 multiscalearrays.jl.