[julia-users] Speeding up Matrix .^ transpose(Vector)

2016-06-29 Thread Anonymous
I have an algorithm where the bulk of the computation time is spent calculating an operation of the form Matrix .^ transpose(Vector) I was able to get a 33% speed up by re-writing this as exp(transpose(Vector) .* log(Matrix)) however this is something of a hack and I don't really approve of

[julia-users] Re: readdlm() pound sign at beginning of string is not read

2016-06-26 Thread Anonymous
://docs.julialang.org/en/release-0.4/stdlib/io-network/#Base.readdlm). > > Perhaps if the fields are quoted, the comment character does not have > effect, but haven't checked this. > > On Saturday, June 25, 2016 at 4:41:55 PM UTC-4, Anonymous wrote: >> >> Let's say I have

[julia-users] readdlm() pound sign at beginning of string is not read

2016-06-25 Thread Anonymous
Let's say I have a file of the form 1#hello 2hello Where the space between the number and the ascii string is intended to be a tab, then I run my_file = readdlm(file, '\t') this reads in the first line as "". Is this the desired functionality? It works fine with other characters

[julia-users] printing specific RGB colors

2016-06-15 Thread Anonymous
So I've gotten about as much mileage out of print_with_color() as I can, which is to say not much, it doesn't even print the right colors half the time. There's a bunch of color packages which seem to be concerned with abstractly manipulating different color parameterizations, but no mention

Re: [julia-users] Re: why not make the ternary operator into an optional binary operator?

2016-06-08 Thread Anonymous
Kofod Mogensen <patrick@gmail.com > > wrote: > > But that is exactly what Forgy's code does > > > > expression && do_something > > Problem with this is that it is a bit cryptic. > > There is this related issue: > https://github.com/Julia

[julia-users] Re: why not make the ternary operator into an optional binary operator?

2016-06-08 Thread Anonymous
I think maybe I didn't write exactly what I meant to. The expression in my original post should have been a boolean value, I want to mimic an if statement basically. Something of the form: boolean ? expression_to_eval_if_boolean_is_true Since the ternary operator mimics an if-else

[julia-users] why not make the ternary operator into an optional binary operator?

2016-06-08 Thread Anonymous
So we have the ternary operator expression ? eval_if_true : eval_if_false You can jimmy-rig this into a binary operator by doing expression ? eval_if_true : nothing so why not have it be an optional binary operator by making the colon optional, so that I could have expression ? eval_if_true

Re: [julia-users] readdlm throws error for empty line

2016-06-05 Thread Anonymous
it does appear to be related, unfortunately no resolution appears to be as of yet forth coming. On Sunday, June 5, 2016 at 6:53:56 PM UTC-7, Miguel Bazdresch wrote: > > This may be related: https://github.com/JuliaLang/julia/issues/16248 > > On Sun, Jun 5, 2016 at 6:16 PM, An

[julia-users] readdlm throws error for empty line

2016-06-05 Thread Anonymous
So I have a BysteString vector A, containing a bunch of byte strings of varying lengths of the form: "1,2,\n" "\n" "5,2,4\n" etc. What I have set up is to do [vec(readdlm(IOBuffer(line), ',', Float64)) for line in A] However because as you see above the second line is empty except for the

Re: [julia-users] filter() function edge case, possible bug.

2016-06-01 Thread Anonymous
. But still filing a > bug report, if one does not exist yet, is probably the right thing to do. > > On Wed, 2016-06-01 at 03:26, Anonymous <esp...@gmail.com > > wrote: > > Consider the code: > > > > filter(n -> true, collect(1:0)) > > > &

[julia-users] filter() function edge case, possible bug.

2016-05-31 Thread Anonymous
Consider the code: filter(n -> true, collect(1:0)) this returns a 0-element array. However if I don't collect the iterator into an array: filter(n -> true, 1:0) I get the error Error: TypeError: typeassert: expected AbstractArray{Bool, N}, got Array{Int64, 1} in filter at array.jl:923 It

[julia-users] Re: field name aliases

