[julia-users] Re: Maps in Julia?

2016-09-11 Thread Spencer Lyon
Maybe PlotlyJS.jl can provide the mapping functionality you need? It allows you to create chloropleth maps as well as scatter plots (line, bubble, or dots) on top of maps.

[julia-users] http://quant-econ.net/jl/linear_algebra.html

2016-05-18 Thread Spencer Lyon
Thanks for letting us know about the broken link. I'll be travelling today, but will get this fixed up tomorrow and the fix will be included the next time we publish the site.

Re: [julia-users] ANN: PlotlyJS.jl

2016-03-11 Thread Spencer Lyon
er-clever? > > Best, > --Tim > > On Friday, March 11, 2016 08:18:14 AM Spencer Lyon wrote: > > New package announcement. I've just registered PlotlyJS.jl with > metadata. > > The package leverages the plotly.js javascript library to provide a >

[julia-users] ANN: DSGE.jl

2015-12-03 Thread Spencer Lyon
The Federal Reserve bank of New York has finished moving their fairly large DSGE model from Matlab to Julia. This model is used inside the Fed for forecasting and policy analysis. As part of the move to Julia, the code base has been open sourced. A blog post announcing the release is here:

Re: [julia-users] ANN: DSGE.jl

2015-12-03 Thread Spencer Lyon
Ahh nice, You found the draft of our next post ;) Good point about matlab.jl. we did make heavy use of that when transitioning to julia.

Re: [julia-users] julian style for assignments in a try block?

2015-09-03 Thread Spencer Lyon
Another one would be to call local t, data just before the try block, though I like Matt’s better. On Thursday, September 3, 2015 at 5:21:31 PM UTC-4, Spencer Russell wrote: Ah yes. That works. Good idea, thanks for the tip. > > -s > > > On Thu, Sep 3, 2015, at 05:12 PM, Mike Innes

[julia-users] Re: Multidimensional linear extrapolation on irregular grid

2015-08-31 Thread Spencer Lyon
It's not quite ready for public consumption, which is why it isn't released in metadata yet, but you can look at https://github.com/spencerlyon2/CompEcon.jl. It works quite well, but the API isn't totally fleshed out yet. This has support for an arbitrary number of dimensions. If you do want

[julia-users] Re: Multidimensional linear extrapolation on irregular grid

2015-08-31 Thread Spencer Lyon
Yep, constructing a 1d interpoland is about the same as constructing a 6d one! On Monday, August 31, 2015 at 8:26:34 AM UTC-4, Nils Gudat wrote: > > Sounds interesting, I'd definitely give it a go! I'd be doing 3 to 6 > dimensional interpolation, but I'm sure a 3D example would scale up

[julia-users] Re: Multidimensional linear extrapolation on irregular grid

2015-08-31 Thread Spencer Lyon
Reach out of you need help! And, just a minor clarification, the interpolation bits are in the CompEcon (not QuantEcon) repo. Eventually they will probably make there way under the QuantEcon umbrella, but they aren't quite polished enough. Sorry for the unfortunate similarity between the

Re: [julia-users] Re: ANN: JuliaDiff -- differentiation tools in Julia

2015-08-26 Thread Spencer Lyon
It would be awesome to get this under AD.  I'm not sure I follow with how to get DF(y) at each output point. Can you provide a quick example (made up data is totally fine)? Thanks // Spencer On August 25, 2015 at 4:15:28 PM EDT, Christoph Ortner christophortn...@gmail.com wrote:In this case

[julia-users] Re: ANN: JuliaDiff -- differentiation tools in Julia

2015-08-25 Thread Spencer Lyon
Thanks Cristoph. You are totally right that my problem is a different class of problem than what the packages within JuliaDiff are designed to solve. That being said, I had a hunch that members of the JuliaDiff community might have a bit more expertise than my for my particular problem! About

