[julia-users] Would the Complex{Bool}(false,true) == im approach be useful for Quaternion i,j,k?

2016-01-12 Thread Jeffrey Sarnoff
complex.jl defines im as Complex{Bool}(false,true).  Is there a reason that 
re is not defined as Complex{Bool}(true,false}? 

If I were to build a parameterized collection of Quaternion types 
(different from Quaternions.jl), including Quaternion{Bool} and 
Quaternion{FloatNN},
is there an advantage obtained by defining the Quaternion `imaginary` units 
i,j,k as 
   qi=Quaternion{Bool}(false,true,false,false}; 
qj=Quaternion{Bool}(false,false,true,false}; qk 
=Quaternion{Bool}(false,false,false.true}?
Would some of the op(Quaternion,Quaternion) math run faster (or jump 
higher)?  







[julia-users] Re: Variable scope in a function

2016-01-12 Thread elextr
IIUC isdefined(:awards) tests for a global variable called awards, so it 
won't find a local variable called awards.  What are you trying to achieve 
with this test?

On Wednesday, January 13, 2016 at 12:48:50 PM UTC+10, Brandon Booth wrote:
>
> So this is the full function. Note lines 4 and 5 - even if I define the 
> "awards" and "idvs" arrays in the function, it doesn't work. If I define 
> them outside the function, it works fine.
>
> Thanks.
>
> Brandon
>
> function parsefeed(url,st,fin)
>
>   db = SQLite.DB("/home/brandon/Documents/FPDS/fpds.db")
>   schema = Data.Schema(["piid","task","mod","obl_amt"], [ASCIIString, 
> ASCIIString, ASCIIString, Float64],)
>   sink = SQLite.Sink(schema,db,"feeds")
>   awards = ETree[]   #this doesn't matter
>   idvs = ETree[]#this doesn't matter
>
>   for x in st:10:fin
> dfall = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
> [:piid, :task, :mod, :obl_amt], 0)
> df = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
> [:piid, :task, :mod, :obl_amt], 1)
>
> pg = xp_parse(readall(get(string(url,"=",x
> awards = xpath(pg,"/feed/entry/content/ns1:award")
> idvs = xpath(pg,"/feed/entry/content/ns1:IDV")
>
> if isdefined(:awards)
>   for award in awards
> df[:piid] = 
> string(LibExpat.find(award,"ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
> df[:task] = string(LibExpat.find(award, 
> "ns1:referencedIDVID/ns1:PIID#string"))
> df[:mod] = string(LibExpat.find(award, 
> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
> df[:obl_amt] = 
> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
> append!(dfall,df)
>   end
> end
>
> if isdefined(:idvs)
>   for idv in idvs
> df[:piid] = string(LibExpat.find(idv, 
> "ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
> df[:task] = ""
> df[:mod] = string(LibExpat.find(idv, 
> "ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
> df[:obl_amt] = 
> float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
> append!(dfall,df)
>   end
> end
>
> if size(dfall,1) > 0
>   source = convertdf(dfall) #Data.Table(dfall) doesn't work, but I 
> copied the function from DataStreams and called it convertdf and that 
> solves the problem.
>   Data.stream!(source,sink)
> end
>   end
> end
>


[julia-users] Re: Variable scope in a function

2016-01-12 Thread Eric Forgy
On Wednesday, January 13, 2016 at 11:15:25 AM UTC+8, ele...@gmail.com wrote:
>
> IIUC isdefined(:awards) tests for a global variable called awards, so it 
> won't find a local variable called awards.  What are you trying to achieve 
> with this test?
>

Good catch. I'd try to remove that check. Learn something new every day :)

julia> y = 1
1

julia> function foo()
   x = 1
   println(isdefined(:x))
   println(isdefined(:y))
   end
foo (generic function with 1 method)

julia> foo()
false
true



[julia-users] Shell commands in Julia 0.4.2 in Windows 10

2016-01-12 Thread Jason Bates
Hi All,

I am having issues executing shell commands from within Julia (either in 
the REPL or via the iJulia notebook) on Windows 10.  I can run actual 
programs from within Julia, but all attempts at executing shell commands 
produce an error.

For instance, the example from the documentation:

julia> run(`echo hello`)

produces

julia> run(`echo hello`)
ERROR: could not spawn `echo hello`: no such file or directory (ENOENT)
 in _jl_spawn at process.jl:262

I get the same result using the semi-colon shortcut, both in the REPL and 
within iJulia.

However, I am able to call windows programs from within Julia successfully. 
 For instance, 

julia> run(`notepad`)

successfully spawns a notepad window.

Has anyone else run into this or similar issues on Win10?  Google searches 
have turned up empty.  Further, the issue appears to be exclusive to Julia; 
shell magic commands within iPython still execute correctly.


Thanks,

Jason Bates


Re: [julia-users] Re: Linking values in composite type and array?

2016-01-12 Thread Jon Norberg
Many thanks all, I learned a lot again from this great community.

Jon


[julia-users] Re: Variable scope in a function

2016-01-12 Thread Brandon Booth
So this is the full function. Note lines 4 and 5 - even if I define the 
"awards" and "idvs" arrays in the function, it doesn't work. If I define 
them outside the function, it works fine.

Thanks.

Brandon

function parsefeed(url,st,fin)

  db = SQLite.DB("/home/brandon/Documents/FPDS/fpds.db")
  schema = Data.Schema(["piid","task","mod","obl_amt"], [ASCIIString, 
ASCIIString, ASCIIString, Float64],)
  sink = SQLite.Sink(schema,db,"feeds")
  awards = ETree[]   #this doesn't matter
  idvs = ETree[]#this doesn't matter

  for x in st:10:fin
dfall = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
[:piid, :task, :mod, :obl_amt], 0)
df = DataFrame([ASCIIString, ASCIIString, ASCIIString, Float64], 
[:piid, :task, :mod, :obl_amt], 1)

pg = xp_parse(readall(get(string(url,"=",x
awards = xpath(pg,"/feed/entry/content/ns1:award")
idvs = xpath(pg,"/feed/entry/content/ns1:IDV")

if isdefined(:awards)
  for award in awards
df[:piid] = 
string(LibExpat.find(award,"ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
df[:task] = string(LibExpat.find(award, 
"ns1:referencedIDVID/ns1:PIID#string"))
df[:mod] = string(LibExpat.find(award, 
"ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
df[:obl_amt] = 
float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
append!(dfall,df)
  end
end

if isdefined(:idvs)
  for idv in idvs
df[:piid] = string(LibExpat.find(idv, 
"ns1:awardID/ns1:awardContractID/ns1:PIID#string"))
df[:task] = ""
df[:mod] = string(LibExpat.find(idv, 
"ns1:awardID/ns1:awardContractID/ns1:modNumber#string"))
df[:obl_amt] = 
float64(LibExpat.find(award,"ns1:dollarValues/ns1:obligatedAmount#string"))
append!(dfall,df)
  end
end

if size(dfall,1) > 0
  source = convertdf(dfall) #Data.Table(dfall) doesn't work, but I 
copied the function from DataStreams and called it convertdf and that 
solves the problem.
  Data.stream!(source,sink)
end
  end
end


[julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread DNF
So, what happened to this experiment?

Has the move been abandoned, or just been put on ice? The Google forum 
looks pretty primitive, and especially reading code is a real pain. But is 
there just not a lot of enthusiasm for the new platform? On the surface it 
looks vastly superior, but I don't understand much about the administration 
tools etc.


[julia-users] Manipulating strings from user input

2016-01-12 Thread Jose Pereira
Hi,
I need to use Julia's string functions to manipulate a string from a user 
input. Julia keeps giving an error. Strings defined directly in the code 
seem to work fine with Julia's string functions.

>From the code snippet below, the string defined for "b" gives the correct 
output.

For "c", code fails at line 19 with the following error message:

ERROR: LoadError: MethodError: 'get index' has no method matching 
getindex(::Symbol, ::Int64) 
in include at boot.jl:261
in include_from_node1 at loading.jl:304

If line 19 is commented out, it fails at line 20 with the following error 
message:

ERROR: LoadError: MethodError: 'length' has no method matching 
length(::Symbol) 
in include at boot.jl:261
in include_from_node1 at loading.jl:304

Need suggestions on what is wrong/missing in my code.

Thanks,
Jose

1b=string();
2c=string();
3
4b="CGAT";
5
6#Input
7 function input(prompt::AbstractString="")
8  print("Enter first string\n")
9  chomp(readline())
10   end
11   c=parse(input());
12   println("You entered, ",c)
13
14   println("string b = ",b)
15   println("1st char in string b = ",b[1])
16   println("Length of string b = ",length(b))
17
18  println("string c = ",c)
19  println("1st char in string c = ",c[1])
20  println("Length of string c = ",length(c))


[julia-users] Factors in Sparse QR factorization

2016-01-12 Thread Christopher Rinderspacher
Dear All,

I need direct access to Q and R of a sparse matrix for one of my 
algorithms. Currently, it seems the API does not support this, although 
internally spqr.jl implements qmult, which I presume I could use if it was 
exposed to multiply Q with the identity (in a sparse format) to get Q. 
Similarly with R. Are there any plans to expose appropriate APIs?

Sincerely,

Christopher


[julia-users] good approach to run julia scripts in parallel in a PC

2016-01-12 Thread Charles Novaes de Santana
Hi julians,

Parallel computing is not my focus, but I would like to run a  julia script
in parallel in my PC in order to save time. The PC has an 8-core processor
so I would like to run at least 4 replicates of my script (test1.jl) at the
same time, each one with one different parameter.

So far I was working on a cluster and I was using qsub in order to submit
my jobs. I didn't need to configure anything. I had a quota of 20 jobs, so
if I launched 200 jobs 20 of them would run and the others would be in a
queue waiting for their moment to run.

Now I would like to run my scripts in my machine and I would like to do
something similar. For me it is fine if I wait for the current jobs to
finish running in order to launch another bunch of jobs. As well as it is
fine if I launch a new job for each experiment that finishes. The easiest
option the best :)

My script does not receive any file as input, but it writes the outputs to
unique files (the file names are unique for each job).

Do you recommend a good way to do it in Julia? Let's say my script is
called "test1.jl". So far I was trying the following code to call my jobs:

function main()
parameters = collect(0.001:0.001:0.6);
@parallel for(p in parameters)
command1 = `/home/cdesantana/Downloads/julia -p 4
/home/cdesantana/Experiments/test1.jl $p`;
run(command1);
end
end

main();

I really don't understand what is happening here, but I am sure it is not
working 4 jobs of my scripts... :(

cdesantana@c-de-santana:~/Data/Dendritics/poster2016$ ps aux|grep julia
cdesant+  1964  3.7  1.3 9214696 107356 pts/10 Sl   15:20   0:01
/home/cdesantana/Downloads/julia/julia script.jl
cdesant+  1994 92.2  2.7 9489844 214388 pts/10 Rl   15:20   0:31
/home/cdesantana/Downloads/julia/julia -p4
/home/cdesantana/Experiments/test1.jl 1 0.001
cdesant+  2013  8.7  1.5 9189424 120340 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2016  9.2  1.6 9288520 131600 ?  Ssl  15:20   0:03
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2018  6.7  1.6 9353972 131772 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2023  7.7  1.6 9419496 131604 ?  Ssl  15:20   0:02
/home/cdesantana/Downloads/julia/usr/bin/julia -Cnative
-J/home/cdesantana/Downloads/julia/usr/lib/julia/sys.so --bind-to
192.168.89.174 --worker
cdesant+  2159  0.0  0.0  11716   892 pts/10   S+   15:21   0:00 grep
--color=auto julia

I was expecting that it would be running my script 4 times, each one with
one different value of $p (0.001, 0.002, 0.003, 0.004).

Any suggestion? My machine has ubuntu installed so I am fine if I need to
combine Linux programs with Julia.

Many thanks in advance for any help!

Best,

Charles
-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Tom Breloff
Just to throw in my $0.02... I use gmail most of the time, and I have a few
filters to auto-partition into a directory structure I like which combines
github and google groups emails.  If I could no longer do this I would be
disappointed.

On Tue, Jan 12, 2016 at 6:08 AM, Mauro  wrote:

> I second Tamas: a good email interface is a must.  This seems to be
> lacking currently:
> https://meta.discourse.org/t/email-interface-suggested-improvements/32140
>
> On Tue, 2016-01-12 at 11:32, Tamas Papp  wrote:
> > On Tue, Jan 12 2016, DNF wrote:
> >
> >> Hmm, I didn't consider that. I *never* read the emails, instead using
> the
> >> email notifications as jumping-off points to go into the forum. I always
> >> thought it strange that people refer to posts as 'mails'.
> >
> > I don't see an alternative given my preferences --- as I said, I don't
> > want to deal with different web interfaces. Also, sometimes I work
> > offline.
> >
> >> But, surely, plain text for code is *terrible*. Wrong or no
> indentation, no
> >> syntax highlighting, no font contrast between code and text? Or are you
> >> able to achieve some of those with your Emacs setup?
> >
> > Fixed width font takes care of indentation. For short code snippets, I
> > can live without highlighting, for longer code I prefer if people post
> > it as a gist.
> >
> > Best,
> >
> > Tamas
>


[julia-users] Problems with Pycall and scipy

2016-01-12 Thread Christopher Bross
Hi,

I'm trying to use some linear solvers from scipy in julia with pycall and I 
always get an error:
ERROR: PyError (:PyObject_Call) 
TypeError('type not understood',)


My small test program:

using PyCall
@pyimport numpy as np
@pyimport scipy.sparse.linalg as sp

sp.gmres(np.eye(5,5),np.zeros(5))

In the end I want to use julia types but I have already problems using the 
arrays created by numpy.
It is also not working when I'm using a PyObject.

I can use some scipy functions like 'sum' or 'inv' but also otheres like 
'cg' are not working.

Can someone help me at this point?

I'm using julia 0.4.0 and linked against python 3.4.1 (it is also not 
working with 2.7.8) .

Cheers
Christopher



Re: [julia-users] Re: Linking values in composite type and array?

2016-01-12 Thread Kevin Squire
Hi Jon,

On Tue, Jan 12, 2016 at 8:53 AM, David P. Sanders 
wrote:

> El martes, 12 de enero de 2016, 10:36:50 (UTC-6), Jon Norberg escribió:
>>
>> I would like to create a composite type and then also create an array
>> that has values from this type by reference. The behaviour I am looking for
>> is like this:
>>
>> type c
>>   a::Float64
>>   b::Float64
>> end
>>
>> x=c(0.1,0.2)
>> y=c(0.3,0.4)
>>
>> z=[x.a,x.b,y.a,y.b]
>>
>> show(z)
>> [0.1,0.2,0.3,0.4]
>>
>> x.a=0.5
>>
>> show(z)
>> [0.5,0.2,0.3,0.4]
>>
>> z[4]=0.6
>>
>> show(y.b)
>> 0.6
>>
>> Is this possible?
>>
>
>
> You can get this effect by creating an array of the two objects (rather
> than of their components, which doesn't make much sense anyway):
>
> julia> type MyType
>a::Float64
>b::Float64
>end
>
> julia> x = MyType(1, 2)
> MyType(1.0,2.0)
>
> julia> y = MyType(3, 4)
> MyType(3.0,4.0)
>
> julia> z = [x, y]
> 2-element Array{MyType,1}:
>  MyType(1.0,2.0)
>  MyType(3.0,4.0)
>
> julia> x.a = 10
> 10.0
>
> julia> z
> 2-element Array{MyType,1}:
>  MyType(10.0,2.0)
>  MyType(3.0,4.0)
>

For the array itself, it is possible to view it in multiple ways using
immutable and reinterpret.  But mimicking the answers above, it's not
possible to directly get a reference to the object (and even if it was, you
couldn't modify the individual parts of the object with that reference,
because here, it's immutable).

julia> immutable C
   a::Float64
   b::Float64
   end

julia> z = [C(0.1,0.2), C(0.3,0.4)]
2-element Array{C,1}:
 C(0.1,0.2)
 C(0.3,0.4)

julia> z_view = reinterpret(Float64, z)
4-element Array{Float64,1}:
 0.1
 0.2
 0.3
 0.4

julia> z_view[4] = 0.6
0.6

julia> z
2-element Array{C,1}:
 C(0.1,0.2)
 C(0.3,0.6)

julia> z[1] = C(1.0, 2.0)
C(1.0,2.0)

julia> z_view
4-element Array{Float64,1}:
 1.0
 2.0
 0.3
 0.6

Cheers,
   Kevin


[julia-users] Arrays of Unions

2016-01-12 Thread Christian Winkler
Suppose I have two types, and a Union of those two types. As expected, I 
can pass either type in as an argument to a function where the 
corresponding function argument is annotated with the Union:

julia> type TypeA; a::Float64; end

julia> type TypeB; a::Float64; b::Float64; end

julia> TypeAorB = Union{TypeA,TypeB}
Union{TypeA,TypeB}

julia> function foo(x::TypeAorB); x.a + 3; end
foo (generic function with 1 method)

julia> a = TypeA(1.5)
TypeA(1.5)

julia> foo(a)
4.5


I can define a function that takes an argument which is an array whose 
elements are members of that Union:

julia> function foovec(x::Vector{TypeAorB}); [foo(xi) for xi in x]; end
foovec (generic function with 1 method)

julia> methods(foovec)
# 1 method for generic function "foovec":
foovec(x::Array{Union{TypeA,TypeB},1}) at none:1


However, if I try to pass in any vector whose elements are of TypeA or 
TypeB, I get an unexpected (to me at least) failure:

julia> foovec([a,a])
ERROR: MethodError: `foovec` has no method matching foovec(::Array{TypeA,1})


In my real use case, the vectors never mix elements from my two types, so I 
can get the behavior that I want using a second Union (of vector types):

julia> TypeAorBvec = Union{Vector{TypeA},Vector{TypeB}}
Union{Array{TypeA,1},Array{TypeB,1}}

julia> function foovec(x::TypeAorBvec); [foo(xi) for xi in x]; end
foovec (generic function with 2 methods)

julia> foovec([a,a])
2-element Array{Float64,1}:
 4.5
 4.5


But I would like to know why the first example does not work.

An even simpler example: if I define a function with an argument of type 
Vector{Any}, then I cannot pass in an array of TypeA, again I get a "no 
method matching" error.





-- 


Please click here 
 for 
important information regarding this e-mail communication.


[julia-users] Re: Arrays of Unions

2016-01-12 Thread Yichao Yu


On Tuesday, January 12, 2016 at 1:04:26 PM UTC-5, Christian Winkler wrote:
>
> Suppose I have two types, and a Union of those two types. As expected, I 
> can pass either type in as an argument to a function where the 
> corresponding function argument is annotated with the Union:
>

See this thread

https://groups.google.com/forum/?fromgroups=#!topic/julia-users/daqcSANzgmo
 

>
> julia> type TypeA; a::Float64; end
>
> julia> type TypeB; a::Float64; b::Float64; end
>
> julia> TypeAorB = Union{TypeA,TypeB}
> Union{TypeA,TypeB}
>
> julia> function foo(x::TypeAorB); x.a + 3; end
> foo (generic function with 1 method)
>
> julia> a = TypeA(1.5)
> TypeA(1.5)
>
> julia> foo(a)
> 4.5
>
>
> I can define a function that takes an argument which is an array whose 
> elements are members of that Union:
>
> julia> function foovec(x::Vector{TypeAorB}); [foo(xi) for xi in x]; end
> foovec (generic function with 1 method)
>
> julia> methods(foovec)
> # 1 method for generic function "foovec":
> foovec(x::Array{Union{TypeA,TypeB},1}) at none:1
>
>
> However, if I try to pass in any vector whose elements are of TypeA or 
> TypeB, I get an unexpected (to me at least) failure:
>
> julia> foovec([a,a])
> ERROR: MethodError: `foovec` has no method matching 
> foovec(::Array{TypeA,1})
>
>
> In my real use case, the vectors never mix elements from my two types, so 
> I can get the behavior that I want using a second Union (of vector types):
>
> julia> TypeAorBvec = Union{Vector{TypeA},Vector{TypeB}}
> Union{Array{TypeA,1},Array{TypeB,1}}
>
> julia> function foovec(x::TypeAorBvec); [foo(xi) for xi in x]; end
> foovec (generic function with 2 methods)
>
> julia> foovec([a,a])
> 2-element Array{Float64,1}:
>  4.5
>  4.5
>
>
> But I would like to know why the first example does not work.
>
> An even simpler example: if I define a function with an argument of type 
> Vector{Any}, then I cannot pass in an array of TypeA, again I get a "no 
> method matching" error.
>
>
>
>
>
>
>
> Please click here 
>  
> for 
> important information regarding this e-mail communication.
>


Re: [julia-users] Arrays of Unions

2016-01-12 Thread Keno Fischer
This is explained in the manual:
http://docs.julialang.org/en/release-0.4/manual/types/ (grep for invariant,
not sure how to link a section). In short T <: S does not imply Array{T} <:
Array{S}.

On Tue, Jan 12, 2016 at 6:26 PM, Christian Winkler <
christian.wink...@conning.com> wrote:

> Suppose I have two types, and a Union of those two types. As expected, I
> can pass either type in as an argument to a function where the
> corresponding function argument is annotated with the Union:
>
> julia> type TypeA; a::Float64; end
>
> julia> type TypeB; a::Float64; b::Float64; end
>
> julia> TypeAorB = Union{TypeA,TypeB}
> Union{TypeA,TypeB}
>
> julia> function foo(x::TypeAorB); x.a + 3; end
> foo (generic function with 1 method)
>
> julia> a = TypeA(1.5)
> TypeA(1.5)
>
> julia> foo(a)
> 4.5
>
>
> I can define a function that takes an argument which is an array whose
> elements are members of that Union:
>
> julia> function foovec(x::Vector{TypeAorB}); [foo(xi) for xi in x]; end
> foovec (generic function with 1 method)
>
> julia> methods(foovec)
> # 1 method for generic function "foovec":
> foovec(x::Array{Union{TypeA,TypeB},1}) at none:1
>
>
> However, if I try to pass in any vector whose elements are of TypeA or
> TypeB, I get an unexpected (to me at least) failure:
>
> julia> foovec([a,a])
> ERROR: MethodError: `foovec` has no method matching
> foovec(::Array{TypeA,1})
>
>
> In my real use case, the vectors never mix elements from my two types, so
> I can get the behavior that I want using a second Union (of vector types):
>
> julia> TypeAorBvec = Union{Vector{TypeA},Vector{TypeB}}
> Union{Array{TypeA,1},Array{TypeB,1}}
>
> julia> function foovec(x::TypeAorBvec); [foo(xi) for xi in x]; end
> foovec (generic function with 2 methods)
>
> julia> foovec([a,a])
> 2-element Array{Float64,1}:
>  4.5
>  4.5
>
>
> But I would like to know why the first example does not work.
>
> An even simpler example: if I define a function with an argument of type
> Vector{Any}, then I cannot pass in an array of TypeA, again I get a "no
> method matching" error.
>
>
>
>
>
>
>
> Please click here
>  for
> important information regarding this e-mail communication.
>


Re: [julia-users] Arrays of Unions

2016-01-12 Thread Keno Fischer
Also for completeness, the two ways around this are to use either.

f{T<:TypeAOrB}(::Array{T})
f(::Union{Array{TypeA},Array{TypeB}})

On Tue, Jan 12, 2016 at 7:07 PM, Keno Fischer 
wrote:

> This is explained in the manual:
> http://docs.julialang.org/en/release-0.4/manual/types/ (grep for
> invariant, not sure how to link a section). In short T <: S does not imply
> Array{T} <: Array{S}.
>
> On Tue, Jan 12, 2016 at 6:26 PM, Christian Winkler <
> christian.wink...@conning.com> wrote:
>
>> Suppose I have two types, and a Union of those two types. As expected, I
>> can pass either type in as an argument to a function where the
>> corresponding function argument is annotated with the Union:
>>
>> julia> type TypeA; a::Float64; end
>>
>> julia> type TypeB; a::Float64; b::Float64; end
>>
>> julia> TypeAorB = Union{TypeA,TypeB}
>> Union{TypeA,TypeB}
>>
>> julia> function foo(x::TypeAorB); x.a + 3; end
>> foo (generic function with 1 method)
>>
>> julia> a = TypeA(1.5)
>> TypeA(1.5)
>>
>> julia> foo(a)
>> 4.5
>>
>>
>> I can define a function that takes an argument which is an array whose
>> elements are members of that Union:
>>
>> julia> function foovec(x::Vector{TypeAorB}); [foo(xi) for xi in x]; end
>> foovec (generic function with 1 method)
>>
>> julia> methods(foovec)
>> # 1 method for generic function "foovec":
>> foovec(x::Array{Union{TypeA,TypeB},1}) at none:1
>>
>>
>> However, if I try to pass in any vector whose elements are of TypeA or
>> TypeB, I get an unexpected (to me at least) failure:
>>
>> julia> foovec([a,a])
>> ERROR: MethodError: `foovec` has no method matching
>> foovec(::Array{TypeA,1})
>>
>>
>> In my real use case, the vectors never mix elements from my two types, so
>> I can get the behavior that I want using a second Union (of vector types):
>>
>> julia> TypeAorBvec = Union{Vector{TypeA},Vector{TypeB}}
>> Union{Array{TypeA,1},Array{TypeB,1}}
>>
>> julia> function foovec(x::TypeAorBvec); [foo(xi) for xi in x]; end
>> foovec (generic function with 2 methods)
>>
>> julia> foovec([a,a])
>> 2-element Array{Float64,1}:
>>  4.5
>>  4.5
>>
>>
>> But I would like to know why the first example does not work.
>>
>> An even simpler example: if I define a function with an argument of type
>> Vector{Any}, then I cannot pass in an array of TypeA, again I get a "no
>> method matching" error.
>>
>>
>>
>>
>>
>>
>>
>> Please click here
>>  
>> for
>> important information regarding this e-mail communication.
>>
>
>


Re: [julia-users] Re: Linking values in composite type and array?

2016-01-12 Thread Kaj Wiik
Thanks Kevin!

Haven't thought of reinterpret in this context, very elegant solution for 
array of omposites - composite of arrays type of problems.

Cheers,
Kaj


On Tuesday, January 12, 2016 at 8:04:26 PM UTC+2, Kevin Squire wrote:
>
>
> Hi Jon,
>
> On Tue, Jan 12, 2016 at 8:53 AM, David P. Sanders  > wrote:
>
>> El martes, 12 de enero de 2016, 10:36:50 (UTC-6), Jon Norberg escribió:
>>>
>>> I would like to create a composite type and then also create an array 
>>> that has values from this type by reference. The behaviour I am looking for 
>>> is like this:
>>>
>>> type c
>>>   a::Float64
>>>   b::Float64
>>> end
>>>
>>> x=c(0.1,0.2)
>>> y=c(0.3,0.4)
>>>
>>> z=[x.a,x.b,y.a,y.b]
>>>
>>> show(z)
>>> [0.1,0.2,0.3,0.4]
>>>
>>> x.a=0.5
>>>
>>> show(z)
>>> [0.5,0.2,0.3,0.4]
>>>
>>> z[4]=0.6
>>>
>>> show(y.b)
>>> 0.6
>>>
>>> Is this possible?
>>>
>>
>>
>> You can get this effect by creating an array of the two objects (rather 
>> than of their components, which doesn't make much sense anyway):
>>
>> julia> type MyType
>>a::Float64
>>b::Float64
>>end
>>
>> julia> x = MyType(1, 2)
>> MyType(1.0,2.0)
>>
>> julia> y = MyType(3, 4)
>> MyType(3.0,4.0)
>>
>> julia> z = [x, y]
>> 2-element Array{MyType,1}:
>>  MyType(1.0,2.0)
>>  MyType(3.0,4.0)
>>
>> julia> x.a = 10
>> 10.0
>>
>> julia> z
>> 2-element Array{MyType,1}:
>>  MyType(10.0,2.0)
>>  MyType(3.0,4.0)
>>
>
> For the array itself, it is possible to view it in multiple ways using 
> immutable and reinterpret.  But mimicking the answers above, it's not 
> possible to directly get a reference to the object (and even if it was, you 
> couldn't modify the individual parts of the object with that reference, 
> because here, it's immutable).
>
> julia> immutable C
>a::Float64
>b::Float64
>end
>
> julia> z = [C(0.1,0.2), C(0.3,0.4)]
> 2-element Array{C,1}:
>  C(0.1,0.2)
>  C(0.3,0.4)
>
> julia> z_view = reinterpret(Float64, z)
> 4-element Array{Float64,1}:
>  0.1
>  0.2
>  0.3
>  0.4
>
> julia> z_view[4] = 0.6
> 0.6
>
> julia> z
> 2-element Array{C,1}:
>  C(0.1,0.2)
>  C(0.3,0.6)
>
> julia> z[1] = C(1.0, 2.0)
> C(1.0,2.0)
>
> julia> z_view
> 4-element Array{Float64,1}:
>  1.0
>  2.0
>  0.3
>  0.6
>
> Cheers,
>Kevin
>


[julia-users] Re: Arrays of Unions

2016-01-12 Thread Christian Winkler
Thanks, Keno and Yichao. This is very helpful.

-- 


Please click here 
 for 
important information regarding this e-mail communication.


[julia-users] Error running examples of parallel computing with Julia

2016-01-12 Thread Charles Novaes de Santana
Hi,

I am trying to figure out how to work with parallel computing with Julia.
The documentation looks great, even for someone that has never worked with
Parallel Computing (and that does not understand most of the concepts
behind the documentation ;)).

Just to mention: I am working in a PC with Ubuntu. It has a 4-core
processor.

To run the code I describe below I am calling the julia terminal as:

$ julia -p 4

I am following the documentation here:
http://docs.julialang.org/en/latest/manual/parallel-computing/

For one example, specifically, I am facing some problems.

In this section:
http://docs.julialang.org/en/latest/manual/parallel-computing/#id2

I am trying to run the following piece of code:

@everywhere advection_shared_chunk!(q, u) = advection_chunk!(q, u,
myrange(q)..., 1:size(q,3)-1)

function advection_shared!(q, u)
@sync begin
for p in procs(q)
@async remotecall_wait(advection_shared_chunk!, p, q, u)
end
end
q
end

q = SharedArray(Float64, (500,500,500))
u = SharedArray(Float64, (500,500,500))

#Run once to JIT-compile
advection_shared!(q,u)

But I am facing the following error:

ERROR: MethodError: `remotecall_wait` has no method matching
remotecall_wait(::Function, ::Int64, ::SharedArray{Float64,3},
::SharedArray{Float64,3})
Closest candidates are:
  remotecall_wait(::LocalProcess, ::Any, ::Any...)
  remotecall_wait(::Base.Worker, ::Any, ::Any...)
  remotecall_wait(::Integer, ::Any, ::Any...)
 in anonymous at task.jl:447

...and 3 other exceptions.

 in sync_end at ./task.jl:413
 [inlined code] from task.jl:422
 in advection_shared! at none:2

What am I doing wrong here? As far as I know I am just reproducing the
example in the docs... or not?

Thanks for any help,

Charles


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Tamas Papp
I don't know about others, but for me it is hard to beat e-mail. Plain
text is fine for code.

The problem with various forums is that each community has a different
one. I would prefer not to deal with N web interfaces, no matter how
nice and featureful, instead of my nicely customized inbox in Emacs.

Best,

Tamas

On Tue, Jan 12 2016, DNF wrote:

> So, what happened to this experiment?
>
> Has the move been abandoned, or just been put on ice? The Google forum
> looks pretty primitive, and especially reading code is a real pain. But is
> there just not a lot of enthusiasm for the new platform? On the surface it
> looks vastly superior, but I don't understand much about the administration
> tools etc.


[julia-users] Re: Manipulating strings from user input

2016-01-12 Thread Kristoffer Carlsson
Why do you run "parse" on input()? This will parse a string to give a 
expression which in this case just gives you a symbol.

Removing the parse call makes thing work for me.

On Tuesday, January 12, 2016 at 1:51:59 PM UTC+1, Jose Pereira wrote:
>
> Hi,
> I need to use Julia's string functions to manipulate a string from a user 
> input. Julia keeps giving an error. Strings defined directly in the code 
> seem to work fine with Julia's string functions.
>
> From the code snippet below, the string defined for "b" gives the correct 
> output.
>
> For "c", code fails at line 19 with the following error message:
>
> ERROR: LoadError: MethodError: 'get index' has no method matching 
> getindex(::Symbol, ::Int64) 
> in include at boot.jl:261
> in include_from_node1 at loading.jl:304
>
> If line 19 is commented out, it fails at line 20 with the following error 
> message:
>
> ERROR: LoadError: MethodError: 'length' has no method matching 
> length(::Symbol) 
> in include at boot.jl:261
> in include_from_node1 at loading.jl:304
>
> Need suggestions on what is wrong/missing in my code.
>
> Thanks,
> Jose
>
> 1b=string();
> 2c=string();
> 3
> 4b="CGAT";
> 5
> 6#Input
> 7 function input(prompt::AbstractString="")
> 8  print("Enter first string\n")
> 9  chomp(readline())
> 10   end
> 11   c=parse(input());
> 12   println("You entered, ",c)
> 13
> 14   println("string b = ",b)
> 15   println("1st char in string b = ",b[1])
> 16   println("Length of string b = ",length(b))
> 17
> 18  println("string c = ",c)
> 19  println("1st char in string c = ",c[1])
> 20  println("Length of string c = ",length(c))
>


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread DNF
Hmm, I didn't consider that. I *never* read the emails, instead using the 
email notifications as jumping-off points to go into the forum. I always 
thought it strange that people refer to posts as 'mails'.

But, surely, plain text for code is *terrible*. Wrong or no indentation, no 
syntax highlighting, no font contrast between code and text? Or are you 
able to achieve some of those with your Emacs setup?


On Tuesday, January 12, 2016 at 11:16:47 AM UTC+1, Tamas Papp wrote:
>
> I don't know about others, but for me it is hard to beat e-mail. Plain 
> text is fine for code. 
>
> The problem with various forums is that each community has a different 
> one. I would prefer not to deal with N web interfaces, no matter how 
> nice and featureful, instead of my nicely customized inbox in Emacs. 
>
> Best, 
>
> Tamas 
>
> On Tue, Jan 12 2016, DNF wrote: 
>
> > So, what happened to this experiment? 
> > 
> > Has the move been abandoned, or just been put on ice? The Google forum 
> > looks pretty primitive, and especially reading code is a real pain. But 
> is 
> > there just not a lot of enthusiasm for the new platform? On the surface 
> it 
> > looks vastly superior, but I don't understand much about the 
> administration 
> > tools etc. 
>


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Tamas Papp
On Tue, Jan 12 2016, DNF wrote:

> Hmm, I didn't consider that. I *never* read the emails, instead using the
> email notifications as jumping-off points to go into the forum. I always
> thought it strange that people refer to posts as 'mails'.

I don't see an alternative given my preferences --- as I said, I don't
want to deal with different web interfaces. Also, sometimes I work
offline.

> But, surely, plain text for code is *terrible*. Wrong or no indentation, no
> syntax highlighting, no font contrast between code and text? Or are you
> able to achieve some of those with your Emacs setup?

Fixed width font takes care of indentation. For short code snippets, I
can live without highlighting, for longer code I prefer if people post
it as a gist.

Best,

Tamas


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Mauro
I second Tamas: a good email interface is a must.  This seems to be
lacking currently:
https://meta.discourse.org/t/email-interface-suggested-improvements/32140

On Tue, 2016-01-12 at 11:32, Tamas Papp  wrote:
> On Tue, Jan 12 2016, DNF wrote:
>
>> Hmm, I didn't consider that. I *never* read the emails, instead using the
>> email notifications as jumping-off points to go into the forum. I always
>> thought it strange that people refer to posts as 'mails'.
>
> I don't see an alternative given my preferences --- as I said, I don't
> want to deal with different web interfaces. Also, sometimes I work
> offline.
>
>> But, surely, plain text for code is *terrible*. Wrong or no indentation, no
>> syntax highlighting, no font contrast between code and text? Or are you
>> able to achieve some of those with your Emacs setup?
>
> Fixed width font takes care of indentation. For short code snippets, I
> can live without highlighting, for longer code I prefer if people post
> it as a gist.
>
> Best,
>
> Tamas


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread DNF


On Tuesday, January 12, 2016 at 11:32:21 AM UTC+1, Tamas Papp wrote:
>
> I don't see an alternative given my preferences --- as I said, I don't 
> want to deal with different web interfaces. Also, sometimes I work 
> offline. 


I see how that can work for you. But don't all such forums support email? 
Of course, if you use emails, there is no incentive to switch.
  

> Fixed width font takes care of indentation. For short code snippets, I 
> can live without highlighting, for longer code I prefer if people post 
> it as a gist. 
>

I guess many of my problems with the current forum are purely aesthetic. 
The fixed-width font is ugly, the highlighting is mostly just copied over 
colors, half the time posters just can't be bothered to mark it as code 
(though that could happen on any forum, highlighting seems to be gently 
enforced on, say, stack overflow, since it looks so much better). Inline 
code is apparently possible, but I cannot figure out how. Any sort of fancy 
layout, layout when quoting documentation, etc. is missing. Quoting of 
posts you reply to look bad, line widths are all over the place. Everything 
just looks plain dated and untidy.

My impression of this discussion, and the one here 
 is 
that most people are indifferent. Is everyone is just using emails?


[julia-users] Re: adding an axis to an array

2016-01-12 Thread Cedric St-Jean
It's been proposed  
already. I assume it will be part of the language in some form eventually, 
but I wouldn't hold my breath!

On Monday, January 11, 2016 at 7:51:53 AM UTC-5, Michael Borregaard wrote:
>
> Would 
> a1 = cat(3, a)
>
> do what you want?
>
> Den mandag den 11. januar 2016 kl. 09.03.57 UTC+1 skrev Doug Y'barbo:
>>
>> apologies if this topic has been asked and answered; lack of distinctive 
>> terms gave me large result sets from my queries of this archive
>>
>> it's common for me to want to add an axis to a Julia array, usually as a 
>> predicate to broadcasting, or more precisely to modify two arrays so that 
>> their trailing dimensions are equal and therefore invoke the Julia 
>> compiler's own broadcasting.
>>
>> to be clear, i'm not talking about a very specific transformation--one 
>> that doesn't change the Array's length and that can be reversed by calling 
>> *squeeze*
>>
>> this is how i do it just now:
>>
>>
>> a = rand(4, 3)
>>  
>> a1 = reshape(a, 4, 1, 3) 
>>
>> what i would like to do is something like NumPy (which of course also has 
>> a reshape method, but it likely wouldn't be used for this purpose)
>>
>> a1 = [:,NP.newaxis,:]
>>
>> to me this is much better because a1 is a view, rather than a copy, and i 
>> never had to pass in the values for the other dimensions, which is 
>> inconvenient and error-prone. (The two expressions for a1 are both valid 
>> NumPy and are equivalent).
>>
>> i would bet that Julia has a built-in similar to NumPy's to do what i 
>> want, i just can't find it
>>
>> --doug
>>
>>
>>
>>

[julia-users] Resources for GLAbstraction and the PerspectiveCamera method

2016-01-12 Thread kleinsplash
Hi,

Is there an API or somewhere I can find info on the args of 
PerspectiveCamera? Specifically for theta, translation, zoom, FOV and clip 
distances. I know my understanding is not up to scratch because translation 
and eyeposition seem similar, along with eyeposition and translation, zoom 
and FOV etc.. Basically I am just confusing myself with what needs to go 
where and ending up with a blank image render. 

https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLCamera.jl

Thx


Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-01-12 Thread Charles Novaes de Santana
My $0.02: I consider julia-users as a mailing-list. In general, my main
communication is through emails. I write the posts to the mailing list
using a webmail interface, but I use to read the posts of others from an
email client or from mobile. Of course I can adapt myself and use another
platform to communicate, but it would certainly take some time to be used
to it. My vote is to keep the mailing list working as it is, even if we
decide to put efforts in the other platform too.

Best,

Charles

On 12 January 2016 at 14:46, Tom Breloff  wrote:

> Just to throw in my $0.02... I use gmail most of the time, and I have a
> few filters to auto-partition into a directory structure I like which
> combines github and google groups emails.  If I could no longer do this I
> would be disappointed.
>
> On Tue, Jan 12, 2016 at 6:08 AM, Mauro  wrote:
>
>> I second Tamas: a good email interface is a must.  This seems to be
>> lacking currently:
>> https://meta.discourse.org/t/email-interface-suggested-improvements/32140
>>
>> On Tue, 2016-01-12 at 11:32, Tamas Papp  wrote:
>> > On Tue, Jan 12 2016, DNF wrote:
>> >
>> >> Hmm, I didn't consider that. I *never* read the emails, instead using
>> the
>> >> email notifications as jumping-off points to go into the forum. I
>> always
>> >> thought it strange that people refer to posts as 'mails'.
>> >
>> > I don't see an alternative given my preferences --- as I said, I don't
>> > want to deal with different web interfaces. Also, sometimes I work
>> > offline.
>> >
>> >> But, surely, plain text for code is *terrible*. Wrong or no
>> indentation, no
>> >> syntax highlighting, no font contrast between code and text? Or are you
>> >> able to achieve some of those with your Emacs setup?
>> >
>> > Fixed width font takes care of indentation. For short code snippets, I
>> > can live without highlighting, for longer code I prefer if people post
>> > it as a gist.
>> >
>> > Best,
>> >
>> > Tamas
>>
>
>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
https://github.com/cndesantana


Re: [julia-users] Re: RFC: ROOT.jl, wrappers for the ROOT library from CERN

2016-01-12 Thread Keno Fischer
>
> Doesn't work with ROOT-6, though, as the LLVM instances
> of Cling and Julia seem to clash.
>

I've been talking to the ROOT authors to get this resolved as well as
getting better integration.


[julia-users] Re: RFC: ROOT.jl, wrappers for the ROOT library from CERN

2016-01-12 Thread Oliver Schulz
Hello,

Keno's Cxx.jl is indeed awsome - was able to write a TTree 
 (using ROOT-5) quite
easily. Doesn't work with ROOT-6, though, as the LLVM instances
of Cling and Julia seem to clash. I tried with your rjulia executable, 
Joosep, but that
didn't help (though maybe I built it wrong).


Cheers,

Oliver


On Monday, September 28, 2015 at 11:10:01 AM UTC+2, Joosep Pata wrote:
>
> https://github.com/jpata/ROOT.jl 
> https://github.com/JuliaLang/METADATA.jl/pull/3550 
>
> These are a stop-gap until they can be ported to Keno’s Cxx.jl, but they 
> are already useful since a few years, so I’d like to ask for more sets of 
> eyes to look at them. 
>


[julia-users] Cannot pull with rebase...?

2016-01-12 Thread fabian
Hello all 
(first post)

I just now downloaded version 0.4.2 of Julia, and installed it on my 
W10x64pro machine. I was going to use it to run the optimization packages, 
so I did the Pkg.update() on the Julia cmd line, as instructed here 
http://www.juliaopt.org/.

To my surprise, i get the following error message:

INFO: Updating METADATA...
error: Cannot pull with rebase: You have unstaged changes.
ERROR: failed process: Process(`git pull --rebase -q`, ProcessExited(1)) [1]
 in pipeline_error at process.jl:555

I have not done any changes to any source, just DL'ed and installed the 
64-bit binary for windows, and I have no clue what is going on... Does 
anyone have any ideas?

Thanks.


Re: [julia-users] Cannot pull with rebase...?

2016-01-12 Thread Stefan Karpinski
If you go into ~/.julia/v0.4/METADATA and do `git status` you should see
what's going on there.

On Tue, Jan 12, 2016 at 10:41 AM,  wrote:

> Hello all
> (first post)
>
> I just now downloaded version 0.4.2 of Julia, and installed it on my
> W10x64pro machine. I was going to use it to run the optimization packages,
> so I did the Pkg.update() on the Julia cmd line, as instructed here
> http://www.juliaopt.org/.
>
> To my surprise, i get the following error message:
>
> INFO: Updating METADATA...
> error: Cannot pull with rebase: You have unstaged changes.
> ERROR: failed process: Process(`git pull --rebase -q`, ProcessExited(1))
> [1]
>  in pipeline_error at process.jl:555
>
> I have not done any changes to any source, just DL'ed and installed the
> 64-bit binary for windows, and I have no clue what is going on... Does
> anyone have any ideas?
>
> Thanks.
>


Re: [julia-users] Re: RFC: ROOT.jl, wrappers for the ROOT library from CERN

2016-01-12 Thread Oliver Schulz
That's great news - thanks a lot, Keno!

On Tuesday, January 12, 2016 at 4:24:33 PM UTC+1, Keno Fischer wrote:
>
> Doesn't work with ROOT-6, though, as the LLVM instances
>> of Cling and Julia seem to clash.
>>
>
> I've been talking to the ROOT authors to get this resolved as well as 
> getting better integration. 
>


[julia-users] Re: Resources for GLAbstraction and the PerspectiveCamera method

2016-01-12 Thread Simon Danisch
In the case of GLAbstraction, with it's missing Documentation, it's best to 
just open an issue there!

I did that for you:  https://github.com/JuliaGL/GLAbstraction.jl/issues/33


Am Dienstag, 12. Januar 2016 14:06:45 UTC+1 schrieb kleinsplash:
>
> Hi,
>
> Is there an API or somewhere I can find info on the args of 
> PerspectiveCamera? Specifically for theta, translation, zoom, FOV and clip 
> distances. I know my understanding is not up to scratch because translation 
> and eyeposition seem similar, along with eyeposition and translation, zoom 
> and FOV etc.. Basically I am just confusing myself with what needs to go 
> where and ending up with a blank image render. 
>
> https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLCamera.jl
>
> Thx
>
 


Re: [julia-users] Linking values in composite type and array?

2016-01-12 Thread Stefan Karpinski
No, Float64 is a value type (i.e. immutable).

On Tue, Jan 12, 2016 at 11:36 AM, Jon Norberg 
wrote:

> I would like to create a composite type and then also create an array that
> has values from this type by reference. The behaviour I am looking for is
> like this:
>
> type c
>   a::Float64
>   b::Float64
> end
>
> x=c(0.1,0.2)
> y=c(0.3,0.4)
>
> z=[x.a,x.b,y.a,y.b]
>
> show(z)
> [0.1,0.2,0.3,0.4]
>
> x.a=0.5
>
> show(z)
> [0.5,0.2,0.3,0.4]
>
> z[4]=0.6
>
> show(y.b)
> 0.6
>
> Is this possible?
>
> Thanks, Jon
>
>


[julia-users] Linking values in composite type and array?

2016-01-12 Thread Jon Norberg
I would like to create a composite type and then also create an array that 
has values from this type by reference. The behaviour I am looking for is 
like this:

type c
  a::Float64
  b::Float64
end

x=c(0.1,0.2)
y=c(0.3,0.4)

z=[x.a,x.b,y.a,y.b]

show(z)
[0.1,0.2,0.3,0.4]

x.a=0.5

show(z)
[0.5,0.2,0.3,0.4]

z[4]=0.6

show(y.b)
0.6

Is this possible?

Thanks, Jon