2016-05-27 Thread Anonymous
from changing them in the future. > > On Friday, May 27, 2016 at 6:52:17 PM UTC-4, Anonymous wrote: >> >> Is there a way to have an alias to a field name? For instance suppose I >> have >> >> type Foo >> x::Int >> end >> >> and I want to have Foo

[julia-users] field name aliases

2016-05-27 Thread Anonymous
Is there a way to have an alias to a field name? For instance suppose I have type Foo x::Int end and I want to have Foo.y reference Foo.x, but I don't want an extra field y in order to save memory. Of course why not just have type Foo y::Int end instead? Because I wan't the user to access

[julia-users] Re: Base.show(io::IO, mytype::Type) results in cluttered display for arrays

2016-05-16 Thread Anonymous
Wow strange, I could have sworn I tried that and it didn't do anything, but now it works, thanks. On Monday, May 16, 2016 at 1:40:06 AM UTC-7, David P. Sanders wrote: > > Change the print statement to print(io, "..."). io is the object of type > IO that you need to print to.

[julia-users] Base.show(io::IO, mytype::Type) results in cluttered display for arrays

2016-05-16 Thread Anonymous
So I have code of the form: type Foo x::Int end Base.show(io::IO, foo::Foo) = print("Foo:\n x = $(foo.x)") This works fine for a single instance of Foo, but when I have an array of Foo objects the display for the array in the REPL calls Base.show() multiple times on each element and doesn't

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
Yes the algorithm I'm testing this on is fairly polished at this point, all variables are within a type and they all have strict type declarations. The memory allocations are very low compared to the vectorized code, so memory-wise the loops are doing their job, but this doesn't translate into

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
ou run it twice? Remember that memory is allocated during JIT > compilation, so the amount of memory on the first call is completely > meaningless. > > --Tim > > On Wednesday, May 11, 2016 11:03:38 PM Anonymous wrote: > > In response to both Kristoffer and Keno's timely res

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
So the consensus is not that Julia's devectorized code is so much faster than its vectorized code (in fact I keep getting slow-downs when I test out various devectorizations of my algorithms), but that R's devectorized code just sucks. On Thursday, May 12, 2016 at 4:49:42 AM UTC-7, Stefan

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
So I guess the consensus is not that Julia's devectorized code is so much faster than its vectorized code (in fact I keep getting slow downs when I test out different devectorizations of my algorithms), but that R's devectorized code just sucks, either that or I really suck at writing for

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
Bouchet-Valat wrote: > > Le mercredi 11 mai 2016 à 23:03 -0700, Anonymous a écrit : > > In response to both Kristoffer and Keno's timely responses, > > > > Originally I just did a simple @time test of the form > > Matrix .* horizontal vector > > > > and

Re: [julia-users] Re: how long until vectorized code runs fast?

2016-05-12 Thread Anonymous
Accelerator.jl. They have a quite > > sophisticated compiler that does loop fusions and parallelization and > other > > cool stuff. > > > > > > > > On Thursday, May 12, 2016 at 7:22:24 AM UTC+2, Anonymous wrote: > >> > >> This remains one of t

[julia-users] how long until vectorized code runs fast?

2016-05-11 Thread Anonymous
This remains one of the main drawbacks of Julia, and the devectorize package is basically useless as it doesn't support some really crucial vectorized operations. I'd really prefer not to rewrite all my vectorized code into nested loops if at all possible, but I really need more speed, can

[julia-users] Why don't NaNs raise an error?

2016-04-26 Thread Anonymous
Why are NaNs allowed to be created without raising an error, and then allowed to propagate around your program corrupting basically all future computation.

[julia-users] How to delete multiple keys from a dictionary

2016-04-16 Thread Anonymous
The question basically says it all, delete!(mydict, key), will delete a single key, but how do I pass a vector of keys to delete! in order to delete multiple keys at once?

Re: [julia-users] Re: Parametric types which add or delete fields.

