[julia-users] Re: using Images error
I don't get this error on yesterdays Julia master on OSX. The prerelease is a moving target, and we usually don't want to spend much time on debugging on old versions, if the problem could possibly have been fixed in the mean time. Can you try to update Julia? Ivar kl. 07:19:11 UTC+1 tirsdag 25. mars 2014 skrev Yakir Gagnon følgende: > > I get this error from just "using Images". > ERROR: type: Image: in A, expected A<:StoredArray{T,N}, got Type{SubArray{ > RGB,N,O<:Overlay{AT<:(AbstractArray{T,N}...,),N,SIT<:(ScaleInfo{T}...,)}, > IT<:(Union(Range1{Int64},Int64,Range{Int64})...,)}} > in reload_path at loading.jl:144 > in _require at loading.jl:59 > in require at loading.jl:43 > Tried both: > Pkg.update() > and > Pkg.rm("Images") > Pkg.add("Images") > But that error keeps coming back. I'm on Version 0.3.0-prerelease+1379 > (2014-02-04 03:15 UTC) Commit 00760bd* (49 days old master) > x86_64-linux-gnu ubuntu 12.04. > Anyone knows how to fix this? > Thanks! >
[julia-users] using Images error
I get this error from just "using Images". ERROR: type: Image: in A, expected A<:StoredArray{T,N}, got Type{SubArray{ RGB,N,O<:Overlay{AT<:(AbstractArray{T,N}...,),N,SIT<:(ScaleInfo{T}...,)},IT <:(Union(Range1{Int64},Int64,Range{Int64})...,)}} in reload_path at loading.jl:144 in _require at loading.jl:59 in require at loading.jl:43 Tried both: Pkg.update() and Pkg.rm("Images") Pkg.add("Images") But that error keeps coming back. I'm on Version 0.3.0-prerelease+1379 (2014-02-04 03:15 UTC) Commit 00760bd* (49 days old master) x86_64-linux-gnu ubuntu 12.04. Anyone knows how to fix this? Thanks!
[julia-users] Re: Julia package style / learning
Thanks for the discussion and thanks to JMW for the pull request! On Sunday, March 23, 2014 9:42:19 PM UTC-7, Ryan Gehring wrote: > > Hey all, > I decided to start learning Julia over the weekend and am having fun so > far. I implemented the wikipedia single layer perceptron algorithm as well > as kendall's tau to see what it would be like to develop a medium sized > package in the language. Link to the repo is below (the title just popped > into my head there's no amazing product or grand plan meant by the name.) > > https://github.com/rgehring/SimpleNets > > As a student of the language I'd love to hear anyone's thoughts on any > style issues or mistakes they see, I'm sure there are plenty. Here are some > things I think I did wrong right off the top of my head... > >- Submodule importing. In src/util/association_measures.jl I wanted to >just expose KendallsTau.kendallstau as AssociationMeasures.kendallstau and >I think I should have used import rather than include / using ? >- Test inclusion strategy: I thought it would make sense to have a >unit test file for every src file and to import the src file at the top of >each test, but this makes the tests brittle to directory changes, is it a >better idea to include all the files in test_runner.jl? >- Excessively specific typing and casting to ints and floats. >- Arrays of Arrays - should I have used matrices or the native >multidimensional array structure? > > Here are some things that I think might be good: > >- Tried to keep a reasonable degree of abstraction on all the files, >although I may have been too heavy on the use of submodules. >- Test coverage + a (very basic) actual statistical validation script >for the algorithms. >- Tried to be explicit about public API's to the submodules. I may >have carried this too far with src/util/association_measures.jl which is >basically an interface module designed to only expose the public API's of >each included submodule (presently only KendallsTau). > > I'm potentially interested in contributing to the codebase as a way to > keep learning, does anyone have any small, bite-sized github issues they'd > be interested in help with or seeing a pull request for? > > >
[julia-users] Re: Calculus2: A new proposed interface for Calculus
On Sunday, March 23, 2014 11:29:37 PM UTC-7, Miles Lubin wrote: > > I like the unified interface for differentiation. My only qualm is with > flattening out the hierarchy of packages by including DualNumbers. There > was some discussion on this here: > https://github.com/johnmyleswhite/Calculus.jl/pull/44 > > To start out, what is the intended scope of Calculus.jl? Once you start > getting into including automatic differentiation it opens up a whole can of > worms. For example, why swallow up DualNumbers and not PowerSeries? What > about reverse mode for gradients and Hessians? There are too many different > approaches, and I don't think they all belong under one package. We're > using DualNumbers now because it's stable and mostly just works, but we > should be leaving room for future developments. > > Proposal: > 1. Low-level package (SymbolicDerivatives.jl?) that exports a table of > symbolic derivatives that can be shared among different implementations. > gradexpr and hessexpr can go here too. > 2. Differentiation packages: DualNumbers, PowerSeries, > ReverseDiffOverload, ReverseDiffSparse, ReverseDiffSource, etc. > 3. Unified interface like the one implemented in Calculus2 with grad/hess. > (Call this Derivatives.jl?) > I think this is a great idea. The same thing occurred to me as I was writing PowerSeries. I would like to get the derivative definitions in that package merged in with the rest of them so that there is only one big list of derivatives to maintain and test (or at least one fewer). > On Sunday, March 23, 2014 1:28:03 PM UTC-4, John Myles White wrote: >> >> I recently had a project where I made heavy use of the Calculus package >> and found that the interface has really fallen out of sync with the >> functionality that’s available. I also found myself wanting to have easier >> access to forward-mode automatic differentation. >> >> So I wrote up a variant of the Calculus package, which I’m calling >> Calculus2, to provide a demonstration of a new interface that I’d like to >> propose for the Calculus package. You can try the new interface here: >> >> https://github.com/johnmyleswhite/Calculus2.jl >> >> This package takes the old Calculus code and cleans it up, but also fully >> incorporates the DualNumbers package, so that you can switch between many >> different styles of differentiation using two keyword arguments: >> >> using Calculus2 >> grad(sin, 1.0, method = :finite) >> grad(sin, 1.0, method = :finite, direction = :complex) >> grad(sin, 1.0, method = :ad) >> >> hess(sin, 1.0, method = :finite) >> >> I’d be really interested to see if people think this interface is worth >> pursuing. I’m hopeful that this interface or something similar can help to >> surface all of the useful functionality that’s been hidden inside of the >> Calculus package. >> >> — John >> >>
Re: [julia-users] Re: Is a.(b) valid?
dynamic names can be handy, but they are also quite slow. symbol(string(nomes[1])) === nomes[1] On Mon, Mar 24, 2014 at 11:13 PM, J Luis wrote: > Thanks > > So this means we cannot do the dynamic names as in Matlab (where the "b" is > the member name) > > BTW, I needed to extract the member name as a string to compare with another > string and the only way I got it done was with > > julia> nomes=names(MyType) > 1-element Array{Symbol,1}: > :a > > julia> @sprintf("%s", nomes[1]) > "a" > > > but don't know how to do it the other way around. Not that I need it now but > Matlab dynamic names are quite handy. > > Terça-feira, 25 de Março de 2014 3:01:13 UTC, Sam L escreveu: >> >> After some experimentation, it looks like second way takes a symbol or >> variable who's value is a symbol. >> >> julia> type MyType; a::Int; end >> >> julia> x = MyType(3) >> MyType(3) >> >> julia> x.a >> 3 >> >> julia> x.(a) >> ERROR: a not defined >> >> julia> x.(:a) >> 3 >> >> julia> b = :a >> :a >> >> julia> x.(b) >> 3 >> >> >> On Monday, March 24, 2014 7:46:38 PM UTC-7, J Luis wrote: >>> >>> The doc of getfield says >>> >>> getfield(value, name::Symbol) >>> >>> Extract a named field from a value of composite type. The syntax a.b >>> calls >>> getfield(a, :b), and the syntax a.(b) calls getfield(a, b). >>> >>> >>> but when I try the a.(b) variation, it errors (or it's me who errors?) >>> >>> julia> gmt_modules.write >>> "?O" >>> >>> julia> gmt_modules.(write) >>> ERROR: type: getfield: expected Symbol, got Function >>> >>> >>> >>> >
[julia-users] Re: Is a.(b) valid?
Thanks So this means we cannot do the dynamic names as in Matlab (where the "b" is the member name) BTW, I needed to extract the member name as a string to compare with another string and the only way I got it done was with julia> nomes=names(MyType) 1-element Array{Symbol,1}: :a julia> @sprintf("%s", nomes[1]) "a" but don't know how to do it the other way around. Not that I need it now but Matlab dynamic names are quite handy. Terça-feira, 25 de Março de 2014 3:01:13 UTC, Sam L escreveu: > > After some experimentation, it looks like second way takes a symbol or > variable who's value is a symbol. > > julia> type MyType; a::Int; end > > julia> x = MyType(3) > MyType(3) > > julia> x.a > 3 > > julia> x.(a) > ERROR: a not defined > > julia> x.(:a) > 3 > > julia> b = :a > :a > > julia> x.(b) > 3 > > > On Monday, March 24, 2014 7:46:38 PM UTC-7, J Luis wrote: >> >> The doc of getfield says >> >> getfield(*value*, *name::Symbol*) >> >> Extract a named field from a value of composite type. The syntax a.bcalls >> getfield(a, :b), and the syntax a.(b) calls getfield(a, b). >> >> but when I try the a.(b) variation, it errors (or it's me who errors?) >> >> julia> gmt_modules.write >> "?O" >> >> julia> gmt_modules.(write) >> ERROR: type: getfield: expected Symbol, got Function >> >> >> >> >>
[julia-users] Re: Is a.(b) valid?
After some experimentation, it looks like second way takes a symbol or variable who's value is a symbol. julia> type MyType; a::Int; end julia> x = MyType(3) MyType(3) julia> x.a 3 julia> x.(a) ERROR: a not defined julia> x.(:a) 3 julia> b = :a :a julia> x.(b) 3 On Monday, March 24, 2014 7:46:38 PM UTC-7, J Luis wrote: > > The doc of getfield says > > getfield(*value*, *name::Symbol*) > > Extract a named field from a value of composite type. The syntax a.b calls > getfield(a, :b), and the syntax a.(b) calls getfield(a, b). > > but when I try the a.(b) variation, it errors (or it's me who errors?) > > julia> gmt_modules.write > "?O" > > julia> gmt_modules.(write) > ERROR: type: getfield: expected Symbol, got Function > > > > >
Re: [julia-users] Is a.(b) valid?
You need to pass a variable containing a Symbol. Try write = :write On Mon, Mar 24, 2014 at 10:46 PM, J Luis wrote: > The doc of getfield says > > getfield(*value*, *name::Symbol*) > > Extract a named field from a value of composite type. The syntax a.b calls > getfield(a, :b), and the syntax a.(b) calls getfield(a, b). > > but when I try the a.(b) variation, it errors (or it's me who errors?) > > julia> gmt_modules.write > "?O" > > julia> gmt_modules.(write) > ERROR: type: getfield: expected Symbol, got Function > > > > >
[julia-users] Is a.(b) valid?
The doc of getfield says getfield(*value*, *name::Symbol*) Extract a named field from a value of composite type. The syntax a.b calls getfield(a, :b), and the syntax a.(b) calls getfield(a, b). but when I try the a.(b) variation, it errors (or it's me who errors?) julia> gmt_modules.write "?O" julia> gmt_modules.(write) ERROR: type: getfield: expected Symbol, got Function
Re: [julia-users] Filling a long composite type
On Monday, March 24, 2014 09:55:32 PM Jameson Nash wrote: > tt = t( ["" for i = 1:120]... ) You can also define an inner constructor and leave many/all of the fields uninitialized. --Tim > > On Mon, Mar 24, 2014 at 9:43 PM, J Luis wrote: > > Let's say I have this composite type > > > > julia> type t > > > >aa::ASCIIString; > >bb::ASCIIString; > >end > > > > and try to fill it a la C (or Matlab) > > > > julia> tt=t > > t (constructor with 1 method) > > > > julia> tt.aa="AA" > > ERROR: type DataType has no field aa > > > > so bad surprise. I can't. So I have to do for instance > > > > julia> tt=t("AA","BB"); > > > > but my real type is 120 members long and I don't want to do it that way (I > > would for sure make lots of mistakes). So I want to try like this > > > > julia> tt=t("",""); > > > > julia> tt.aa="AA" > > "AA" > > > > > > but do I avoid doing tt=t("","","",... 120 times?) > > > > Tried this but no luck either > > > > julia> tt=t(repmat([""],10)); > > ERROR: no method t(Array{ASCIIString,1}) > > > > Thanks
Re: [julia-users] Filling a long composite type
Thanks a lot It would be nice to have a kind of repository for tricks where this one would deserve a place Terça-feira, 25 de Março de 2014 1:55:32 UTC, Jameson escreveu: > > tt = t( ["" for i = 1:120]... ) > > On Mon, Mar 24, 2014 at 9:43 PM, J Luis > > wrote: > > Let's say I have this composite type > > > > julia> type t > >aa::ASCIIString; > >bb::ASCIIString; > >end > > > > and try to fill it a la C (or Matlab) > > > > julia> tt=t > > t (constructor with 1 method) > > > > julia> tt.aa="AA" > > ERROR: type DataType has no field aa > > > > so bad surprise. I can't. So I have to do for instance > > > > julia> tt=t("AA","BB"); > > > > but my real type is 120 members long and I don't want to do it that way > (I > > would for sure make lots of mistakes). So I want to try like this > > > > julia> tt=t("",""); > > > > julia> tt.aa="AA" > > "AA" > > > > > > but do I avoid doing tt=t("","","",... 120 times?) > > > > Tried this but no luck either > > > > julia> tt=t(repmat([""],10)); > > ERROR: no method t(Array{ASCIIString,1}) > > > > Thanks > > > > > > > > >
Re: [julia-users] Filling a long composite type
tt = t( ["" for i = 1:120]... ) On Mon, Mar 24, 2014 at 9:43 PM, J Luis wrote: > Let's say I have this composite type > > julia> type t >aa::ASCIIString; >bb::ASCIIString; >end > > and try to fill it a la C (or Matlab) > > julia> tt=t > t (constructor with 1 method) > > julia> tt.aa="AA" > ERROR: type DataType has no field aa > > so bad surprise. I can't. So I have to do for instance > > julia> tt=t("AA","BB"); > > but my real type is 120 members long and I don't want to do it that way (I > would for sure make lots of mistakes). So I want to try like this > > julia> tt=t("",""); > > julia> tt.aa="AA" > "AA" > > > but do I avoid doing tt=t("","","",... 120 times?) > > Tried this but no luck either > > julia> tt=t(repmat([""],10)); > ERROR: no method t(Array{ASCIIString,1}) > > Thanks > > > >
[julia-users] Filling a long composite type
Let's say I have this composite type julia> type t aa::ASCIIString; bb::ASCIIString; end and try to fill it a la C (or Matlab) julia> tt=t t (constructor with 1 method) julia> tt.aa="AA" ERROR: type DataType has no field aa so bad surprise. I can't. So I have to do for instance julia> tt=t("AA","BB"); but my real type is 120 members long and I don't want to do it that way (I would for sure make lots of mistakes). So I want to try like this julia> tt=t("",""); julia> tt.aa="AA" "AA" but do I avoid doing tt=t("","","",... 120 times?) Tried this but no luck either julia> tt=t(repmat([""],10)); ERROR: no method t(Array{ASCIIString,1}) Thanks
[julia-users] Re: set parent to None in PySide
I don't really know. This of course is an issue, as it likely won't get garbage collected once removed. I thought setting the parent to `nothing` would work, but it doesn't. If you find something that does work please let me know. On Monday, March 24, 2014 9:00:13 PM UTC-4, Samuele Carcagno wrote: > > another PySide.jl question, how to set the parent to None > after removing a widget? If I attempt it I get the following error: > > julia> pw_prm_sizer_0[:removeWidget](wd["fieldLabel"][1]) > > julia> wd["fieldLabel"][1][:setParent](None) > ERROR: PyError (PyObject_Call) > TypeError("'PySide.QtGui.QWidget.setParent' called with wrong argument > types:\n PySide.QtGui.QWidget.setParent(PyCall.jlwrap)\nSupported > signatures:\n PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget)\n > PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget, > PySide.QtCore.Qt.WindowFlags)",) > > in pyerr_check at /home/sam/.julia/v0.3/PyCall/src/exception.jl:58 > in pycall at /home/sam/.julia/v0.3/PyCall/src/PyCall.jl:85 > in fn at /home/sam/.julia/v0.3/PyCall/src/conversions.jl:181 >
[julia-users] set parent to None in PySide
another PySide.jl question, how to set the parent to None after removing a widget? If I attempt it I get the following error: julia> pw_prm_sizer_0[:removeWidget](wd["fieldLabel"][1]) julia> wd["fieldLabel"][1][:setParent](None) ERROR: PyError (PyObject_Call) TypeError("'PySide.QtGui.QWidget.setParent' called with wrong argument types:\n PySide.QtGui.QWidget.setParent(PyCall.jlwrap)\nSupported signatures:\n PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget)\n PySide.QtGui.QWidget.setParent(PySide.QtGui.QWidget, PySide.QtCore.Qt.WindowFlags)",) in pyerr_check at /home/sam/.julia/v0.3/PyCall/src/exception.jl:58 in pycall at /home/sam/.julia/v0.3/PyCall/src/PyCall.jl:85 in fn at /home/sam/.julia/v0.3/PyCall/src/conversions.jl:181
Re: [julia-users] Re: setting Qt properties in PySide
On 25/03/14 00:40, j verzani wrote: It varies. qt_enum("AlignTop") will do the first, Qt.QVBoxLayout()[:SetFixedSize] the second, and Qt.QFrame()[:Sunken] the third. that works, thank you! The qt_enum() function is basically pyimport("PySide.QtCore")["Qt"][:property_name] which is needed to fish properties out of the Qt object, as @pyimport will try to convert what it can into methods. On Monday, March 24, 2014 8:02:18 PM UTC-4, Samuele Carcagno wrote: Hi, I can't figure out the syntax to set Qt graphics properties in PySide.jl For example, how to translate the following Python code: sizer.setAlignment(Qt.AlignTop) or pw.layout().setSizeConstraint(QLayout.SetFixedSize) or cw.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken) any help would be appreciated. Sam
[julia-users] Re: setting Qt properties in PySide
It varies. qt_enum("AlignTop") will do the first, Qt.QVBoxLayout()[:SetFixedSize] the second, and Qt.QFrame()[:Sunken] the third. The qt_enum() function is basically pyimport("PySide.QtCore")["Qt"][:property_name] which is needed to fish properties out of the Qt object, as @pyimport will try to convert what it can into methods. On Monday, March 24, 2014 8:02:18 PM UTC-4, Samuele Carcagno wrote: > > Hi, > > I can't figure out the syntax to set Qt graphics properties in PySide.jl > For example, how to translate the following Python code: > > sizer.setAlignment(Qt.AlignTop) > > or > > pw.layout().setSizeConstraint(QLayout.SetFixedSize) > > or > > cw.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken) > > any help would be appreciated. > > Sam >
[julia-users] Re: Managing objects and state
it's not completely clear to me what you're asking. julia isn't particularly object oriented (i just checked and there's no mention of objects or classes in the intro at http://julialang.org/) having said that, you can store and modify (unless the type is immutable) values in composite types. so, for example julia> type State x::Int end julia> function set(s::State, x::Int) s.x = x end set (generic function with 1 method) julia> function read(s::State) return s.x end read (generic function with 1 method) julia> s = State(12) State(12) julia> s.x 12 julia> s.x = 100 100 julia> s.x 100 julia> s State(100) julia> set(s, 32) 32 julia> s State(32) julia> read(s) 32 maybe that helps? obviously set and read are trivial to do directly on the instance, but you could imagine more complex functions. andrew On Monday, 24 March 2014 16:32:41 UTC-3, Bob Cowdery wrote: > > Forgive me if this is daft and often answered question but I'm trying to > get my head around Julia OO. > > Am I correct in thinking that as there is no binding between methods and > types that I have to explicitly pass in an instance of a type to a method. > If that is the case then how do I hold state on a remote object. I call a > function that creates an instance of a type say something simple. > type State > > sock > > end > I just want to hold a socket reference. If the first remote function I call > creates State then how can the next function I call obtain the state instance. > > Do I have to create a remote reference or something which it can use? > > Thanks > Bob > > >
[julia-users] setting Qt properties in PySide
Hi, I can't figure out the syntax to set Qt graphics properties in PySide.jl For example, how to translate the following Python code: sizer.setAlignment(Qt.AlignTop) or pw.layout().setSizeConstraint(QLayout.SetFixedSize) or cw.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken) any help would be appreciated. Sam
Re: [julia-users] Fastest method to create a matrix of random integers
How about In [186]: @time rand(-1:2:1,1,1); elapsed time: 2.29940616 seconds (80224 bytes allocated) No need for an extra function. This uses a range from -1 to 1 with a step size of 2 so you only get those two numbers. -Jacob On Mon, Mar 24, 2014 at 7:21 PM, David P. Sanders wrote: > Hi, > > What is the fastest way to create a matrix containing random integers: 1 > or -1 with equal probability? > I have tried the following options but was wondering if I am missing > something. > (I also need 1, 0 or -1 with different probabilities later, which is why I > don't just use a boolean random matrix.) > > Thanks, > David. > > julia> function rand_pm1_matrix(L) >matrix::Array{Int8, 2} = 2 .* randbool(L,L) .- 1 >end > rand_pm1_matrix (generic function with 1 method) > > julia> function elementwise(L) >A = Array(Int8, (L, L)) >for i in 1:length(A) >if rand() < 0.5 >A[i] = -1 >else >A[i] = 1 >end >end >A >end > elementwise (generic function with 1 method) > > julia> function elementwise_random_block(L) >r = rand(L, L) >A = Array(Int8, (L, L)) >for i in 1:length(A) >if r[i] < 0.5 >A[i] = -1 >else >A[i] = 1 >end >end >A >end > elementwise_random_block (generic function with 1 method) > > julia> L = 10 > 10 > > julia> rand_pm1_matrix(L); > > julia> elementwise(L); > > julia> elementwise_random_block(L); > > julia> > > julia> L = 100 > 100 > > julia> @time rand_pm1_matrix(L); > elapsed time: 6.5661e-5 seconds (188588 bytes allocated) > > julia> @time elementwise(L); > elapsed time: 0.001172332 seconds (10160 bytes allocated) > > julia> @time elementwise_random_block(L); > elapsed time: 0.000131455 seconds (90240 bytes allocated) > > julia> > > julia> L = 1000 > 1000 > > julia> @time rand_pm1_matrix(L); > elapsed time: 0.013428217 seconds (18125456 bytes allocated) > > julia> @time elementwise(L); > elapsed time: 0.074257183 seconds (1000176 bytes allocated) > > julia> @time elementwise_random_block(L); > elapsed time: 0.007721683 seconds (9000288 bytes allocated) > > julia> > > julia> L = 1 > 1 > > julia> @time rand_pm1_matrix(L); > elapsed time: 2.75006866 seconds (1812500448 bytes allocated) > > julia> @time elementwise(L); > elapsed time: 6.727148454 seconds (10176 bytes allocated) > > julia> @time elementwise_random_block(L); > elapsed time: 2.819847794 seconds (90288 bytes allocated) > > \ >
[julia-users] Fastest method to create a matrix of random integers
Hi, What is the fastest way to create a matrix containing random integers: 1 or -1 with equal probability? I have tried the following options but was wondering if I am missing something. (I also need 1, 0 or -1 with different probabilities later, which is why I don't just use a boolean random matrix.) Thanks, David. julia> function rand_pm1_matrix(L) matrix::Array{Int8, 2} = 2 .* randbool(L,L) .- 1 end rand_pm1_matrix (generic function with 1 method) julia> function elementwise(L) A = Array(Int8, (L, L)) for i in 1:length(A) if rand() < 0.5 A[i] = -1 else A[i] = 1 end end A end elementwise (generic function with 1 method) julia> function elementwise_random_block(L) r = rand(L, L) A = Array(Int8, (L, L)) for i in 1:length(A) if r[i] < 0.5 A[i] = -1 else A[i] = 1 end end A end elementwise_random_block (generic function with 1 method) julia> L = 10 10 julia> rand_pm1_matrix(L); julia> elementwise(L); julia> elementwise_random_block(L); julia> julia> L = 100 100 julia> @time rand_pm1_matrix(L); elapsed time: 6.5661e-5 seconds (188588 bytes allocated) julia> @time elementwise(L); elapsed time: 0.001172332 seconds (10160 bytes allocated) julia> @time elementwise_random_block(L); elapsed time: 0.000131455 seconds (90240 bytes allocated) julia> julia> L = 1000 1000 julia> @time rand_pm1_matrix(L); elapsed time: 0.013428217 seconds (18125456 bytes allocated) julia> @time elementwise(L); elapsed time: 0.074257183 seconds (1000176 bytes allocated) julia> @time elementwise_random_block(L); elapsed time: 0.007721683 seconds (9000288 bytes allocated) julia> julia> L = 1 1 julia> @time rand_pm1_matrix(L); elapsed time: 2.75006866 seconds (1812500448 bytes allocated) julia> @time elementwise(L); elapsed time: 6.727148454 seconds (10176 bytes allocated) julia> @time elementwise_random_block(L); elapsed time: 2.819847794 seconds (90288 bytes allocated) \
Re: [julia-users] ANN / RFC: SGEArray iterator
Hello, On Friday, March 21, 2014 4:31:59 AM UTC+1, Jiahao Chen wrote: > > I wrote a similar package long ago for Python and remember SGE array jobs > well. > If ClusterManager's addprocs_sge function doesn't respect the current > working directory in the worker processes, it would be nice to file an > issue about it. It would be really nice to have your code integrated > OK, I might do that. I feel a bit hesitant, though, to call this an issue. Maybe the behaviour is by design. > more tightly with ClusterManager rather than exist as a separate > package. > > It is just a few lines of code---if anybody form ClusterManagers is willing to integrate it---by all means. ---david > Thanks, > > Jiahao Chen > Staff Research Scientist > MIT Computer Science and Artificial Intelligence Laboratory > > > On Thu, Mar 13, 2014 at 4:07 AM, David van Leeuwen > > wrote: > > Hello, > > > > I've got a tiny package that makes certain Sun Grid Engine array > processing > > jobs easier with Julia. I've put it up at > > > > Pkg.clone("https://github.com/davidavdav/SGEArrays.jl.git";) > > > > The premise is that your main Julia script needs to process a large > number > > of files, which are given as a list. > > > > Rather than splitting the files in separate lists outside Julia, and > > spawning an array of jobs calling the Julia script with a different list > > files for every job, this splitting is done in an iterator. > > > > Your main julia script `bin/julia-script` could look like > > > > using SGEArrays > > > > listfile = ARGS[1] > > files = readdlm(listfile) > > > > for file in SGEArray(files) > > ## process file $file > > end > > > > i,e., the `SGEArray(files)` replaces the bit where you would normally > have > > `files`. Calling the script as an SGE task array of size 80 would go > like: > > > > find data/input/ -type f > filelist > > qsub -t1:80 -b y -cwd bin/julia-script filelist > > > > but the code would also work outside SGE > > > > bin/julia-script filelist > > > > For certain computing tasks I find this somewhat easier than using > > ClusterManagers.addprocs_sge, which also doesn't seem to respect the > current > > working directory in the worker processes. > > > > Cheers, > > > > ---david >
Re: [julia-users] Embedding Julia in an app / calling from C++
This isn't really possible right now--large, essential parts of Julia are written in Julia, and there's not full differentiation between the core needed just to get the language running and the other components included in Base. Please see https://github.com/JuliaLang/julia/issues/5155 and recent comments on https://github.com/JuliaLang/julia/issues/1906 for a bit more of the current discussion on this topic. On Monday, March 24, 2014 5:43:41 PM UTC-5, Dibyendu Majumdar wrote: > > The error message I got was: > > System image file "C:\project\Debug\../lib/julia/sys.ji" not found > > This occurred when I called jl_init() with NULL. It seems that it is > trying to find files relative to the executable file location. > I tried setting JULIA_HOME environment variable but that did not help. > I then changed the argument to "c:\julia\bin" which worked. > > It takes about 2 seconds to startup on my laptop (2009 Intel duo Mac). > > I was wondering if I could modify Julia to only be a language - i.e. > remove all the standard library and therefore most (all?) of the > dependencies. As an embedded language I don't really want all these > external dependencies. > Is this possible? Where should I start? Are any of the dependencies must > have? > Is there a developer's guide for Julia? > > Thanks and Regards > Dibyendu >
Re: [julia-users] Embedding Julia in an app / calling from C++
The error message I got was: System image file "C:\project\Debug\../lib/julia/sys.ji" not found This occurred when I called jl_init() with NULL. It seems that it is trying to find files relative to the executable file location. I tried setting JULIA_HOME environment variable but that did not help. I then changed the argument to "c:\julia\bin" which worked. It takes about 2 seconds to startup on my laptop (2009 Intel duo Mac). I was wondering if I could modify Julia to only be a language - i.e. remove all the standard library and therefore most (all?) of the dependencies. As an embedded language I don't really want all these external dependencies. Is this possible? Where should I start? Are any of the dependencies must have? Is there a developer's guide for Julia? Thanks and Regards Dibyendu
[julia-users] Re: Constructing arrays with dim > 2
Ok, one might be less redundant if reading the thread properly before posting. Sorry about the noise. Den måndagen den 24:e mars 2014 kl. 23:12:03 UTC+1 skrev Gunnar Farnebäck: > > [f(i,j)[k] for k in 1:K, i in 1:n, j in i:m] > > Den måndagen den 24:e mars 2014 kl. 15:07:49 UTC+1 skrev Linus Mellberg: >> >> Hi! >> >> I'm trying to construct a 3 dimensional array from a number of 1 >> dimensional arrays. Essentially what i would like to do is >> >> a = [f(i, j) for i in 1:n, j in 1:m] >> >> where f(i, j) is a function that returns an array (note, f has to >> construct the entire array at the same time). The code above creates a >> 2-dimensional array of arrays, but I would like to get a 3-dimensional >> array with the arrays returned by f in the first dimension with i and j in >> the second and third dimension, hope you understand >> >> a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] >> a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] >> . >> . >> . >> a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] >> >> f(i,j) are column arrays above. >> >> It can be achieved by first creating the large matrix and then filling it >> >> a = zeros(Int64, k, n, m) >> for i in 1:n, j in 1:m >> a[:,i,j] = f(i,j) >> end >> >> Is this the only way? I find it sort of ugly when its usually possible to >> do nice construction using comprehensions in other cases. >> >>
[julia-users] Re: Constructing arrays with dim > 2
[f(i,j)[k] for k in 1:K, i in 1:n, j in i:m] Den måndagen den 24:e mars 2014 kl. 15:07:49 UTC+1 skrev Linus Mellberg: > > Hi! > > I'm trying to construct a 3 dimensional array from a number of 1 > dimensional arrays. Essentially what i would like to do is > > a = [f(i, j) for i in 1:n, j in 1:m] > > where f(i, j) is a function that returns an array (note, f has to > construct the entire array at the same time). The code above creates a > 2-dimensional array of arrays, but I would like to get a 3-dimensional > array with the arrays returned by f in the first dimension with i and j in > the second and third dimension, hope you understand > > a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] > a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] > . > . > . > a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] > > f(i,j) are column arrays above. > > It can be achieved by first creating the large matrix and then filling it > > a = zeros(Int64, k, n, m) > for i in 1:n, j in 1:m > a[:,i,j] = f(i,j) > end > > Is this the only way? I find it sort of ugly when its usually possible to > do nice construction using comprehensions in other cases. > >
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
That seems like the perfect language. -- John On Mar 24, 2014, at 9:16 AM, Ted Fujimoto wrote: > OK. How about asking if I could assist them on a Julia version under an MIT > license? The result is the same but I guess language does make a difference... > > On Monday, March 24, 2014 9:08:23 AM UTC-7, John Myles White wrote: > I think Tom’s point is that most people prefer that you assist them rather > than offer them the chance to assist you. > > — John > > On Mar 24, 2014, at 8:58 AM, Ted Fujimoto wrote: > >> I probably was not clear in my response to Jake but what I meant was that I >> would ask the authors if they wanted to use the GPL because they felt that >> license was most appropriate. If not, I would then give them the choice to >> assist me at any level they choose with a Julia version of their package >> under an MIT license (since they are academics, my guess is that they would >> want to be a part of popularizing their work with different versions), and >> they can decline to help if they choose to do so. I think it would be best >> not to keep them in the dark. >> >> On Monday, March 24, 2014 4:47:08 AM UTC-7, tshort wrote: >> Instead of asking the package authors to do extra work, it might be >> better to offer to convert their package to a Julia package. Then, you >> can ask the authors if the converted package could be released with an >> MIT license. >> >> On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto wrote: >> > Thanks Jake! I'll also ask if they are willing to participate in the Julia >> > community by implementing a Julia version too! :) >> > >> > >> > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: >> >> >> >> Another strategy is to contact the authors directly and ask them if they >> >> would consider relicensing their work. Many people do not really >> >> consider >> >> the implications of choosing one license over another and just go with a >> >> default. >> >> >> >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: >> >>> >> >>> Yes, including the same GPL-3 license is sufficient if you've derived >> >>> your work from a GPL-3 project. You may also need to include the >> >>> original >> >>> headers of the files if they contain attribution information that you >> >>> are >> >>> required to preserve. >> >>> >> >>> I don't think there's anything dishonest about creating a GPL-3 package. >> >>> If you would like to release something under a permissive license, >> >>> you'll >> >>> have to implement your code from scratch without ever reading any of the >> >>> code from a GPL or closed-source implementation. >> >>> >> >>> What's most beneficial depends on context. Many businesses prohibit GPL >> >>> software, so many people in the Julia (and Python) communities >> >>> intentionally >> >>> produce MIT or BSD software. But Julia benefits a lot from having GPL >> >>> packages when there's no reasonable alternative. >> >>> >> >>> -- John >> >>> >> >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: >> >>> >> >>> Hi all, >> >>> >> >>> I'm trying to familiarize myself with Julia by seeing how it compares to >> >>> other languages. I would also like to "open-source" my code if it seems >> >>> useful to others. Unfortunately, licenses have made this process >> >>> complicated. >> >>> >> >>> A tangible example: >> >>> >> >>> I am trying to implement a Julia version of the R package pcalg >> >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most R >> >>> packages, it is protected under the GPL-3 license. Also, the license >> >>> states >> >>> that it would consider my implementation a "modification" of the R >> >>> package. >> >>> Say I feel that my project is ready to be open-sourced and put it in a >> >>> github repository. Is it enough to follow the RmathDist.jl lead and do >> >>> the >> >>> following?: >> >>> 1. Include the same license in the repository. >> >>> 2. Cite the R package I modified. >> >>> >> >>> A more long term question: I'm guessing a better (and more honest) >> >>> alternative to the above would be to implement the relevant algorithms >> >>> by >> >>> looking at the pseudocode and applying it in a way that is friendlier to >> >>> future improvements using idiomatic Julia (if it exists yet). After >> >>> that, >> >>> open-source it under the MIT license. Would this be a more beneficial >> >>> approach than the "Julia version of an R package" approach? >> >>> >> >>> >> >
[julia-users] Managing objects and state
Forgive me if this is daft and often answered question but I'm trying to get my head around Julia OO. Am I correct in thinking that as there is no binding between methods and types that I have to explicitly pass in an instance of a type to a method. If that is the case then how do I hold state on a remote object. I call a function that creates an instance of a type say something simple. type State sock end I just want to hold a socket reference. If the first remote function I call creates State then how can the next function I call obtain the state instance. Do I have to create a remote reference or something which it can use? Thanks Bob
[julia-users] Re: Constructing arrays with dim > 2
Thinking about it, it is probably not so ... efficient. Le lundi 24 mars 2014 19:41:14 UTC+1, Antoine Chevalier a écrit : > > Hi, I guess you want a 3d array instead of a 2D array containing 1D > arrays. I tried this: > > arrayLength = 10; > > matrixCols = 10; > > matrixSlices= 10; > function arrayTest(arrayLength,i,j)singleArray = > ones(1,arrayLength)*(i+j); #each array has a unique value i+jreturn > singleArrayend > > matrix3d = [arrayTest(arrayLength,i,j)[k] for k=1:arrayLength, > i=1:matrixCols, j=1:matrixSlices ]; > matrix3d[:,1,1] > > It works fine ;) > > > > Le lundi 24 mars 2014 15:07:49 UTC+1, Linus Mellberg a écrit : >> >> Hi! >> >> I'm trying to construct a 3 dimensional array from a number of 1 >> dimensional arrays. Essentially what i would like to do is >> >> a = [f(i, j) for i in 1:n, j in 1:m] >> >> where f(i, j) is a function that returns an array (note, f has to >> construct the entire array at the same time). The code above creates a >> 2-dimensional array of arrays, but I would like to get a 3-dimensional >> array with the arrays returned by f in the first dimension with i and j in >> the second and third dimension, hope you understand >> >> a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] >> a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] >> . >> . >> . >> a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] >> >> f(i,j) are column arrays above. >> >> It can be achieved by first creating the large matrix and then filling it >> >> a = zeros(Int64, k, n, m) >> for i in 1:n, j in 1:m >> a[:,i,j] = f(i,j) >> end >> >> Is this the only way? I find it sort of ugly when its usually possible to >> do nice construction using comprehensions in other cases. >> >>
[julia-users] Re: Constructing arrays with dim > 2
Hi, I guess you want a 3d array instead of a 2D array containing 1D arrays. I tried this: arrayLength = 10; matrixCols = 10; matrixSlices= 10; function arrayTest(arrayLength,i,j)singleArray = ones(1,arrayLength)*(i+j); #each array has a unique value i+jreturn singleArrayend matrix3d = [arrayTest(arrayLength,i,j)[k] for k=1:arrayLength, i=1:matrixCols, j=1:matrixSlices ]; matrix3d[:,1,1] It works fine ;) Le lundi 24 mars 2014 15:07:49 UTC+1, Linus Mellberg a écrit : > > Hi! > > I'm trying to construct a 3 dimensional array from a number of 1 > dimensional arrays. Essentially what i would like to do is > > a = [f(i, j) for i in 1:n, j in 1:m] > > where f(i, j) is a function that returns an array (note, f has to > construct the entire array at the same time). The code above creates a > 2-dimensional array of arrays, but I would like to get a 3-dimensional > array with the arrays returned by f in the first dimension with i and j in > the second and third dimension, hope you understand > > a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] > a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] > . > . > . > a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] > > f(i,j) are column arrays above. > > It can be achieved by first creating the large matrix and then filling it > > a = zeros(Int64, k, n, m) > for i in 1:n, j in 1:m > a[:,i,j] = f(i,j) > end > > Is this the only way? I find it sort of ugly when its usually possible to > do nice construction using comprehensions in other cases. > >
[julia-users] Re: Constructing arrays with dim > 2
If you really want a 3d matrix and not a 2d array containing arrays, I would have tried this : arrayLength= 10 ; matrixCol = 10; matrixSlices= 10; function arrayTest(arrayLength,i,j) singleArray = ones(1,arrayLength)*(i+j); #each array has a unique value i+j return singleArray end matrix3d = [arrayTest(arrayLength,i,j)[k] for k=1:arrayLength, i=1:matrixCol, j=1:matrixSlices ]; matrix3d[:,1,1] Le lundi 24 mars 2014 19:25:56 UTC+1, Keith Campbell a écrit : > > This runs fine for me, running Version 0.3.0-prerelease (2014-02-28 04:44 > UTC): > > f(i,j) = [i,j] > n=3; m=2 > a = [f(i, j) for i in 1:n, j in 1:m] > > Out[91]: > > 3x2 Array{Any,2}: > [1,1] [1,2] > [2,1] [2,2] > [3,1] [3,2] > > On Monday, March 24, 2014 10:07:49 AM UTC-4, Linus Mellberg wrote: >> >> Hi! >> >> I'm trying to construct a 3 dimensional array from a number of 1 >> dimensional arrays. Essentially what i would like to do is >> >> a = [f(i, j) for i in 1:n, j in 1:m] >> >> where f(i, j) is a function that returns an array (note, f has to >> construct the entire array at the same time). The code above creates a >> 2-dimensional array of arrays, but I would like to get a 3-dimensional >> array with the arrays returned by f in the first dimension with i and j in >> the second and third dimension, hope you understand >> >> a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] >> a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] >> . >> . >> . >> a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] >> >> f(i,j) are column arrays above. >> >> It can be achieved by first creating the large matrix and then filling it >> >> a = zeros(Int64, k, n, m) >> for i in 1:n, j in 1:m >> a[:,i,j] = f(i,j) >> end >> >> Is this the only way? I find it sort of ugly when its usually possible to >> do nice construction using comprehensions in other cases. >> >>
Re: [julia-users] Re: Build a constructor with fewer inputs than values
I get julia> x.Valve1 12-element Array{Bool,1}: true false true false true false true false true false true false I even went to the trouble to build Julia 0.2.1 and test it there, too; same result. So I can't replicate your problem. (I'm on Linux.) How are you getting Julia? Building it yourself? Binary download? Anyway, it sounds like you want to try a different way of getting Julia. --Tim On Monday, March 24, 2014 07:18:42 AM RecentConvert wrote: > The updated code works the same with Status([1:12]) as it does with > vector(Dstc["StatusW"]). > > type Status >Valve1::Vector{Bool} >Valve2::Vector{Bool} >Valve3::Vector{Bool} >Valve4::Vector{Bool} >Valve5::Vector{Bool} >Valve6::Vector{Bool} >Valve7::Vector{Bool} >Valve8::Vector{Bool} > ># Constructor for Status type >function Status(vals::Array{Int64}) >l = int64(length(vals)) > >Valve1 = Array(Bool,l) >Valve2 = Array(Bool,l) >Valve3 = Array(Bool,l) >Valve4 = Array(Bool,l) >Valve5 = Array(Bool,l) >Valve6 = Array(Bool,l) >Valve7 = Array(Bool,l) >Valve8 = Array(Bool,l) > ># Parse Inputs >for i=1:l > # Byte 1 > Valve1[i] = vals[i] & 2^(1-1) > 0 > Valve2[i] = vals[i] & 2^(2-1) > 0 > Valve3[i] = vals[i] & 2^(3-1) > 0 > Valve4[i] = vals[i] & 2^(4-1) > 0 > Valve5[i] = vals[i] & 2^(5-1) > 0 > Valve6[i] = vals[i] & 2^(6-1) > 0 > Valve7[i] = vals[i] & 2^(7-1) > 0 > Valve8[i] = vals[i] & 2^(8-1) > 0 >end # End of conversion > > >new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8) > > >end # End of constructor > end # End of type > > statuses = Status(vector(Dstc["StatusW"])) > julia> typeof(statuses) Nothing (constructor with 1 method) > > julia> statuses.Valve1 ErrorException("type Nothing has no field Valve1") > > > > julia> x = Status([1:12]) > > julia> typeof(x) Nothing (constructor with 1 method) > > julia> x.Valve1 ErrorException("type Nothing has no field Valve1")
[julia-users] Re: Constructing arrays with dim > 2
This runs fine for me, running Version 0.3.0-prerelease (2014-02-28 04:44 UTC): f(i,j) = [i,j] n=3; m=2 a = [f(i, j) for i in 1:n, j in 1:m] Out[91]: 3x2 Array{Any,2}: [1,1] [1,2] [2,1] [2,2] [3,1] [3,2] On Monday, March 24, 2014 10:07:49 AM UTC-4, Linus Mellberg wrote: > > Hi! > > I'm trying to construct a 3 dimensional array from a number of 1 > dimensional arrays. Essentially what i would like to do is > > a = [f(i, j) for i in 1:n, j in 1:m] > > where f(i, j) is a function that returns an array (note, f has to > construct the entire array at the same time). The code above creates a > 2-dimensional array of arrays, but I would like to get a 3-dimensional > array with the arrays returned by f in the first dimension with i and j in > the second and third dimension, hope you understand > > a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] > a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] > . > . > . > a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] > > f(i,j) are column arrays above. > > It can be achieved by first creating the large matrix and then filling it > > a = zeros(Int64, k, n, m) > for i in 1:n, j in 1:m > a[:,i,j] = f(i,j) > end > > Is this the only way? I find it sort of ugly when its usually possible to > do nice construction using comprehensions in other cases. > >
[julia-users] Re: Gauss quadrature package
Hallo Bill; could you please explain or post some reference about that specialised version you mention of the QL iteration to get directly the first components of the normalised eigenvectors. As I am working with complex, non-hermitian, symmetric eigenvalue problems it would be of great help. Thanks! El miércoles, 16 de octubre de 2013 03:16:33 UTC+2, Bill McLean escribió: > > Steven, thanks for pointing out Base.gauss. My package relies, via eig, > on the Lapack eigensystem routines for a symmetric tridiagonal matrix, but > it would be possible to write such an eigensolver in Julia and so support > higher precision. If I find the time I will try to do this. In fact, to > generate the Gauss rules you need only the eigenvalues and the first > component of each normalized eigenvector, and there is a specialised > version of the QL iteration that does this without having to compute the > other components of the eigenvectors. > > On Tuesday, October 15, 2013 6:38:54 AM UTC+11, Steven G. Johnson wrote: >> >> Note that this functionality (for constant weight functions) is already >> in Base, e.g. >> >> x, w = Base.gauss(Float64, 17) >> >> gives a 17-point Gauss rule on [-1,1]. There is also Base.kronrod for >> Gauss-Kronrod rules. (Currently, these are not documented; that >> functionality use used internally by the quadgk function.) >> >> It is nice to have Gauss quadrature rules for different weight functions, >> though. You might want to look at the Base implementation (in >> base/quadgk.jl), however, and possibly exploit some of its subroutines, >> since the Base implementation supports computation of points and weights in >> arbitrary precision. >> >> On Saturday, October 12, 2013 9:05:53 PM UTC-4, Bill McLean wrote: >>> >>> I have written a Julia package to generate the points and weights of the >>> classical Gauss quadrature rules. I did not succeed in following the >>> instructions in the manual to add it to the list of available packages, but >>> you can obtain the package from >>> https://github.com/billmclean/GaussQuadrature.jl >>> >>>
Re: [julia-users] Terminate a task
Alternatively, might be fun to make a ccall_in_worker_thread intrinsic which handles all of the fiddly gc details and only blocks the local task (and/or returns a remoteref) On Monday, March 24, 2014, Stefan Karpinski wrote: > Yes, we need this ability. Externally terminating and otherwise > interacting with tasks is a good way to deal with things like timeouts and > cancelling distributed work. > > > On Mon, Mar 24, 2014 at 1:01 AM, Amit Murthy > > > wrote: > >> I think currently the only way to interrupt a task is when it is blocked >> on a condition variable by using the "notify" call. Will be good to have a >> "terminate(t::Task)" call. >> >> >> On Sun, Mar 23, 2014 at 9:08 PM, Bob Cowdery >> >> > wrote: >> >>> Could you clarify please. If its on a blocking call how do I throw an >>> error and if its not complete why would the gc delete it. >>> >>> >>> On Sunday, March 23, 2014 3:27:18 PM UTC, Bob Cowdery wrote: Is there any way to terminate a task that is stuck on a blocking call. I can see that I can call istaskdone() or start a Timeout to know that the task is potentially blocked but I don't see anything in Task that lets me terminate it. Bob >>> >> >
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
OK. How about asking if I could assist *them* on a Julia version under an MIT license? The result is the same but I guess language does make a difference... On Monday, March 24, 2014 9:08:23 AM UTC-7, John Myles White wrote: > > I think Tom’s point is that most people prefer that you assist them rather > than offer them the chance to assist you. > > — John > > On Mar 24, 2014, at 8:58 AM, Ted Fujimoto > > wrote: > > I probably was not clear in my response to Jake but what I meant was that > I would ask the authors if they wanted to use the GPL because they felt > that license was most appropriate. If not, I would then give them the > choice to *assist* me at any level they choose with a Julia version of > their package under an MIT license (since they are academics, my guess is > that they would want to be a part of popularizing their work with different > versions), and they can decline to help if they choose to do so. I think it > would be best not to keep them in the dark. > > On Monday, March 24, 2014 4:47:08 AM UTC-7, tshort wrote: >> >> Instead of asking the package authors to do extra work, it might be >> better to offer to convert their package to a Julia package. Then, you >> can ask the authors if the converted package could be released with an >> MIT license. >> >> On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto wrote: >> > Thanks Jake! I'll also ask if they are willing to participate in the >> Julia >> > community by implementing a Julia version too! :) >> > >> > >> > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: >> >> >> >> Another strategy is to contact the authors directly and ask them if >> they >> >> would consider relicensing their work. Many people do not really >> consider >> >> the implications of choosing one license over another and just go with >> a >> >> default. >> >> >> >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: >> >>> >> >>> Yes, including the same GPL-3 license is sufficient if you've derived >> >> >>> your work from a GPL-3 project. You may also need to include the >> original >> >>> headers of the files if they contain attribution information that you >> are >> >>> required to preserve. >> >>> >> >>> I don't think there's anything dishonest about creating a GPL-3 >> package. >> >>> If you would like to release something under a permissive license, >> you'll >> >>> have to implement your code from scratch without ever reading any of >> the >> >>> code from a GPL or closed-source implementation. >> >>> >> >>> What's most beneficial depends on context. Many businesses prohibit >> GPL >> >>> software, so many people in the Julia (and Python) communities >> intentionally >> >>> produce MIT or BSD software. But Julia benefits a lot from having GPL >> >> >>> packages when there's no reasonable alternative. >> >>> >> >>> -- John >> >>> >> >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: >> >>> >> >>> Hi all, >> >>> >> >>> I'm trying to familiarize myself with Julia by seeing how it compares >> to >> >>> other languages. I would also like to "open-source" my code if it >> seems >> >>> useful to others. Unfortunately, licenses have made this process >> >>> complicated. >> >>> >> >>> A tangible example: >> >>> >> >>> I am trying to implement a Julia version of the R package pcalg >> >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most >> R >> >>> packages, it is protected under the GPL-3 license. Also, the license >> states >> >>> that it would consider my implementation a "modification" of the R >> package. >> >>> Say I feel that my project is ready to be open-sourced and put it in a >> >> >>> github repository. Is it enough to follow the RmathDist.jl lead and >> do the >> >>> following?: >> >>> 1. Include the same license in the repository. >> >>> 2. Cite the R package I modified. >> >>> >> >>> A more long term question: I'm guessing a better (and more honest) >> >>> alternative to the above would be to implement the relevant >> algorithms by >> >>> looking at the pseudocode and applying it in a way that is friendlier >> to >> >>> future improvements using idiomatic Julia (if it exists yet). After >> that, >> >>> open-source it under the MIT license. Would this be a more beneficial >> >> >>> approach than the "Julia version of an R package" approach? >> >>> >> >>> >> > > > >
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
I think Tom’s point is that most people prefer that you assist them rather than offer them the chance to assist you. — John On Mar 24, 2014, at 8:58 AM, Ted Fujimoto wrote: > I probably was not clear in my response to Jake but what I meant was that I > would ask the authors if they wanted to use the GPL because they felt that > license was most appropriate. If not, I would then give them the choice to > assist me at any level they choose with a Julia version of their package > under an MIT license (since they are academics, my guess is that they would > want to be a part of popularizing their work with different versions), and > they can decline to help if they choose to do so. I think it would be best > not to keep them in the dark. > > On Monday, March 24, 2014 4:47:08 AM UTC-7, tshort wrote: > Instead of asking the package authors to do extra work, it might be > better to offer to convert their package to a Julia package. Then, you > can ask the authors if the converted package could be released with an > MIT license. > > On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto wrote: > > Thanks Jake! I'll also ask if they are willing to participate in the Julia > > community by implementing a Julia version too! :) > > > > > > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: > >> > >> Another strategy is to contact the authors directly and ask them if they > >> would consider relicensing their work. Many people do not really consider > >> the implications of choosing one license over another and just go with a > >> default. > >> > >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: > >>> > >>> Yes, including the same GPL-3 license is sufficient if you've derived > >>> your work from a GPL-3 project. You may also need to include the original > >>> headers of the files if they contain attribution information that you are > >>> required to preserve. > >>> > >>> I don't think there's anything dishonest about creating a GPL-3 package. > >>> If you would like to release something under a permissive license, you'll > >>> have to implement your code from scratch without ever reading any of the > >>> code from a GPL or closed-source implementation. > >>> > >>> What's most beneficial depends on context. Many businesses prohibit GPL > >>> software, so many people in the Julia (and Python) communities > >>> intentionally > >>> produce MIT or BSD software. But Julia benefits a lot from having GPL > >>> packages when there's no reasonable alternative. > >>> > >>> -- John > >>> > >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: > >>> > >>> Hi all, > >>> > >>> I'm trying to familiarize myself with Julia by seeing how it compares to > >>> other languages. I would also like to "open-source" my code if it seems > >>> useful to others. Unfortunately, licenses have made this process > >>> complicated. > >>> > >>> A tangible example: > >>> > >>> I am trying to implement a Julia version of the R package pcalg > >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most R > >>> packages, it is protected under the GPL-3 license. Also, the license > >>> states > >>> that it would consider my implementation a "modification" of the R > >>> package. > >>> Say I feel that my project is ready to be open-sourced and put it in a > >>> github repository. Is it enough to follow the RmathDist.jl lead and do > >>> the > >>> following?: > >>> 1. Include the same license in the repository. > >>> 2. Cite the R package I modified. > >>> > >>> A more long term question: I'm guessing a better (and more honest) > >>> alternative to the above would be to implement the relevant algorithms by > >>> looking at the pseudocode and applying it in a way that is friendlier to > >>> future improvements using idiomatic Julia (if it exists yet). After that, > >>> open-source it under the MIT license. Would this be a more beneficial > >>> approach than the "Julia version of an R package" approach? > >>> > >>> > >
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
I probably was not clear in my response to Jake but what I meant was that I would ask the authors if they wanted to use the GPL because they felt that license was most appropriate. If not, I would then give them the choice to *assist* me at any level they choose with a Julia version of their package under an MIT license (since they are academics, my guess is that they would want to be a part of popularizing their work with different versions), and they can decline to help if they choose to do so. I think it would be best not to keep them in the dark. On Monday, March 24, 2014 4:47:08 AM UTC-7, tshort wrote: > > Instead of asking the package authors to do extra work, it might be > better to offer to convert their package to a Julia package. Then, you > can ask the authors if the converted package could be released with an > MIT license. > > On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto > > > wrote: > > Thanks Jake! I'll also ask if they are willing to participate in the > Julia > > community by implementing a Julia version too! :) > > > > > > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: > >> > >> Another strategy is to contact the authors directly and ask them if > they > >> would consider relicensing their work. Many people do not really > consider > >> the implications of choosing one license over another and just go with > a > >> default. > >> > >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: > >>> > >>> Yes, including the same GPL-3 license is sufficient if you've derived > >>> your work from a GPL-3 project. You may also need to include the > original > >>> headers of the files if they contain attribution information that you > are > >>> required to preserve. > >>> > >>> I don't think there's anything dishonest about creating a GPL-3 > package. > >>> If you would like to release something under a permissive license, > you'll > >>> have to implement your code from scratch without ever reading any of > the > >>> code from a GPL or closed-source implementation. > >>> > >>> What's most beneficial depends on context. Many businesses prohibit > GPL > >>> software, so many people in the Julia (and Python) communities > intentionally > >>> produce MIT or BSD software. But Julia benefits a lot from having GPL > >>> packages when there's no reasonable alternative. > >>> > >>> -- John > >>> > >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: > >>> > >>> Hi all, > >>> > >>> I'm trying to familiarize myself with Julia by seeing how it compares > to > >>> other languages. I would also like to "open-source" my code if it > seems > >>> useful to others. Unfortunately, licenses have made this process > >>> complicated. > >>> > >>> A tangible example: > >>> > >>> I am trying to implement a Julia version of the R package pcalg > >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most > R > >>> packages, it is protected under the GPL-3 license. Also, the license > states > >>> that it would consider my implementation a "modification" of the R > package. > >>> Say I feel that my project is ready to be open-sourced and put it in a > >>> github repository. Is it enough to follow the RmathDist.jl lead and do > the > >>> following?: > >>> 1. Include the same license in the repository. > >>> 2. Cite the R package I modified. > >>> > >>> A more long term question: I'm guessing a better (and more honest) > >>> alternative to the above would be to implement the relevant algorithms > by > >>> looking at the pseudocode and applying it in a way that is friendlier > to > >>> future improvements using idiomatic Julia (if it exists yet). After > that, > >>> open-source it under the MIT license. Would this be a more beneficial > >>> approach than the "Julia version of an R package" approach? > >>> > >>> > > >
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
I probably was not clear in my response to Jake but what I meant was that I would ask the authors if they wanted to use the GPL because they felt that license was most appropriate. If not, I would then give them the choice to *assist* me at any level they choose with a Julia version of their package under an MIT license (since they are academics, my guess is that they would want to be a part of popularizing their work with different versions), and decline to help if they choose to do so. I think would be best not to keep them in the dark. On Monday, March 24, 2014 4:47:08 AM UTC-7, tshort wrote: > > Instead of asking the package authors to do extra work, it might be > better to offer to convert their package to a Julia package. Then, you > can ask the authors if the converted package could be released with an > MIT license. > > On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto > > > wrote: > > Thanks Jake! I'll also ask if they are willing to participate in the > Julia > > community by implementing a Julia version too! :) > > > > > > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: > >> > >> Another strategy is to contact the authors directly and ask them if > they > >> would consider relicensing their work. Many people do not really > consider > >> the implications of choosing one license over another and just go with > a > >> default. > >> > >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: > >>> > >>> Yes, including the same GPL-3 license is sufficient if you've derived > >>> your work from a GPL-3 project. You may also need to include the > original > >>> headers of the files if they contain attribution information that you > are > >>> required to preserve. > >>> > >>> I don't think there's anything dishonest about creating a GPL-3 > package. > >>> If you would like to release something under a permissive license, > you'll > >>> have to implement your code from scratch without ever reading any of > the > >>> code from a GPL or closed-source implementation. > >>> > >>> What's most beneficial depends on context. Many businesses prohibit > GPL > >>> software, so many people in the Julia (and Python) communities > intentionally > >>> produce MIT or BSD software. But Julia benefits a lot from having GPL > >>> packages when there's no reasonable alternative. > >>> > >>> -- John > >>> > >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: > >>> > >>> Hi all, > >>> > >>> I'm trying to familiarize myself with Julia by seeing how it compares > to > >>> other languages. I would also like to "open-source" my code if it > seems > >>> useful to others. Unfortunately, licenses have made this process > >>> complicated. > >>> > >>> A tangible example: > >>> > >>> I am trying to implement a Julia version of the R package pcalg > >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most > R > >>> packages, it is protected under the GPL-3 license. Also, the license > states > >>> that it would consider my implementation a "modification" of the R > package. > >>> Say I feel that my project is ready to be open-sourced and put it in a > >>> github repository. Is it enough to follow the RmathDist.jl lead and do > the > >>> following?: > >>> 1. Include the same license in the repository. > >>> 2. Cite the R package I modified. > >>> > >>> A more long term question: I'm guessing a better (and more honest) > >>> alternative to the above would be to implement the relevant algorithms > by > >>> looking at the pseudocode and applying it in a way that is friendlier > to > >>> future improvements using idiomatic Julia (if it exists yet). After > that, > >>> open-source it under the MIT license. Would this be a more beneficial > >>> approach than the "Julia version of an R package" approach? > >>> > >>> > > >
Re: [julia-users] Julia package style / learning
Just for the record. To convert from Array{Array{Float64, 1}, 1} to Array{Float64,2} you can use hcat(a...) Ivar kl. 15:50:36 UTC+1 mandag 24. mars 2014 skrev Ethan Anderes følgende: > > Yep, that was my situation: no linear algebra but a lot of grabbing > columns within for loops. Looking forward to non-copying array slices:) > > Thanks, > Ethan >
Re: [julia-users] Re: Terminate a task
Yes, we need this ability. Externally terminating and otherwise interacting with tasks is a good way to deal with things like timeouts and cancelling distributed work. On Mon, Mar 24, 2014 at 1:01 AM, Amit Murthy wrote: > I think currently the only way to interrupt a task is when it is blocked > on a condition variable by using the "notify" call. Will be good to have a > "terminate(t::Task)" call. > > > On Sun, Mar 23, 2014 at 9:08 PM, Bob Cowdery wrote: > >> Could you clarify please. If its on a blocking call how do I throw an >> error and if its not complete why would the gc delete it. >> >> >> On Sunday, March 23, 2014 3:27:18 PM UTC, Bob Cowdery wrote: >>> >>> Is there any way to terminate a task that is stuck on a blocking call. I >>> can see that I can call istaskdone() or start a Timeout to know that the >>> task is potentially blocked but I don't see anything in Task that lets me >>> terminate it. >>> >>> Bob >>> >> >
Re: [julia-users] Julia package style / learning
Yep, that was my situation: no linear algebra but a lot of grabbing columns within for loops. Looking forward to non-copying array slices:) Thanks, Ethan
Re: [julia-users] Julia package style / learning
I think comparisons between those two will depend a lot on context. If you need to use linear algebra functions, the Array{Array{Float64, 1}, 1} approach won’t work at all, so it’ll be infinitely slow. If you’re constantly just grabbing columns stored that way, it might be faster since you might avoid some copying — at the moment, for an array, A, A[:, i] does a copy which you might slow things down depending on context. — John On Mar 24, 2014, at 7:33 AM, Ethan Anderes wrote: > I'm definitely not an expert but I thought I would chime in on your "arrays > of arrays vrs matrices" question. > > I recently developed a project where I started out using: > Array{Array{Float64,1},1} as a container for a set of state vectors in an ODE > flow. This seemed most natural but I figured once I got it to work, I would > speed it up by representing everything in a compact matrix representation: > Array{Float64,2}. However, I was never able to speed things up much with > Array{Float64,2} over the Array{Array{Float64,1},1} container. > > I ended up with the impression (experts can confirm or deny this) that > although Array{Float64,2} may be stored in memory more compactly than > Array{Array{Float64,1},1}, the latter container is already very efficient so > that any speed gains were marginal. > > Is this the experience of others? > > Cheers, > Ethan
[julia-users] Julia package style / learning
I'm definitely not an expert but I thought I would chime in on your "arrays of arrays vrs matrices" question. I recently developed a project where I started out using: Array{Array{Float64,1},1} as a container for a set of state vectors in an ODE flow. This seemed most natural but I figured once I got it to work, I would speed it up by representing everything in a compact matrix representation: Array{Float64,2}. However, I was never able to speed things up much with Array{Float64,2} over the Array{Array{Float64,1},1} container. I ended up with the impression (experts can confirm or deny this) that although Array{Float64,2} may be stored in memory more compactly than Array{Array{Float64,1},1}, the latter container is already very efficient so that any speed gains were marginal. Is this the experience of others? Cheers, Ethan
Re: [julia-users] Re: Build a constructor with fewer inputs than values
The updated code works the same with Status([1:12]) as it does with vector(Dstc["StatusW"]). type Status Valve1::Vector{Bool} Valve2::Vector{Bool} Valve3::Vector{Bool} Valve4::Vector{Bool} Valve5::Vector{Bool} Valve6::Vector{Bool} Valve7::Vector{Bool} Valve8::Vector{Bool} # Constructor for Status type function Status(vals::Array{Int64}) l = int64(length(vals)) Valve1 = Array(Bool,l) Valve2 = Array(Bool,l) Valve3 = Array(Bool,l) Valve4 = Array(Bool,l) Valve5 = Array(Bool,l) Valve6 = Array(Bool,l) Valve7 = Array(Bool,l) Valve8 = Array(Bool,l) # Parse Inputs for i=1:l # Byte 1 Valve1[i] = vals[i] & 2^(1-1) > 0 Valve2[i] = vals[i] & 2^(2-1) > 0 Valve3[i] = vals[i] & 2^(3-1) > 0 Valve4[i] = vals[i] & 2^(4-1) > 0 Valve5[i] = vals[i] & 2^(5-1) > 0 Valve6[i] = vals[i] & 2^(6-1) > 0 Valve7[i] = vals[i] & 2^(7-1) > 0 Valve8[i] = vals[i] & 2^(8-1) > 0 end # End of conversion new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8) end # End of constructor end # End of type statuses = Status(vector(Dstc["StatusW"])) julia> typeof(statuses) Nothing (constructor with 1 method) julia> statuses.Valve1 ErrorException("type Nothing has no field Valve1") julia> x = Status([1:12]) julia> typeof(x) Nothing (constructor with 1 method) julia> x.Valve1 ErrorException("type Nothing has no field Valve1")
[julia-users] Constructing arrays with dim > 2
Hi! I'm trying to construct a 3 dimensional array from a number of 1 dimensional arrays. Essentially what i would like to do is a = [f(i, j) for i in 1:n, j in 1:m] where f(i, j) is a function that returns an array (note, f has to construct the entire array at the same time). The code above creates a 2-dimensional array of arrays, but I would like to get a 3-dimensional array with the arrays returned by f in the first dimension with i and j in the second and third dimension, hope you understand a[:,:,1] = [f(1,1) f(2,1) ... f(n,1)] a[:,:,2] = [f(1,2) f(2,2) ... f(n,2)] . . . a[:,:,m] = [f(1,m) f(2,m) ... f(n,m)] f(i,j) are column arrays above. It can be achieved by first creating the large matrix and then filling it a = zeros(Int64, k, n, m) for i in 1:n, j in 1:m a[:,i,j] = f(i,j) end Is this the only way? I find it sort of ugly when its usually possible to do nice construction using comprehensions in other cases.
Re: [julia-users] Yet another licensing question: Building a Julia version of an R package
Instead of asking the package authors to do extra work, it might be better to offer to convert their package to a Julia package. Then, you can ask the authors if the converted package could be released with an MIT license. On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto wrote: > Thanks Jake! I'll also ask if they are willing to participate in the Julia > community by implementing a Julia version too! :) > > > On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: >> >> Another strategy is to contact the authors directly and ask them if they >> would consider relicensing their work. Many people do not really consider >> the implications of choosing one license over another and just go with a >> default. >> >> On Sunday, March 23, 2014 8:59:58 PM UTC-4, John Myles White wrote: >>> >>> Yes, including the same GPL-3 license is sufficient if you've derived >>> your work from a GPL-3 project. You may also need to include the original >>> headers of the files if they contain attribution information that you are >>> required to preserve. >>> >>> I don't think there's anything dishonest about creating a GPL-3 package. >>> If you would like to release something under a permissive license, you'll >>> have to implement your code from scratch without ever reading any of the >>> code from a GPL or closed-source implementation. >>> >>> What's most beneficial depends on context. Many businesses prohibit GPL >>> software, so many people in the Julia (and Python) communities intentionally >>> produce MIT or BSD software. But Julia benefits a lot from having GPL >>> packages when there's no reasonable alternative. >>> >>> -- John >>> >>> On Mar 23, 2014, at 1:17 PM, Ted Fujimoto wrote: >>> >>> Hi all, >>> >>> I'm trying to familiarize myself with Julia by seeing how it compares to >>> other languages. I would also like to "open-source" my code if it seems >>> useful to others. Unfortunately, licenses have made this process >>> complicated. >>> >>> A tangible example: >>> >>> I am trying to implement a Julia version of the R package pcalg >>> (http://cran.r-project.org/web/packages/pcalg/index.html). Like most R >>> packages, it is protected under the GPL-3 license. Also, the license states >>> that it would consider my implementation a "modification" of the R package. >>> Say I feel that my project is ready to be open-sourced and put it in a >>> github repository. Is it enough to follow the RmathDist.jl lead and do the >>> following?: >>> 1. Include the same license in the repository. >>> 2. Cite the R package I modified. >>> >>> A more long term question: I'm guessing a better (and more honest) >>> alternative to the above would be to implement the relevant algorithms by >>> looking at the pseudocode and applying it in a way that is friendlier to >>> future improvements using idiomatic Julia (if it exists yet). After that, >>> open-source it under the MIT license. Would this be a more beneficial >>> approach than the "Julia version of an R package" approach? >>> >>> >
[julia-users] Re: Trying to understand how to structure parallel computation
Maybe the pmap example from the doc can be useful, it feeds work to other processes: http://julia.readthedocs.org/en/latest/manual/parallel-computing/#synchronization-with-remote-references
Re: [julia-users] Re: Build a constructor with fewer inputs than values
On Monday, March 24, 2014 03:56:08 AM RecentConvert wrote: > statuses = Status(vector(Dstc["StatusW"])) That's still not very helpful, because we have no idea what vector(Dstc["StatusW"]) yields. Does Status([1:12]) work? If so, the problem is in the particular inputs you're supplying. If not, then I'm not sure what's going on. --Tim
[julia-users] Re: Build a constructor with fewer inputs than values
Thanks for the quick replies. *Purpose:* Given a double, convert it to a collection of boolean values representing the statuses of various valves and settings. I'm still torn about whether I want to input an array of values and store arrays of statuses in one type or create an array of the type with individual collections. This implementation is *intended* to be for arrays. It's partly to teach myself Julia so learning how to do it this way is important but I am also open to *just do it this really easy way*. Once I have the parsed statuses I can use it separate calibration data from the rest of the data, among other things. I call it with the following line: statuses = Status(vector(Dstc["StatusW"])) The original format is a data frame. Julia Version 0.2.1 Commit e44b593* (2014-02-11 06:30 UTC) Platform Info: System: Windows (x86_64-w64-mingw32) WORD_SIZE: 64
[julia-users] Re: Build a constructor with fewer inputs than values
Sorry that you did not get any response, I did not comprehend what you were trying to do last time. The code you posted seems to work fine for me on 0.2.1 and 0.3-prerelease. How did you trigger the error? As a side note if efficiency is important, I would recommend that you use Valve2::Array{Bool, 1} or the equivalent Valve2::Vector{Bool} in the type declaration, so that Julia knows it will not get a matrix or tensor of booleans from your type. Ivar kl. 11:02:37 UTC+1 mandag 24. mars 2014 skrev RecentConvert følgende: > > Is this question not clear or just uninteresting? >
Re: [julia-users] Re: Build a constructor with fewer inputs than values
On Monday, March 24, 2014 03:02:37 AM RecentConvert wrote: > Is this question not clear or just uninteresting? You're not showing how you're actually calling the constructor. If I copy/paste your type definition, and then say Status([1:12]), it works just fine for me. What version of Julia are you running? I'm on master from about a week ago. A few comments: - Your arrays have ambiguous dimensionality, so this will be slow. Presumably it would be better to declare the fields as Valve1::Vector{Bool}. Or if you need multiple dimensionalities, put the dimensionality N as a parameter of the type, Status{N}, and declare them as Array{Bool, N}. - I don't see the reason for "int64" in int64(length(vals)). - You probably already know this, but in case it's useful to you: BitArrays represent an Int64 (or vector of Int64s) as an array of bits. --Tim
[julia-users] Re: Build a constructor with fewer inputs than values
Is this question not clear or just uninteresting?