Re: [julia-users] JuliaDB?

2016-11-02 Thread Seth


On Wednesday, November 2, 2016 at 9:43:16 AM UTC-7, Jeff Bezanson wrote:
>
> This is an internal name we've been using; it hasn't been finalized 
> yet so I removed it from the site (the name collision with the 
> existing github org is one of the issues of course). If you're 
> interested in this kind of functionality please contact me directly. 
>
>
> On Wed, Nov 2, 2016 at 10:37 AM, Seth <catc...@bromberger.com 
> > wrote: 
> > From http://juliacomputing.com/products/juliafin.html 
> > 
> >> JuliaDB is a high-performance, columnar data store for working with 
> >> large-scale time series data. What sets it apart from the existing 
> products 
> >> in this area is the tight-knit integration of data and algorithms with 
> the 
> >> full power of the Julia ecosystem. In addition, high-performance 
> analytics, 
> >> easy parallelism, graphics and leveraging integrations with 
> spreadsheets and 
> >> data sources is the key to simplifying algorithmic trading, 
> backtesting, and 
> >> risk analytics. 
> > 
> > 
> > However, the only references I can find to JuliaDB is the GitHub 
> > organization (https://github.com/JuliaDB). 
> > 
> > Is this code open source, and if so, where does it reside? 
> > 
> > 
>

Thanks, Jeff. Are you folks planning on open-sourcing the database? 


[julia-users] JuliaDB?

2016-11-02 Thread Seth
>From http://juliacomputing.com/products/juliafin.html

*JuliaDB* is a high-performance, columnar data store for working with 
> large-scale time series data. What sets it apart from the existing products 
> in this area is the tight-knit integration of data and algorithms with the 
> full power of the Julia ecosystem. In addition, high-performance analytics, 
> easy parallelism, graphics and leveraging integrations with spreadsheets 
> and data sources is the key to simplifying algorithmic trading, 
> backtesting, and risk analytics.


However, the only references I can find to JuliaDB is the GitHub 
organization (https://github.com/JuliaDB). 

Is this code open source, and if so, where does it reside?




[julia-users] Re: Benchmarking Julia

2016-09-27 Thread Seth


On Tuesday, September 27, 2016 at 4:06:10 AM UTC-7, cormu...@mac.com wrote:
>
> Ah, yes. Strange. Thanks.
>
> Trying to install it looks like it's not the simple solution I was looking 
> for.
>
> WARNING: The following packages do not have relocatable bottles, 
> installation may fail!
> 
> sed: .git/GITHUB_HEADERS: No such file or directory
> 
> Xcode can be updated from the App Store.
>
> I might try for something a bit simpler... :)
>

This is an artifact of homebrew / xcode and sierra, and not Julia (except 
that it uses both). A Sierra upgrade does something bad to XCode that is 
solved by (re)installing the latest version (8.0). The GITHUB_HEADERS error 
goes away after the first time.


[julia-users] HEADS-UP: breaking change in LightGraphs API

2016-09-25 Thread Seth


Sorry if this is not relevant to your use of LightGraphs, but I wanted to 
make sure everyone's aware of a change in the API for the 
`induced_subgraph()` function.


Starting in LightGraphs 0.7.1, `induced_subgraph()` will, in addition to 
the subgraph itself, return a mapping of the original vertex indices to the 
new ones. This will require code changes to ignore the new return value if 
you’re using this function.


If you’re using the `getindex` version of `induced_subgraph` (that is, 
`g[1:5]`), there will be no change.


Please feel free to file issues over at LightGraphs.jl if you run into 
problems.


Re: [julia-users] Re: Is there a way to reclaim memory?

2016-08-02 Thread Seth


On Tuesday, August 2, 2016 at 11:07:29 AM UTC-7, Erik Schnetter wrote:
>
> Can you make a copy of the vector, and assign this copy to the original 
> variable? As in:
>
> ```Julia
> type Node
> edges::Vector{X}
> end
>
> ...
> node.edges = copy(node.edges)
> ...
> ```
>
> -erik
>
>
>
> On Tue, Aug 2, 2016 at 1:56 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>>
>>
>> On Tuesday, August 2, 2016 at 10:41:26 AM UTC-7, Seth wrote:
>>>
>>> So, a 62.5 million edge LightGraphs.Graph should only take about a 1.25 
>>> gigs of memory, all-in. However, because the edges are being added to 
>>> vectors within the datastructure, and each vector is doing its own memory 
>>> allocation, we wind up with the Julia process taking ~6.5 gigs.
>>>
>>> Given that we don't know the degree distribution of the graph before we 
>>> load it (and therefore can't use sizehint! effectively), is there any way 
>>> to reclaim the allocated-but-unused memory from all these vectors, with the 
>>> accepted large performance hit that would come should we decide to add 
>>> another edge?
>>>
>>
>> Things that I've tried that *don't* work:
>>
>> - explicitly calling sizehint! after the vectors have been created and 
>> populated
>> - calling resize! after the vectors have been created and populated
>>  
>>
>
>
>
>
Thanks. I tried this:

for i = 1:nv(g)
  g.fadjlist[i] = copy(g.fadjlist[i])
end

and that actually increased memory footprint from 6.25 to 7.96 GB. I even 
tried an explicit gc() afterwards.




[julia-users] Re: Is there a way to reclaim memory?

2016-08-02 Thread Seth


On Tuesday, August 2, 2016 at 10:41:26 AM UTC-7, Seth wrote:
>
> So, a 62.5 million edge LightGraphs.Graph should only take about a 1.25 
> gigs of memory, all-in. However, because the edges are being added to 
> vectors within the datastructure, and each vector is doing its own memory 
> allocation, we wind up with the Julia process taking ~6.5 gigs.
>
> Given that we don't know the degree distribution of the graph before we 
> load it (and therefore can't use sizehint! effectively), is there any way 
> to reclaim the allocated-but-unused memory from all these vectors, with the 
> accepted large performance hit that would come should we decide to add 
> another edge?
>

Things that I've tried that *don't* work:

- explicitly calling sizehint! after the vectors have been created and 
populated
- calling resize! after the vectors have been created and populated
 


[julia-users] Is there a way to reclaim memory?

2016-08-02 Thread Seth
So, a 62.5 million edge LightGraphs.Graph should only take about a 1.25 
gigs of memory, all-in. However, because the edges are being added to 
vectors within the datastructure, and each vector is doing its own memory 
allocation, we wind up with the Julia process taking ~6.5 gigs.

Given that we don't know the degree distribution of the graph before we 
load it (and therefore can't use sizehint! effectively), is there any way 
to reclaim the allocated-but-unused memory from all these vectors, with the 
accepted large performance hit that would come should we decide to add 
another edge?


Re: [julia-users] Is there a way to convert function name to a string?

2016-04-10 Thread Seth
Simpler, perhaps:

julia> foo(x) = x + 6
foo (generic function with 1 method)


julia> string(foo)
"foo"


julia> string(foos)   # just to show it's not arbitrary
ERROR: UndefVarError: foos not defined


On Friday, April 8, 2016 at 11:50:45 PM UTC-7, K leo wrote:
>
> Thanks.  I have an array for functions like funcArray=[FuncA, FuncB, 
> FuncC], and as I run them through a loop, I want to be able to tell which 
> function is running.  So perhaps just simply string(FuncA) would serve my 
> need.
>
> On Saturday, April 9, 2016 at 12:01:34 PM UTC+5:30, Tamas Papp wrote:
>>
>> julia> functionname(f)=string(f.env.name) 
>> functionname (generic function with 1 method) 
>>
>> julia> foo(x)=1 
>> foo (generic function with 1 method) 
>>
>> julia> functionname(foo) 
>> "foo" 
>>
>> But be aware that this may change and is unlikely to be a good solution 
>> unless you really, really know what you are doing. Perhaps if you 
>> explained what you want to achieve you would get suggestions for better 
>> solutions. 
>>
>> Best, 
>>
>> Tamas 
>>
>>
>> On Sat, Apr 09 2016, K. leo wrote: 
>>
>> > Say a function is named FuncA.  I hope to get this name into a string 
>> like 
>> > "FuncA".  Is there a way to do that? 
>>
>>

[julia-users] Re: Julia console with inline graphics?

2016-04-06 Thread Seth
ITerm with Compose.jl and TerminalExtensions.jl allows me to use 
GraphPlots.jl to visualize LightGraph output.

On Saturday, April 2, 2016 at 3:45:22 AM UTC-7, Oliver Schulz wrote:
>
> Hi,
>
> I'm looking for a Julia console with inline graphics (e.g. to display 
> Gadfly plots). There's Jupyter/IJulia, of course, but I saw a picture of 
> something more console-like in the AxisArrays readme (at the end of 
> https://github.com/mbauman/AxisArrays.jl#example-of-currently-implemented-behavior)
>  
> - does anyone know what's been used there?
>
> Cheers,
>
> Oliver
>
>

[julia-users] Help with convoluted types and Vararg

2016-04-05 Thread Seth
Hi all,

I have the following on 0.4.6-pre+18:

z = [Pair((+,1,5,7), 3), Pair((-,6,5,3,5,8), 1)]
type Foo
x::Array{Pair{Tuple{Function, Vararg{Int}}, Int}}
end


and I'm getting

julia> Foo(z)
ERROR: MethodError: `convert` has no method matching 
convert(::Type{Pair{Tuple{Function,Vararg{Int64}},Int64}}, 
::Pair{Tuple{Function,Int64,Int64,Int64},Int64})
This may have arisen from a call to the constructor 
Pair{Tuple{Function,Vararg{Int64}},Int64}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  Pair{A,B}(::Any, ::Any)
  call{T}(::Type{T}, ::Any)
  convert{T}(::Type{T}, ::T)
 in copy! at abstractarray.jl:310
 in call at none:2


It's probably a stupid oversight, but I'm stuck. Can someone point me to 
the error?


Re: [julia-users] Status of Graphs.jl ?

2016-03-12 Thread Mridul Seth
Hi James,

I started a conversation regarding the same on the gitter 
channel https://gitter.im/JuliaGraphs/LightGraphs.jl with Seth Bromberger

Thanks :)

Mridul

On Saturday, 12 March 2016 06:51:24 UTC+5:30, James Fairbanks wrote:
>
> Hi Mridul,
>
> JuliaGraphs is a Github organization for people who are interested in 
> writing graph code.
> We primarily work on LightGraphs, which is a simple adjacency list 
> representation for graphs along with a lot of functions for processing 
> graphs.
> LightGraphs includes I/O for many common storage formats.
>
> Just this week JuliaGraphs started on graph visualization in 
> https://github.com/JuliaGraphs/GraphVisualize.jl. Although GraphLayout.jl 
> and GraphPlots.jl are more mature.
> If you want to work on graphs, check out the Github issues! :)
>
> Best,
> James Fairbanks
>
> On Friday, March 11, 2016 at 3:23:14 PM UTC-5, Tim Holy wrote:
>>
>> I think LightGraphs.jl is more active. 
>>
>> Best, 
>> --Tim 
>>
>> On Thursday, March 10, 2016 10:45:35 PM Mridul Seth wrote: 
>> > https://github.com/JuliaLang/Graphs.jl looks like a great project but 
>> there 
>> > haven't been a lot of activity (last commit Nov 1, 2015). Is there any 
>> > general interest regarding working on Graphs.jl during GSoC period? 
>> > And what the difference between https://github.com/JuliaGraphs and 
>> Graphs.jl 
>> > 
>> > Thanks, 
>> > Mridul Seth 
>>
>>

[julia-users] Status of Graphs.jl ?

2016-03-11 Thread Mridul Seth
https://github.com/JuliaLang/Graphs.jl looks like a great project but there 
haven't been a lot of activity (last commit Nov 1, 2015). Is there any 
general interest regarding working on Graphs.jl during GSoC period?
And what the difference between https://github.com/JuliaGraphs and Graphs.jl

Thanks,
Mridul Seth


[julia-users] Re: A non-breaking Julia control-flow change to separate the One language from mortal languages, doomed to die

2015-12-09 Thread Seth
Seems to me that this is just a more complex repeat...until or do...while 
bottom-conditional loop, which has already been discussed and rejected (to 
my disappointment).

On Wednesday, December 9, 2015 at 7:05:43 AM UTC-8, Dan wrote:
>
> *A non-breaking Julia control-flow change to separate the One language from *
>
> *mortal languages, doomed to die
> *
> From a design patterns and DRY perspective it seems `for` loops together with 
> the `break` statement 
>
> are serving as a useful `try`/`catch` mechanism for non-error situations. A 
> common pattern defines 
>
> a variable before a `for` loop and tries to discern, using said variable, the 
> circumstances of exiting 
>
> the `for` loop. Leveraging the embedded mental construct of `try`/`catch` 
> blocks, we can simplify 
>
> this repeating pattern and make it easier and more readable.
>
> The syntax can look as follows:
>
> for ...(loop vars here)... 
>
> ...(local vars here)...
>
> ...
>
> if ...
>
> break 
>
> end
>
> ...
>
> catch 
>
> ...(access local/loop vars and  here)...
>
> 
>
> finally
>
> ...(access local/loop vars here)...
>
> 
>
> end 
>
>   Syntax changes worthy of consideration should be self-explanatory to 
> many, as I hope this suggestion is.
> But an example should help:
>
> After change:
>
> for line in eachline(f) 
>
> fields = split(line) 
>
> status = fileds[2] 
>
> if status=="FAIL" 
>
> break 
>
> end 
>
> catch 
>
> println("Test $(fields[1]) failed with reason $(fields[3])") 
>
> finally 
>
> println("Test successful!") 
>
> end 
>
> Before change:
>
>  
>
> fields = [] 
>
> didfail = false 
>
> for line in eachline(f) 
>
> fields = split(line) 
>
> status = fields[2] 
>
> if status=="FAIL" 
>
> didfail = true 
>
> break 
>
> end 
>
> end 
>
> if didfail 
>
> println("Test $(fields[1]) failed with reason $(fields[3])") 
>
> else 
>
> println("Test successful!") 
>
> end 
>
>   The above example does not use the `break ` suggestion. 
> With multiple `break` circumstances it should
>
> be useful to have separate code for each circumstance. One option is to 
> replicate the `try`/`catch` form 
>
> with a `` passed as ``, another would be to use `catch 
> ` to run catch block 
>
> if "`break  == catch `" (the `` can be a human readable 
> symbol). A direct jump in the 
>
> LLVM code to the appropriate `catch` block would be an easy optimization to 
> implement.
>
> Another issue to consider is the return value of a `for` block. The 
> suggestion above adds the option to change 
>
> the current default `nothing` return with `` in the new optional 
> blocks.
>
> Notice that the `catch` and `finally` blocks are completely optional and 
> therefore backward compatibility 
>
> is easy. Additionally there are no additional keywords and block nesting 
> would not conflict with `try`/`catch`.
>
> Hey, Julia is still < 0.9 so there is still time for some change.
>
> Obligatory Disclaimerism:
>
> 1. This has already been considered before by **name**/**issue**.
> 2. Before suggesting I should have studied past discussions more.
> 3. Other langauges actually already have this... bla bla.
> 4. This post is what it is.
>
>
> This suggestion is also readable in github markdown in the gist: 
> https://gist.github.com/getzdan/75136f130c6f8ffeb60e
>
>
> Feedback/Pointers/Gotchas welcome, of course.
>
>

[julia-users] Re: conditional dependencies on packages with macros

2015-12-08 Thread Seth
Sorry, Jeffrey, I'm not following. Could you explain a bit better how this 
would work? Are you intending that "using Package" goes within the if 
statement?

On Tuesday, December 8, 2015 at 8:02:17 AM UTC-8, Jeffrey Sarnoff wrote:
>
> if isdir(joinpath(Pkg.dir(),"Package"))
>   ...
> else
>   ...
> end
>
>
> On Monday, December 7, 2015 at 10:50:56 AM UTC-5, Seth wrote:
>>
>> Is there a way to specify a conditional dependency (that is, use package 
>> Foo if it's available and define functions that use things from Foo; 
>> otherwise, don't define the functions or throw an error message) on 
>> packages that contain macros? isdefined(Main, :Package) won't work since 
>> the macros from Package are evaluated prior to this conditional, and it 
>> will throw an error.
>>
>> I was using Requires.jl to do this, but one issue I ran into is that an 
>> error in the code within the @require block is not propagated as an error; 
>> it's presented as a warning, which means that things like unit tests will 
>> pass even if the code is incorrect.
>>
>

[julia-users] Re: conditional dependencies on packages with macros

2015-12-08 Thread Seth
Thanks, Jeffrey. I'll give that a shot.

On Tuesday, December 8, 2015 at 8:43:00 AM UTC-8, Jeffrey Sarnoff wrote:
>
> If I understand your question, you need to determine whether or not a 
> package (call it "Package") is available to be used via *using* or 
> *import.*
> You can know if a package is present before trying to load the package.  
>
> This will evaluate true when the package "Package" is present, and false 
> when the package is not present, before trying to load it:
> ``
>  isdir(joinpath(Pkg.dir(),"Package")
> ```
> On Tuesday, December 8, 2015 at 11:02:17 AM UTC-5, Jeffrey Sarnoff wrote:
>>
>> if isdir(joinpath(Pkg.dir(),"Package"))
>>   ...
>> else
>>   ...
>> end
>>
>>
>> On Monday, December 7, 2015 at 10:50:56 AM UTC-5, Seth wrote:
>>>
>>> Is there a way to specify a conditional dependency (that is, use package 
>>> Foo if it's available and define functions that use things from Foo; 
>>> otherwise, don't define the functions or throw an error message) on 
>>> packages that contain macros? isdefined(Main, :Package) won't work since 
>>> the macros from Package are evaluated prior to this conditional, and it 
>>> will throw an error.
>>>
>>> I was using Requires.jl to do this, but one issue I ran into is that an 
>>> error in the code within the @require block is not propagated as an error; 
>>> it's presented as a warning, which means that things like unit tests will 
>>> pass even if the code is incorrect.
>>>
>>

[julia-users] conditional dependencies on packages with macros

2015-12-07 Thread Seth
Is there a way to specify a conditional dependency (that is, use package 
Foo if it's available and define functions that use things from Foo; 
otherwise, don't define the functions or throw an error message) on 
packages that contain macros? isdefined(Main, :Package) won't work since 
the macros from Package are evaluated prior to this conditional, and it 
will throw an error.

I was using Requires.jl to do this, but one issue I ran into is that an 
error in the code within the @require block is not propagated as an error; 
it's presented as a warning, which means that things like unit tests will 
pass even if the code is incorrect.


Re: [julia-users] issue with 0.0 = -0.0

2015-12-07 Thread Seth
I was just about to post this result, which I don't understand. Why should

0.0 == -0.0

but bar(0.0) != bar(-0.0) when bar is immutable? (yes, you can override == 
for this to be ==(x::bar, y::bar) = x.a == y.a, but that seems as if it 
should be unnecessary.)


On Monday, December 7, 2015 at 5:14:28 PM UTC-8, Yichao Yu wrote:
>
> On Mon, Dec 7, 2015 at 7:01 PM, Davide Lasagna  > wrote: 
> > Cool! Thanks 
>
> Also note that since your type is mutable, the default `==` is object 
> identity and your `a` and `b` won't equal even if their content are 
> the same by default. An `immutable` type will compare the content by 
> default (although `-0.0` and `0.0` have different bit pattern and 
> won't equal as a field by default as you pointed out). 
>
> ``` 
> julia> type foo 
>a::Float64 
>end 
>
> julia> b = foo(0) 
> foo(0.0) 
>
> julia> a = foo(0) 
> foo(0.0) 
>
> julia> a == b 
> false 
>
> julia> immutable bar 
>a::Float64 
>end 
>
> julia> b = bar(0) 
> bar(0.0) 
>
> julia> a = bar(0) 
> bar(0.0) 
>
> julia> a == b 
> true 
>
> julia> bar(0.0) == bar(-0.0) 
> false 
> ``` 
>


[julia-users] Re: can't load any package

2015-12-06 Thread Seth
Are you connected to the internet? Can you get to https://www.github.com 
from your browser? Do you have a firewall / proxy / other network filtering 
device between you and github?


On Saturday, December 5, 2015 at 11:41:41 PM UTC-8, bbd 666 wrote:
>
> I've just installed Julia 0.3.12
> I can't install any package.
> same message, every time :
> INFO : Initializing package repository c:..
> INFO : cloning METADATA from git//github.com/JuliaLang/METADATA.jl
> fatal : unable to connect to github.com:
> github.com:[192.30.252.130]: errno=No error
> ERROR:failed process blablabla...
>


[julia-users] Libz with an unknown file

2015-12-06 Thread Seth
Hi,

I'm moving from Gzip.jl to Libz.jl, and am running into a problem. Gzip 
used to allow a file to be opened using its methods even if the file was 
not encrypted. Libz doesn't allow that.

The problem I'm having is that I can't figure out a try/catch/finally that 
works. Basically, I want this (pseudocode):

io = ZlibInflateInputStream(open(fn,"r"))   # this will succeed if fn 
exists, even if fn isn't compressed
contents = try
   do_something_with_io(io)   # this will error if fn isn't compressed
catch
  io = open(fn,"r")   # so we try to open it as an uncompressed file
  do_something_with_io(io)
finally
  close(io)
end

but this doesn't work (the finally statement fails, for one).

What's the accepted way of doing this?


Re: [julia-users] Libz with an unknown file

2015-12-06 Thread Seth
This gets more complicated because the return value from the try and catch 
blocks will be the close() statement, when I really want the output from 
do_sth. How do you work around that?

On Sunday, December 6, 2015 at 6:02:21 PM UTC-8, Erik Schnetter wrote:
>
> I would separate the two independent access methods:
> ```
> try
> io = zlibopen
> do_sth(io)
> close(io)
> catch
> io = open
> do_sth(io)
> close(io)
> end
> ```
>
> If you want another try block to ensure the file is closed, I'd open 
> secondary try blocks within this one. I think you're trying to do two 
> things at once -- see whether zlib is needed, and also check for I/O errors.
>
> Incidentally, you don't need a `finally` clause for the regular `open` 
> function; you can instead write
>
> ```
> contents = open(fn, "r") do io
> do_sth(io)
> end
> ```
>
> which ensures that `io` will be closed no matter what.
>
> -erik
>
>
> On Sun, Dec 6, 2015 at 8:16 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>> Hi,
>>
>> I'm moving from Gzip.jl to Libz.jl, and am running into a problem. Gzip 
>> used to allow a file to be opened using its methods even if the file was 
>> not encrypted. Libz doesn't allow that.
>>
>> The problem I'm having is that I can't figure out a try/catch/finally 
>> that works. Basically, I want this (pseudocode):
>>
>> io = ZlibInflateInputStream(open(fn,"r"))   # this will succeed if fn 
>> exists, even if fn isn't compressed
>> contents = try
>>do_something_with_io(io)   # this will error if fn isn't compressed
>> catch
>>   io = open(fn,"r")   # so we try to open it as an uncompressed file
>>   do_something_with_io(io)
>> finally
>>   close(io)
>> end
>>
>> but this doesn't work (the finally statement fails, for one).
>>
>> What's the accepted way of doing this?
>>
>
>
>
> -- 
> Erik Schnetter <schn...@gmail.com > 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


Re: [julia-users] binary string to hex

2015-12-04 Thread Seth
That works, but I'm concerned with the part of the original post that says 
" I want to change some of the bits and get a hex back"

I'm hoping that the OP's plan to "change bits" is not realized by changing 
the string representation, but rather changing the bit representation 
(using << and >> and/or bitwise operators). 

S.

On Friday, December 4, 2015 at 4:49:09 AM UTC-8, Mauro wrote:
>
> This works: 
>
> julia> a = 0b1010 
> 0xaf 
>
> julia> parse("0b"*bin(a)) 
> 0xaf 
>
> but maybe there are better ways. 
>
> On Fri, 2015-12-04 at 13:33, Martin Somers  > wrote: 
> > Just wondering binary to hex 
> > a = 0b1010 
> > bin(a) >  "1010" 
> > 
> > this results in a string that can be accessed with [] notation 
> > 
> > is there an easy way to go backwards I want to change some of the bits 
> and 
> > get a hex back 
> > 
> > M 
>


[julia-users] Re: Convert SubString{ASCIIString} to String

2015-12-04 Thread Seth
Maybe this will work for you?

julia> a = "foobarbaz"
"foobarbaz"

julia> b = SubString(a,3,6)
"obar"

julia> typeof(b)
SubString{ASCIIString}

julia> c = ASCIIString(b)
"obar"

julia> typeof(c)
ASCIIString



On Friday, December 4, 2015 at 2:48:12 PM UTC-8, Charles Santana wrote:
>
> Hi people,
>
> Maybe it is a trivial question for most of you, but I really could not 
> find a way to solve my problem.
>
> I am using the function quandlget(id::ASCIIString) from the library 
> https://github.com/milktrader/Quandl.jl (a great contribution, by the 
> way!)
>
> Everything works fine when I use it in a straightforward way:
>
> julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
> 100x6 DataFrames.DataFrame
> | Row | Date   | Open   | High   | Low| Close  | Volume|
> |-||||||---|
> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>
>
> or when I do:
>
> julia> myid = "GOOG/NASDAQ_GOOG"
> "GOOG/NASDAQ_GOOG"
>
> julia> typeof(myid)
> ASCIIString
>
> julia> mydat = quandl(myid,rows=100,format="DataFrame")
> 100x6 DataFrames.DataFrame
> | Row | Date   | Open   | High   | Low| Close  | Volume|
> |-||||||---|
> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>
>
> However, I get an error when I read my data from an external file. Assume 
> I have an ascii file containing only one line:
>
> $ echo "GOOG/NASDAQ_GOOG" > portfolio.txt
>
> $ cat portfolio.txt 
> GOOG/NASDAQ_GOOG
>
>
> I just read the content of this file by using readdlm and try to use it to 
> call the same function quandl, but it does not work.
>
> julia> myportfolio = readdlm("./portfolio.txt",'\n')
> 1x1 Array{Any,2}:
>  "GOOG/NASDAQ_GOOG"
>
> julia> typeof(myportfolio[1])
> SubString{ASCIIString}
>
> julia> mydat = quandl(myportfolio[1],rows=100,format="DataFrame")
> ERROR: MethodError: `quandlget` has no method matching 
> quandlget(::SubString{ASCIIString})
>
>
> I suppose the easiest way to solve this problem is to convert my 
> SubString{ASCIIString} variable to ASCIIString. Am I right here? How can I 
> do it?
>
> Does any of you have another suggestion? May be I could read my data in a 
> different way instead of using readdlm? 
>
> Thanks for any tip!
>
> best,
>
> Charles
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


[julia-users] what's the easiest way to force a recompilation?

2015-12-04 Thread Seth
I'd rather not alter any of the source files. Is there a Pkg command that 
will recompile? (Pkg.build() doesn't seem to do it).


[julia-users] Re: what's the easiest way to force a recompilation?

2015-12-04 Thread Seth
Awesome. Thank you.

On Friday, December 4, 2015 at 4:29:57 PM UTC-8, Tony Kelman wrote:
>
> Base.compilecache
>
> On Friday, December 4, 2015 at 2:50:03 PM UTC-8, Seth wrote:
>>
>> I'd rather not alter any of the source files. Is there a Pkg command that 
>> will recompile? (Pkg.build() doesn't seem to do it).
>>
>

[julia-users] Re: binary string to hex

2015-12-04 Thread Seth
you're binary-or'ing a bit with 0x0, which means you're not going to change 
it.

There's some useful information 
here: https://en.wikipedia.org/wiki/Bit_manipulation


On Friday, December 4, 2015 at 9:47:45 AM UTC-8, Martin Somers wrote:
>
>
>
> On Friday, 4 December 2015 16:36:34 UTC, James Gilbert wrote:
>>
>> I find bits(a) more useful than bin(a). It enables me to see all the bits 
>> of an integer when experimenting with << and >> to see if I'm doing the 
>> right thing. eg, set the 2nd bit of a byte:
>>
>>
>> *julia> **a = 0b0010*
>>
>> *0x02*
>>
>>
>> *julia> **bits(a)*
>>
>> *"0010"*
>>
>>
>> *julia> **a = a | (0x1 << 6)*
>>
>> *0x42*
>>
>>
>> *julia> **bits(a)*
>>
>> *"0110"*
>>
>>
> Looks interesting though when I try to set it back to the original, I get 
> 0x42
>
> a = a | (0x0 << 6)
>
> I guess im missing something :)
> M 
>


[julia-users] Re: How to: grep an Array of strings

2015-12-03 Thread Seth
If you don't like regexes,

julia> a = ["apple","bear","ape","collar"]
4-element Array{ASCIIString,1}:
 "apple"
 "bear"
 "ape"
 "collar"


julia> filter(x->contains(x,"ap"),a)
2-element Array{ASCIIString,1}:
 "apple"
 "ape"


julia> filter(x->contains(x,"ar"),a)
2-element Array{ASCIIString,1}:
 "bear"
 "collar"


On Thursday, December 3, 2015 at 11:52:34 AM UTC-8, Jason McConochie wrote:
>
> Is there grep for an Array of AbstractStrings?  See code below
>
>
> # A. Read a file into memory (nLines pre-determined)
>
> fID=open(fName)
>
> iLine=0;
>
> rLines=Array(ASCIIString,nLines);
>
> while !eof(fID)
>
>   iLine+=1
>
>   rLines[iLine]=readline(fID)
>
> end
>
>
> # B. Find all strings in rLines with "parameter"
>
>  Is something like this possible?
>
> indices=grep(rLines,r"parameter")
>
>
>
>

[julia-users] Re: How to: grep an Array of strings

2015-12-03 Thread Seth
One way using my previous code:

julia> find(x->contains(x,"ap"),a)
2-element Array{Int64,1}:
 1
 3

julia> find(x->contains(x,"ar"),a)
2-element Array{Int64,1}:
 2
 4


On Thursday, December 3, 2015 at 1:24:07 PM UTC-8, Jason McConochie wrote:
>
> Thank you to all.  In particular, how can the indices of the matching 
> lines be returned - I've a matlab background so am used to working from the 
> indices.
>
>
> On Thursday, December 3, 2015 at 8:52:34 PM UTC+1, Jason McConochie wrote:
>>
>> Is there grep for an Array of AbstractStrings?  See code below
>>
>>
>> # A. Read a file into memory (nLines pre-determined)
>>
>> fID=open(fName)
>>
>> iLine=0;
>>
>> rLines=Array(ASCIIString,nLines);
>>
>> while !eof(fID)
>>
>>   iLine+=1
>>
>>   rLines[iLine]=readline(fID)
>>
>> end
>>
>>
>> # B. Find all strings in rLines with "parameter"
>>
>>  Is something like this possible?
>>
>> indices=grep(rLines,r"parameter")
>>
>>
>>
>>

Re: [julia-users] How to: grep an Array of strings

2015-12-03 Thread Seth
That's really elegant. Is there a reason filter() is defined for regex 
strings but not ASCIIStrings?

On Thursday, December 3, 2015 at 12:55:50 PM UTC-8, Stefan Karpinski wrote:
>
> You can just pass a Regex object to filter:
>
> filter(r"a.*b.*c"i, map(chomp,open(readlines,"/usr/share/dict/words")))
>
> This gives all dictionary words containing "a", "b" and "c" in order but 
> not contiguous.
>
> On Thu, Dec 3, 2015 at 3:29 PM, David P. Sanders  > wrote:
>
>>
>>
>> El jueves, 3 de diciembre de 2015, 13:54:01 (UTC-6), Erik Schnetter 
>> escribió:
>>>
>>> You are looking for `filter`:
>>>
>>> filter(line->match(r"parameter", line), rLines)
>>>
>>
>> Apparently this needs to be
>>
>> filter(line->ismatch(r"3", line) != nothing, rLines)  
>>
>> (replace "match" with "ismatch" to get a Boolean expression instead of a 
>> RegexMatch object).
>>  
>>
>>>
>>> -erik
>>>
>>> On Thu, Dec 3, 2015 at 2:52 PM, Jason McConochie  
>>> wrote:
>>>
 Is there grep for an Array of AbstractStrings?  See code below


 # A. Read a file into memory (nLines pre-determined)

 fID=open(fName)

 iLine=0;

 rLines=Array(ASCIIString,nLines);

 while !eof(fID)

   iLine+=1

   rLines[iLine]=readline(fID)

 end


 # B. Find all strings in rLines with "parameter"

  Is something like this possible?

 indices=grep(rLines,r"parameter")




>>>
>>>
>>> -- 
>>> Erik Schnetter  
>>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>>
>>
>

Re: [julia-users] How to: grep an Array of strings

2015-12-03 Thread Seth
Makes sense. Thanks!

On Thursday, December 3, 2015 at 1:06:16 PM UTC-8, Stefan Karpinski wrote:
>
> There's an obvious predicate implied by a Regex: does it match a string? 
> What's the obvious predicate for a string? Checking whether it is contained 
> in another string is one option but that's pretty arbitrary. You could just 
> as well check for containment the other way. Or prefix, or suffix, etc.
>
> On Thu, Dec 3, 2015 at 4:01 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>> That's really elegant. Is there a reason filter() is defined for regex 
>> strings but not ASCIIStrings?
>>
>> On Thursday, December 3, 2015 at 12:55:50 PM UTC-8, Stefan Karpinski 
>> wrote:
>>>
>>> You can just pass a Regex object to filter:
>>>
>>> filter(r"a.*b.*c"i, map(chomp,open(readlines,"/usr/share/dict/words")))
>>>
>>> This gives all dictionary words containing "a", "b" and "c" in order but 
>>> not contiguous.
>>>
>>> On Thu, Dec 3, 2015 at 3:29 PM, David P. Sanders <dpsa...@gmail.com> 
>>> wrote:
>>>
>>>>
>>>>
>>>> El jueves, 3 de diciembre de 2015, 13:54:01 (UTC-6), Erik Schnetter 
>>>> escribió:
>>>>>
>>>>> You are looking for `filter`:
>>>>>
>>>>> filter(line->match(r"parameter", line), rLines)
>>>>>
>>>>
>>>> Apparently this needs to be
>>>>
>>>> filter(line->ismatch(r"3", line) != nothing, rLines)  
>>>>
>>>> (replace "match" with "ismatch" to get a Boolean expression instead of 
>>>> a RegexMatch object).
>>>>  
>>>>
>>>>>
>>>>> -erik
>>>>>
>>>>> On Thu, Dec 3, 2015 at 2:52 PM, Jason McConochie <
>>>>> jason.mc...@gmail.com> wrote:
>>>>>
>>>>>> Is there grep for an Array of AbstractStrings?  See code below
>>>>>>
>>>>>>
>>>>>> # A. Read a file into memory (nLines pre-determined)
>>>>>>
>>>>>> fID=open(fName)
>>>>>>
>>>>>> iLine=0;
>>>>>>
>>>>>> rLines=Array(ASCIIString,nLines);
>>>>>>
>>>>>> while !eof(fID)
>>>>>>
>>>>>>   iLine+=1
>>>>>>
>>>>>>   rLines[iLine]=readline(fID)
>>>>>>
>>>>>> end
>>>>>>
>>>>>>
>>>>>> # B. Find all strings in rLines with "parameter"
>>>>>>
>>>>>>  Is something like this possible?
>>>>>>
>>>>>> indices=grep(rLines,r"parameter")
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Erik Schnetter <schn...@gmail.com> 
>>>>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>>>>
>>>>
>>>
>

Re: [julia-users] getindex for a real number

2015-12-02 Thread Seth
This is great. I assume it catches "for i in n" where n is a scalar, also, 
right?

I could see requiring this by default in all my packages.

On Wednesday, December 2, 2015 at 1:49:22 AM UTC-8, Eric Forgy wrote:
>
> Some more improvements...
>
> julia> n = 5
> 5
>
> julia> for i = n
>println(i)
>end
> 5
>
> julia> using strict
>
> julia> for i = n
>println(i)
>end
> ERROR: MethodError: `start` has no method matching start(::Type{Number})
>  in start at C:\Users\Eric Forgy\.julia\v0.4\strict\src\strict.jl:24
>
>
> On Wednesday, December 2, 2015 at 12:05:07 PM UTC+8, Eric Forgy wrote:
>>
>> It's a start :)
>>
>> https://github.com/EricForgy/strict.jl
>>
>>
>> julia> using strict
>>
>> julia> a = 5
>> 5
>>
>> julia> a[1]
>> ERROR: MethodError: `getindex` has no method matching getindex(::Type{
>> Number}, ::Type{Integer})
>> Closest candidates are:
>>   getindex(::Type{T}, ::Any...)
>>   getindex{T<:Union{Char,Number}}(::Type{T<:Union{Char,Number}}, ::Range{
>> T})
>>   getindex{T<:Union{Char,Number}}(::Type{T<:Union{Char,Number}}, ::Range{
>> T}, ::Range{T}...)
>>  in getindex at C:\Users\Eric Forgy\.julia\v0.4\strict\src\strict.jl:4
>>
>>
>> On Wednesday, December 2, 2015 at 11:02:45 AM UTC+8, Tim Holy wrote:
>>>
>>> Likewise, I do see why this is a little troublesome. It's annoying when 
>>> you 
>>> mean to write `for i = 1:n` but accidentally write `for i = n`; it's not 
>>> always an easy bug to find. 
>>>
>>> --Tim 
>>>
>>> On Tuesday, December 01, 2015 06:38:46 PM Eric Forgy wrote: 
>>> > It bugs me, but only a little, so I won't lose sleep over it :) 
>>> > 
>>> > Then again, I wish Julia had a "strict" mode. In strict mode, the 
>>> language 
>>> > would be more pure mathematically, e.g. scalars have no indices, the 
>>> > transpose of a vector is a covector, etc. This bit me recently because 
>>> if T 
>>> > <: U, then Array{T} is NOT <: Array{U} although as, sub-modules 
>>> > , Tmodule <: 
>>> Umodule. 
>>> > 
>>> > Then again, as I'm learning, if we want Julia to do something bad 
>>> enough, 
>>> > e.g. have a "strict" mode,  we can have it. For example, I could write 
>>> a 
>>> > package "strict.jl" where 
>>> > 
>>> > using strict 
>>> > 
>>> > would kill Base.getindex(::Number) and things like that. That could be 
>>> cool 
>>> > 
>>> > :) 
>>> > 
>>> > On Wednesday, December 2, 2015 at 9:38:50 AM UTC+8, Tim Holy wrote: 
>>> > > On Tuesday, December 01, 2015 03:19:33 PM Eric Forgy wrote: 
>>> > > > A scalar is distinct from a vector so size(a) = () makes sense. 
>>> getindex 
>>> > > 
>>> > > for 
>>> > > 
>>> > > > a scalar does not make sense and should probably be removed on the 
>>> > > 
>>> > > grounds 
>>> > > 
>>> > > > of mathematical elegance :) Any code that depends on referencing a 
>>> > > 
>>> > > scalar 
>>> > > 
>>> > > > via an index is probably flawed in the first place. 
>>> > > 
>>> > > Conversely, there are many people who seem to want Julia to treat 
>>> scalars 
>>> > > and 
>>> > > 1-vectors indistinguishably (ala Matlab). 
>>> > > 
>>> > > For what it's worth, here's a (contrived) example to justify the 
>>> current 
>>> > > behavior: 
>>> > > 
>>> > > function sum_over_dims(A, dims) 
>>> > > 
>>> > > for d in dims 
>>> > > 
>>> > > A = sum(A, d) 
>>> > > 
>>> > > end 
>>> > > A 
>>> > > 
>>> > > end 
>>> > > 
>>> > > sum_over_dims(A, [2,3]) 
>>> > > sum_over_dims(A, 2) 
>>> > > 
>>> > > Why should I write sum_over_dims(A, [2]) in the latter case? 
>>> > > 
>>> > > Best, 
>>> > > --Tim 
>>>
>>>

[julia-users] Re: Where does all the time go?

2015-11-28 Thread Seth
Probably has to do with global scope. Try putting it in a function:

julia> function f()
   tic()
   start = time()
   sleep(1)
   done = time()
   toc()
   println(done - start)
   end
f (generic function with 1 method)

julia> f()
elapsed time: 1.003258943 seconds
1.0033071041107178



On Saturday, November 28, 2015 at 9:19:24 AM UTC-8, Thomas Hatch wrote:
>
> First off, Julia is fantastic! I am just trying to figure out out 
> something odd I am seeing with the time() function.
>
> if I write this code in julia:
>
> tic() 
> start = time() 
> sleep(1) 
> done = time() 
> toc() 
> println(done - start)
>
> I get this output
>
> elapsed time: 1.092225041 seconds 
> 1.0776820182800293
>
> That is more than 1 second, the same code in python (no tic and toc of 
> course) shows 0.01 over 1 second.
>
> So I am just curious, where do the extra 0.07 seconds come from?
>


[julia-users] Re: is it possible for collect() to return a collection of a specific type?

2015-11-27 Thread Seth
That did it - thank you!

For the archives:

eltype(::Type{EdgeIter}) = Edge


On Friday, November 27, 2015 at 5:29:20 PM UTC-8, Dan wrote:
>
> Looking at the collect code, it seems you really should define Base.eltype 
> for 
> your iterator and things will work out.
>
> On Saturday, November 28, 2015 at 3:15:18 AM UTC+2, Seth wrote:
>>
>> I guess that makes sense, though I struggle to see why one would create 
>> an iterator that produces multiple types.
>>
>> On Friday, November 27, 2015 at 4:45:26 PM UTC-8, ele...@gmail.com wrote:
>>>
>>> Collect only requires that the collection is iterable, for which 
>>> providing an eltype() function is optional.  I don't know if it is possible 
>>> to check at runtime if eltype() exists for the collection then it could use 
>>> that instead of Any, otherwise it would have to iterate the collection to 
>>> find all the types and either accumulate the results in an Any collection 
>>> as it goes and copy them to the right type collection later, or iterate 
>>> twice.
>>>
>>> On Saturday, November 28, 2015 at 10:17:09 AM UTC+10, Seth wrote:
>>>>
>>>> Well, I just found collect(Edge, edges(g)) works, but it would be nice 
>>>> if collect() returned a vector of Edge by default. Any ideas?
>>>>
>>>> On Friday, November 27, 2015 at 3:46:58 PM UTC-8, Seth wrote:
>>>>>
>>>>> I have implemented my own iterator that works against edges in a 
>>>>> graph, and edges(g) returns the iterator. However, collect(edges(g)) 
>>>>> returns an array of Any,1. I'd like it to return an array of Edge, 1. 
>>>>> What am I missing?
>>>>>
>>>>>

[julia-users] is it possible for collect() to return a collection of a specific type?

2015-11-27 Thread Seth
I have implemented my own iterator that works against edges in a graph, and 
edges(g) returns the iterator. However, collect(edges(g)) returns an array 
of Any,1. I'd like it to return an array of Edge, 1. What am I missing?



[julia-users] Re: is it possible for collect() to return a collection of a specific type?

2015-11-27 Thread Seth
I guess that makes sense, though I struggle to see why one would create an 
iterator that produces multiple types.

On Friday, November 27, 2015 at 4:45:26 PM UTC-8, ele...@gmail.com wrote:
>
> Collect only requires that the collection is iterable, for which providing 
> an eltype() function is optional.  I don't know if it is possible to check 
> at runtime if eltype() exists for the collection then it could use that 
> instead of Any, otherwise it would have to iterate the collection to find 
> all the types and either accumulate the results in an Any collection as it 
> goes and copy them to the right type collection later, or iterate twice.
>
> On Saturday, November 28, 2015 at 10:17:09 AM UTC+10, Seth wrote:
>>
>> Well, I just found collect(Edge, edges(g)) works, but it would be nice 
>> if collect() returned a vector of Edge by default. Any ideas?
>>
>> On Friday, November 27, 2015 at 3:46:58 PM UTC-8, Seth wrote:
>>>
>>> I have implemented my own iterator that works against edges in a graph, 
>>> and edges(g) returns the iterator. However, collect(edges(g)) returns 
>>> an array of Any,1. I'd like it to return an array of Edge, 1. What am I 
>>> missing?
>>>
>>>

[julia-users] Re: is it possible for collect() to return a collection of a specific type?

2015-11-27 Thread Seth
Yup. That's actually where I was using it.

On Friday, November 27, 2015 at 5:15:10 PM UTC-8, Dan wrote:
>
> have you tried running collect within a function? sometimes the Global 
> scope is bad for type inference.
>
> On Saturday, November 28, 2015 at 2:45:26 AM UTC+2, ele...@gmail.com 
> wrote:
>>
>> Collect only requires that the collection is iterable, for which 
>> providing an eltype() function is optional.  I don't know if it is possible 
>> to check at runtime if eltype() exists for the collection then it could use 
>> that instead of Any, otherwise it would have to iterate the collection to 
>> find all the types and either accumulate the results in an Any collection 
>> as it goes and copy them to the right type collection later, or iterate 
>> twice.
>>
>> On Saturday, November 28, 2015 at 10:17:09 AM UTC+10, Seth wrote:
>>>
>>> Well, I just found collect(Edge, edges(g)) works, but it would be nice 
>>> if collect() returned a vector of Edge by default. Any ideas?
>>>
>>> On Friday, November 27, 2015 at 3:46:58 PM UTC-8, Seth wrote:
>>>>
>>>> I have implemented my own iterator that works against edges in a graph, 
>>>> and edges(g) returns the iterator. However, collect(edges(g)) returns 
>>>> an array of Any,1. I'd like it to return an array of Edge, 1. What am 
>>>> I missing?
>>>>
>>>>

[julia-users] Re: is it possible for collect() to return a collection of a specific type?

2015-11-27 Thread Seth
Well, I just found collect(Edge, edges(g)) works, but it would be nice if 
collect() returned a vector of Edge by default. Any ideas?

On Friday, November 27, 2015 at 3:46:58 PM UTC-8, Seth wrote:
>
> I have implemented my own iterator that works against edges in a graph, 
> and edges(g) returns the iterator. However, collect(edges(g)) returns an 
> array of Any,1. I'd like it to return an array of Edge, 1. What am I 
> missing?
>
>

[julia-users] Re: Result changes if I change the number of workers

2015-11-26 Thread Seth
Are you doing floating point calculations? Some FP operations aren't 
associative and therefore may appear different on successive runs of a 
parallel operation depending on what's summed first:

julia> (0.1 + 0.2) + 0.3
0.6001


julia> 0.1 + (0.2 + 0.3)
0.6


On Thursday, November 26, 2015 at 11:48:25 AM UTC-8, Eduardo Lenz wrote:
>
> Hi.
>
> I came across a very weird behaviour when using a very simple @parallel 
> loop. The block is quite large and complex, but the idea is the following:
>
>
> A = zeros(some_dimension)
> A = convert(SharedArray,A)
> @sync @parallel for i=1:some_dimension
>
> Lots of code, but with no function calls
>
> A[i]  += block_result
>
> end
>
> some computation with sdata(A).
>
> If I use 4 processes, I get one result. With 8 processes, a diferent 
> result. Without parallel processing, another one.
>
> I am probably losing something, but I think this is not the intended 
> behaviour. 
>
> I am using jula 4.11, fedora 23 - 64 bits.
>
> Thanks for your help.
>


Re: [julia-users] "shrink wrap" overallocations?

2015-11-25 Thread Seth
Ah, yes - it's coming 
full-circle. https://github.com/JuliaLang/julia/issues/2879 - I must have 
subconsciously remembered your use of the term "shrink wrap".

On Wednesday, November 25, 2015 at 2:20:45 PM UTC-8, Stefan Karpinski wrote:
>
> I don't think we have an API for this – I would suggest that 
> sizehint!(c,n) where n is smaller than the current size of the collection c 
> should do this, if someone wants to take a crack at it.
>
> On Wed, Nov 25, 2015 at 5:02 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>> Inspired by a discussion here: 
>> https://github.com/JuliaLang/julia/issues/14112#issuecomment-159715454, 
>> it might be nice to be able to reduce the amount of "padded" 
>> (allocated-but-not-yet-used) memory for dynamic structures in certain cases 
>> where we're not planning to expand the structures significantly (and can 
>> tolerate allocation delays if we do).
>>
>> Does a function that does something like this exist already?
>>
>
>

[julia-users] "shrink wrap" overallocations?

2015-11-25 Thread Seth
Inspired by a discussion 
here: https://github.com/JuliaLang/julia/issues/14112#issuecomment-159715454, 
it might be nice to be able to reduce the amount of "padded" 
(allocated-but-not-yet-used) memory for dynamic structures in certain cases 
where we're not planning to expand the structures significantly (and can 
tolerate allocation delays if we do).

Does a function that does something like this exist already?


[julia-users] Re: `(,a) = (1,2)` returns an error

2015-11-23 Thread Seth
Why not simply

_, x, _, y = f()

? This seems easier to read and understand. _ is a valid variable but is 
typically used for superfluous assignment.

On Monday, November 23, 2015 at 9:56:27 AM UTC-8, Sisyphuss wrote:
>
> OK, so if I have a function which returns a tuple (a,b,c,d), 
> but I only want the 2nd and 4th value, the most concise way is
>
> (x,y) = f()[[2;4]]
>
>

[julia-users] Re: What is the best way to delete unwanted subgraph?

2015-11-23 Thread Seth
Aleksandr,

The easiest way to do this is something like the following:

cc = connected_components(G)
G = G[cc[1]]


This replaces G with the induced subgraph made up of the vertices in the 
first connected component. (You can create a new graph H if you want to 
keep G.)

We are also implementing rem_vertex!() soon thanks to Carlo Lucibello, but 
it's not in master yet and it's probably not as performant as the above.

Thanks,

Seth.


On Monday, November 23, 2015 at 5:17:33 AM UTC-8, Aleksandr Mikheev wrote:
>
> Hi all,
>
> I'm currently using LightGraphs package in my student research work. And I 
> have some problems with it. Imagine we have a undirrected graph G, which 
> contains, for example, 10 vertices and some edges. I would like to know 
> which components of graph G are connected, so I call 
> "connected_components(G)". Suppose I have this situation:
>
> julia> connected_components(G)
> 6-element Array{Array{Int64,1},1}:
> [1,2,3]
> [4,7]
> [5]
> [6]
> [8,9]
> [10]
>
> And now I would like to delete all subgraphs, except [1,2,3]. In other 
> words, I would like to have subgraph [1,2,3] as a graph G further. Is there 
> any effective methods to do this in LightGraphs or in any other packages? I 
> mean, I can delete vertices one by one (I guess I saw this function 
> somewhere in GitHub), but that would be pretty slow, I imagine.
>
> Thank you in advance.
>


[julia-users] Re: What is the best way to delete unwanted subgraph?

2015-11-23 Thread Seth
Keep in mind that induced subgraphs will not preserve vertex numbering, so 
if you do something like

G = G[4,5,6]

your old vertices 4, 5, and 6 will be renumbered so that the new G has 
vertices in the range 1 : 3.



On Monday, November 23, 2015 at 5:23:55 AM UTC-8, Seth wrote:
>
> Aleksandr,
>
> The easiest way to do this is something like the following:
>
> cc = connected_components(G)
> G = G[cc[1]]
>
>
> This replaces G with the induced subgraph made up of the vertices in the 
> first connected component. (You can create a new graph H if you want to 
> keep G.)
>
> We are also implementing rem_vertex!() soon thanks to Carlo Lucibello, but 
> it's not in master yet and it's probably not as performant as the above.
>
> Thanks,
>
> Seth.
>
>
> On Monday, November 23, 2015 at 5:17:33 AM UTC-8, Aleksandr Mikheev wrote:
>>
>> Hi all,
>>
>> I'm currently using LightGraphs package in my student research work. And 
>> I have some problems with it. Imagine we have a undirrected graph G, which 
>> contains, for example, 10 vertices and some edges. I would like to know 
>> which components of graph G are connected, so I call 
>> "connected_components(G)". Suppose I have this situation:
>>
>> julia> connected_components(G)
>> 6-element Array{Array{Int64,1},1}:
>> [1,2,3]
>> [4,7]
>> [5]
>> [6]
>> [8,9]
>> [10]
>>
>> And now I would like to delete all subgraphs, except [1,2,3]. In other 
>> words, I would like to have subgraph [1,2,3] as a graph G further. Is there 
>> any effective methods to do this in LightGraphs or in any other packages? I 
>> mean, I can delete vertices one by one (I guess I saw this function 
>> somewhere in GitHub), but that would be pretty slow, I imagine.
>>
>> Thank you in advance.
>>
>

[julia-users] Re: What is the best way to delete unwanted subgraph?

2015-11-23 Thread Seth


On Monday, November 23, 2015 at 2:09:13 PM UTC-8, Aleksandr Mikheev wrote:
>
> Excuse me once again. How can I use rem_vertex!() now? I tried to update 
> my package - didn't help. I tried to do a new file (called GraphFeatures), 
> in witch I copied all the functions from here 
> 
>  - 
> but it does not understand standart Graph type from LightGraphs:
>
> ERROR: MethodError: `rem_vertex!` has no method matching 
>> rem_vertex!(::LighGraphs.Graph, ::Int64)
>> Closest candidates are:
>>   rem_vertex!(::Union{GraphFeatures.DiGraph,GraphFeatures.Graph}, ::Int64)
>
>
>  What should I do? 
>

Try this:

Pkg.clone("LightGraphs") # this makes sure you're on the most current code 
in master
Then exit / restart Julia REPL, and type "using LightGraphs" - this will 
force a recompile
rem_vertex!() should now be available for Graph and DiGraph:

julia> g = PathGraph(10)
{10, 9} undirected graph

julia> rem_vertex!(g,4)
{9, 7} undirected graph

If you have any other questions, please feel free to ask here or open up an 
issue on the LightGraphs repo.

Really sorry for silly questions, but I am really new to Julia language and 
> also I am not very good in coding generally.
>
 
Absolutely no need to apologize. Feel free to ask away.



[julia-users] Re: What is the best way to delete unwanted subgraph?

2015-11-23 Thread Seth
Er. Sorry for the bad instructions. Don't use Pkg.clone("LightGraphs"), use 
Pkg.checkout("LightGraphs").

On Monday, November 23, 2015 at 2:31:42 PM UTC-8, Seth wrote:
>
>
>
> On Monday, November 23, 2015 at 2:09:13 PM UTC-8, Aleksandr Mikheev wrote:
>>
>> Excuse me once again. How can I use rem_vertex!() now? I tried to update 
>> my package - didn't help. I tried to do a new file (called GraphFeatures), 
>> in witch I copied all the functions from here 
>> <https://github.com/JuliaGraphs/LightGraphs.jl/blob/0b91e3d04fe2d0b557127e0ad42d879455a4b158/src/core.jl>
>>  - 
>> but it does not understand standart Graph type from LightGraphs:
>>
>> ERROR: MethodError: `rem_vertex!` has no method matching 
>>> rem_vertex!(::LighGraphs.Graph, ::Int64)
>>> Closest candidates are:
>>>   rem_vertex!(::Union{GraphFeatures.DiGraph,GraphFeatures.Graph}, 
>>> ::Int64)
>>
>>
>>  What should I do? 
>>
>
> Try this:
>
> Pkg.clone("LightGraphs") # this makes sure you're on the most current code 
> in master
> Then exit / restart Julia REPL, and type "using LightGraphs" - this will 
> force a recompile
> rem_vertex!() should now be available for Graph and DiGraph:
>
> julia> g = PathGraph(10)
> {10, 9} undirected graph
>
> julia> rem_vertex!(g,4)
> {9, 7} undirected graph
>
> If you have any other questions, please feel free to ask here or open up 
> an issue on the LightGraphs repo.
>
> Really sorry for silly questions, but I am really new to Julia language 
>> and also I am not very good in coding generally.
>>
>  
> Absolutely no need to apologize. Feel free to ask away.
>
>

[julia-users] Re: What is the best way to delete unwanted subgraph?

2015-11-23 Thread Seth
...and just to follow up, rem_vertex!() is now in LightGraphs master. This 
will be more efficient if the connected components you're trying to remove 
are small relative to the ones you want to preserve.


On Monday, November 23, 2015 at 5:28:04 AM UTC-8, Seth wrote:
>
> Keep in mind that induced subgraphs will not preserve vertex numbering, so 
> if you do something like
>
> G = G[4,5,6]
>
> your old vertices 4, 5, and 6 will be renumbered so that the new G has 
> vertices in the range 1 : 3.
>
>
>
> On Monday, November 23, 2015 at 5:23:55 AM UTC-8, Seth wrote:
>>
>> Aleksandr,
>>
>> The easiest way to do this is something like the following:
>>
>> cc = connected_components(G)
>> G = G[cc[1]]
>>
>>
>> This replaces G with the induced subgraph made up of the vertices in the 
>> first connected component. (You can create a new graph H if you want to 
>> keep G.)
>>
>> We are also implementing rem_vertex!() soon thanks to Carlo Lucibello, 
>> but it's not in master yet and it's probably not as performant as the above.
>>
>> Thanks,
>>
>> Seth.
>>
>>
>> On Monday, November 23, 2015 at 5:17:33 AM UTC-8, Aleksandr Mikheev wrote:
>>>
>>> Hi all,
>>>
>>> I'm currently using LightGraphs package in my student research work. And 
>>> I have some problems with it. Imagine we have a undirrected graph G, which 
>>> contains, for example, 10 vertices and some edges. I would like to know 
>>> which components of graph G are connected, so I call 
>>> "connected_components(G)". Suppose I have this situation:
>>>
>>> julia> connected_components(G)
>>> 6-element Array{Array{Int64,1},1}:
>>> [1,2,3]
>>> [4,7]
>>> [5]
>>> [6]
>>> [8,9]
>>> [10]
>>>
>>> And now I would like to delete all subgraphs, except [1,2,3]. In other 
>>> words, I would like to have subgraph [1,2,3] as a graph G further. Is there 
>>> any effective methods to do this in LightGraphs or in any other packages? I 
>>> mean, I can delete vertices one by one (I guess I saw this function 
>>> somewhere in GitHub), but that would be pretty slow, I imagine.
>>>
>>> Thank you in advance.
>>>
>>

[julia-users] Re: Creating a stable version of Julia + Packages for a semester long course?

2015-11-16 Thread Seth
Avik,

what happens with precompilation if .julia isn't writable? (Too chicken to 
try it out here.)


On Monday, November 16, 2015 at 4:30:34 AM UTC-8, Avik Sengupta wrote:
>
> .julia does not need to be writable for running Julia code. It needs to be 
> writable for package operations (add, update etc). I run a shared .julia on 
> a multiuser linux machine, it works well. The only issue is that doing 
> Pkg.update() is a bit of a pain, but we only do that very rarely. 
>
> Regards
> -
> Avik
>
> On Monday, 16 November 2015 08:05:38 UTC, Sheehan Olver wrote:
>>
>> Another requirement is that the packages are shared across users, to save 
>> disk space.  Gadfly + PyPlot + IJulia (with Conda.jl version of Jupyter) 
>> takes over 750MB.   Does .julia need to be writable?  If not, I guess both 
>> options are still possible.
>>
>> On Monday, November 16, 2015 at 2:05:45 PM UTC+11, Sheehan Olver wrote:
>>>
>>>
>>> I'm trying to figure out the "best" way to create a stable version of 
>>> Julia + Gadfly + PyPlot + IJulia (+ other packages?) for a semester long 
>>> course.  I don't want to have the students run Pkg.add(...)/Pkg.update(), 
>>> as packages have a tendency to occasionally break on updates, and it's a 
>>> headache dealing with this during the lecture.
>>>
>>> Two possible solutions I can think of of are:
>>>
>>> 1)  Prebake a .julia folder that contains all the necessary resources, 
>>> with a script to reset in case the students break it with Pkg.update().
>>> 2)  Use system image
>>>
>>> http://docs.julialang.org/en/release-0.4/devdocs/sysimg/
>>>
>>> that includes all the necessary packages.   It's not really clear how to 
>>> do this from the documentation, though.   I'm also not sure how that would 
>>> interact with Pkg.update() though, so probably instructions to delete 
>>> .julia would also need to be given.
>>>
>>>
>>> Any other options I'm missing?  If 2 is recommended, any tutorial how to 
>>> do this?
>>>
>>

[julia-users] Re: push! performance

2015-11-16 Thread Seth
I'm not sure the equivalence is entirely accurate:

julia> a = Vector{Int}()
0-element Array{Int64,1}

julia> Base.summarysize(a)
0

julia> @time sizehint!(a,10_000_000)
0.96 seconds (149 allocations: 76.304 MB)
0-element Array{Int64,1}

julia> Base.summarysize(a)
0

julia> @time b = zeros(Int,10_000_000);
0.037202 seconds (35 allocations: 76.295 MB, 64.13% gc time)

julia> Base.summarysize(b)
8000



On Monday, November 16, 2015 at 1:10:36 AM UTC-8, Tomas Lycken wrote:
>
> sizehint! preallocates for you, with comparable cost to calling e.g. 
> zeroes, but lets you treat the array semantically the same way as a 
> non-preallocated one (but without the cost for reallocation). Hopefully, 
> these comments highlight the differences between the various appraches:
>
> N = 10_000
> A = Array(Float64,0) 
> sizehint!(A, 10_000) # this preallocates memory for 10k elements
> B = Array(Float64,0)
> C = zeros(10_000) # this also preallocates memory for 10k elements
>
> # now, A and C are pre-allocated, while B is not# however, A and B are 
> semantically equivalent (0-length) vectors,
> # while C is already of length 10 000:
> println(length(A)) # 0
> println(length(B)) # 0
> println(length(C)) # 1
>
> for i in 1:10_000
>push!(A, i) # no reallocation happens here, because we did it with 
> sizehint!
>push!(B, i) # this will re-allocate B every now and then
>C[i] = i # can't use push! here, but must manually track index instead
> end
>
> I don't know what `dynamic` does in this context, and I can't find it in 
> the docs, so can't help you there :)
>
> // T
>
> On Monday, November 16, 2015 at 2:07:13 AM UTC+1, Seth wrote:
>
> What happens if you use sizehint!() with dynamic()?
>>
>> On Sunday, November 15, 2015 at 3:35:45 PM UTC-8, Steven G. Johnson wrote:
>>>
>>> function prealloc(n)
>>> a = Array(Int, n)
>>> for i = 1:n
>>> a[i] = i
>>> end
>>> return a
>>> end
>>> function dynamic(n)
>>> a = Int[]
>>> for i = 1:n
>>> push!(a, i)
>>> end
>>> return a
>>> end
>>> @time prealloc(10^7);
>>> @time dynamic(10^7);
>>>
>>>
>>> On my machine, the preallocated version is 2.5–3x faster.  A significant 
>>> but not overwhelming margin.
>>>
>> ​
>


[julia-users] Re: sparse rank, sparse nullspace, sparse linear algebra over rationals?

2015-11-16 Thread Seth
well, nullspace appears to be defined for dense arrays only - and rank is 
defined for abstract arrays but will fail in svdvals!() when passed a 
sparse array (this is arguably a bug).

On Monday, November 16, 2015 at 1:12:04 PM UTC-8, Laurent Bartholdi wrote:
>
> Hello world,
> I'm new at julia, and trying it out as a replacement for matlab and other 
> computer algebra systems. I'm a bit stuck with sparse matrices: I have 
> largeish matrices (10^6 x 10^6) that are very sparse, and
> want to know their rank and nullspace. (the matrices decompose by blocks, 
> so the nullspace should be expressible as a sparse matrix).
>
> I tried with the latest (github) julia 0.5:
>
> julia> nullspace(sparse([1],[1],[1]))
> ERROR: MethodError: `nullspace` has no method matching 
> nullspace(::SparseMatrixCSC{Int64,Int64})
>
> julia> nullspace(full(sparse([1],[1],[1])))
> 1x0 Array{Float64,2} # I'm a bit unhappy here, I was hoping to get a 
> rational answer.
>
> julia> nullspace([1//1])
> 1x0 Array{Float32,2} # yikes! I'm down to 32 bits floats now.
>
> julia> rank(sparse([1],[1],[1.0]))
> ERROR: MethodError: `svdvals!` has no method matching 
> svdvals!(::SparseMatrixCSC{Float64,Int64})
>
> julia> rank([1.0])
> ERROR: MethodError: `rank` has no method matching rank(::Array{Float64,1})
>
> julia> rank([1 0;0 1])
> 2 # finally something that works...
>
> Many thanks in advance! Laurent
>
>

[julia-users] Re: push! performance

2015-11-16 Thread Seth
Yup, I'm convinced. Though if we ever get 
https://github.com/JuliaLang/julia/issues/9147 implemented perhaps it'll be 
faster in the case of zeros too :)

On Monday, November 16, 2015 at 9:42:40 AM UTC-8, Tomas Lycken wrote:
>
> Yeah, that makes it even more clear that they’re very similar:
>
> julia> gc(); @time for i=1:1_000; sizehint!(Vector{Int}(0), 1_000); end
>   0.000186 seconds (2.00 k allocations: 7.721 MB)
>
> julia> gc(); @time for i=1:1_000; Vector{Int}(1_000); end
>   0.000181 seconds (1000 allocations: 7.706 MB)
>
> (broken into smaller chunks, because the timings started to get awfully 
> close to the resolution of the clock, and the gc percentage count got 
> really borked…)
>
> // T
>
> On Monday, November 16, 2015 at 6:26:04 PM UTC+1, Steven G. Johnson wrote:
>
>
>
> On Monday, November 16, 2015 at 11:24:20 AM UTC-5, Tomas Lycken wrote:
>
> Making sure that precompilation and gc don’t factor into the result, I get 
> quite different timings:
>
> julia> gc(); @time sizehint!(a, 10_000_000);
>   0.001493 seconds (46 allocations: 76.296 MB, 304.61% gc time)
>
> julia> gc(); @time b = zeros(Int, 10_000_000);
>   0.021997 seconds (38 allocations: 76.296 MB, 0.70% gc time)
>
>
> Compare to Array(Int,  10_000_000), which allocates an uninitialized array.
>
> ​
>
> ​
>
> ...



[julia-users] Re: General question on indexing

2015-11-16 Thread Seth
I wish I walked faster with @simd - for some reason I'm getting the same 
performance as described 
here: https://groups.google.com/d/msg/julia-users/DycY6jwDcWs/yYXHsWF9AwAJ

One of the key objectives for LightGraphs is to be as fast as possible, so 
while Julia itself is pretty darn good, we want to eke every possible 
performance gain out of it so that we can scale to very large graphs. This 
also includes memory allocation, so fast and small. We're getting to the 
point where improving one results in bad performance in the other. That's 
both a good sign (that we've optimized away the low-hanging fruit) and a 
bad sign (that we may be hitting the limits of what we can do). I'm sure 
we've missed some stuff, though.

Thanks for the discussion. Feel free to join us over 
at https://github.com/JuliaGraphs/LightGraphs.jl/issues if this sort of 
stuff interests you :)

Seth.



On Monday, November 16, 2015 at 11:28:15 AM UTC-8, hustf wrote:
>
> Seth, I appreciate that. As a novice programmer I appreciate to have 
> exchanges with you guys who are making this. I'm using commercial software 
> every day that hasn't made progress since the nineties. 
>
> I worked through something like fifteen types for the adjacency matrix 
> (and, by the way, tuples for storage worked out, but was slower). I suppose 
> Julia is fast so that we don't actually need to optimize like this all the 
> time, but it's an excellent lesson. 
>
> In the example I gave above you may have noted some confusion about 
> rows-columns order. Those algorithms which were adapted from text books or 
> other languages seem to walk along rows. In Julia, you walk faster 
> downhill. And with @simd. 
>


[julia-users] Re: optimization of sorted vector / insert and dedup?

2015-11-16 Thread Seth
I managed to squeeze a bit more performance out of it:

_insert_and_dedup!(v::Vector{Int}, x::Int) = isempty(splice!(v, searchsorted
(v,x), x))

If there's a better way of doing it, please let me know.



On Monday, November 16, 2015 at 3:37:34 PM UTC-8, Seth wrote:
>
> I found this stackoverflow question: 
> http://stackoverflow.com/questions/25678112/insert-item-into-a-sorted-list-with-julia-with-and-without-duplicates
>
> with a great solution by Stefan.
>
> Moving from [x] to x (see his followup) reduced the time to do this 
> insert/dedup by ~30%.
>
> Is there a more efficient way to do this? Here's the code I have right now:
>
> function _insert_and_dedup!(v::Vector{Int}, x::Int)
> oldv = length(v)
> splice!(v, searchsorted(v,x), x)
> return (length(v) == oldv+1)
> end
>
> I'm returning true if the value was added; false if it was a duplicate 
> (needed for some other function).
>
>

Re: [julia-users] Re: General question on indexing

2015-11-15 Thread Seth
Thank you, Tim - I'll definitely check it out. Right now I can't seem to 
find an efficient way of doing it, but there are a few tricks in 
Iterators.jl that might work.

On Sunday, November 15, 2015 at 1:33:29 PM UTC-8, Tim Holy wrote:
>
> This may also be a case where writing an iterator that just visits the 
> elements with i >= j might be what you want. You can study the 
> implementation 
> of CartesianIndex in Base for inspiration. 
>
> --Tim 
>
> On Saturday, November 14, 2015 02:18:45 PM hustf wrote: 
> > I believe this work-in-progress type may be adapted? I wanted to make 
> this 
> > faster by using tuples or immutable fixed vectors to store the data or 
> > whatnot, but I guess I'm currently stuck. Help wanted. 
> > 
> > Compared to looping unnecessarily over a full matrix, this speeds things 
> up 
> > by around 35%. 
> > 
> > immutable Maq7 <:AbstractMatrix{Int} 
> > data::Array{Int64,2}   # upper triangular except diagonal, stored as a 
> > horizontal vector 
> > width::Int64 
> > function Maq7(mat::Matrix{Int64}) 
> > if issym(mat) 
> > n=size(mat,1) 
> > if n>1 
> > v=mat[2:n,1] 
> > for col = 2:(n-1) 
> > append!(v,mat[(col+1):n,col]) 
> > end 
> > new(v', size(mat,1)) 
> > else 
> > error("Ouch, not > (1x1)") 
> > end 
> > else 
> > error("Ouch, not square symmetric") 
> > end 
> > end 
> > end 
> > Base.size(A::Maq7)= A.width, A.width 
> > Base.length(A::Maq7)= div(A.width*(A.width-1), 2) 
> > Base.getindex(A::Maq7, i::Int) = Base.getindex(A.data, i) 
> > function Base.getindex(A::Maq7, r::Int , c::Int ) 
> > if c > r 
> > return getindex(A.data, div( (r-1)*(2*A.width -r) , 2 ) + c - r ) 
> > elseif r > c 
> > return getindex(A.data, div( (c-1)*(2*A.width -c) , 2 ) + r - c ) 
> > else 
> > return zero(eltype(A.data)) 
> > end 
> > end 
> > Base.linearindexing(::Type{Maq7}) = Base.LinearFast() 
> > 
> > 
> > 
> > Example: 
> > julia> ms 
> > 4x4 Array{Int64,2}: 
> >  7  1  2   3 
> >  1  8  4   5 
> >  2  4  9   6 
> >  3  5  6  10 
> > 
> > 
> > julia> m=Maq7(ms) 
> > 4x4 Maq7: 
> >  0  1  2  3 
> >  1  0  4  5 
> >  2  4  0  6 
> >  3  5  6  0 
> > 
> > julia> collect(m) 
> > 6-element Array{Int64,1}: 
> >  1 
> >  2 
> >  3 
> >  4 
> >  5 
> >  6 
> > 
> > 
> > julia> length(m) 
> > 6 
>
>

[julia-users] Re: push! performance

2015-11-15 Thread Seth
What happens if you use sizehint!() with dynamic()?

On Sunday, November 15, 2015 at 3:35:45 PM UTC-8, Steven G. Johnson wrote:
>
> function prealloc(n)
> a = Array(Int, n)
> for i = 1:n
> a[i] = i
> end
> return a
> end
> function dynamic(n)
> a = Int[]
> for i = 1:n
> push!(a, i)
> end
> return a
> end
> @time prealloc(10^7);
> @time dynamic(10^7);
>
>
> On my machine, the preallocated version is 2.5–3x faster.  A significant 
> but not overwhelming margin.
>


Re: [julia-users] Re: General question on indexing

2015-11-15 Thread Seth
That's very cool and close to what I need. Thanks. I'm using adjacency 
lists (vectors of vectors) but I'm sure I can adapt this code.

On Sunday, November 15, 2015 at 6:12:19 PM UTC-8, Tim Holy wrote:
>
> Haven't tested timing carefully, but something like the following should 
> be 
> pretty decent: 
>
> julia> immutable LowerTriangularIterator{A<:AbstractMatrix} 
>data::A 
>end 
>
> julia> Base.start(iter::LowerTriangularIterator) = (1,1) 
> start (generic function with 49 methods) 
>
> julia> Base.done(iter::LowerTriangularIterator, state) = state[2] > 
> size(iter.data, 2) 
> done (generic function with 51 methods) 
>
> julia> @inline function Base.next(iter::LowerTriangularIterator, state) 
>item = iter.data[state[1], state[2]] 
>newstate = ifelse(state[1] == size(iter.data, 1), (state[2]+1, 
> state[2]+1), (state[1]+1, state[2])) 
>item, newstate 
>end 
>
>
> To make it vectorize (i.e., SIMD), you might also need definitions like 
> these: 
>
> https://github.com/JuliaLang/julia/blob/aa24ee0d0f334e8d9ecbced64bd975a6cc5f240d/base/multidimensional.jl#L134-L150
>  
>
> but perhaps vectorization isn't applicable to your problem anyway. 
>
> --Tim 
>
> On Sunday, November 15, 2015 05:06:23 PM Seth wrote: 
> > Thank you, Tim - I'll definitely check it out. Right now I can't seem to 
> > find an efficient way of doing it, but there are a few tricks in 
> > Iterators.jl that might work. 
> > 
> > On Sunday, November 15, 2015 at 1:33:29 PM UTC-8, Tim Holy wrote: 
> > > This may also be a case where writing an iterator that just visits the 
> > > elements with i >= j might be what you want. You can study the 
> > > implementation 
> > > of CartesianIndex in Base for inspiration. 
> > > 
> > > --Tim 
> > > 
> > > On Saturday, November 14, 2015 02:18:45 PM hustf wrote: 
> > > > I believe this work-in-progress type may be adapted? I wanted to 
> make 
> > > 
> > > this 
> > > 
> > > > faster by using tuples or immutable fixed vectors to store the data 
> or 
> > > > whatnot, but I guess I'm currently stuck. Help wanted. 
> > > > 
> > > > Compared to looping unnecessarily over a full matrix, this speeds 
> things 
> > > 
> > > up 
> > > 
> > > > by around 35%. 
> > > > 
> > > > immutable Maq7 <:AbstractMatrix{Int} 
> > > > data::Array{Int64,2}   # upper triangular except diagonal, stored as 
> a 
> > > > horizontal vector 
> > > > width::Int64 
> > > > function Maq7(mat::Matrix{Int64}) 
> > > > if issym(mat) 
> > > > n=size(mat,1) 
> > > > if n>1 
> > > > v=mat[2:n,1] 
> > > > for col = 2:(n-1) 
> > > > append!(v,mat[(col+1):n,col]) 
> > > > end 
> > > > new(v', size(mat,1)) 
> > > > else 
> > > > error("Ouch, not > (1x1)") 
> > > > end 
> > > > else 
> > > > error("Ouch, not square symmetric") 
> > > > end 
> > > > end 
> > > > end 
> > > > Base.size(A::Maq7)= A.width, A.width 
> > > > Base.length(A::Maq7)= div(A.width*(A.width-1), 2) 
> > > > Base.getindex(A::Maq7, i::Int) = Base.getindex(A.data, i) 
> > > > function Base.getindex(A::Maq7, r::Int , c::Int ) 
> > > > if c > r 
> > > > return getindex(A.data, div( (r-1)*(2*A.width -r) , 2 ) + c - r ) 
> > > > elseif r > c 
> > > > return getindex(A.data, div( (c-1)*(2*A.width -c) , 2 ) + r - c ) 
> > > > else 
> > > > return zero(eltype(A.data)) 
> > > > end 
> > > > end 
> > > > Base.linearindexing(::Type{Maq7}) = Base.LinearFast() 
> > > > 
> > > > 
> > > > 
> > > > Example: 
> > > > julia> ms 
> > > > 
> > > > 4x4 Array{Int64,2}: 
> > > >  7  1  2   3 
> > > >  1  8  4   5 
> > > >  2  4  9   6 
> > > >  3  5  6  10 
> > > > 
> > > > julia> m=Maq7(ms) 
> > > > 
> > > > 4x4 Maq7: 
> > > >  0  1  2  3 
> > > >  1  0  4  5 
> > > >  2  4  0  6 
> > > >  3  5  6  0 
> > > > 
> > > > julia> collect(m) 
> > > > 
> > > > 6-element Array{Int64,1}: 
> > > >  1 
> > > >  2 
> > > >  3 
> > > >  4 
> > > >  5 
> > > >  6 
> > > > 
> > > > julia> length(m) 
> > > > 6 
>
>

[julia-users] Re: General question on indexing

2015-11-15 Thread Seth
Hustf, I don't know why my reply didn't show up here yesterday, but I 
wanted to thank you for the code. I'm looking at how to make that work. 
Thanks for your response.

On Saturday, November 14, 2015 at 2:18:45 PM UTC-8, hustf wrote:
>
> I believe this work-in-progress type may be adapted? I wanted to make this 
> faster by using tuples or immutable fixed vectors to store the data or 
> whatnot, but I guess I'm currently stuck. Help wanted.
>
> Compared to looping unnecessarily over a full matrix, this speeds things 
> up by around 35%.
>
> immutable Maq7 <:AbstractMatrix{Int}
> data::Array{Int64,2}   # upper triangular except diagonal, stored as a 
> horizontal vector
> width::Int64
> function Maq7(mat::Matrix{Int64}) 
> if issym(mat)
> n=size(mat,1)
> if n>1
> v=mat[2:n,1]
> for col = 2:(n-1)
> append!(v,mat[(col+1):n,col])
> end
> new(v', size(mat,1))
> else
> error("Ouch, not > (1x1)")
> end
> else 
> error("Ouch, not square symmetric")
> end
> end
> end
> Base.size(A::Maq7)= A.width, A.width 
> Base.length(A::Maq7)= div(A.width*(A.width-1), 2)
> Base.getindex(A::Maq7, i::Int) = Base.getindex(A.data, i) 
> function Base.getindex(A::Maq7, r::Int , c::Int )
> if c > r 
> return getindex(A.data, div( (r-1)*(2*A.width -r) , 2 ) + c - r )
> elseif r > c
> return getindex(A.data, div( (c-1)*(2*A.width -c) , 2 ) + r - c )
> else
> return zero(eltype(A.data))
> end
> end
> Base.linearindexing(::Type{Maq7}) = Base.LinearFast()
>
>
>
> Example:
> julia> ms
> 4x4 Array{Int64,2}:
>  7  1  2   3
>  1  8  4   5
>  2  4  9   6
>  3  5  6  10
>
>
> julia> m=Maq7(ms)
> 4x4 Maq7:
>  0  1  2  3
>  1  0  4  5
>  2  4  0  6
>  3  5  6  0
>
> julia> collect(m)
> 6-element Array{Int64,1}:
>  1
>  2
>  3
>  4
>  5
>  6
>
>
> julia> length(m)
> 6
>
>
>
>
>

[julia-users] General question on indexing

2015-11-13 Thread Seth
Is it always expected that foo[i] == collect(foo)[i]? I'm running into a 
bit of an issue with undirected graphs where this may not be the case for 
collections of graph edges, and I'm wondering how much time I should sink 
into fixing a problem that might not even exist.

The discrepancy is with an edge (s,d) where s > d - in the iterator they're 
ignored in undirected graphs since we represent it as d,s in this case 
(smaller vertex first), but in the adjacency list that is used to build the 
getindex, they're both there. So we can have Edge(20,10) in edges(graph) be 
true, but Edge(20,10) in collect(edges(graph)) be false (Edge(10,20) will 
be in the collection).

Thanks for any input.


[julia-users] Re: haskey for Set

2015-11-12 Thread Seth
in(el, S) or  el in S.

On Thursday, November 12, 2015 at 2:36:28 PM UTC-8, Freddy Chua wrote:
>
> haskey does not work for Set ? It only works for Dict. Should it be that 
> way? How do I test whether an element is in a Set?
>


[julia-users] Re: did something change already with arrays in 0.5?

2015-11-12 Thread Seth
Following up, the easiest way I've found to fix things so they're 
cross-version is to change my test from

foo = [1 2 3 4 5]
@test [1, :] == [1 2 3 4 5]

to 

foo = [1 2 3 4 5]
@test [1, :][:] == [1, 2, 3, 4, 5]   # note the trailing [:]


This works on both 0.4 and 0.5.


On Wednesday, November 11, 2015 at 9:31:28 PM UTC-8, Tony Kelman wrote:
>
> We could possibly start adding feature flags for this kind of change 
> that's only in semantics and not syntax. Maybe better to put that kind of 
> flag in Compat.jl by way of a dummy indexing test rather than in Base?
>
>
> On Wednesday, November 11, 2015 at 8:50:17 PM UTC-8, Seth wrote:
>>
>> Thanks, Tony. It's in tests, so I guess I can make it version-dependent. 
>> Is there a better way to do it? I had version conditionals throughout the 
>> code during the 0.3 - 0.4 cycle, and it was less than ideal. I'd like to 
>> avoid that again if at all possible.
>>
>>
>> On Wednesday, November 11, 2015 at 8:43:02 PM UTC-8, Tony Kelman wrote:
>>>
>>> Yes. https://github.com/JuliaLang/julia/pull/13612
>>> It's in NEWS.md.
>>>
>>> Make your code version-dependent if it can't handle the new behavior.
>>>
>>>
>>> On Wednesday, November 11, 2015 at 8:19:32 PM UTC-8, Seth wrote:
>>>>
>>>> LightGraphs started failing 0.5 tests, while -release is fine:
>>>>
>>>> https://travis-ci.org/JuliaGraphs/LightGraphs.jl/jobs/90631116
>>>>
>>>> apparently foo[3,:] now returns [x,y,z] instead of [x y z].
>>>>
>>>> 1) could someone confirm this new behavior?
>>>> 2) what's the best way of handling this besides disabling tests on 0.5?
>>>>
>>>>

Re: [julia-users] macro to exclude code depending on VERSION

2015-11-12 Thread Seth
...and I just discovered Requires.jl. Fantastic stuff.

On Thursday, November 12, 2015 at 8:55:23 PM UTC-8, Seth wrote:
>
> This could be useful to me :)
>
> I have a couple of functions that require JuMP but I don't want to add 
> JuMP to my REQUIRE file. My usual tactic of checking isdefined(:JuMP) won't 
> work because JuMP uses macros that are evaluated prior to runtime. However, 
> I was unable to make the following code work:
>
> @cond (isdefined(:JuMP)) begin
> function something_that_requires_jump(a...)
> ...
> end # function
> end # macro
>
> Is there an accepted way to do conditional includes of packages that 
> contain macros?
>
> On Thursday, November 12, 2015 at 4:37:43 AM UTC-8, andrew cooke wrote:
>>
>>
>> ah, great.  i won't make a new package then.  thanks.
>>
>> On Thursday, 12 November 2015 09:30:21 UTC-3, Yichao Yu wrote:
>>>
>>> https://github.com/JuliaLang/julia/issues/7449 
>>> https://github.com/JuliaLang/Compat.jl/pull/131 
>>> https://github.com/JuliaLang/julia/issues/5892 
>>>
>>> On Thu, Nov 12, 2015 at 7:23 AM, andrew cooke <and...@acooke.org> 
>>> wrote: 
>>> > 
>>> > when you're writing code that uses macros, supporting different 
>>> versions of 
>>> > julia seems to be more complex than normal.  in particular, things 
>>> like: 
>>> > 
>>> > if VERSION > XX 
>>> > # code with macros here 
>>> > end 
>>> > 
>>> > don't work as expected, because macro expansion occurs before runtime 
>>> > evaluation.  so the macros are expenaded whatever version. 
>>> > 
>>> > given that, i have found this simple macro to be useful; 
>>> > 
>>> > macro cond(test, block) 
>>> > if eval(test) 
>>> > block 
>>> > end 
>>> > end 
>>> > 
>>> > @cond VERSION >= v"0.4" begin 
>>> >  # code with macros here 
>>> > end 
>>> > 
>>> > anyway, my questions are: (1) is the above sensible and (2) does this 
>>> > already exist? 
>>> > 
>>> > thanks, 
>>> > andrew 
>>> > 
>>>
>>

Re: [julia-users] macro to exclude code depending on VERSION

2015-11-12 Thread Seth
This could be useful to me :)

I have a couple of functions that require JuMP but I don't want to add JuMP 
to my REQUIRE file. My usual tactic of checking isdefined(:JuMP) won't work 
because JuMP uses macros that are evaluated prior to runtime. However, I 
was unable to make the following code work:

@cond (isdefined(:JuMP)) begin
function something_that_requires_jump(a...)
...
end # function
end # macro

Is there an accepted way to do conditional includes of packages that 
contain macros?

On Thursday, November 12, 2015 at 4:37:43 AM UTC-8, andrew cooke wrote:
>
>
> ah, great.  i won't make a new package then.  thanks.
>
> On Thursday, 12 November 2015 09:30:21 UTC-3, Yichao Yu wrote:
>>
>> https://github.com/JuliaLang/julia/issues/7449 
>> https://github.com/JuliaLang/Compat.jl/pull/131 
>> https://github.com/JuliaLang/julia/issues/5892 
>>
>> On Thu, Nov 12, 2015 at 7:23 AM, andrew cooke  wrote: 
>> > 
>> > when you're writing code that uses macros, supporting different 
>> versions of 
>> > julia seems to be more complex than normal.  in particular, things 
>> like: 
>> > 
>> > if VERSION > XX 
>> > # code with macros here 
>> > end 
>> > 
>> > don't work as expected, because macro expansion occurs before runtime 
>> > evaluation.  so the macros are expenaded whatever version. 
>> > 
>> > given that, i have found this simple macro to be useful; 
>> > 
>> > macro cond(test, block) 
>> > if eval(test) 
>> > block 
>> > end 
>> > end 
>> > 
>> > @cond VERSION >= v"0.4" begin 
>> >  # code with macros here 
>> > end 
>> > 
>> > anyway, my questions are: (1) is the above sensible and (2) does this 
>> > already exist? 
>> > 
>> > thanks, 
>> > andrew 
>> > 
>>
>

Re: [julia-users] Re: haskey for Set

2015-11-12 Thread Seth
Also note the equivalent unicode methods:

∈(item,collection) -> Bool
∋(collection,item) -> Bool
∉(item,collection) -> Bool
∌(collection,item) -> Bool

All(?) of which can also be infixed.

On Thursday, November 12, 2015 at 4:42:21 PM UTC-8, Freddy Chua wrote:
>
> that works, thank you.
>
> Freddy Chua
>
>
> On Thu, Nov 12, 2015 at 3:06 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>> in(el, S) or  el in S.
>>
>>
>> On Thursday, November 12, 2015 at 2:36:28 PM UTC-8, Freddy Chua wrote:
>>>
>>> haskey does not work for Set ? It only works for Dict. Should it be that 
>>> way? How do I test whether an element is in a Set?
>>>
>>
>

[julia-users] did something change already with arrays in 0.5?

2015-11-11 Thread Seth
LightGraphs started failing 0.5 tests, while -release is fine:

https://travis-ci.org/JuliaGraphs/LightGraphs.jl/jobs/90631116

apparently foo[3,:] now returns [x,y,z] instead of [x y z].

1) could someone confirm this new behavior?
2) what's the best way of handling this besides disabling tests on 0.5?



[julia-users] Re: Google releases TensorFlow as open source

2015-11-11 Thread Seth
Awesome. Feel free to open up a LightGraphs issue to track.

On Wednesday, November 11, 2015 at 2:24:13 PM UTC-8, Alireza Nejati wrote:
>
> Both! :)



[julia-users] Re: did something change already with arrays in 0.5?

2015-11-11 Thread Seth
Thanks, Tony. It's in tests, so I guess I can make it version-dependent. Is 
there a better way to do it? I had version conditionals throughout the code 
during the 0.3 - 0.4 cycle, and it was less than ideal. I'd like to avoid 
that again if at all possible.


On Wednesday, November 11, 2015 at 8:43:02 PM UTC-8, Tony Kelman wrote:
>
> Yes. https://github.com/JuliaLang/julia/pull/13612
> It's in NEWS.md.
>
> Make your code version-dependent if it can't handle the new behavior.
>
>
> On Wednesday, November 11, 2015 at 8:19:32 PM UTC-8, Seth wrote:
>>
>> LightGraphs started failing 0.5 tests, while -release is fine:
>>
>> https://travis-ci.org/JuliaGraphs/LightGraphs.jl/jobs/90631116
>>
>> apparently foo[3,:] now returns [x,y,z] instead of [x y z].
>>
>> 1) could someone confirm this new behavior?
>> 2) what's the best way of handling this besides disabling tests on 0.5?
>>
>>

Re: [julia-users] Re: The growth of Julia userbase

2015-11-09 Thread Seth
If I'm reading the graphs correctly, the underlying data is a year old.

On Monday, November 9, 2015 at 3:10:41 PM UTC-8, Ken B wrote:
>
> Here's a nice comparison of languages used in github repo's and Julia is 
> #43 out of 50:
> http://githut.info/
>
> On Thursday, 5 November 2015 02:50:43 UTC+1, Iain Dunning wrote:
>>
>> Some more data, from pkg.julialang.org web analytics: 
>> In January there were 3.5k "users", which ramped up to 5k by March, and 
>> then held there roughly before spiking up to nearly 6k in October - maybe 
>> the 0.4 release?
>>
>> Theres also the number of packages themselves:
>> 300 packages ~ April 2014
>> 400 packages ~ October 2014
>> 500 packages ~ February 2015
>> 600 packages ~ June 2015
>> 700 packages ~ October 2014
>> It does look roughly superlinear to me.
>>
>>
>> On Wednesday, November 4, 2015 at 4:35:18 PM UTC-5, Milan Bouchet-Valat 
>> wrote:
>>>
>>> Le mercredi 04 novembre 2015 à 20:49 +, Ben Ward a écrit : 
>>> > Could anyone who can see it tell me the current figures? Or see to 
>>> > making this data public? It seems an odd thing to keep private - I 
>>> > would presume growth figures were something to show off. 
>>> Unfortunately, the graphs only cover about 10 days. There are a little 
>>> more than 1,000 unique visitor each day, and about 10,000 since 10/22. 
>>>
>>> Some time ago, I posted the evolution of the number of Debian users who 
>>> have enabled popcon and have Julia installed. The absolute value is not 
>>> representative of anything, but the growth is exponential : 
>>> https://qa.debian.org/popcon.php?package=julia 
>>>
>>> You can also look at the number of stars attributed by users to Julia 
>>> packages : 
>>> http://pkg.julialang.org/pulse 
>>>
>>>
>>> Regards 
>>>
>>>
>>> > On Wed, Nov 4, 2015 at 7:28 PM, Luthaf  wrote: 
>>> > > These graphs are not available for people who are not (Github) 
>>> > > collaborator for the julia repository. 
>>> > > 
>>> > > Tony Kelman a écrit : 
>>> > > > There are some interesting numbers at 
>>> > > > https://github.com/JuliaLang/julia/graphs/traffic 
>>> > > > 
>>> > > > Elliot Saba also did some scraping of the AWS download logs for 
>>> > > > binaries and shared the aggregate numbers (broken down by 
>>> > > > platform) privately with a few people, it may be worth sharing 
>>> > > > those publicly. 
>>> > > > 
>>> > > > 
>>> > > > On Wednesday, November 4, 2015 at 8:26:19 AM UTC-8, Ben Ward 
>>> > > > wrote: 
>>> > > > Hi all, 
>>> > > > 
>>> > > > I was wondering are there any metrics or stats available that 
>>> > > > show how the user-base of Julia has grown over the last few 
>>> > > > years, and what it's size is now? 
>>> > > > 
>>> > > > Many Thanks, 
>>> > > > Ben W. 
>>>
>>

Re: [julia-users] Do I have simd?

2015-11-06 Thread Seth
Hi Rob,

I built it (and openblas) myself (via git clone) since I'm testing out 
Cxx.jl. Xcode is Version 7.1 (7B91b).

Seth.


On Friday, November 6, 2015 at 3:54:04 PM UTC-8, Rob J Goedman wrote:
>
> Seth,
>
> You must have built  Julia 0.4.1-pre yourself. Did you use brew?
>
> It looks like you are on Yosemite and picked up a newer libLLVM. Which 
> Xcode are you using?
> In the Julia.rb formula there is a test ENV.compiler, could it be clang is 
> not being used? 
>
> Rob
>
> On Nov 6, 2015, at 3:01 PM, Seth <catc...@bromberger.com > 
> wrote:
>
> For what it's worth, I'm getting
>
> julia> timeit(1000,1000)
> GFlop= 2.3913033081289967
> GFlop (SIMD) = 2.2694726426420293
>
>
> julia> versioninfo()
> Julia Version 0.4.1-pre+22
> Commit 669222e* (2015-11-01 00:06 UTC)
> Platform Info:
>   System: Darwin (x86_64-apple-darwin14.5.0)
>   CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
>   WORD_SIZE: 64
>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
>   LAPACK: libopenblas64_
>   LIBM: libopenlibm
>   LLVM: libLLVM-svn
>
> so it doesn't look like I'm taking advantage of simd either. :(
>
> On Friday, November 6, 2015 at 11:43:41 AM UTC-8, Rob J Goedman wrote:
>>
>> Hi DNF,
>>
>> In below versioninfo’s only libopenblas appears different. You installed 
>> using brew. The first thing I would try is to execute the steps under 
>> Common Issues listed on https://github.com/staticfloat/homebrew-julia. A 
>> bit further down on that site there is also some additional openblas 
>> related info.
>>
>> Rob
>>
>> On Nov 6, 2015, at 10:35 AM, DNF <oyv...@gmail.com> wrote:
>>
>> Thanks for the feedback. It seems like this is not a problem for most.
>>
>> If anyone has even the faintest clue where I could start looking for a 
>> solution to this, I would be grateful. Perhaps there is some software I 
>> could run that would detect hardware problems, or maybe I am missing 
>> software dependencies of some kind? What could I even google for? All my 
>> searches just seem to bring up general info about SIMD, nothing like what 
>> I'm describing.
>>
>>
>>
>> On Friday, November 6, 2015 at 12:15:47 AM UTC+1, DNF wrote:
>>>
>>> I install using homebrew from here: 
>>> https://github.com/staticfloat/homebrew-julia
>>>
>>> I have limited understanding of the process, but believe there is some 
>>> compilation involved.
>>>
>>
>> Julia Version 0.4.0
>> Commit 0ff703b* (2015-10-08 06:20 UTC)
>> Platform Info:
>>   System: Darwin (x86_64-apple-darwin13.4.0)
>>   CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
>>   WORD_SIZE: 64
>>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
>>   LAPACK: libopenblas64_
>>   LIBM: libopenlibm
>>   LLVM: libLLVM-3.3
>>
>> Julia Version 0.4.0
>> Commit 0ff703b* (2015-10-08 06:20 UTC)
>> Platform Info:
>>   System: Darwin (x86_64-apple-darwin15.0.0)
>>   CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
>>   WORD_SIZE: 64
>>   BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Haswell)
>>   LAPACK: libopenblas
>>   LIBM: libopenlibm
>>   LLVM: libLLVM-3.3
>>
>>
>

[julia-users] Re: Julia Hands-on: Introductory Tutorial for Distributed Computing

2015-11-06 Thread Seth
André,

Would you mind posting a link to the notebooks? (Also, if there's any 
possibility of an English translation for your presentation, that'd be 
amazing.)

Thanks,

S.

On Friday, November 6, 2015 at 3:07:47 AM UTC-8, André Lage wrote:
>
> Hello,
>
> I'll be giving the tutorial "Introduction to Julia for Distributed 
> Computing" *today at 2pm (UCT-3)* at Brazilian (Northeast Region) 
> High-performance Computing School. 
>
> The tutorial will be in *Portuguese* and all the support material (IJulia 
> Notebooks) will be in *English*. You are welcome to participate through 
> Hangout:
>
>
> https://calendar.google.com/calendar/event?action=TEMPLATE=ZWNhcHJlNzJmNHRqcWFmOWkxc2M3cDNmZjQgcHJvZi5hbGFnZUBt=prof.alage%40gmail.com
>
> Regards,
>
>
> André Lage.
>


[julia-users] Re: "using Gadfly" (using a package) only if needed

2015-11-06 Thread Seth
The way we do it in LightGraphs is as follows:

try
using GraphMatrices
import GraphMatrices.CombinatorialAdjacency
nothing
catch
end


and then

if isdefined(:GraphMatrices)

   ... conditional code here
end

taking advantage of the fact that :Package is defined when "Package" is 
imported.



On Thursday, November 5, 2015 at 3:39:32 PM UTC-8, Ismael VC wrote:
>
> This also works:
>
> julia> function foo(x, y; make_plot::Bool=false)
># ...
>if make_plot
>@eval using Gadfly
>plot(x = x, y = y, Geom.line)
>end
># ...
>end
> foo (generic function with 1 method)
>
> julia> x = -π:0.1:π; foo(x, sin(x))
>
> julia> x = -π:0.1:π; foo(x, sin(x), make_plot = true)
>
> julia>
>
>
>
> El martes, 4 de agosto de 2015, 12:26:58 (UTC-5), Felipe Jiménez escribió:
>>
>> I've written a function, fwhm, that goes fast without plotting anything 
>> (which is the usual usage).
>> But if one optional argument is dodraw = true, it draws a figure to 
>> visualize its doings.
>> To draw the figure it uses the package Gadfly. But "using Gadfly" takes 
>> time to execute (the first time), and most of the sessions it is not needed 
>> because by default dodraw = false.
>> Since I cannot do "using Gadfly" inside a function, I cannot do something 
>> like this:
>>
>> function fwhm(xk, yk; dodraw::Bool=false)
>>   # ...
>>
>>   if dodraw
>> using Gadfly
>> plot(x=xk, y=yk)  # etc.
>>   end
>>
>>   # ...
>> end
>>
>> I don't want to add overhead time to every session I use the module where 
>> fwhm is, because most of the times dodraw = false and I just need a fast 
>> result without figures.
>> Any idea?
>> Thank you in advance.
>>
>

[julia-users] Properties of IntSet?

2015-11-05 Thread Seth
Could someone please clue me in on IntSet?

1) Does the fact that it's implemented as a bitstring mean that it's a 
dense vector that takes n bits to store values from 1:n?
2) Does this also mean that search and insertion is O(1)?
3) What are common use cases for IntSets?
4) Anything else that's interesting (good or bad) about IntSets?

Thanks.


[julia-users] Re: installing julia via cygwin

2015-11-01 Thread Seth
It sounds like you don't have '.' in your path. In cygwin, in your bin 
directory, type ./julia and see if that works.



On Sunday, November 1, 2015 at 3:31:42 PM UTC-8, digxx wrote:
>
> Thank you. After hours of compilation it finally finished without errors.
> Now I have the Julia.exe file in my bin folder but when trying to run it 
> from there by typing
> Julia.exe or just Julia or -c Julia.exe it tells me: command not found?
>
> Btw: how did u see it was m4? I mean u didnt really read these 1000 lines 
> of code?
> Vollständigen Inhalt anzeigen 
>


Re: [julia-users] Re: For loop = or in?

2015-10-29 Thread Seth
+1

On Thursday, October 29, 2015 at 5:56:46 AM UTC-7, Tom Breloff wrote:
>
> Lets close the topic.  Keep them both.
>
> On Thu, Oct 29, 2015 at 8:47 AM, feza  
> wrote:
>
>> My only problem with `=` vs `in`
>> is that even the base julia code is inconsistent! Looking at one file ( I 
>> can't remember which now)
>> it had both
>> i = 1:nr
>> and
>> i in 1:n
>> Again this was in the same file! Please tell me I am not being pedantic 
>> when I saw this and thought this must be fixed if even the base is being 
>> inconsistent.
>>
>> On Thursday, October 29, 2015 at 8:44:03 AM UTC-4, mschauer wrote:
>>>
>>> Do we want to give up on this topic? Then we should do so in an earnest 
>>> way and close the case with a clear message, ideally after 
>>> establishing if we want to add a style recommendation about the use of 
>>> ``=`` and ``in`` to 
>>> http://docs.julialang.org/en/release-0.4/manual/style-guide/. Currently 
>>> the manual states in the control-flow chapter "In general, the for loop 
>>> construct can iterate over any container. In these cases, the alternative 
>>> (but fully equivalent) keyword in is typically used instead of =, since 
>>> it makes the code read more clearly."
>>>
>>
>

Re: [julia-users] Re: How to get first number from Int64

2015-10-28 Thread Seth
One solution is to make sure you're using the current release version of 
Julia: parse(Int,string(lista[3])[1]) works as intended.


On Wednesday, October 28, 2015 at 3:06:26 AM UTC-7, paul analyst wrote:
>
> Is ok but  I can`t convert to int 
> julia> string(lista[3])[1] 
> '4' 
>
> julia> int(string(lista[3])[1]) 
> 52 
> Paul 
> W dniu 2015-10-27 o 09:35, Alireza Nejati pisze: 
> > Michele's solution is preferred here, but you can also do it like this: 
> > 
> > string(lista[3])[1] 
>
>

[julia-users] Re: Is there a tutorial on how to set up my own Julia cluster?

2015-10-28 Thread Seth

On Wednesday, October 28, 2015 at 10:20:00 AM UTC-7, Ismael VC wrote:
>
> How can I start 2 workers on each node, using Julia 0.3.11?
>
> [count*][user@]host[:port] [bind_addr[:port]]
>
> The way I understand:
>
> [count*][user@]host[:port] [bind_addr[:port]]
>
> Is that `count` is an integer while `*` means zero or more repetitions in 
> REGEX lang, 
> at first it seems it doesn't need a space character between the count and 
> the `user@host`,
> but I have tried several forms and it doesn't work:
>

I don't think your interpretation is correct. I think the "*" is syntax for 
"(this many) times". Did you try appending an asterisk after the number? 
That is, "2* user@host "?


[julia-users] ANN: new version of LightGraphs; discontinuation of Julia 0.3 support

2015-10-27 Thread Seth
Hi all,

Just a quick note to let you know that we've tagged a new minor version of 
LightGraphs - v0.4.0, available via 
https://github.com/JuliaGraphs/LightGraphs.jl. The reason this is 
significant is that it is the first version that (explicitly and 
intentionally) breaks compatibility with Julia 0.3. Going forward we will 
be ensuring compatibility with release and development branches of Julia.

The last version of LightGraphs that is guaranteed to work on Julia 0.3 is, 
coincidentally, LightGraphs v0.3.5. We will not be adding new functionality 
to LightGraphs v0.3.x, but if there's a critical bug identified we'll do 
our best to fix it.

Thanks,

Seth.



[julia-users] What does sizehint! do, exactly?

2015-10-21 Thread Seth
I know it's good to use sizehint! with an estimate of the sizes of 
(variable-length) containers such as vectors, but I have a couple of 
questions I'm hoping someone could answer:

1) what are the benefits of using sizehint!? (How does it work, and under 
what circumstances is it beneficial?)
2) what are the implications (positive/negative, if any) of overestimating 
the size of a container?

Thanks.


Re: [julia-users] What does sizehint! do, exactly?

2015-10-21 Thread Seth
Thanks, Jacob and Stefan. What happens if you overestimate? Is the 
allocated-but-not-used memory eventually freed, or is it tied up until the 
object gets removed?

On Wednesday, October 21, 2015 at 12:18:28 PM UTC-7, Stefan Karpinski wrote:
>
> If you expect that you're going to have to push a lot of values onto a 
> vector, you can avoid the cost of incremental reallocation by doing it once 
> up front.
>
> On Wednesday, October 21, 2015, Jacob Quinn <quinn@gmail.com 
> > wrote:
>
>> The way I came to understand was to just take a peak at the [source code](
>> https://github.com/JuliaLang/julia/blob/ae154d076a6ae75bfdb9a0a377a6a5f9b0e1096f/src/array.c#L670);
>>  
>> I find it pretty legible. The basic idea is that the underlying "storage" 
>> of a Julia Array{T,N} can actually be (and often is) different than the 
>> size(A) in Julia. sizehint! modifies that underlying storage without 
>> changing the size(A) in Julia.
>>
>> -Jacob
>>
>> On Wed, Oct 21, 2015 at 12:46 PM, Seth <c...@bromberger.com> wrote:
>>
>>> I know it's good to use sizehint! with an estimate of the sizes of 
>>> (variable-length) containers such as vectors, but I have a couple of 
>>> questions I'm hoping someone could answer:
>>>
>>> 1) what are the benefits of using sizehint!? (How does it work, and 
>>> under what circumstances is it beneficial?)
>>> 2) what are the implications (positive/negative, if any) of 
>>> overestimating the size of a container?
>>>
>>> Thanks.
>>>
>>
>>

Re: [julia-users] What does sizehint! do, exactly?

2015-10-21 Thread Seth
Is there a reason Julia doesn't use jl_array_del_end as a means to allow 
users to shrink the allocation for an array (either within sizehint! or as 
a separate function)?

On Wednesday, October 21, 2015 at 12:32:04 PM UTC-7, Jacob Quinn wrote:
>
> I believe it stays allocated until the object is removed. There's an old 
> issue about providing a way to "shrink" the underlying storage: 
> https://github.com/JuliaLang/julia/issues/2879
>
> -Jacob
>
> On Wed, Oct 21, 2015 at 1:26 PM, Seth <catc...@bromberger.com 
> > wrote:
>
>> Thanks, Jacob and Stefan. What happens if you overestimate? Is the 
>> allocated-but-not-used memory eventually freed, or is it tied up until the 
>> object gets removed?
>>
>> On Wednesday, October 21, 2015 at 12:18:28 PM UTC-7, Stefan Karpinski 
>> wrote:
>>>
>>> If you expect that you're going to have to push a lot of values onto a 
>>> vector, you can avoid the cost of incremental reallocation by doing it once 
>>> up front.
>>>
>>> On Wednesday, October 21, 2015, Jacob Quinn <quinn@gmail.com> wrote:
>>>
>>>> The way I came to understand was to just take a peak at the [source 
>>>> code](
>>>> https://github.com/JuliaLang/julia/blob/ae154d076a6ae75bfdb9a0a377a6a5f9b0e1096f/src/array.c#L670
>>>>  
>>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fjulia%2Fblob%2Fae154d076a6ae75bfdb9a0a377a6a5f9b0e1096f%2Fsrc%2Farray.c%23L670=D=1=AFQjCNHQ3e_imUCFF2rvxf4NzFs3DTZxJQ>);
>>>>  
>>>> I find it pretty legible. The basic idea is that the underlying "storage" 
>>>> of a Julia Array{T,N} can actually be (and often is) different than the 
>>>> size(A) in Julia. sizehint! modifies that underlying storage without 
>>>> changing the size(A) in Julia.
>>>>
>>>> -Jacob
>>>>
>>>> On Wed, Oct 21, 2015 at 12:46 PM, Seth <c...@bromberger.com> wrote:
>>>>
>>>>> I know it's good to use sizehint! with an estimate of the sizes of 
>>>>> (variable-length) containers such as vectors, but I have a couple of 
>>>>> questions I'm hoping someone could answer:
>>>>>
>>>>> 1) what are the benefits of using sizehint!? (How does it work, and 
>>>>> under what circumstances is it beneficial?)
>>>>> 2) what are the implications (positive/negative, if any) of 
>>>>> overestimating the size of a container?
>>>>>
>>>>> Thanks.
>>>>>
>>>>
>>>>
>

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

2015-10-19 Thread Seth
Yup, posting rights have been reestablished. Thanks! (Now to figure out why 
notifications aren't working.)

On Sunday, October 18, 2015 at 11:52:49 PM UTC-7, Jonathan Malmaud wrote:
>
> Turns out I forgot to revert the special settings I used during the 
> julia-users import; should be good now.
>
> On Sunday, October 18, 2015 at 1:28:08 PM UTC-5, Seth wrote:
>>
>> "You're replying too quickly. Please wait 277 hours before trying again."
>>
>> one comment every 11 days, or is this a bug? (I'd post it there, but)
>>
>>
>>
>> On Tuesday, October 13, 2015 at 5:50:21 PM UTC-7, Jonathan Malmaud wrote:
>>>
>>> Also just realized there's extensive support for oneboxing (smart inline 
>>> expansion of links)  http://julia.malmaud.com/t/testing-oneboxing/3205/1
>>>
>>> On Tuesday, October 13, 2015 at 8:27:37 PM UTC-4, Jonathan Malmaud wrote:
>>>>
>>>> I installed a mathjax plugin to Discourse. Try it out! 
>>>> http://julia.malmaud.com/t/testing-mathjax-plugin/3203/1
>>>>
>>>> On Tuesday, October 13, 2015 at 4:51:04 PM UTC-4, feza wrote:
>>>>>
>>>>> Wow this looks great. Much better than google groups which is rather 
>>>>> annoying in many respects. Looking forward to using this sometime in the 
>>>>> future. Do you think  mathjax support for latex equations would be useful 
>>>>> for a Julia forum?
>>>>>
>>>>> On Saturday, September 19, 2015 at 8:16:36 PM UTC-4, Jonathan Malmaud 
>>>>> wrote:
>>>>>>
>>>>>> Hi all,
>>>>>> There's been some chatter about maybe switching to a new, more modern 
>>>>>> forum platform for Julia that could potentially subsume julia-users, 
>>>>>> julia-dev, julia-stats, julia-gpu, and julia-jobs.   I created 
>>>>>> http://julia.malmaud.com for us to try one out and see if we like 
>>>>>> it. Please check it out and leave feedback. All the old posts from 
>>>>>> julia-users have already been imported to it.
>>>>>>
>>>>>> It is using Discourse <http://www.discourse.org/faq/>, the same 
>>>>>> forum software used for the forums of Rust 
>>>>>> <https://users.rust-lang.org>, BoingBoing, and some other big sites. 
>>>>>> Benefits over Google Groups include better support for topic tagging, 
>>>>>> community moderation features,  Markdown (and hence syntax highlighting) 
>>>>>> in 
>>>>>> messages, inline previews of linked-to Github issues, better mobile 
>>>>>> support, and more options for controlling when and what you get emailed. 
>>>>>> The 
>>>>>> Discourse website <http://www.discourse.org/faq/> does a better job 
>>>>>> of summarizing the advantages than I could.
>>>>>>
>>>>>> To get things started, MIke Innes suggested having a topic on what 
>>>>>> we plan on working on this coming wee 
>>>>>> <http://julia.malmaud.com/t/whats-everyone-working-on-this-week-9-19-2015-9-26/3155>k.
>>>>>>  
>>>>>> I think that's a great idea.
>>>>>>
>>>>>> Just to be clear, this isn't "official" in any sense - it's just to 
>>>>>> kickstart the discussion. 
>>>>>>
>>>>>> -Jon
>>>>>>
>>>>>>
>>>>>>

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

2015-10-18 Thread Seth
"You're replying too quickly. Please wait 277 hours before trying again."

one comment every 11 days, or is this a bug? (I'd post it there, but)



On Tuesday, October 13, 2015 at 5:50:21 PM UTC-7, Jonathan Malmaud wrote:
>
> Also just realized there's extensive support for oneboxing (smart inline 
> expansion of links)  http://julia.malmaud.com/t/testing-oneboxing/3205/1
>
> On Tuesday, October 13, 2015 at 8:27:37 PM UTC-4, Jonathan Malmaud wrote:
>>
>> I installed a mathjax plugin to Discourse. Try it out! 
>> http://julia.malmaud.com/t/testing-mathjax-plugin/3203/1
>>
>> On Tuesday, October 13, 2015 at 4:51:04 PM UTC-4, feza wrote:
>>>
>>> Wow this looks great. Much better than google groups which is rather 
>>> annoying in many respects. Looking forward to using this sometime in the 
>>> future. Do you think  mathjax support for latex equations would be useful 
>>> for a Julia forum?
>>>
>>> On Saturday, September 19, 2015 at 8:16:36 PM UTC-4, Jonathan Malmaud 
>>> wrote:

 Hi all,
 There's been some chatter about maybe switching to a new, more modern 
 forum platform for Julia that could potentially subsume julia-users, 
 julia-dev, julia-stats, julia-gpu, and julia-jobs.   I created 
 http://julia.malmaud.com for us to try one out and see if we like it. 
 Please check it out and leave feedback. All the old posts from julia-users 
 have already been imported to it.

 It is using Discourse , the same forum 
 software used for the forums of Rust , 
 BoingBoing, and some other big sites. Benefits over Google Groups include 
 better support for topic tagging, community moderation features,  Markdown 
 (and hence syntax highlighting) in messages, inline previews of linked-to 
 Github issues, better mobile support, and more options for controlling 
 when 
 and what you get emailed. The Discourse website 
  does a better job of summarizing the 
 advantages than I could.

 To get things started, MIke Innes suggested having a topic on what we 
 plan on working on this coming wee 
 k.
  
 I think that's a great idea.

 Just to be clear, this isn't "official" in any sense - it's just to 
 kickstart the discussion. 

 -Jon




[julia-users] Re: GraphPlot.jl

2015-10-18 Thread Seth
This is very cool! Just FYI for others: we have native LightGraphs 
integration for GraphPlot now - it joins GraphLayout and TikzGraphs as 
supported rendering packages.

On Friday, October 16, 2015 at 5:57:25 AM UTC-7, Jihui Han wrote:
>
> https://github.com/afternone/GraphPlot.jl
>
>
> 
>
>
> 
>
>
> 
>
>
> 
>
>
> 
>
>

[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread Seth
Surround it by parens:

julia> ($)(x::Int, y::Int) = x+y+5
...
julia> ($)(5,7)
17

On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>
> Hello everyone,
>
> I try to do $(x,y)=something, it says: syntax: invalid assignment location
> while +(x,y)=something is ok.
>
> Is there any speciality of $ operator?
>
> Best,
> Cheng
>


[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread Seth
Oops, hit post too quickly. Can also be called infix:

julia> 5 $ 7
17


On Wednesday, October 7, 2015 at 12:05:10 PM UTC-7, Seth wrote:
>
> Surround it by parens:
>
> julia> ($)(x::Int, y::Int) = x+y+5
> ...
> julia> ($)(5,7)
> 17
>
> On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>>
>> Hello everyone,
>>
>> I try to do $(x,y)=something, it says: syntax: invalid assignment 
>> location
>> while +(x,y)=something is ok.
>>
>> Is there any speciality of $ operator?
>>
>> Best,
>> Cheng
>>
>

Re: [julia-users] copy a local variable to all parallel workers

2015-10-05 Thread Seth
As a related aside, what's the significance of the "$" in front of 
"local_var"?

On Monday, October 5, 2015 at 4:04:13 PM UTC-7, Jameson wrote:
>
> despite your naming convention, it looks like "local_var" was a global. 
> try wrapping it in a let block:
>
> let local_var=123
> @everywhere var=$local_var
> end
>
> On Mon, Oct 5, 2015 at 6:22 PM Gabor  wrote:
>
>> I would like to copy a local variable to all parallel workers.
>>
>> I thought that the following code would do the job:
>> local_var=123
>> @everywhere var=local_var
>>
>>
>> But I get the following error:
>>
>> ERROR: On worker 2:
>> UndefVarError: local_var not defined
>>  in eval at sysimg.jl:14
>>  in anonymous at multi.jl:1350
>>  in anonymous at multi.jl:892
>>  in run_work_thunk at multi.jl:645
>>  [inlined code] from multi.jl:892
>>  in anonymous at task.jl:63
>>  in remotecall_fetch at multi.jl:731
>>
>> ...and 2 other exceptions.
>>
>>  in sync_end at task.jl:413
>>  in anonymous at multi.jl:1361
>>
>>
>> I ask for your help.
>> What is the simplest solution for this simple problem?
>>
>

[julia-users] Re: Juliabox down?

2015-09-23 Thread Seth
Working for me at Wed Sep 23 07:13:36 PDT 2015

On Wednesday, September 23, 2015 at 7:11:55 AM UTC-7, Lars Ruthotto wrote:
>
> Dear all, 
>
> I just noticed that Juliabox doesn't work right now. Is there an expected 
> maintenance going on and does anybody know when it will be back?
>
> Thanks,
> Lars
>
>

Re: [julia-users] Re: Juliabox down?

2015-09-23 Thread Seth
That's actually not a good test, since the inability to get to notebooks is 
different from the inability to get to the main site.

On Wednesday, September 23, 2015 at 8:28:18 AM UTC-7, Kristoffer Carlsson 
wrote:
>
> http://downforeveryoneorjustme.com/www.juliabox.org/
>
> On Wednesday, September 23, 2015 at 5:23:22 PM UTC+2, Michiaki Ariga wrote:
>>
>> Hi Lars,
>>
>> I can see only empty site, and Google Chrome Console shows following 
>> error message.
>>
>> https://dl.dropboxusercontent.com/u/171669/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202015-09-24%200.16.26.png
>>
>> When the same problem occurred, people who connect JuliaBox earlier could 
>> use it normally.
>> But people who connect later, they couldn't use it because of capacity. 
>> So I published my ipython notebook and told them to study at their home :/
>>
>> Thanks,
>> Michiaki
>>
>>
>> On Thu, Sep 24, 2015 at 12:07 AM Lars Ruthotto <lrut...@googlemail.com> 
>> wrote:
>>
>>> Hi Michiaki,
>>>
>>> I'm using juliabox only on my machine and there are a few (around 8) 
>>> students in the department here that need to finish some homework. I doubt 
>>> that that should challenge EC2. 
>>>
>>> for me the website https://juliabox.org/ is completely empty. No error 
>>> message at all. How does it look for you right now?
>>>
>>> Thx,
>>> Lars
>>>
>>>
>>> On Wednesday, September 23, 2015 at 11:02:27 AM UTC-4, Michiaki Ariga 
>>> wrote:
>>>
>>>> Hi, Lars
>>>> Are you using Juliabox with over 20 person or more?
>>>>
>>>> Once I held hands on at Julia Tokyo with 30+ participants,
>>>> JuliaBox suddenly returns 503.
>>>>
>>>> Now I access JuliaBox and I see same error.
>>>>
>>>> > Failed to load resource: the server responded with a status of 503 
>>>> (Service Unavailable: Back-end server is at capacity)
>>>>
>>>> I heard JuliaBox is running on Amazon EC2, so I think there are some 
>>>> limitation for number of concurrent users.
>>>>
>>>
>>>> On Wed, Sep 23, 2015 at 11:49 PM Lars Ruthotto <lrut...@googlemail.com> 
>>>> wrote:
>>>>
>>>>> Sorry! but now it does seems to be down again. Does anyone know why? 
>>>>>
>>>>>
>>>>> On Wednesday, September 23, 2015 at 10:15:14 AM UTC-4, Lars Ruthotto 
>>>>> wrote:
>>>>>>
>>>>>> Thanks, Seth. Now it works for me again too. Problem solved :) 
>>>>>>
>>>>>> On Wednesday, September 23, 2015 at 10:13:43 AM UTC-4, Seth wrote:
>>>>>>>
>>>>>>> Working for me at Wed Sep 23 07:13:36 PDT 2015
>>>>>>>
>>>>>>> On Wednesday, September 23, 2015 at 7:11:55 AM UTC-7, Lars Ruthotto 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Dear all, 
>>>>>>>>
>>>>>>>> I just noticed that Juliabox doesn't work right now. Is there an 
>>>>>>>> expected maintenance going on and does anybody know when it will be 
>>>>>>>> back?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Lars
>>>>>>>>
>>>>>>>>

[julia-users] Re: Pkg.publish() woes

2015-09-21 Thread Seth
I got it to work and wrote my process up 
here: https://github.com/JuliaLang/julia/issues/10766

On Monday, September 21, 2015 at 9:05:38 PM UTC-7, Amit Murthy wrote:
>
> julia> Pkg.publish()
>
> INFO: Validating METADATA
> INFO: Pushing LibCURL permanent tags: v0.1.6
> INFO: Submitting METADATA changes
> INFO: Forking JuliaLang/METADATA.jl to amitmurthy
> INFO: Recompiling stale cache file /home/amitm/.julia/lib/v0.4/JSON.ji for 
> module JSON.
> Enter host password for user 'amitmurthy':
> INFO: Two-factor authentication in use.  Enter auth code.  (You may have 
> to re-enter your password.)
> Authentication code: xx
> Enter host password for user 'amitmurthy':
> INFO: Retrieving existing GitHub token. (You may have to re-enter your 
> password twice more.)
> Enter host password for user 'amitmurthy':
> New authentication code: xx
> Enter host password for user 'amitmurthy':
> INFO: Could not authenticate with existing token. Deleting token and 
> trying again.
> Enter host password for user 'amitmurthy':
> INFO: Two-factor authentication in use.  Enter auth code.  (You may have 
> to re-enter your password.)
> Authentication code: xx
> Enter host password for user 'amitmurthy':
> INFO: Retrieving existing GitHub token. (You may have to re-enter your 
> password twice more.)
> Enter host password for user 'amitmurthy':
> New authentication code: xx
> Enter host password for user 'amitmurthy':
> ERROR: forking JuliaLang/METADATA.jl failed: Bad credentials
>  in error at ./error.jl:21
>  in fork at pkg/github.jl:144
>  in pull_request at pkg/entry.jl:327
>  in publish at pkg/entry.jl:394
>  in anonymous at pkg/dir.jl:31
>  in cd at file.jl:22
>  in cd at pkg/dir.jl:31
>  in publish at pkg.jl:61
>
>
>
> After entering credentials umpteen number of times, it just barfs out. Any 
> pointers?
>
>
>
>
>

[julia-users] Re: Boolean operations on arrays?

2015-09-21 Thread Seth
Note that the broadcasting works for sparse matrices only on recent builds.

On Monday, September 21, 2015 at 6:28:46 AM UTC-7, Matt Bauman wrote:
>
> The bitwise operations (&, |) broadcast over arrays and work just fine for 
> this.  Watch out for their precedence, though: you need to wrap them in 
> parentheses if you want to combine them with the result of comparisons `(A 
> == 1) | (A == 2)`.
>
> On Monday, September 21, 2015 at 8:41:29 AM UTC-4, Daniel Carrera wrote:
>>
>> It looks like I can get the right effect using component-wise 
>> multiplication:
>>
>> julia> ![true, true, false] .* [false, true, true]
>> 3-element Array{Bool,1}:
>>  false
>>  false
>>   true
>>
>>
>> Is this the correct solution or is this an ugly hack?
>>
>> Cheers,
>> Daniel.
>>
>>
>>
>> On 21 September 2015 at 14:35, Daniel Carrera  wrote:
>>
>>> Hello,
>>>
>>> I have two boolean arrays and I am trying to obtain the boolean array 
>>> resulting from a component-wise `AND`:
>>>
>>> julia> [true, true, false] .&& [false, true, true]
>>> ERROR: syntax: invalid identifier name "&&"
>>>
>>> julia> [true, true, false] .& [false, true, true]
>>> ERROR: type Array has no field &
>>>
>>>
>>> Can anyone figure out what I'm doing wrong? I was hoping that `.&` and 
>>> `.&&` would apply the operation on a per-component basis. Help?
>>>
>>> Cheers,
>>> Daniel.
>>>
>>
>>

Re: [julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-20 Thread Seth
As an interim step, you can also get text profiling information using 
Profile.print() if the graphics aren't working.

On Sunday, September 20, 2015 at 11:35:35 AM UTC-7, Daniel Carrera wrote:
>
> Hmm... ProfileView gives me an error:
>
> ERROR: panzoom not defined
>  in view at /home/daniel/.julia/v0.3/ProfileView/src/ProfileViewGtk.jl:32
>  in view at /home/daniel/.julia/v0.3/ProfileView/src/ProfileView.jl:51
>  in include at ./boot.jl:245
>  in include_from_node1 at ./loading.jl:128
> while loading /home/daniel/Projects/optimization/run_sim.jl, in expression 
> starting on line 55
>
> Do I need to update something?
>
> Cheers,
> Daniel.
>
> On 20 September 2015 at 20:28, Kristoffer Carlsson  > wrote:
>
>> https://github.com/timholy/ProfileView.jl is invaluable for performance 
>> tweaking.
>>
>> Are you on 0.4?
>>
>> On Sunday, September 20, 2015 at 8:26:08 PM UTC+2, Milan Bouchet-Valat 
>> wrote:
>>>
>>> Le dimanche 20 septembre 2015 à 20:22 +0200, Daniel Carrera a écrit : 
>>> > 
>>> > 
>>> > On 20 September 2015 at 19:43, Kristoffer Carlsson < 
>>> > kcarl...@gmail.com> wrote: 
>>> > > Did you run the code twice to not time the JIT compiler? 
>>> > > 
>>> > > For me, my version runs in 0.24 and Daniels in 0.34. 
>>> > > 
>>> > > Anyway, adding this to Daniels version: 
>>> > > https://gist.github.com/KristofferC/c19c0ccd867fe44700bd makes it 
>>> > > run in 0.13 seconds for me. 
>>> > > 
>>> > > 
>>> > 
>>> > Interesting. For me that change only makes a 10-20% improvement. On 
>>> > my laptop the program takes about 1.5s which is similar to Adam's. So 
>>> > I guess we are running on similar hardware and you are probably using 
>>> > a faster desktop. In any case, I added the change and updated the 
>>> > repository: 
>>> > 
>>> > https://github.com/dcarrera/sim 
>>> > 
>>> > Is there a good way to profile Julia code? So I have been profiling 
>>> > by inserting tic() and toc() lines everywhere. On my computer 
>>> > @profile seems to do the same thing as @time, so it's kind of useless 
>>> > if I want to find the hot spots in a program. 
>>> Sure : 
>>> http://julia.readthedocs.org/en/latest/manual/profile/ 
>>>
>>>
>>> Regards 
>>>
>>
>

Re: [julia-users] Re: IDE for Julia

2015-09-18 Thread Seth
Might be nice to be able to bind a single ^D (EOF) to workspace() so that 
we can reset easily.

On Friday, September 18, 2015 at 1:43:51 PM UTC-7, Scott Jones wrote:
>
> workspace() should give a new REPL environment in Julia.
>
> On Friday, September 18, 2015 at 4:34:41 PM UTC-4, Christof Stocker wrote:
>>
>> To me (and I realize that is biased) the things I like most about RStudio 
>> / Spider are
>>
>>- they feel very fast and responsive (then again I do love Intellij 
>>IDEA which can be very slow). 
>>- an integrated REPL that is at least as good as the standard one 
>>(i.e. auto-completion and such) 
>>- a way to send lines or pieces of code from the editor to the REPL 
>>that mimics copy and past (unlike the Jewel approach) 
>>- a decent code editor (syntax highlighting, smart indentation, and 
>>auto-completion) 
>>- and integrated help viewer that has nice and readable formating 
>>(90% of all my issues in R were very quickly resolved using the 
>> integrated 
>>help) 
>>- an object browser that shows what variables are in scope 
>>- docked plot windows are also nice to have (simply because then 
>>there is no trade-of between staying in foreground vs being in the way) 
>>
>> So to me a scientific IDE is more for convenient interactive research 
>> work. 
>>
>> Julia specific there is one thing I would really like to see, and that is 
>> a convenient and quick way to reset the REPL. My current mode of package 
>> development is weird in that I only really use the REPL for 
>> Pkg.test("MyPackage"). If i ever do end up using MyPackage to try some 
>> change, then I always seem to have to exit() and start Julia again to avoid 
>> issues. I code in Juno but I use in exclusively as a text editor and do 
>> nothing at all with the integrated Julia session.
>>
>> I just recently saw the Atom post with the GIFs for the first time, and I 
>> have to admit I am eager to try it out. It does look very nice and the 
>> authors should be very proud of this work. But since I am on the stable 
>> release of Julia I will wait for the stable 0.4 until I’ll make the hard 
>> transition to 0.4 (and thus won’t maintain 0.3 of my package anymore)
>>
>> On 2015-09-18 21:49, Daniel Carrera wrote:
>>
>> I have never used RStudio (or R, or IDEs). What features does it have 
>> that you would like to see in a Julia IDE? 
>>
>> Cheers,
>> Daniel.
>>
>> On 18 September 2015 at 10:08, Christof Stocker  
>> wrote:
>>
>>> I would be a huge fan of an RStudio like Julia IDE
>>>
>>> On 2015-09-18 10:05, Uwe Fechner wrote:
>>>
>>> I like QT a lot. There is more then one open source, QT based IDE out 
>>> there, e.g. QT Creator.
>>> QT has a GUI builder, that is much better then the GUI builders for GTK 
>>> (in my opinion).
>>> And you can use the java-script like QML language for building the user 
>>> interface, if you want to.
>>>
>>> Tutorial for PyQT:
>>> https://pythonspot.com/qml-and-pyqt-creating-a-gui-tutorial/
>>>
>>> As soon as the Julia/C++ integration is available by default (hopefully 
>>> in Julia 0.5), QT integration
>>> should be easy. For those, that want to play with Julia and QT now 
>>> already, have a look at:
>>>
>>> https://github.com/jverzani/PySide.jl
>>>
>>> (very experimental)
>>>
>>> Am Freitag, 18. September 2015 08:25:44 UTC+2 schrieb Daniel Carrera: 

 There are no Qt bindings for Julia yet. I also don't know what text 
 editing component is provided by Qt or what its features are. I began 
 working with Gtk in part because the Julia Gtk bindings seem to be the 
 most 
 developed. 

 Is there a reason you like Qt besides it being cross-platform?


 On 17 September 2015 at 23:50, SrAceves  wrote:

> What about Qt? RStudio is fantastic: Qt based, multi-platoform. 
> Everything anyone ever wanted of an IDE.
>
> El martes, 15 de septiembre de 2015, 8:13:04 (UTC-5), Daniel Carrera 
> escribió: 
>>
>>
>> Last night I started experimenting with Gtk, and started making a 
>> sketch of what a Julia IDE might look like. In the process I am writing 
>> down a list of things that are probably needed before a Julia IDE
>>
>>
>>  getting a list of things that probably need to exist before a Julia 
>> IDE can be completed. This is what I have so far:
>> 1) A Julia package for the GNOME Docking Library
>>
>> I think most people expect that an IDE has docking 
>>
>> Despite the name, it does not depend on any GNOME libraries, only 
>> Gtk. This is what Anjuta and MonoDevelop use to get docking windows. I 
>> think most people expect to be able to move things around in an IDE.
>>
>> https://developer.gnome.org/gdl/
>>
>>
>> 2)
>>
>>
>>
>> On 14 September 2015 at 17:10,  wrote:
>>
>>> 

Re: [julia-users] planned array changes

2015-09-18 Thread Seth
Are there similar plans to revamp sparse matrices? (I'd like to start 
getting informed as early as possible).

On Friday, September 18, 2015 at 2:14:53 AM UTC-7, Tim Holy wrote:
>
> On Thursday, September 17, 2015 11:55:56 PM harven wrote: 
> > I see that there are many changes scheduled for arrays in the next 
> release. 
> > Can someone summarize what is planned? 
>
> https://github.com/JuliaLang/julia/issues/13157 
>
> > I understand that [,] will become non concatenating. What will be the 
> type 
> > of expressions such as 
> > 
> >   ["julia", [1, 1.0]] 
> > 
> > Any,  union{AbstractString, Array{Float64}}? 
>
> Presumably an Arrary{Any,1}, though Array{Union{ASCIIString, 
> Array{Float64,1}}, 1} is also a possibility. 
>
> > 
> > Will the following code return an error or an array of some type? 
> > 
> >   push!(["one", [1, 5.1]], 1.5) 
>
> Depends on the above 
>
> > Is there some syntactic sugar planned for Any arrays, in the spirit of 
> {}? 
>
> Almost certainly not. Braces are in short supply, Any[] is easy. There is 
> little enthusiasm for burning diamonds to heat the house :-). 
>
> --Tim 
>
>

[julia-users] Re: how to submit a new function?

2015-09-18 Thread Seth
We'd also love to see it in LightGraphs if you want to make a PR there: 
https://github.com/JuliaGraphs/LightGraphs.jl.

On Friday, September 18, 2015 at 12:56:07 AM UTC-7, Michela Di Lullo wrote:
>
> Hello everyone,
>
> I wrote a new julia function that calculates (a) cycle basis of a 
> connected graph with m edges and n nodes, starting from its edge-node 
> incidence matrix.
>
> How could I share it with the julia community? 
>
> I think it could perfectly stay in the Graphs.jl package.
>
> Thank you in advance for any info,
>
> Michela 
>
>

[julia-users] Re: libcurl in Plotly

2015-09-13 Thread Seth
Hi,

I don't know whether this will make a difference, but your version of Julia 
is almost a year old. Current stable is up to 0.3.11 now with a 0.4 release 
just around the corner. Unless you can reproduce the problem in a more 
current version, it might be difficult to get help.

On Saturday, September 12, 2015 at 1:15:13 PM UTC-7, Paddy Healy wrote:
>
> Greetings,
>
> I'm new to julia and even newer to plotly.  I'm getting a libcurl error 
> when I call Plotly.plot():
>
> julia> response = Plotly.plot([trace1], ["filename" => "basic-line", 
> "fileopt" => "overwrite"])
> ERROR: error compiling post: error compiling put_post: error compiling 
> _put_post: error compiling setup_easy_handle: could not load module 
> libcurl: libcurl: cannot open shared object file: No such file or directory
>  in post at /home/healyp/.julia/v0.3/HTTPClient/src/HTTPC.jl:402
>  in plot at /home/healyp/.julia/v0.3/Plotly/src/Plotly.jl:52
>
> From searching around I have seen that this is reported as "fixed" earlier 
> but not for me.  My julia version is:
>
> julia> versioninfo()
> Julia Version 0.3.2
> Platform Info:
>   System: Linux (i586-linux-gnu)
>   CPU: Intel(R) Core(TM)2 CPU  6400  @ 2.13GHz
>   WORD_SIZE: 32
>   BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Core2)
>   LAPACK: libopenblas
>   LIBM: libopenlibm
>   LLVM: libLLVM-3.5
>
> I'd be very grateful if anybody has any leads for fixing this.  Apologies 
> if this is not the appropriate forum for this type of issue.
>
> Beannachtaí,
> Patrick healy
>


[julia-users] Julian way of tracking a "global" module setting

2015-09-13 Thread Seth
Hi all,

I'd like to track a setting throughout my module (that will cause the 
[transparent] dispatch of either single-threaded or parallel versions of 
many different functions). Is there a more Julian way of doing the 
following? This seems inelegant:

_parallel = false# start off without parallelism - user calls 
parallelize() to set/unset.

function parallelize(p::Bool=true)
global _parallel = p
end


function foo(a::Int) # there will be many functions like this
  if _parallel
 _foo_parallel(a)
  else
_foo_singlethread(a)
  end
end



[julia-users] Re: Julian way of tracking a "global" module setting

2015-09-13 Thread Seth
That's interesting - but what advantage does it have over a single global 
variable?

On Sunday, September 13, 2015 at 7:03:24 PM UTC-7, Tom Breloff wrote:
>
> Here's a pattern I like to use a lot, that should be what you're looking 
> for.  Wrap your value in a type, and have a global const of that type, with 
> a getter and setter method (you can skip the getter/setter, but it makes it 
> nicer).
>
>
> julia> type GlobalVarHolder
>mybool::Bool
>end
>
> julia> const GLOBALVAR = GlobalVarHolder(true)
> GlobalVarHolder(true)
>
> julia> gv() = GLOBALVAR.mybool
> gv (generic function with 1 method)
>
> julia> gv!(b::Bool) = (GLOBALVAR.mybool = b)
> gv! (generic function with 1 method)
>
> julia> f() = @show gv()
> f (generic function with 1 method)
>
> julia> f()
> gv() = true
> true
>
> julia> gv!(false)
> false
>
> julia> f()
> gv() = false
> false
>
>
>
>
> On Sunday, September 13, 2015 at 6:33:16 PM UTC-4, Seth wrote:
>>
>> Hi all,
>>
>> I'd like to track a setting throughout my module (that will cause the 
>> [transparent] dispatch of either single-threaded or parallel versions of 
>> many different functions). Is there a more Julian way of doing the 
>> following? This seems inelegant:
>>
>> _parallel = false# start off without parallelism - user calls 
>> parallelize() to set/unset.
>>
>> function parallelize(p::Bool=true)
>> global _parallel = p
>> end
>>
>>
>> function foo(a::Int) # there will be many functions like this
>>   if _parallel
>>  _foo_parallel(a)
>>   else
>> _foo_singlethread(a)
>>   end
>> end
>>
>>

[julia-users] Re: Julian way of tracking a "global" module setting

2015-09-13 Thread Seth
This looks interesting but I'd want to give the user the option of turning 
parallelization on and off at will. Not sure this will do it.

On Sunday, September 13, 2015 at 5:59:37 PM UTC-7, andrew cooke wrote:
>
>
> the following works..
>
> first, defining module AB:
>
> module A
> export foo
> foo() = println("a")
> end
>
> module B
> export foo
> foo() = println("b")
> end
>
> module AB
> if Main.USE_A
> using A
> else
> using B
> end
> export foo
> end
>
> that depends on Main.USE_A, where Main is the initial module when things 
> start up,  so then you can do:
>
> USE_A = true
>
> include("ab.jl")
>
> using AB
> foo()
>
> which prints "a".
>
> no idea if this is considered kosher...
>
> andrew
>
>
>
>
> On Sunday, 13 September 2015 21:45:57 UTC-3, andrew cooke wrote:
>>
>>
>> i don't know of a good way to do this.
>>
>> really, parameterised modules would be great.
>>
>> the simplest thing i can think of is if modules are first class and using 
>> etal can take an expression, but the following doesn't run:
>>
>> module A
>> foo() = println("a")
>> end
>>
>> module B
>> foo() = println("b")
>> end
>>
>> module AB
>> m(x) = x ? A : B
>> end
>>
>> using AB
>> using m(true)
>> foo()  # wouldn't it be nice if this printed "a"?
>>
>> andrew
>>
>>
>> On Sunday, 13 September 2015 19:33:16 UTC-3, Seth wrote:
>>>
>>> Hi all,
>>>
>>> I'd like to track a setting throughout my module (that will cause the 
>>> [transparent] dispatch of either single-threaded or parallel versions of 
>>> many different functions). Is there a more Julian way of doing the 
>>> following? This seems inelegant:
>>>
>>> _parallel = false# start off without parallelism - user calls 
>>> parallelize() to set/unset.
>>>
>>> function parallelize(p::Bool=true)
>>> global _parallel = p
>>> end
>>>
>>>
>>> function foo(a::Int) # there will be many functions like this
>>>   if _parallel
>>>  _foo_parallel(a)
>>>   else
>>> _foo_singlethread(a)
>>>   end
>>> end
>>>
>>>

Re: [julia-users] Convert an Array{Any,2} to an AbstractVector in Julia

2015-09-10 Thread Seth
would vec() also work for you? It's supposed to be pretty fast.

julia> a = rand(4,4)
4x4 Array{Float64,2}:
 0.794534   0.618345   0.941777  0.449794
 0.0615869  0.513610.141349  0.874955
 0.504186   0.0687788  0.64149   0.863215
 0.485404   0.193311   0.766789  0.0304138

julia> vec(a)
16-element Array{Float64,1}:
 0.794534
 0.0615869
 0.504186
 0.485404
 0.618345
 0.51361
 0.0687788
 0.193311
 0.941777
 0.141349
 0.64149
 0.766789
 0.449794
 0.874955
 0.863215
 0.0304138



On Thursday, September 10, 2015 at 5:38:35 AM UTC-7, Charles Santana wrote:
>
> Mauro, you are a genius! :) 
>
> Thanks a lot! It worked perfectly! 
>
> Best,
>
> Charles
>
> On 10 September 2015 at 14:30, Mauro  
> wrote:
>
>> >>> wc = wordcloud(x = corpus)
>> > ERROR: TypeError: typeassert: expected AbstractArray{T,1}, got 
>> Array{Any,2}
>> >
>> > Do you have any suggestion about how to convert an Array{Any,2} to an
>> > AbstractVector? Or how to read a text file to an AbstractVector 
>> variable?
>>
>> Have you tried to just flatten the array:
>>
>> wc = wordcloud(x = corpus[:])
>>
>
>
>
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


[julia-users] Re: a floating point test for other's environments

2015-09-09 Thread Seth
 The numerics tested work properly.
on

Julia Version 0.4.0-pre+7107
Commit 4e44a1c (2015-08-31 16:51 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


On Tuesday, September 8, 2015 at 10:04:34 PM UTC-7, Jeffrey Sarnoff wrote:
>
> I wrote this  FloatTest  to 
> find out if three things that should be true of numerics with Julia hold 
> for the wide variety of working environments in use.
> It is 40 lines -- just click 'raw', copy it and paste it into your REPL. 
>  It is done immediately.
> If a test fails, please note that with basic system infoas an 'issue' at 
> the github site.
>
>
>
>
>

[julia-users] Re: cleaning up objects in parallel processes?

2015-09-09 Thread Seth
julia> remotecall_fetch(2, whos, )
>From worker 2:ArrayViews137 KB Module : 
ArrayViews
>From worker 2:AutoHashEquals   5345 bytes  Module : 
AutoHashEquals
>From worker 2:  Base  20321 KB Module : Base
>From worker 2:Compat 25 KB Module : Compat
>From worker 2:  Core   2741 KB Module : Core
>From worker 2: FactCheck 34 KB Module : 
FactCheck
>From worker 2:  GZip250 KB Module : GZip
>From worker 2: GraphMatrices294 KB Module : 
GraphMatrices
>From worker 2:   LightGraphs296 KB Module : 
LightGraphs
>From worker 2:  LightXML 35 KB Module : LightXML
>From worker 2:  Main  25038 KB Module : Main
>From worker 2:  ParserCombinator206 KB Module : 
ParserCombinator
>From worker 2: StatsBase342 KB Module : 
StatsBase
>From worker 2: StatsFuns348 KB Module : 
StatsFuns

Nothing showing the 10.30GB Activity Monitor is showing for this instance.

On Wednesday, September 9, 2015 at 2:06:15 AM UTC-7, Nils Gudat wrote:
>
> I think whos() should help you, it'll give a list of all objects defined, 
> as well as their size in memory. If you run it as remotecall_fetch(2, whos, 
> ), where 2 is the number of the worker process (of course you could pick 
> any number returned by procs()), you should be able to figure out what's 
> taking up the space in memory.
>
> Let me know if this works!
>


[julia-users] Re: cleaning up objects in parallel processes?

2015-09-09 Thread Seth
Not sure if this is significant, but rmprocs(2) returns immediately with 
:ok and frees up the memory (again, according to Activity Monitor).

On Wednesday, September 9, 2015 at 2:06:24 PM UTC-7, Seth wrote:
>
> julia> remotecall_fetch(2, whos, )
> From worker 2:ArrayViews137 KB Module : 
> ArrayViews
> From worker 2:AutoHashEquals   5345 bytes  Module : 
> AutoHashEquals
> From worker 2:  Base  20321 KB Module : Base
> From worker 2:Compat 25 KB Module : Compat
> From worker 2:  Core   2741 KB Module : Core
> From worker 2: FactCheck 34 KB Module : 
> FactCheck
> From worker 2:  GZip250 KB Module : GZip
> From worker 2: GraphMatrices294 KB Module : 
> GraphMatrices
> From worker 2:   LightGraphs296 KB Module : 
> LightGraphs
> From worker 2:  LightXML 35 KB Module : 
> LightXML
> From worker 2:  Main  25038 KB Module : Main
> From worker 2:  ParserCombinator206 KB Module : 
> ParserCombinator
> From worker 2: StatsBase342 KB Module : 
> StatsBase
> From worker 2: StatsFuns348 KB Module : 
> StatsFuns
>
> Nothing showing the 10.30GB Activity Monitor is showing for this instance.
>
> On Wednesday, September 9, 2015 at 2:06:15 AM UTC-7, Nils Gudat wrote:
>>
>> I think whos() should help you, it'll give a list of all objects defined, 
>> as well as their size in memory. If you run it as remotecall_fetch(2, whos, 
>> ), where 2 is the number of the worker process (of course you could pick 
>> any number returned by procs()), you should be able to figure out what's 
>> taking up the space in memory.
>>
>> Let me know if this works!
>>
>

[julia-users] Could someone explain ordering on tuples?

2015-09-08 Thread Seth
I *think *it's based on the first element:

julia> (2,2) < (3,3)   # this makes intuitive sense
true

julia> (2,2) < (1,3)   # this makes intuitive sense
false

julia> (2,2) < (3,1)   # this is somewhat confusing
true

but it might be nice to have pairwise comparisons, so that, for example, 
one can tell whether a matrix can "fit" inside another matrix across all 
dimensions via comparison of each matrix's size (in this case, the last 
result would be false).

I'm sure there's a reason the ordering is the way it is, though - does 
anyone have any insight into what applications rely on this sort of 
behavior? I'm probably overlooking something very basic since I'm focused 
on a particular issue right now.

Thanks for any insight.


  1   2   3   4   >