2016-04-15 Thread Anonymous
edit of previous post: I have color and year reversed, color should be ASCIIString and year should be Int, same thing with Color and Year. On Friday, April 15, 2016 at 12:56:16 AM UTC-7, Anonymous wrote: > > I need the fields color and year to be Int and ASCIIString, respectively, &

Re: [julia-users] Re: Parametric types which add or delete fields.

2016-04-15 Thread Anonymous
the constructor to return: Car{Void, Void, Feature3, Void, Feature5, Feature6}(nothing, nothing, a, nothing, b, c) On Friday, April 15, 2016 at 12:18:56 AM UTC-7, Mauro wrote: > > > On Fri, 2016-04-15 at 07:28, Anonymous <esp...@gmail.com > > wrote: > > OP here, > > >

[julia-users] Re: Parametric types which add or delete fields.

2016-04-14 Thread Anonymous
OP here, So it looks like the consensus is to use a single type with un-used features set to nothing. I've actually been playing around with this approach since I posted this question. Here's what I've got: abstract AbstractCar abstract Color abstract Year typealias ColorOrVoid

[julia-users] Parametric types which add or delete fields.

2016-04-14 Thread Anonymous
So I have a pretty complex problem in designing my type data structure which I haven't been able to solve. Let's say I have an abstract car type: abstract AbstractCar now let's say I have the following possible features for a car: color horsepower model year Now I want to be able to create

[julia-users] Re: Setting min()=Inf and max()=-Inf

2016-04-12 Thread Anonymous
22:10 PM UTC-4, Anonymous wrote: >> >> Have the Julia developers considered the effects of setting >> Base.min()=Inf and Base.max()=-Inf. This is common in real analysis since >> it plays nice with set theory, i.e. >> > > It only plays nicely with sets of

[julia-users] Re: Setting min()=Inf and max()=-Inf

2016-04-12 Thread Anonymous
:23 PM UTC-7, Eric Forgy wrote: > > Hi Anonymous, > > One of the nice things about Julia is that if you want that feature in > your code, you just need to do this: > > import Base: min, max > > min() = Inf > max() = -Inf > > Voila. It will be a good/fast as

[julia-users] Setting min()=Inf and max()=-Inf

2016-04-12 Thread Anonymous
Have the Julia developers considered the effects of setting Base.min()=Inf and Base.max()=-Inf. This is common in real analysis since it plays nice with set theory, i.e. A ⊆ B => max(A) ≤ max(B) A ⊆ B => min(A) ≥ min(B) Thus since the empty set ø is a subset of every set, the max of it

[julia-users] is accessing tuple elements more efficient than accessing elements of a 1d array?

2016-04-11 Thread Anonymous
If I have a vector of data which I don't intend to ever change, should I represent it as a tuple rather than a 1d array? Is there any benefit above and beyond protecting against mutability? Is it more efficient?

[julia-users] Re: Outer constructor to initialize parametric type

2016-04-05 Thread Anonymous
> On Tuesday, April 5, 2016 at 1:12:00 PM UTC+2, Anonymous wrote: >> >> I couldn't really figure out a good way to describe it my title, but what >> I'm trying to do is this: >> >> type Foo{T} >> x::Vector{T} >> end >> >> Foo{T}() = Foo

[julia-users] Outer constructor to initialize parametric type

2016-04-05 Thread Anonymous
I couldn't really figure out a good way to describe it my title, but what I'm trying to do is this: type Foo{T} x::Vector{T} end Foo{T}() = Foo{T}(T[]) but I get the warning msg: Warning: static parameter T does not occur in signature for call at none:1. The method will not be callable. How

Re: [julia-users] why is there no colvals function for sparse matrices in base?

2016-04-01 Thread Anonymous
oh cool that's convenient, for some reason the nzrange function isn't mentioned in the documentation. On Friday, April 1, 2016 at 2:46:53 AM UTC-7, Mauro wrote: > > On Fri, 2016-04-01 at 11:07, Anonymous <esp...@gmail.com > > wrote: > > but what if I need to a

Re: [julia-users] why is there no colvals function for sparse matrices in base?