Re: [julia-users] Re: ANN: JuliaDiff -- differentiation tools in Julia

2015-08-25 Thread Spencer Lyon
Hey Mauro, That’s right. The ODE solver does give me the first derivative. The problem is that I need the first two derivatives! So what I’ve done to test all my numerical tools for accuracy is to compare the approximated first derivative with the actual one given my by the ODE solver. That’s

[julia-users] Re: ANN: JuliaDiff -- differentiation tools in Julia

2015-08-24 Thread Spencer Lyon
Probably the wrong place to post this, but I couldn't find a julia-diff list :) I'm having stability issues computing the derivative of functions I only know on (non-uniform) grids. For example, I have a grid of x (I can't choose this) and the associated values of y = f(x). I've tried a few

[julia-users] Re: What am I doing wrong when using QuantEcon's ARMA type?

2015-08-17 Thread Spencer Lyon
The problem here is that the third argument is actually not the variance of epsilon, but rather the standard deviation (see docs http://quantecon.github.io/QuantEcon.jl/api/QuantEcon/#type__arma.1): julia ρ = 0.8; julia σ_ϵ = 0.03; julia theoretical_variance = σ_ϵ^2/(1 - ρ^2) # change from

[julia-users] Re: What am I doing wrong when using QuantEcon's ARMA type?

2015-08-17 Thread Spencer Lyon
Great point, that is definitely a typo in the docs. I'll fix that now. Thanks! On Monday, August 17, 2015 at 8:38:43 AM UTC-4, Nils Gudat wrote: Ah, I should have checked the docs more closely. I was confused because I went by the fields listed in the type defintion of ARMA (e.g. here in the

[julia-users] Re: How has the behavior of include/require etc. changed in 0.4?

2015-08-15 Thread Spencer Lyon
Great point. Definitely looks like a docstring error here. I was speaking somewhat off topic. What I had in mind was the proposed solution in the link to the other github issue (https://github.com/QuantEcon/QuantEcon.jl/issues/64#issuecomment-130149602). Here for some reason I could call

[julia-users] Re: How has the behavior of include/require etc. changed in 0.4?

2015-08-15 Thread Spencer Lyon
Hmm. Too bad it didn't fix all the problems! I would guess you are hitting some strange bug in the automatic pre-compilation mechanism recently merged into Julia master. Disclaimer: this is all unfounded speculation, but here are my thoughts on what might be happening. It seems that until

[julia-users] Re: How has the behavior of include/require etc. changed in 0.4?

2015-08-14 Thread Spencer Lyon
We saw problems trying to load on very recent master the other day. I was able to fix it using the steps outlined here: https://github.com/QuantEcon/QuantEcon.jl/issues/64#issuecomment-130149602. Can you give that a try and report back? On Friday, August 14, 2015 at 3:34:51 PM UTC-4, Nils

Re: [julia-users] John L. Gustafson's UNUMs

2015-07-29 Thread Spencer Lyon
I'll keep an eye on it and potentially pitch in! On Wednesday, July 29, 2015 at 12:47:07 PM UTC-4, Tom Breloff wrote: If anyone wants to follow, comment, or contribute: https://github.com/tbreloff/Unums.jl On Wed, Jul 29, 2015 at 12:01 PM, Job van der Zwan j.l.van...@gmail.com javascript:

[julia-users] Re: Irregular Interpolation

2015-07-29 Thread Spencer Lyon
It's currently going through a major overhaul to get ready for public consumption, but CompEcon.jl https://github.com/spencerlyon2/CompEcon.jl provides a Julia implementation of the popular (amongst economists) CompEcon matlab toolbox. It does irregular interpolation for an arbitrary number

Re: [julia-users] John L. Gustafson's UNUMs

2015-07-29 Thread Spencer Lyon
I would love to read a summary.  I don't think I have time to read the whole book AND contribute, but I might be able to find time to read a summary and contribute.  // Spencer BTW, Tom, I was already working on a summary of the book (on an IJulia notebook). I'm on mobile right now so

[julia-users] Re: Atom package

2015-06-12 Thread Spencer Lyon
John, Do you have create permissions within the JuliaLang github org? If not, who should we contact to create the repo/set up permissions? I guess I could just request that my repo be transferred to the organization, but I'd want whoever gets that message to have a heads up.

Re: [julia-users] Re: Atom package

2015-06-12 Thread Spencer Lyon
I've been wondering the same. I don't think it would be too difficult to hook Lint.jl up

Re: [julia-users] Re: Atom package

2015-06-12 Thread Spencer Lyon
Excellent. Thank you. I've been traveling all day, but will push the code within the next 24 hours. I have some experimental ideas implemented right now so my initial push will probably be accompanied by some pull requests to get comments from other users.

[julia-users] Re: Atom package

2015-06-11 Thread Spencer Lyon
. The important thing is that the package is named language-julia, not the repo.On Thursday, June 11, 2015 at 8:05:20 PM UTC-7, Spencer Lyon wrote:Good to see something for atom-language-julia. That is what the package was named originally, but it wasn't maintained so it was forked and renamed

[julia-users] Re: Atom package

2015-06-11 Thread Spencer Lyon
Good to see something for atom-language-julia. That is what the package was named originally, but it wasn't maintained so it was forked and renamed language-julia. I don't think there will really be any reusable components. I just dont know another editor/tool that uses textmate style grammar

[julia-users] Atom package

2015-06-10 Thread Spencer Lyon
Right now the atom package for adding syntax highlighting for Julia is https://github.com/tpoisot/language-julia Based on issues like this one (https://github.com/tpoisot/language-julia/issues/8) it seems like the grammar.cson is incorrect. I did a fresh restart of the grammar based on the

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-07 Thread Spencer Lyon
and the constructors chapters to get a good understanding). andrew On Saturday, 19 April 2014 21:50:05 UTC-3, Spencer Lyon wrote: Say I have a type that defines a model. Something like this: abstract Model type Results # Details not shown here end type IFP{T : FloatingPoint} : Model

[julia-users] Re: Question about how to use uninitialized fields for Composite type

2015-05-07 Thread Spencer Lyon
On Thursday, May 7, 2015 at 4:17:20 PM UTC-4, Spencer Lyon wrote: Uninitialized fields need to be declared last because the way you construct an incompletely initialized type is to call `new` with less than the total number of fields. Then, elsewhere (preferably via a function call later

[julia-users] Cartesian: have @nexprs (or other macro) generate arithmetic expression instead of many isolated expressions

2015-05-07 Thread Spencer Lyon
Consider the following expression: julia macroexpand(:(@nexprs 3 j-(out[r, ix] *= z[r, i_{3-j+1}]) )) quote out[r,ix] *= z[r,i_3] out[r,ix] *= z[r,i_2] out[r,ix] *= z[r,i_1] end What I would really like to be able to do is have a macro generate the expression julia ... some magic

Re: [julia-users] Cartesian: have @nexprs (or other macro) generate arithmetic expression instead of many isolated expressions

2015-05-07 Thread Spencer Lyon
, 2015 09:03:08 AM Spencer Lyon wrote: Consider the following expression: julia macroexpand(:(@nexprs 3 j-(out[r, ix] *= z[r, i_{3-j+1}]) )) quote out[r,ix] *= z[r,i_3] out[r,ix] *= z[r,i_2] out[r,ix] *= z[r,i_1] end What I would really like to be able to do

[julia-users] Re: performance puzzle: linux vs osx

2015-05-01 Thread Spencer Lyon
fast Julia on OS X again! On Thursday, April 30, 2015 at 12:10:37 PM UTC-4, Spencer Lyon wrote: Thanks for the tip. I rebuilt my docker image to have a 1-day old master and am getting the same results (see updated gist). So, unfortunately the puzzle isn't resolved yet... On Wednesday

[julia-users] Re: performance puzzle: linux vs osx

2015-04-30 Thread Spencer Lyon
Thanks for the tip. I rebuilt my docker image to have a 1-day old master and am getting the same results (see updated gist). So, unfortunately the puzzle isn't resolved yet... On Wednesday, April 29, 2015 at 4:50:03 PM UTC-4, Spencer Lyon wrote: I ran into strange performance issues

[julia-users] performance puzzle: linux vs osx

2015-04-29 Thread Spencer Lyon
I ran into strange performance issues in an algorithm I have been working on. I have a test case as well as some timing and profiler results at this gist: https://gist.github.com/spencerlyon2/d21d6368a2ccbf6f1e7b I summarize the issues here. Consider the following code (note I am defining

[julia-users] Re: derivatives of Chebyshev polynomials

2015-04-04 Thread Spencer Lyon
I have a function that will compute the derivative matrix operator that transforms coefficients of a Chebyshev interpolant on interval [a, b] of degree n (so n+1 total Chebyshev basis functions T_0, T_1, … T_n) into the coefficients of a degree n-1 chebyshev interpolant on [a, b] that is the

[julia-users] Re: derivatives of Chebyshev polynomials

2015-04-04 Thread Spencer Lyon
Oh I forgot to say how to use it. If c are your coefficients for a degree n interpolant on [a, b] then the coefficients of the derivative of that interpolant are der_matrix(n, a, b) * c On Saturday, April 4, 2015 at 11:39:49 PM UTC-4, Spencer Lyon wrote: I have a function that will compute

[julia-users] Re: How to generate composite types with a macro?

2015-03-10 Thread Spencer Lyon
Seems like you have a good answer already, but for what it’s worth I have the following code in a package I’m developing: # Some helpful typealiases to keep things tidy typealias SymExpr Union(Symbol, Expr) typealias VecSymExpr Union(Vector{Symbol}, Vector{Expr}) # Take a name and type and

Re: [julia-users] Re: Tensor-product function for multidimensional arrays (2 dims)

2015-02-23 Thread Spencer Lyon
22, 2015 12:32:34 AM Viral Shah wrote: Best to file an issue. -viral On Sunday, February 22, 2015 at 12:52:17 PM UTC+5:30, Spencer Lyon wrote: Bump on this thread. I need this functionality again... On Friday, December 6, 2013 at 11:04:44 AM UTC-5, Spencer Lyon wrote

[julia-users] Re: Tensor-product function for multidimensional arrays (2 dims)

2015-02-21 Thread Spencer Lyon
Bump on this thread. I need this functionality again... On Friday, December 6, 2013 at 11:04:44 AM UTC-5, Spencer Lyon wrote: I am working with tensors with more than 2 dimensions. I would like to find a Julia equivalent to the numpy function tensordot. The docstring for the function

Re: [julia-users] Re: Is there a julia user group in New York area?

2015-01-06 Thread Spencer Lyon
I live in NYC and will be back in a few weeks. Happy to meet up. Also interested in a meetup. On Tuesday, January 6, 2015 2:38:02 PM UTC-7, Stefan Karpinski wrote: I'm actually planning on jump-starting this and having the first meetup in late January (I'll be giving the first talk). I've

[julia-users] How does the colon actually get parsed in array indexing?

2014-11-13 Thread Spencer Lyon
I am trying to construct a type with this definition: # are two ranges disjoint? isdisjoint(r1::UnitRange, r2::UnitRange) = isempty(intersect(r1, r2)) # are a collection of ranges all disjoint? function all_disjoint(rs::UnitRange...) n = length(rs) for i=1:n, j=i+1:n if

[julia-users] Re: How does the colon actually get parsed in array indexing?

2014-11-13 Thread Spencer Lyon
would like to make this general enough to support time-invaraint matrices F, V, G, W, but if one or more matrices happen to be constant, I don’t want the user to have to worry about specifying for which time periods the matrices apply. On Thursday, November 13, 2014 10:24:44 AM UTC-5, Spencer Lyon

[julia-users] Re: How does the colon actually get parsed in array indexing?

2014-11-13 Thread Spencer Lyon
UTC-5, Spencer Lyon wrote: I am trying to construct a type with this definition: # are two ranges disjoint? isdisjoint(r1::UnitRange, r2::UnitRange) = isempty(intersect(r1, r2)) # are a collection of ranges all disjoint? function all_disjoint(rs::UnitRange...) n = length(rs) for i=1:n

[julia-users] Questions. Abstract or composite with no fields

2014-11-11 Thread Spencer Lyon
What are the differences/advantages of following: ``` # 1 abstract MyType #2 type MyType end ``` Is there any reason to prefer one over the other?

[julia-users] equivalent to `import` or `using` for loading package only on one process

2014-10-22 Thread Spencer Lyon
I am doing some numerical work and then plotting some results. I really don’t need to load the plotting packages on all processes that are used to do the computation. Is there a way to execute import or using on one process only? I have tried include(joinpath(Pkg.dir(PackageName),

[julia-users] Re: equivalent to `import` or `using` for loading package only on one process

2014-10-22 Thread Spencer Lyon
typo in my hacky function. Should have written include(joinpath(Pkg.dir(PackageName), src, PackageName.jl)) On Wednesday, October 22, 2014 11:33:11 AM UTC-4, Spencer Lyon wrote: I am doing some numerical work and then plotting some results. I really don’t need to load the plotting packages

[julia-users] Re: Bug in deserialize?

2014-10-18 Thread Spencer Lyon
Thanks, I hadn't seen that issue yet. I'm curious why loading color would cause this. I didn't losd it directly, but I precompile gadfly which causes color to be precompiled also. Could that have the same effect as loading color?

Re: [julia-users] ANN: QuantEcon.jl

2014-10-08 Thread Spencer Lyon
, I'd like to write my code in a way that chooses the better option in each iteration, but at the moment I'm stumped as for how to figure out which situation suits which routine. Thanks! On Saturday, September 20, 2014 1:06:41 AM UTC+1, Spencer Lyon wrote: Hi David, Thanks for the questions

Re: [julia-users] ANN: QuantEcon.jl

2014-10-08 Thread Spencer Lyon
That’s great! One more tip. If you know that the integration bounds are going to be constant over certain iterations (which is likely given that you are doing value function iteration), it helps performance significantly if you precompute the nodes and weights before the iterations begin,

Re: [julia-users] ANN: QuantEcon.jl

2014-10-08 Thread Spencer Lyon
Oh ok. Yeas, the helper function is just that: a helper to reduce repetitive code. It should have no impact on performance. On Wednesday, October 8, 2014 11:27:55 AM UTC-4, Nils Gudat wrote: I do have changing bounds unfortunately, so I'm stuck with computing the nodes and weights each

Re: [julia-users] ANN: QuantEcon.jl

2014-10-08 Thread Spencer Lyon
Right now we don’t have any documentation specific to QuantEcon.jl. We are waiting for this issue https://github.com/JuliaLang/julia/issues/8514 to be closed in the main Julia repo so that we can have a more stable backend for generating documentation. All the functionality from QuantEcon.py

Re: [julia-users] ANN: QuantEcon.jl

2014-10-08 Thread Spencer Lyon
considerably. the documentation is sparse and it's not quite ready to be advertised, but the tests are quite complete, so check it out at https://github.com/floswald/ApproXD.jl On Saturday, 20 September 2014 02:42:01 UTC+1, Tim Holy wrote: On Friday, September 19, 2014 05:06:41 PM Spencer

Re: [julia-users] ANN: QuantEcon.jl

2014-09-19 Thread Spencer Lyon
: arbitrary precision linear algebra i think most linear algebra operations are defined in julia and thus will work for bignums. sticking a call to big() somewhere in the code is usually enough to promote everything On Fri, Sep 19, 2014 at 8:06 PM, Spencer Lyon spence...@gmail.com javascript

Re: [julia-users] ANN: QuantEcon.jl

2014-09-19 Thread Spencer Lyon
hilsen Andreas Noack 2014-09-19 21:09 GMT-04:00 Spencer Lyon spence...@gmail.com javascript: : Hey Jameson, Thanks for the tip, but I don’t think we have “most linear algebra operations” defined on BigFloat types. See the example below (on Julia master, one day old): julia P1 3x3 Array

[julia-users] ANN: QuantEcon.jl

2014-09-18 Thread Spencer Lyon
New package QuantEcon.jl https://github.com/QuantEcon/QuantEcon.jl. This package collects code for quantitative economic modeling. It is currently comprised of two main parts: 1. A toolbox of routines useful when doing economics 2. Implementations of types and solution

[julia-users] Structuring parallel algorithm that iterates on elements of array

2014-08-30 Thread Spencer Lyon
I often solve fixed point problems where I apply a contraction mapping to an array and`` iterate until convergence. There is nothing in the algorithm that requires the new value at one array index to depend on neighboring indices — only on values obtained at the same index on the previous

[julia-users] Re: Plain text displaying

2014-08-29 Thread Spencer Lyon
10:57:59 AM UTC-4, Spencer Lyon wrote: For displaying a string representation of custom types I have always defined show(io::IO, x::MyType) What is the difference between this and defining writemime(io::IO, mime::MIMEtext/plain, x::MyType) ? Which is preferred and why?

[julia-users] Conditional import within a function

2014-08-22 Thread Spencer Lyon
I am working on a library that defines various types as well as a few “helper” functions to plot those types with PyPlot. If I do [import|using] PyPlot at the top level of any file in my package, PyPlot is loaded when I do [using|import] MyPackage. This makes the startup time for my package

[julia-users] Re: Conditional import within a function

2014-08-22 Thread Spencer Lyon
, Spencer Lyon wrote: I am working on a library that defines various types as well as a few “helper” functions to plot those types with PyPlot. If I do [import|using] PyPlot at the top level of any file in my package, PyPlot is loaded when I do [using|import] MyPackage. This makes the startup

Re: [julia-users] Conditional import within a function

2014-08-22 Thread Spencer Lyon
is not possible. On Fri, Aug 22, 2014 at 11:56 AM, Spencer Lyon spence...@gmail.com javascript: wrote: I am working on a library that defines various types as well as a few “helper” functions to plot those types with PyPlot. If I do [import|using] PyPlot at the top level of any file in my

Re: [julia-users] Re: Conditional import within a function

2014-08-22 Thread Spencer Lyon
. On Fri, Aug 22, 2014 at 12:16 PM, Peter Simon psimo...@gmail.com javascript: wrote: From https://groups.google.com/d/topic/julia-users/AWCerAdDLQo/discussion : eval(Expr(:using,:PyPlot)) can be used inside a conditional. --Peter On Friday, August 22, 2014 8:56:53 AM UTC-7, Spencer

Re: [julia-users] Re: Conditional import within a function

2014-08-22 Thread Spencer Lyon
issue, as much as it is intrinsic to the eval and compilation steps. On Fri, Aug 22, 2014 at 12:49 PM, Spencer Lyon spence...@gmail.com javascript: wrote: I’m actually still having issues with both of these options — I’ll try to enumerate what I think the problem is here. - When I do

[julia-users] keyword argument function masking non-kwarg function

2014-08-21 Thread Spencer Lyon
Consider the following code: function periodogram(x::Array) n = length(x) I_w = abs(fft(x)).^2 ./ n w = 2pi * [0:n-1] ./ n # Fourier frequencies # int rounds to nearest integer. We want to round up or take 1/2 + 1 to # make sure we get the whole interval from [0, pi]

[julia-users] Re: How to require the current master of pacakge

2014-08-19 Thread Spencer Lyon
That's what I thought. I'm happy to do that To do this I just need to do `Pkg.tag(PDMats)` Then push that commit to my fork of METADATA and submit a PR, right? On Tuesday, August 19, 2014 10:13:06 AM UTC-7, Spencer Lyon wrote: Is there a way to specify that a package depends on the current

Re: [julia-users] Re: How to require the current master of pacakge

2014-08-19 Thread Spencer Lyon
Done: https://github.com/JuliaLang/METADATA.jl/pull/1273 Thanks guys On Tuesday, August 19, 2014 10:58:46 AM UTC-7, Leah Hanson wrote: That should work. :) -- Leah On Tue, Aug 19, 2014 at 12:28 PM, Spencer Lyon spence...@gmail.com javascript: wrote: That's what I thought. I'm happy

[julia-users] style: parametric functions or abstract types on arguments

2014-08-19 Thread Spencer Lyon
Suppose I am defining a function that operates on any two real numbers. Which of the following ways of specifying types is preferred (in terms of idomatic Julia and performance considerations) and why? ```julia function foo1(x::Real, y::Real) = ... function foo2{ T: Real}(x::T, y::T) = ...

[julia-users] Re: style: parametric functions or abstract types on arguments

2014-08-19 Thread Spencer Lyon
will make library code less generic for reuse by others (don't overtype is a phrase you might find when searching the forum or the github project pages). Cheers, Tobi Am Dienstag, 19. August 2014 21:54:37 UTC+2 schrieb Spencer Lyon: I just read Tobais’ comment more closely: Specifying

[julia-users] Re: Composite type with dependent fields (using Base.setindex!)

2014-07-10 Thread Spencer Lyon
So I read through issue 1974 https://github.com/JuliaLang/julia/issues/1974. It seems like what I am trying to do is not possible before that gets implemented. Is that correct? On Thursday, July 10, 2014 1:15:14 AM UTC-4, Spencer Lyon wrote: I have a very simple composite type: type

Re: [julia-users] Re: Composite type with dependent fields (using Base.setindex!)

2014-07-10 Thread Spencer Lyon
:40 AM Spencer Lyon wrote: So I read through issue 1974 https://github.com/JuliaLang/julia/issues/1974. It seems like what I am trying to do is not possible before that gets implemented. Is that correct? On Thursday, July 10, 2014 1:15:14 AM UTC-4, Spencer Lyon wrote: I have

[julia-users] Composite type with dependent fields (using Base.setindex!)

2014-07-09 Thread Spencer Lyon
I have a very simple composite type: type DiscreteRv{T : Real} q::Vector{T} Q::Vector{T} end DiscreteRv{T : Real}(x::Vector{T}) = DiscreteRv(x, cumsum(x)) Here q represents a probability vector for a discrete random variable. Q is the associated cdf. I want to make sure that the

Re: [julia-users] Type instability?

2014-06-30 Thread Spencer Lyon
outputs from the types of the inputs. If you have to look at the actual values of the inputs, it's not type-stable. --Tim On Monday, June 30, 2014 09:17:45 AM Spencer Lyon wrote: Does this function suffer from type instability? function bellman_operator{T : FloatingPoint}(g

Re: [julia-users] Type instability?

2014-06-30 Thread Spencer Lyon
of the inputs. If you have to look at the actual values of the inputs, it's not type-stable. --Tim On Monday, June 30, 2014 09:17:45 AM Spencer Lyon wrote: Does this function suffer from type instability? function bellman_operator{T : FloatingPoint}(g::GrowthModel, w::Vector

[julia-users] Quadrature nodes and weights

2014-06-26 Thread Spencer Lyon
I need to find/write some code in julia that can compute the quadrature nodes and weights for various distributions. Some example distributions are Beta, Gamma, Normal, LogNormal, Uniform... I imagine that this functionality already exists somewhere and I don't want to duplicate code, but

[julia-users] Manually defining default constructor for Parametric type

2014-04-21 Thread Spencer Lyon
I am having issues defining constructors for parametric types. I’lll borrow an example from the docs to illustrate my issue: Say I define this type: type Point1{T} x::T y::T end I can then create an object of this type in many ways julia Point1(1.0, 2.0) Point1{Float64}(1.0,2.0) julia

[julia-users] Re: Manually defining default constructor for Parametric type

2014-04-21 Thread Spencer Lyon
-read that section every now and again to remind myself. But I don't think I can say it any better myself, at least not yet. On Monday, April 21, 2014 3:47:40 PM UTC-4, Spencer Lyon wrote: I am having issues defining constructors for parametric types. I’lll borrow an example from the docs

[julia-users] Question about how to use uninitialized fields for Composite type

2014-04-19 Thread Spencer Lyon
Say I have a type that defines a model. Something like this: abstract Model type Results # Details not shown here end type IFP{T : FloatingPoint} : Model # Model parameters rho::T beta::T r::T R::T gamma::T # Grid parameters for a n_a::Integer a_max::T

Re: [julia-users] interp1-like functionality from Grid.jl

2014-04-16 Thread Spencer Lyon
I'd love to beef up this wrapper type and add it to grid, but unfortunately I wont' be able to get to it for a while -- probably late June. On Tuesday, April 15, 2014 9:06:57 AM UTC-4, Tim Holy wrote: On Tuesday, April 15, 2014 05:35:27 AM Spencer Lyon wrote: It seems to me that this would

Re: [julia-users] interp1-like functionality from Grid.jl

2014-04-15 Thread Spencer Lyon
Hey Tim, Looks like that worked well: X = [3:15]; V = sin(X); Xq = [4:.25:12]; ig = InterpGrid(V, BCnil, InterpLinear); y=[ig[x - 2.0] for x in Xq]; plot(X,V,o,Xq,y, orange, Xq, sin(Xq), red); legend([Data, Interp, Actual])

Re: [julia-users] interp1-like functionality from Grid.jl

2014-04-15 Thread Spencer Lyon
Also, The getindex method for the InterpGrid object can accept more than one point. There is no need to evaluate the points using a comprehension: julia y2 = ig[Xq - 2.0]; julia y=[ig[x - 2.0] for x in Xq]; julia maximum(y - y2) 0.0 julia minimum(y - y2) 0.0

Re: [julia-users] interp1-like functionality from Grid.jl

2014-04-15 Thread Spencer Lyon
Also Tim, I am not sure I understand what you mean by You could also scale the values if they aren’t usually spaced by 1. This example now fails again: X = [3:0.5:15]; V = sin(X); Xq = [4:.25:12]; ig = InterpGrid(V, BCnil, InterpLinear); y = ig[Xq - 2.0] plot(X,V,o,Xq,y, orange, Xq,

Re: [julia-users] interp1-like functionality from Grid.jl

2014-04-15 Thread Spencer Lyon
Thanks for the response. I think I have settled on how to get this to work. This is what I have right now immutable ShiftedInterpGrid{T,N,BC,IT} IG::InterpGrid{T,N,BC,IT} m::Number b::Number end function ShiftedInterpGrid{T,BC,IT}(V::Vector{T}, X::Vector{T}, ::Type{BC},

[julia-users] interp1-like functionality from Grid.jl

2014-04-14 Thread Spencer Lyon
I need to do some basic interpolation and think Grid.jl should provide all the functionality I need, but I can’t quite get it to work for me. I am essentially looking to do something like what is described for this form of the interp1 matlab function (copied and pasted excerpt from