Sorry, but this was only an example of using a loop variable outside the
loop.
The real code was not that trivial -- was that not clear from the question:
"Imagine the following function ..."?
Then I apologize for poor wording.
Wanting to know when at what point a loop breaks is a natural request
Writing x'x does not explicitly transpose the first vector. Julia is clever
enough to call dot behind the scenes when you write x'x.
2014-05-21 3:09 GMT+02:00 Blake Johnson :
> In Julia, [1.0 1.0] is a 1x2 Array. If you insert commas you get a
> 2-element vector and then dot works, i.e.
> dot([1
Please consider b += Diagonal(c) instead of diagm. Diagonal(c) only stores
the diagonal elements but works like diagm(c) for matrix arithmetic
Vectorized code is always easier to understand
That is a strong statement. I have vectorised MATLAB code with repmat and
meshgrids that is completely unr
No problem. :)
On Tue, May 20, 2014, at 08:55 PM, Dan B wrote:
Thanks Daniel! Works perfectly! Very much appreciated :)
On Tuesday, May 20, 2014 8:43:55 PM UTC-7, Daniel Jones wrote:
I agree, that should work. I'll try to fix it when I have a chance.
In the mean time, a work around would
Thanks Daniel! Works perfectly! Very much appreciated :)
On Tuesday, May 20, 2014 8:43:55 PM UTC-7, Daniel Jones wrote:
>
> I agree, that should work. I'll try to fix it when I have a chance.
>
> In the mean time, a work around would be to use levels=collect(xs) where
> xs is your vector of n
I agree, that should work. I'll try to fix it when I have a chance.
In the mean time, a work around would be to use
levels=collect(xs) where xs is your vector of names. That will
effectively convert the PooledDataArray to a regular Array, so should
work.
On Tue, May 20, 2014, at 08:25 PM, D
>From one Daniel to the next - thanks! :) This looks like exactly what I
need. If I try manually constructing a vector with the names like you did,
then it does order the bars. However, if I try to pass in an array, I get
the following. Please note - Im new to Julia so I may have some
misun
Perhaps a setdiag!(b,a) function would be handy.
On Tuesday, May 20, 2014 10:46:28 PM UTC-4, gael@gmail.com wrote:
>
> While I cannot not agree with this ;), I'd like to state that:
> 1) High level functions might leverage clever algorithms faster than plain
> loops (best example comming to m
Hi there,
I'm using DataFrames package and having problems using NA on Array{Any}.
Here is the thing:
julia> a = [true 2 "hi"]
1x3 Array{Any,2}:
true 2 "hi"
That's expected, Julia had no way to promote this elements to a single
concrete type, so I got an Array{Any}. Now, if I try:
julia> a
Actually, another way to make it work is removing the blank line. Below little
program shows that readtable() accepts test_df1 and test_df2, but fails on
test_df3.
Also, the fact that it started to happen today had nothing todo with Julia or
DataFrame updates. The file is created by Stan and th
While I cannot not agree with this ;), I'd like to state that:
1) High level functions might leverage clever algorithms faster than plain
loops (best example comming to mind: dot).
2) Vectorized code is always easier to understand, write, fix and maintain
because the intent is clear from the star
Thanks for that, yes you're write I was being dumb.
Just to give an example of how slow, reading a 48mb csv files with a
mixture of strings and numbers with DataFrames's readtable, then writing it
gives:
*julia> **@time writetable("data.csv", r)*
elapsed time: 3.539380236 seconds (77981180
It should work if you add:
Scale.x_discrete(levels=["a", "b", "c"])
where ["a", "b", "c"] is a vector of the values in the order you'd like
them to appear.
On Tue, May 20, 2014, at 05:32 PM, Dan B wrote:
Friends,
I have a simple array that has counts (sorted descending) and names
a
Hi,
Using a freshly updated Version 0.3.0-prerelease+3251 (2014-05-20 23:18 UTC) of
Julia I think I noticed a different behavior of readtable(), which I hope is
not intended.
I have a small test file with data as shown below (and attached as a file at
the end of the email):
lp__,accept_stat__
In Julia, [1.0 1.0] is a 1x2 Array. If you insert commas you get a
2-element vector and then dot works, i.e.
dot([1.0, 1.0], [1.0, 1.0])
On Tuesday, May 20, 2014 8:25:01 PM UTC-4, Altieres Del-Sent wrote:
>
> I am used to write at matlab dot([1 1], [1 1]). I know I can use [1 1]'
> *[1 1] to ca
I am used to write at matlab dot([1 1], [1 1]). I know I can use [1 1]'
*[1 1] to calc the dot product, but I use that way because I think is
faster without ask to transpose, I tried do the samething with julia and
get dot([1.0 1.0],[1.0 1.0])
MethodError(dot,(
1x2 Array{Float64,2}:
1.0
Also, your program is weird. My guess is that you want to give the largest
k such that x[1],..., x[k] are not equal to 0. If you want that, your
program is wrong when x does not contain any 0.
The fact that if x does not contain any 0, your program return length(x) -
1 is very weird to me.
On
This method is also a bit faster as you can check with @time. I guess that
it's because there is only one "if" per loop as opposed to 2 "if" per loop
in your design (Are we at the end of the array ? Is it a 0.0 ?).
François
On Wednesday, May 21, 2014 12:09:02 AM UTC+2, francoi...@gmail.com wrot
Hi,
I would do a while as the loop is a conditional loop :
function test(x::Vector{Float64})
i = 1
while i <= length(x) && x[i] != 0.0
i += 1
end
return i - 1
end
or I would use a return inside the for loop even though I prefer to avoid a
return in the middle of a functi
Hi,
I would do a while as the loop is a conditional loop :
function test(x::Vector{Float64})
i = 1
while i <= length(x) && x[i] != 0.0
i += 1
end
return i - 1
end
or I would use a return inside the for loop even though I prefer to avoid a
return in the middle of a functi
I think that the short answer is that a column vector is not the same thing
than a row vector. Note that Array{Float64,1} (N-vector) is kind of
equivalent to column vectors (Nx1 matrices) in Julia (meaning you can use
them in linear algebra operations), that might be where the confusion comes
f
Can you open a pull request? That's the best way to send a diff and have it
evaluated.
On Tuesday, May 20, 2014, David Moon wrote:
> I finally found time to get back to this. I found that it was easier to
> implement (i.e. many fewer changes to the existing Julia implementation) a
> more comple
I finally found time to get back to this. I found that it was easier to
implement (i.e. many fewer changes to the existing Julia implementation) a
more complex proposal where quote can be either hygienic or non-hygienic
depending on whether it is used inside of a macro. However, it still seems
Hi Davide,
There is already some good answers to your question on the list. See for
instance:
https://groups.google.com/forum/#!searchin/julia-users/array$202d$20scalar/julia-users/L3vPeZ7kews/LY60boyLhnoJ
Hope this is what you were looking for.
Best,
Oliver
Den tirsdag den 20. maj 2014 21.4
You don't need the {T} on the constructor; being inside the type definition
gives you access to that T.
Your call to the constructor needs to have the type parameter explicitly.
The type parameter here indicates which type you want to create.
~~~
MyType{Float64}(zeros(Float64, 5), ["param"=>2.0])
Hi,
Probably it is because I come from a numpy world, but why does slicing by
column differs from slicing by row?
a = ones(Float64, (10, 10))
println(typeof(a[1, :])) # this gives Array{Float64,2} ( i expected a 1d
array )
println(typeof(a[:, 1])) # this gives Array{Float64,1}
Davide
On Tuesday, May 20, 2014 07:22:51 PM Paul Analyst wrote:
> I have arrays about 10k*10k. Is faster by loop?
I think you'll find that loops are a generic answer to many of the questions
you've asked on this list. While in some languages loops are slow and you
_have_ to know about and use some high
Ok, thanks. However, in my actual problem i have to use an inner
constructor, something like
type MyType{T}
data::Array{Float64, 1}
meta::Dict{ASCIIString, T}
N::Int64
function MyType{T}(data::Array{Float64, 1}, meta::Dict{ASCIIString, T})
new(data, meta, length(data)
Regarding this comment:
> Even just serializing a single string profile shows masses of calls in
inference.jl. Surely this shouldn't be necessary?
You'll need to run it twice to get useful results; the first time, the
code must be compiled and therefore many calls are indeed made to inference.
Serlialize is very slow for string.
Is there any way the to speed it up at present, or an alternative way to
save data structures which is significantly faster?
Are there any plans to speed up string serialization in Julia? Is there an
easy low hanging fruit which needs work and could speed thi
That's a very reasonable position and I tend to agree that it should be
possible even if not cheap to delete edges. That issue, however, is quite
specific to Graphs.jl, not Julia as a whole. You should open an issue
requesting the feature on the Graphs.jl GitHub repository and see what comes of
All those dependencies are in the READAME
On Tuesday, May 20, 2014 6:46:41 AM UTC-4, Ivo Balbaert wrote:
>
> Sorry, message was posted too quickly:
>
> Here is my report of the build:
> in /home/ivo/julia:
> git clone git://github.com/JuliaLang/julia.git
> cd julia
> in /home/ivo/julia/julia:
>
I have arrays about 10k*10k. Is faster by loop?
Paul
W dniu 2014-05-20 17:18, Oliver Lylloff pisze:
Yes, and for larger arrays it might be beneficial to write in a loop:
a = rand(1000);
b = rand(1000,1000);
for i = 1:length(a)
b[i,i] = b[i,i] + a[i];
end
Den tirsdag den 20. maj 2014 16.48.3
Thanks Prof. Bates and Stefan. I have made myself more familiar with Julia
because I want to use Octave and R less. However, even though some of the
Julia resistance from the R community is not tenable, it seems a bit unfair
to ask R users to shift their work to Julia at this point. For example,
Another thing is that if macros look like functions then they can be passed as
arguments to higher order functions. What does map(m,v) mean when m is a macro?
This can be worked around but fundamentally the answer is that mapping a macro
like that just isn't sensible. A difference in Julia philo
No, Julia does not have classes as such. Classes lets your group state and
methods that act on that state together. In Python you would do something
like this:
class Neuron:
def __init__(self, w, b):
self.weights = w
self.bias = bias
def multiplybias(self, factor):
We really should have a FAQ entry on this. It's a frequently asked question
:)
/ Toivo
On Tuesday, 20 May 2014 16:49:30 UTC+2, Tobias Knopp wrote:
>
> Python classes map pretty much 1 to 1 to Julia composite types. One just
> has to feed in the type a the first argument in functions.
>
> Am Die
On Tuesday, May 20, 2014 08:34:21 AM Holger Stichnoth wrote:
> The only other thing that I discovered when trying out Julia and Optim.jl
> is that the optimization is currently considerably slower than Matlab's
> fminunc. From the Gist I provided above, are there any potential
> performance impr
Yes, to use autodiff you need to make sure that all of the functions you call
could be applied to Array{T} for all T <: Number. The typing on your code is
currently overly restrictive when you define clogit_ll(beta::Vector{Float64})
and friends. If you loosen things to clogit_ll(beta::Vector), y
Glad that you were able to figure out the source of your problems.
It would be good to get a sense of the amount of time spent inside your
objective function vs. the amount of time spent in the code for optimize(). In
general, my experience is that >>90% of the compute time for an optimization
When I set autodiff = true in the Gist I posted above, I get the message
"ERROR: no method clogit_ll(Array{Dual{Float64},1},)".
Holger
On Monday, 19 May 2014 14:51:16 UTC+1, John Myles White wrote:
>
> If you can, please do share an example of your code. Logit-style models
> are in general num
Hi Andreas,
hi John,
hi Miles (via julia-opt, where I mistakenly also posted my question
yesterday),
Thanks for your help. Here is the link to the Gist I created:
https://gist.github.com/anonymous/5f95ab1afd241c0a5962
In the process of producing a minimal (non-)working example, I discovered
th
Yes, and for larger arrays it might be beneficial to write in a loop:
a = rand(1000);
b = rand(1000,1000);
for i = 1:length(a)
b[i,i] = b[i,i] + a[i];
end
Den tirsdag den 20. maj 2014 16.48.30 UTC+2 skrev paul analyst:
>
> b- not is zeros sometimes...
> c= diagm(a)
> b=b+c.
> Thx
> Paul
>
>
Python classes map pretty much 1 to 1 to Julia composite types. One just
has to feed in the type a the first argument in functions.
Am Dienstag, 20. Mai 2014 14:49:14 UTC+2 schrieb ccsv.1...@gmail.com:
>
> I want to convert some of my python code for exponential smoothing and
> Neural networks f
I don't know much about Julia's math libraries, so I'll leave that for
someone else.
In Julia, types are just data and functions use multiple dispatch to select
which values they work with.
For example, a Python class A with methods foo(self, x, y) and bar(self, z)
would become:
~~~
type A
#pr
b- not is zeros sometimes...
c= diagm(a)
b=b+c.
Thx
Paul
W dniu wtorek, 20 maja 2014 16:17:11 UTC+2 użytkownik Oliver Lylloff
napisał:
>
> Hi Paul,
>
> if b is just zeros, then b = diagm(a).
>
> Best,
> Oliver
>
>
>
> Den tirsdag den 20. maj 2014 15.04.33 UTC+2 skrev paul analyst:
>>
>> a=rand(
Hi Paul,
if b is just zeros, then b = diagm(a).
Best,
Oliver
Den tirsdag den 20. maj 2014 15.04.33 UTC+2 skrev paul analyst:
>
> a=rand(5)
> b=zeros(5,5)
> how to apply a on diagonal b ?
> Paul
>
I got a build of Julia 0.3 working on a fairly newly installed Ubuntu 14.04
LTS (in VMWare client)
It didn't went smooth all by itself (but it wasn't too bad either), here is
the report what I had to do after
git clone sourcode:
Op zaterdag 25 januari 2014 04:30:18 UTC+1 schreef Rajn:
>
> A
I want to convert some of my python code for exponential smoothing and
Neural networks from python over to julia.
My questions are:
What should I do about the classes? I have not seen classes in julia yet so
I am guessing they are all functions.
Secondly what library should they go in. Julia h
Sorry, message was posted too quickly:
Here is my report of the build:
in /home/ivo/julia:
git clone git://github.com/JuliaLang/julia.git
cd julia
in /home/ivo/julia/julia:
make
/bin/sh: 2: g++: not found
make[2]: *** [/home/ivo/julia/julia/usr/lib/libgrisu.so] Error 127
make[1]: *** [julia-rel
I have several libraries I wrote in python that I want to convert to Julia
that are for neural networks and exponential smoothing.
My questions are what do I do about the classes? I have not seen classes in
julia.
Also which libraries do I submit them to? It seems like julia has lots of
scatt
Jeff gave these reasons a long time
ago:
https://github.com/JuliaLang/julia/blob/3c354b4a391307d84915445bdd6fb464371f30fc/doc/at_macro_reasons
As a lisper, I of course understand the ugliness of @. But I think on the
balance it is worth it:
> - it alerts you that something different is happenin
A macro has different rules from function calls, which are reflected in
it's different calling syntax. Macros have more power to affect your code
in strange ways; a macro's arguments may not get run (if the macro doesn't
use them), a macro could change the value of local variables not involved
in c
As another option you could use chained comparisons in this case (I think
that's what they're called).
A[0.5 .< A .< 0.9]
On Tuesday, 20 May 2014 15:38:08 UTC+2, Florian Oswald wrote:
>
> I have an array A that i want to subset, as in
>
> A = rand(100,100)
> A[A.>0.5]
>
> I'm struggling to find
See: https://github.com/JuliaLang/julia/issues/5187
kl. 15:45:43 UTC+2 tirsdag 20. mai 2014 skrev Ivar Nesje følgende:
>
> Try to add parentheses
>
> *A[(A.>0.5)&(A.<0.9)]*
> The expressions you posted reads
> A[ A .> (0.5&A) .< 0.9]
>
> There is an open issue about the high precedence of &
>
> I
Try to add parentheses
*A[(A.>0.5)&(A.<0.9)]*
The expressions you posted reads
A[ A .> (0.5&A) .< 0.9]
There is an open issue about the high precedence of &
Ivar
kl. 15:38:08 UTC+2 tirsdag 20. mai 2014 skrev Florian Oswald følgende:
>
> I have an array A that i want to subset, as in
>
> A = ra
oops - i could swear i tried that!
sorry. thanks.
On 20 May 2014 14:41, Samuele Carcagno wrote:
> On 20/05/14 14:38, Florian Oswald wrote:
>
>> I have an array A that i want to subset, as in
>>
>> |
>> A =rand(100,100)
>> A[A.>0.5]
>> |
>>
>> I'm struggling to find the extension of this to mor
On 20/05/14 14:38, Florian Oswald wrote:
I have an array A that i want to subset, as in
|
A =rand(100,100)
A[A.>0.5]
|
I'm struggling to find the extension of this to more than one rule - i
would have expected that to work:
|
A[A.>0.5&A.<0.9]
ERROR:nomethod &(Float64,Float64)
|
in & at array
I have an array A that i want to subset, as in
A = rand(100,100)
A[A.>0.5]
I'm struggling to find the extension of this to more than one rule - i
would have expected that to work:
A[A.>0.5&A.<0.9]
ERROR: no method &(Float64, Float64)
in & at array.jl:743
how can I get a valid boolean index ve
Hi Jason
>
> I'm curious: do you have a link you can share to the python source?
>
> Sorry. No link to my python source as yet. The correspondence between the
julia and python code is pretty much 1:1
Hi,
On Tuesday, May 20, 2014 3:13:15 PM UTC+2, Ivar Nesje wrote:
>
> Macros are somewhat weird and a somewhat weird syntax seems appropriate in
> my opinion. A macro is very different from a function, and a syntax that
> sets it clearly visually apart is a good thing.
>
In your opinion. A macro
Macros are somewhat weird and a somewhat weird syntax seems appropriate in
my opinion. A macro is very different from a function, and a syntax that
sets it clearly visually apart is a good thing.
Julia also have a convention to have `!` at the end of mutating functions,
which sets them visually
Hello!
When reading about julia I couldn't help but wonder about the use of the @
sign. Why was it introduced? To me it seems somewhat weird to set macros
apart from builtin syntax in this manner.
a=rand(5)
b=zeros(5,5)
how to apply a on diagonal b ?
Paul
On 5/19/14, 20:14, mike c wrote:
I"m having my first look at julia and translated a pathtracer written in
python into julia. (A pathtracer is a kind of raytracer)
The translation was relatively painless, and I've mimicked the python
classes that I lost by using julia's compound types. Code is h
I'm believe I'm working in a relatively niche area, but I'm going to throw
my request in anyway :)
I often work with image sequences (from a still or video camera, but
nothing more exotic than broadcast cameras) which are to be displayed at
video rate (25/50/...Hz), somewhere on a texture in 3D
Tim
On Tuesday, 20 May 2014 20:29:31 UTC+10, Tim Holy wrote:
>
> This may be an issue more for Homebrew.jl than ProfileView.
I may have a hosed brew install that wasn't removed correctly. Not sure.
Softlinked the /usr/local/Cellar path to the new path and everything
worked.
thanks for the he
Julia pathtracer is now rendering the test scene in 11s !! (all updated
code is in the repository)
In the end Ivar Nesje's suggestion made me remove @devec and manually
devectorize the 4 places which had complicated vector maths. Immediately
the time dropped from 27s to 11s.
So julia code i
I'm also pretty excited about using the rift for scientific/technical
visualization (I have a DK1), but so far that hasn't been reflected by
an appropriate amount of spare hacking time.
If you haven't already, I'd recommend checking out the VRUI youtube
demos (for example, this one is pretty sweet
On Tuesday, 20 May 2014 20:29:30 UTC+10, Ivar Nesje wrote:
>
> There are lots of minor performance/style tips we can give, but they are
> unlikely to make any noticable difference in total execution time.
>
That's ok. I was hoping that there would be a couple of really obvious
things i missed,
On Tuesday, 20 May 2014 20:09:30 UTC+10, Alex wrote:
>
> BTW, have you actually tried julia 0.3-prerelease? This might also make a
> difference ...
>
> I got about another 10-15% speedup with julia0.3, but I've since started
using Devectorize in v0.2 (which gives a small boost), but get an erro
This may be an issue more for Homebrew.jl than ProfileView.
In the meantime, right-click on the bars and it will display the source line
in the REPL.
--Tim
On Tuesday, May 20, 2014 02:39:41 AM mike c wrote:
> Hi Tim,
>
> On Tuesday, 20 May 2014 18:58:05 UTC+10, Tim Holy wrote:
> > ProfileView
There are lots of minor performance/style tips we can give, but they are
unlikely to make any noticable difference in total execution time. I did
look at the Profile, and it seems to spend much time on lines containing
vectorized expressions. I am not able to follow the code flow, and that
make
Hi,
> I'm still confused as to the two types of NULL.
>
> Well, *I think* the main point is that nothing is an instance of the type
Nothing, while None is itself a type ("the bottom of the type graph"). In
the context of intersect it seems to make sense to return an object or
nothing.
> I
I can't help you but maybe it could help to look at the extensive
documentation for chebfun, the matlab original:
http://www2.maths.ox.ac.uk/chebfun/guide/
On Tue, 2014-05-20 at 10:07, julia-users@googlegroups.com wrote:
> Maybe, but I really don't understand this code :(
Hi Tim,
On Tuesday, 20 May 2014 18:58:05 UTC+10, Tim Holy wrote:
>
> ProfileView makes your life a lot easier. You just visually pick out the
> widest
> bars for inspection.
>
> I did a Pkg.add("ProfileView") on my OSX Mavericks machine.
I see that a bunch of other packages are installed and
On Tuesday, 20 May 2014 17:04:08 UTC+10, Alex wrote:
>
> Just a thought, I am not sure if it matters in the end: In your
> `intersect` function you are using `None` as a default return value and
> later in `radiance` you compare objects with `None`. I think it would be
> better to use (for exa
Is it supposed to work with Ubuntu 14 too ?
Le samedi 25 janvier 2014 20:37:03 UTC+1, Stefan Karpinski a écrit :
>
> Just do this:
>
> git clone https://github.com/JuliaLang/julia.git
> cd julia
> make
>
>
> It will take a while, but it will download all the things you need under
> the deps dire
Maybe, but I really don't understand this code :(
ProfileView makes your life a lot easier. You just visually pick out the widest
bars for inspection.
--Tim
On Monday, May 19, 2014 09:17:40 PM mike c wrote:
> On Tuesday, 20 May 2014 11:57:15 UTC+10, Tim Holy wrote:
> > I can't look at all that code, but one quick thought: can you use
> > Immuta
Hi Mike,
Just a thought, I am not sure if it matters in the end: In your `intersect`
function you are using `None` as a default return value and later in
`radiance` you compare objects with `None`. I think it would be better to
use (for example) `nothing` here, because the comparison is faster
81 matches
Mail list logo