2016-04-01 Thread Anonymous
s = sprand(10^7, 10^7, 1e-7); > > julia> @time rowvals(s); > 0.04 seconds (4 allocations: 160 bytes) > > julia> @time colvals(s); > 0.508060 seconds (20 allocations: 533.748 MB, 14.61% gc time) > > > On Fri, 2016-04-01 at 10:48, Anonymous &

[julia-users] why is there no colvals function for sparse matrices in base?

2016-04-01 Thread Anonymous
There is a rowals function, and then there is a find function, and the find function actually allows you to write a one line colvals function: colvals(S::SparseMatrixCSC) = round(Int, floor(find(S)/(size(S, 1)+0.1))+1) shouldn't someone add this to base?

Re: [julia-users] overhead of accessing rows vs columns in SparseMatrixCSC format

2016-03-08 Thread Anonymous
course. > > I'm sure you know this, but you'll want to access them through the return > values of findnz or equivalent, not using S[i,j]. > > --Tim > > On Monday, March 07, 2016 10:50:58 AM Anonymous wrote: > > So I have a sparse matrix which doesn't get modified

[julia-users] overhead of accessing rows vs columns in SparseMatrixCSC format

2016-03-07 Thread Anonymous
So I have a sparse matrix which doesn't get modified by for which I would like to access by rows, is there significantly more overhead in accessing rows vs columns? If so, would it be more efficient to instead access the columns of its transpose?

[julia-users] Immutable type with a function datatype

2016-01-18 Thread Anonymous
Is the following code considered bad form in Julia? immutable Foo func::Function end foo = Foo(x->x^2) foo.func(3) This mimics the behavior of OOP since just like in OOP the internal method cannot be changed (since the type is immutable). Sometimes it really does make the most sense to

[julia-users] Re: Immutable type with a function datatype

2016-01-18 Thread Anonymous
wow that is crazy complicated

[julia-users] Re: Immutable type with a function datatype

2016-01-18 Thread Anonymous
this is a good solution, although it prevents the user from defining their own custom metric. On Monday, January 18, 2016 at 9:33:05 AM UTC-8, Matt Bauman wrote: > > On Monday, January 18, 2016 at 11:54:49 AM UTC-5, Anonymous wrote: >> >> As you can see, I have to define a who

[julia-users] Re: Immutable type with a function datatype

2016-01-18 Thread Anonymous
This came up as I was trying to define a sphere manifold type which can have distinct metric structures put on it, here is how I have to do it in Julia: abstract Manifold abstract Metric immutable Metric1 <: Metric end immutable Metric2 <: Metric end immutable Sphere{T<:Metric} <: Manifold

[julia-users] Re: Immutable type with a function datatype

2016-01-18 Thread Anonymous
The issue is that there is no cross section of metrics, one from each manifold, which can all be grouped under the heading of RIEMANNIAN, same with LORENTZIAN, etc. Each manifold will have its own set of idiosyncratic metrics, and the user might require the functionality of being able to

[julia-users] ERROR: Cannot horizonatally stack expressions of varying number of rows

2015-01-20 Thread Anonymous
horizonatally I trust y'all will get this to the right people, where it can do some good.

Re: [julia-users] ERROR: Cannot horizonatally stack expressions of varying number of rows

2015-01-20 Thread Anonymous
to do? :-) Cheers, Kevin On Tue, Jan 20, 2015 at 9:33 PM, Anonymous esp...@gmail.com javascript: wrote: horizonatally I trust y'all will get this to the right people, where it can do some good.

[julia-users] starting up julia from mac terminal (the way you would for python by typing python)

2014-09-01 Thread Anonymous
I'm trying to figure out how to create an alias/shortcut whatever in the mac terminal so that I can just type julia and julia will start up, just the way python works when I type python. It's something about a bash or something.

[julia-users] Julia *args not working

2014-08-29 Thread Anonymous
if A is a multidimensional array and t a tuple, and I try to do something of the form A[*t], I get an error, yet if I put the tuple in manually, for instance A[*(1,1)], it works.