Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-14 Thread Scott T
The issue was that I wasn't storing the Spline2D directly, but rather a function which wrapped log10 calls around the arguments. Pulling these out into my type's call method and directly storing the Spline inside it works perfectly. Thanks! I guess the lesson here is just store the data inside

Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-13 Thread Scott T
That's a really nice solution, thanks. Scott On Thursday, 13 August 2015 22:19:35 UTC+1, Tim Holy wrote: There are several possible solutions, but one is to use the new custom serialization facilities to discard/recreate the interp_func when you save/load the object:

Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-13 Thread Kyle Barbary
Hi Scott, Dierckx.Spline2D is simply a type that holds Vectors of spline coefficients, so it should work with JLD like any other type (but I admit that I’m not that familiar with JLD). I’d probably do something like this: using Dierckx type LogPTGridEOS logP::LinSpace{Float64}

Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-13 Thread Scott T
Thanks Kyle - looks like the error I was getting from JLD was unrelated, as I just managed to save a Spline2D type with it. I'll try your approach. Nice to hear that I can drop the collect calls as well. Scott On Friday, 14 August 2015 00:15:06 UTC+1, Kyle Barbary wrote: Hi Scott,

[julia-users] What's the best way to cache a function generated from a type instance?

2015-08-13 Thread Scott T
Hi everyone, I'm wondering what the most Julian way to handle the following situation is. I know it can't be complicated, but am not quite sure how to go about it. I'm doing some simple interpolation using Dierckx.jl https://github.com/kbarbary/Dierckx.jl, getting densities of materials from

Re: [julia-users] What's the best way to cache a function generated from a type instance?

2015-08-13 Thread Tim Holy
There are several possible solutions, but one is to use the new custom serialization facilities to discard/recreate the interp_func when you save/load the object: https://github.com/JuliaLang/JLD.jl/blob/master/doc/jld.md#custom-serialization --Tim On Thursday, August 13, 2015 12:37:59 PM