Re: [julia-users] Serializing custom types

2015-08-04 Thread Marc Gallant
That's exactly what I was looking for, thanks Tim. On Thursday, July 30, 2015 at 12:08:18 PM UTC-4, Tim Holy wrote: Try the JLD package? --Tim On Thursday, July 30, 2015 08:57:23 AM Marc Gallant wrote: Given the following types: type Bar x::Float64 y::Int end

[julia-users] Serializing custom types

2015-07-30 Thread Marc Gallant
Given the following types: type Bar x::Float64 y::Int end type Foo x::Vector{Float64} y::Bar z::Matrix{Float64} end and the following vector: a = [Foo([1.1, 2.2], Bar(1.1, 4), rand(2, 2)), Foo([1.3, 2.4], Bar(-1.1, 2), rand(2, 2))] Do you have any suggestions on how

[julia-users] The unique function and iterables of custom composite types

2015-07-16 Thread Marc Gallant
The unique function doesn't appear to work using iterables of custom composite types, e.g., julia type Foo x::Int end julia import Base: == julia ==(f1::Foo, f2::Foo) = f1.x == f2.x == (generic function with 85 methods) julia unique(foos) 2-element Array{Foo,1}: Foo(4) Foo(4)

[julia-users] Re: The unique function and iterables of custom composite types

2015-07-16 Thread Marc Gallant
}: Foo(4) Foo(4) julia unique(foos)[1] == unique(foos)[2] true On Thursday, July 16, 2015 at 9:33:26 AM UTC-4, milktrader wrote: How did you get foos? On Thursday, July 16, 2015 at 9:16:01 AM UTC-4, Marc Gallant wrote: The unique function doesn't appear to work using iterables of custom

[julia-users] Constructing a block diagonal matrix from an array of square matrices

2015-06-03 Thread Marc Gallant
If I have an array of square matrices of different sizes; e.g., 3-element Array{Array{Float64,2},1}: 2x2 Array{Float64,2}: 0.539932 0.429322 0.623487 0.0397795 2x2 Array{Float64,2}: 0.35508 0.700551 0.768214 0.954056 3x3 Array{Float64,2}: 0.953354 0.453831 0.991583 0.159975

[julia-users] Project organization

2015-02-23 Thread Marc Gallant
I'm having some trouble figuring out the proper way to organize a project in Julia. I understand how a *package* is organized (from the many available examples), but now I am writing code that uses various packages (my own and others) and I don't feel like I have a good idea on how a *project*

[julia-users] Re: Project organization

2015-02-23 Thread Marc Gallant
Thanks for your input. I have some questions about your reply: 4. Yes, putting constants in global scope is fine. I believe there will not be a performance issue is you mark the variables as const How do I load the configuration file if Major Calculations is a package? using

[julia-users] Flexible construction of types

2014-11-26 Thread Marc Gallant
Suppose I have a type called MyType that has one floating point field x. When constructed, if the value provided for x is greater than, let's say, 5, it has pi subtracted from it. For example, a = MyType(4) # x = 4.0 b = MyType(-11) # x = 11.0 c = MyType(10) # x = 6.8584 d = MyType(-1.443) #

Re: [julia-users] Flexible construction of types

2014-11-26 Thread Marc Gallant
Thanks for your quick response! I have a couple questions/concerns about your implementation: - MyType(1, [2, 3], xyz) fails requirement #2 - MyType(1, [2, 10], xyz) throws InexactError() - Does the declaration s::String cause the ambiguities described in the FAQ here

[julia-users] Unclear Modules Documentation?

2014-09-27 Thread Marc Gallant
Hi, I'm using Julia 0.3.1 and I feel like I'm seeing behaviour that is different from what is indicated in the manual in the Modules section (specifically, in the table) here: http://docs.julialang.org/en/release-0.3/manual/modules/ I was playing around to learn the difference between using,