Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Christoph Ortner
So here is a reason for keeping the linespace a vector: julia> t = linspace(0, 1, 1_000_000); julia> s = collect(t); julia> @time for n = 1:10; exp(t); end 0.209307 seconds (20 allocations: 76.295 MB, 3.42% gc time) julia> @time for n = 1:10; exp(s); end 0.054603 seconds (20 allocations:

[julia-users] Re: Questions about ranges

2015-10-22 Thread andy hayden
> I don't really understand why you can't just use the StepRange for everything You could. However, you can be more efficient by having special types (e.g. with UnitRange you don't need to check the steps). > `findin(::UnitRange, ::UnitRange)` returns another UnitRange This seems good. >

[julia-users] Re: Altering matrix inside function

2015-10-22 Thread Glen O
The reason why it's not working is that you're re-assigning x, rather than editing it. By running "x=x[]", you're creating a copy of x with the appropriate column removed, and then assigning x to point to the copy, rather than to the original array. If you wanted to edit an array's values,

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread ssarkarayushnetdev
This is where Object Oriented programming can be useful. If you define a Trait and then several abstract classes extending the trait at many levels, it will be possible to define complex polynomial ( p(x)=det(A-x*B) ) specific abstract classes at deeper levels for computing coefficients. OOP

[julia-users] entering latexish text

2015-10-22 Thread John Gibson
I can't figure out how to enter a few simple things with the latex-based unicode entry system. I can get a variable with name $x_t$ by entering x\_t-tab, but when I try to get an $x_b$ by entering x\_b-tab, it expands to x\_beta. And I can't figure out how to do multi-character subscripts,

Re: [julia-users] Re: How to feval?

2015-10-22 Thread J Luis
Speed is not critical here. I am porting this script http://gmt.soest.hawaii.edu/projects/gmt-matlab-octave-api/repository/changes/trunk/src/gmtest.m that will call the test scripts that live, as for example, here

[julia-users] Re: map() vs broadcast()

2015-10-22 Thread Glen O
I'm uncertain, but I think I may have figured out what's going on. The hint lies in the number of allocations - map! has 20 million allocations, while broadcast! has just 5. So I had a look at how the two functions are implemented. map! is implemented in perhaps the simplest way you can think

Re: [julia-users] DataFrame type specification

2015-10-22 Thread Milan Bouchet-Valat
Le jeudi 22 octobre 2015 à 09:59 -0700, Andrew Gibb a écrit : > I have a csv with some data. One of the columns is something I'd > always like to be read as a string, although sometimes the value will > just be numerals. Is there some way to specify that I want this > column to be an

Re: [julia-users] Re: Converting an expression to the function

2015-10-22 Thread Stefan Karpinski
Doing it with strings and parsing is not necessary (and will make all good Lispers very sad). You should splice and expression object into a function definition and eval instead: julia> ex = :(2x + y) :(2x + y) julia> @eval f(x,y) = $ex f (generic function with 1 method) julia> f(3,4) 10 On

Re: [julia-users] Parallel loop

2015-10-22 Thread Tim Holy
In short: use SharedArrays, if all processes are on the same host. The example in the documentation should make this pretty clear, but feel free to post again if it's not. As for # of procs, just try different choices up to the # of cores in your machine and see what happens. --Tim On

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread ssarkarayushnetdev
I found that you are one of the core developers of Julia language. Could you please explain how Julia compiler and executor can be called through APIs ? Are there any documentations for APIs. Is it possible to call Julia compiler and executor through programming interfaces from Scala compiler

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread vavasis
One way to build a code-base that everyone can share is to specify interfaces to datatypes as in methods in C++ base classes. Another way is for each individual to write his/her own code, and then read everyone else's code, and then meet at coffee shops and talk on the phone to get things to

Re: [julia-users] Re: How to feval?

2015-10-22 Thread Stefan Karpinski
This will not be fast. It's also wildly insecure if the string come from an external source. I'd strongly recommend figuring out a different approach to what you're doing, but it's hard to provide guidance without more context. On Thu, Oct 22, 2015 at 12:34 PM, Alex Ames

Re: [julia-users] Re: Why am I getting this error?

2015-10-22 Thread Diego Javier Zea
Yes, if a run it without using* -p *I get the 137 exit code. It was difficult to find... Do you have any hint about why is it using more RAM in every iteration (of pmap)? I add a gc() inside main() without results. 2015-10-22 14:31 GMT-03:00 Yichao Yu : > On Thu, Oct 22, 2015

Re: [julia-users] Re: Why am I getting this error?

2015-10-22 Thread Yichao Yu
On Thu, Oct 22, 2015 at 12:56 PM, Diego Javier Zea wrote: > Looks like it's using too much RAM and the system is killing it. I get a: > ProcessExitedException() The lack of a better error was the reason it took a long time to notice the OOM issue on travis. I'll be nice if we

[julia-users] Re: Converting an expression to the function

2015-10-22 Thread Alex Ames
There may be a slicker way to do this, but this should work: julia> fngen(expr,fn) = eval(parse(string(fn)* "=" * string(expr))) fngen (generic function with 1 method) julia> expr = :(x + y) :(x + y) julia> fngen(expr,:(f(x,y))) func (generic function with 1 method) julia> f(2,2) 4 On

Re: [julia-users] Re: dynamically describing inner constructors

2015-10-22 Thread Sloan Lindsey
Oooh, now I think I get it, we use multiple dispatch to make a simple wrapper that does the mapping. I went down the path yesterday of trying to make my complex setup function into a @generated function (because :new isn't available on the first pass at compile time) and ran into too many data

Re: [julia-users] Re: Converting an expression to the function

2015-10-22 Thread Alex Ames
Thanks Stefan, I knew there was a cleaner way. Looks like I need to study Exprs further. As a side-note, Janis, you may want to check out the ForwardDiff package, which allows for cheap, precise derivative evaluation. On Thursday,

Re: [julia-users] Re: Converting an expression to the function

2015-10-22 Thread Jānis Erdmanis
That looks neat :) On Thursday, October 22, 2015 at 8:44:15 PM UTC+3, Stefan Karpinski wrote: > > Doing it with strings and parsing is not necessary (and will make all good > Lispers very sad). You should splice and expression object into a function > definition and eval instead: > > julia> ex

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread Spencer Russell
Julia has a well-developed C API, so you can embed it inside other applications. Info on using it is here: http://docs.julialang.org/en/release-0.4/manual/embedding/ -s > On Oct 22, 2015, at 3:07 PM, ssarkarayushnet...@gmail.com

Re: [julia-users] Re: How to feval?

2015-10-22 Thread J Luis
Anyway, unfortunately none of the above solutions work for files. If the file is called "GMT_insert.jl", and is in the path, I get variations around (+ file extension - file extension) of ERROR: UndefVarError: GMT_insert not defined quinta-feira, 22 de Outubro de 2015 às 18:30:04 UTC+1, J

Re: [julia-users] Re: How to feval?

2015-10-22 Thread Stefan Karpinski
Julia doesn't identify functions and files the way Matlab does. You can just load the file by name. On Thu, Oct 22, 2015 at 2:56 PM, J Luis wrote: > Anyway, unfortunately none of the above solutions work for files. If the > file is called "GMT_insert.jl", and is in the path,

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Christoph Ortner
P.S.: It occurred to me that I should also have tried this: @time for n = 1:10; AppleAccelerate.exp(collect(s)); end 0.041035 seconds (60 allocations: 152.589 MB, 22.94% gc time)

[julia-users] Re: Altering matrix inside function

2015-10-22 Thread Thuener Silva
Thanks. I see that is not easy to change dense matrix. The real problema is more complex. I'm using JuMP matrixial operators, I think this only work with matrix but actually I didn't test with arrays. So I have a matrix with 3 dimensions and want to delete some items of this matrix. I tried a

[julia-users] Re: problem loading PyPlot in windows 10

2015-10-22 Thread Steven G. Johnson
On Thursday, October 22, 2015 at 5:02:58 PM UTC-4, Aditya Mahajan wrote: > > When I try "using PyPlot", I get the following error: > > error compiling jl_Function_call: error compiling convert: error compiling > pytype_query: error compiling pyint_query: could not load module >

Re: [julia-users] Re: Code runs 500 times slower under 0.4.0

2015-10-22 Thread Stefan Karpinski
You can try using @code_warntype to see if there are type instabilities. On Thu, Oct 22, 2015 at 5:50 PM, Gunnar Farnebäck wrote: > If you don't have deprecation warnings I would suspect some change in 0.4 > has introduced type instabilities. If you are using typed

Re: [julia-users] entering latexish text

2015-10-22 Thread John Gibson
That clears it up. Thank you. On Thursday, October 22, 2015 at 4:09:57 PM UTC-4, Yichao Yu wrote: > > On Thu, Oct 22, 2015 at 3:58 PM, John Gibson > wrote: > > I can't figure out how to enter a few simple things with the latex-based > > unicode entry system. > > > > I

[julia-users] Code runs 500 times slower under 0.4.0

2015-10-22 Thread Kris De Meyer
Are there any general style guidelines for moving code from 0.3.11 to 0.4.0? Running the unit and functionality tests for a module that I developed under 0.3.11 in 0.4, I experience a 500 times slowdown of blocks of code that I time with @time. Can't even imagine where I have to start

[julia-users] problem loading PyPlot in windows 10

2015-10-22 Thread Aditya Mahajan
When I try "using PyPlot", I get the following error: error compiling jl_Function_call: error compiling convert: error compiling pytype_query: error compiling pyint_query: could not load module C:\Users\mahajan1\.julia\v0.3\Conda\deps\usr\python27.dll: The specified module could not be found.

Re: [julia-users] entering latexish text

2015-10-22 Thread Yichao Yu
On Thu, Oct 22, 2015 at 3:58 PM, John Gibson wrote: > I can't figure out how to enter a few simple things with the latex-based > unicode entry system. > > I can get a variable with name $x_t$ by entering x\_t-tab, but when I try to > get an $x_b$ by entering x\_b-tab, it

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread ssarkarayushnetdev
It is very nice to exchange thoughts with mathematicians. If classes, instances, types, inheritance, polymorphism and many other things in OOP were derived from concepts in mathematics then there should be no contradiction between scientific computing and OOP. It is just matter of correct

[julia-users] Code runs 500 times slower under 0.4.0

2015-10-22 Thread Kristoffer Carlsson
Just run ProfileView and see what is taking time. Then post the relevant code here and it can likely be fixed.

Re: [julia-users] entering latexish text

2015-10-22 Thread John Gibson
That clears it up. Thank you. On Thursday, October 22, 2015 at 4:09:57 PM UTC-4, Yichao Yu wrote: > > On Thu, Oct 22, 2015 at 3:58 PM, John Gibson > wrote: > > I can't figure out how to enter a few simple things with the latex-based > > unicode entry system. > > > > I

Re: [julia-users] Code runs 500 times slower under 0.4.0

2015-10-22 Thread Stefan Karpinski
Are there any deprecation warnings? Deprecated calls are pretty slow. On Thu, Oct 22, 2015 at 1:29 PM, Kris De Meyer wrote: > Are there any general style guidelines for moving code from 0.3.11 to > 0.4.0? Running the unit and functionality tests for a module that I > developed

[julia-users] Re: Code runs 500 times slower under 0.4.0

2015-10-22 Thread Gunnar Farnebäck
If you don't have deprecation warnings I would suspect some change in 0.4 has introduced type instabilities. If you are using typed concatenations you could be hit by https://github.com/JuliaLang/julia/issues/13254. Den torsdag 22 oktober 2015 kl. 23:03:00 UTC+2 skrev Kris De Meyer: > > Are

[julia-users] sub vs. ArrayViews in 0.4?

2015-10-22 Thread John Brock
As of 0.4, when should I choose to use sub versus ArrayViews.jl? The ArrayViews.jl README mentions that sub uses a less efficient view representation, but just how much less efficient is it? Is there ever a good reason to use sub instead of ArrayViews, despite the less efficient

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread ssarkarayushnetdev
Thank you for the link. I guess an intermediate layer of C application should be written for specific function calls, parameter passing and result set accumulation or manipulation. From Scala compiler (and executor) this application can be accessed through Native Interfaces (JNA4Scala !!). I am

[julia-users] Re: problem loading PyPlot in windows 10

2015-10-22 Thread Tony Kelman
You can also try running dlopen on that file if it exists, and checking it using Dependency Walker to get more information.

Re: [julia-users] Re: parse of string followed by number turned into @doc ?

2015-10-22 Thread Tony Kelman
Are you on master? I believe we recently merged a PR by Michael Hatherly that got rid of documenting a string. Any remaining inconsistencies woukd probably be worth an issue.

[julia-users] Re: Module reloading/Autoreloading workflow in 0.4

2015-10-22 Thread Jonathan Malmaud
Ya, at this point it's the future of Juno. I still use the Jupyter notebook - I find they are useful for different things. Juno is great when I'm writing a library of reusable code or working on an existing library (such as the Julia standard library) and want to use the advanced text

Re: [julia-users] sub vs. ArrayViews in 0.4?

2015-10-22 Thread Tim Holy
"Efficient" has several meanings, but keep in mind that `git blame` shows that particular line was written on 2014-01-24, i.e., getting close to 2 years ago. `sub` in base has changed *radically* in the meantime. In general, with 0.4 I think there are few cases to use ArrayViews anymore.

[julia-users] Re: Altering matrix inside function

2015-10-22 Thread Kristoffer Carlsson
There is no way to delete columns here and there and in general end up with a valid dense matrix. If you want a view on some of the columns of the matrix you can use slice. julia> x = reshape(1:100, (10,10)); julia> slice(x, :, 1:3:10) 10x4

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Andras Niedermayer
You're making a good point about an Array being sometimes faster than a LinSpace. But a LinSpace gets you a factor N improvement in terms of memory efficiency for a size N range, an Array only gets you a constant factor improvement in speed (the factor 15 being admittedly relatively large in

Re: [julia-users] Re: using chol command in Julia v.0.4.0

2015-10-22 Thread Milan Bouchet-Valat
A PR was just merged to change the behavior of chol() for 0.5: https://github.com/JuliaLang/julia/pull/13680 Le dimanche 18 octobre 2015 à 10:14 -0700, Christoph Ortner a écrit : > I agree - that would be much nicer. > > Christoph

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Milan Bouchet-Valat
Le mercredi 21 octobre 2015 à 16:22 -0400, Spencer Russell a écrit : > On Wed, Oct 21, 2015, at 04:07 PM, Gabriel Gellner wrote: > > That doesn't feel like a reason that they can't be iterators, > > rather that they might be slow ;) a la python. My point is not > > about speed but the consistency

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Tim Holy
I may have said this earlier, but we just need https://github.com/JuliaLang/julia/issues/7799. --Tim On Thursday, October 22, 2015 12:11:05 AM Christoph Ortner wrote: > So here is a reason for keeping the linespace a vector: > > julia> t = linspace(0, 1, 1_000_000); > julia> s = collect(t); >

[julia-users] Re: dynamically describing inner constructors

2015-10-22 Thread Dan
Oops, random click on post. So: function MyType(..) : : fieldvalues = Any[val1,val2,val3] fnames = fieldnames(MyType) for i=1:length(fnames) setfield!(newobj,fname[i],fieldvalues[i]) end return newobj end On Thursday, October 22, 2015 at 5:52:34 PM UTC+3, Dan wrote: > > the inner

Re: [julia-users] Re: TinySegmenter benchmark

2015-10-22 Thread Michiaki ARIGA
Masahiro Nakagawa a.k.a. repeatedly told me my mistakes of the benchmark, I re-benchmarked. Node.jsPython2Python3JuliaRuby9.6293.0823.941.4619.44 - loop number of Python was 10 times smaller than other languages - repeatedly optimized Ruby implementation - changed loop size from 100 to 10

Re: [julia-users] Julia object Destructor or module Unload routine

2015-10-22 Thread Yichao Yu
On Thu, Oct 22, 2015 at 9:42 AM, wrote: > Hi Julia-Users > I know that Julia has a Garbage Collector that is being aware of unusable > memory pointers. [ref] I think some other languages e.g. Java also do it > automatically, and Java programmers rarely need to do it manually

Re: [julia-users] Julia object Destructor or module Unload routine

2015-10-22 Thread Stefan Karpinski
There's also atexit: atexit(f) Register a zero-argument function f() to be called at process exit. atexit() hooks are called in last in first out (LIFO) order and run before object finalizers. On Thu, Oct 22, 2015 at 10:48 AM, Yichao Yu wrote: > On Thu, Oct 22, 2015

[julia-users] good textbook for Julia software engineering?

2015-10-22 Thread Steven G. Johnson
Many of my students come from a non-CS background, and aren't familiar with basic ideas of software engineering like modularity, choosing datastructures, putting code into re-usable functions rather than writing long copy-and-paste scripts, etcetera. I'd like to point them at a good book,

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread Abe Schneider
I think this is generally in-line with what I've been advocating for, and not that different from Scala's mix-ins: trait Wheel { // ... } trait Frame { // ... } class Unicycle extends trait Wheel, Frame { // ... } is essentially doing the same thing (i.e. copying the member variables

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread Brendan Tracey
> I do like this approach to composition/delegation, but it requires > automatically adding a lot of methods to the delegator, i.e. Unicycle in > this example, from all of its components, which feels kind of nasty and > dangerous, especially since we allow dynamic addition of methods >

[julia-users] Julia object Destructor or module Unload routine

2015-10-22 Thread rafzalan
Hi Julia-Users I know that Julia has a Garbage Collector that is being aware of unusable memory pointers. [ref ] I think some other languages e.g. Java also do it automatically, and Java programmers rarely need to do

[julia-users] Re: dynamically describing inner constructors

2015-10-22 Thread Dan
the inner constructor, can separate allocation and initialization of a new object. specifically, first do a: newobj = new() then you can set the fields. with a loop this can look like: fieldvalues = Any[val1,val2,val3] On Thursday, October 22, 2015 at 4:14:51 PM UTC+3, Sloan Lindsey

[julia-users] Re: Help on optimization problem

2015-10-22 Thread Miles Lubin
On Tuesday, October 20, 2015 at 11:12:44 PM UTC-4, Spencer Russell wrote: > > > 1. What solver is appropriate for this sort of problem? (or should I just > go with a spring-force algorithm like in GraphLayout.jl?) > That depends very directly on the precise formulation for the objective

[julia-users] Re: Help on optimization problem

2015-10-22 Thread vavasis
The problem of recovering (x,y,z) coordinates given partial pairwise distance information is a famous problem in the optimization community and has attracted the attention of many top people. It is sometimes called the 'Euclidean distance matrix completion' problem by mathematicians and the

[julia-users] Array of type generates error in parallel computing

2015-10-22 Thread Simone Mazzola
Hi all, I'm really new to Julia language, especially in parallel computing. My general code structure is something like this: using MyModule # in this module the type "MyType" is defined MyTypeArray=Array(MyType,z) for i=1:z println(MyTypeArray[i]) end *Using the standard loop

[julia-users] Julia talk video

2015-10-22 Thread Jason Grout
Hi everyone, I just posted up a video of Spencer Lyon's PyData NYC meetup talk on Julia: https://youtu.be/mHr-cEGqiuw?t=56m14s I thought it was a great talk. Spencer also talked about QuantEcon (though with a slant towards the python half of the project, since it was a pydata meetup). See

[julia-users] dynamically describing inner constructors

2015-10-22 Thread Sloan Lindsey
I am trying to make some nice inner constructors for an immutable that acts as a nice container. I've run into a bit of a problem with using the new constructor since I wish to have dynamic construction to avoid having to hardcode the hierarchy. #apply new troubles immutable Vec3

[julia-users] How to feval?

2015-10-22 Thread J Luis
Hi, I need to convert this piece of Matlab code [ps, orig_path] = feval(str2func(test), out_path); where 'test' is the name of a function and 'out_path' it unique input argument. I have read and re-read the eval function and for once it's clear for me how it works (sorry, I find

[julia-users] Re: ANN: ParallelAccelerator.jl v0.1 released

2015-10-22 Thread Raj Barik
After Julia's multithreading is ready for release, we will have a native path to interface with it. This will hopefully enable multiple shm execution paths for users to experiment with. On Wednesday, October 21, 2015 at 9:12:50 AM UTC-5, Steven Sagaert wrote: > > Great news! > Apart from the

Re: [julia-users] Any plans for free tutorials on Coursera,edX or Udacity?

2015-10-22 Thread Isaiah Norton
There have been occasional whispers about a MOOC with Julia, but they have not materialized so far (to my knowledge). I think at this point, there is a need to strike a balance between promotion and maturing the foundations, and perhaps it is wise to err toward the latter. If you are looking for

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Tom Breloff
On Thursday, October 22, 2015 at 9:44:28 AM UTC-4, Gabriel Gellner wrote: > > A related discussion is about a special Ones type representing an array >> of 1, which would allow efficient generic implementations of >> (non-)weighted statistical functions: >>

[julia-users] Re: How to feval?

2015-10-22 Thread J Luis
Thanks, at least it's a place to start. quinta-feira, 22 de Outubro de 2015 às 14:10:44 UTC+1, Kristoffer Carlsson escreveu: > > Maybe > > julia> eval(Symbol("sin"))(5.0) > -0.9589242746631385 > > Not sure if this is the best solution. > > > On Thursday, October 22, 2015 at 2:57:31 PM UTC+2, J

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Gabriel Gellner
> > A related discussion is about a special Ones type representing an array > of 1, which would allow efficient generic implementations of > (non-)weighted statistical functions: > https://github.com/JuliaStats/StatsBase.jl/issues/135 > > But regarding zeros(), there might not be any

Re: [julia-users] Re: map() vs. comprehensions

2015-10-22 Thread Ján Dolinský
Hi, This is an interesting syntax indeed. Thanks! Jan Dňa streda, 21. októbra 2015 18:04:47 UTC+2 Ben Arthur napísal(-a): > > element-wise multiplication of string vectors works too, but only if one > vector is of length 1: > > julia> @time ["["] .* ["as", "sdf", "qwer"] .* ["]"] > 0.33

Re: [julia-users] Re: dynamically describing inner constructors

2015-10-22 Thread Yichao Yu
On Thu, Oct 22, 2015 at 10:55 AM, Dan wrote: > Oops, random click on post. > So: > function MyType(..) > : > : > fieldvalues = Any[val1,val2,val3] > fnames = fieldnames(MyType) > for i=1:length(fnames) > setfield!(newobj,fname[i],fieldvalues[i]) > end > return

[julia-users] Parallel loop

2015-10-22 Thread amiksvi
Hi all, I swear I tried to look into the documentation or online but I can't figure out what I want to do. I have a lot of sequential code executed and at some point I want to parallelize the following loop: mat_a = zeros(n, n) for i = 1:n mat_a[i,i:n] = mean(mat_b[:,i] .* mat_b[:,i:n], 1)

Re: [julia-users] Re: A question of Style: Iterators into regular Arrays

2015-10-22 Thread Christoph Ortner
On Thursday, 22 October 2015 10:24:50 UTC+1, Andras Niedermayer wrote: > > You're making a good point about an Array being sometimes faster than a > LinSpace. But a LinSpace gets you a factor N improvement in terms of memory > efficiency for a size N range, an Array only gets you a constant

Re: [julia-users] Julia object Destructor or module Unload routine

2015-10-22 Thread rafzalan
Interesting, although, I don't know how to do such hooking ... On Thursday, October 22, 2015 at 6:21:05 PM UTC+3:30, Stefan Karpinski wrote: > > There's also atexit: > > atexit(f) > > Register a zero-argument function f() to be called at process exit. > atexit() hooks > are called in

[julia-users] Re: How to feval?

2015-10-22 Thread Alex Ames
You could define your own feval: feval(fn_str, args...) = eval(parse(fn_str))(args...) This has the advantage of accepting anonymous functions and multiple arguments if necessary: julia> feval("sin",5.0) -0.9589242746631385 julia> fn_str = "a_plus_b(a,b) = a + b" "a_plus_b(a,b) = a + b"

[julia-users] map() vs broadcast()

2015-10-22 Thread Ján Dolinský
Hi, I am exploring Julia's map() and broadcast() functions. I did a simple implementation of MAPE (mean absolute percentage error) using broadcast() and map(). Interestingly, the difference in performance was huge. A = rand(5_000_000) F = rand(5_000_000) _f(a,f) = (a - f) / a function

Re: [julia-users] Re: parse of string followed by number turned into @doc ?

2015-10-22 Thread Michael Francis
Coming back to this -- this appears to cause inconsistencies - It is not so much that that you can doc a float, but more that the behavior is surprising. julia> "hello" 2.3 hello julia> "hello" (x)->x+1 WARNING: deprecated syntax "hello (". Use "hello(" instead. ERROR: syntax:

Re: [julia-users] good textbook for Julia software engineering?

2015-10-22 Thread Steven G. Johnson
On Thursday, October 22, 2015 at 11:31:49 AM UTC-4, Stefan Karpinski wrote: > > The Pragmatic Programmer > > > is pretty good. It takes view of someone doing for-pay software > engineering, which isn't entirely

Re: [julia-users] Julia and Object-Oriented Programming

2015-10-22 Thread ggggg
What is the other option here? It seemed like with the OO/Julia way you are complaining about you at least have working (but slow) code handling your new polynomial type. In a case where your new type doesn't work with "obtainCoefficient", it won't work with any of your other code either. You

[julia-users] Converting an expression to the function

2015-10-22 Thread Jānis Erdmanis
I am implementing boundary element method with curved elements. As it is daunting task to evaluate derivatives I thought about using `Calculus` symbolic differentiation which as output gives expression. Now I need to convert this expression to a function, but how can I do it? As an example

[julia-users] Why am I getting this error?

2015-10-22 Thread Diego Javier Zea
I am running this script on a large list (92003 lines) of files. At some point I'm getting this error (unrelated to the files since works fine for a while if I continue from the last file): ERROR (unhandled task failure):

[julia-users] Re: Questions about ranges

2015-10-22 Thread Rory Finnegan
Wow, you're right, that is a more serious bug. On Thursday, 22 October 2015 02:29:13 UTC-5, andy hayden wrote: > > > I don't really understand why you can't just use the StepRange for > everything > > You could. However, you can be more efficient by having special types > (e.g. with UnitRange

[julia-users] Re: good textbook for Julia software engineering?

2015-10-22 Thread Cedric St-Jean
On Thursday, October 22, 2015 at 11:33:39 AM UTC-4, Sisyphuss wrote: > > I have some idea in the previous post. But it seems that they are just > ignored... > Not to derail this thread, but FWIW, I liked your OOP equivalences, and it made me consider writing shorter, focused modules. > > >

[julia-users] Re: Why am I getting this error?

2015-10-22 Thread Diego Javier Zea
Looks like it's using too much RAM and the system is killing it. I get a: ProcessExitedException() El jueves, 22 de octubre de 2015, 13:09:21 (UTC-3), Diego Javier Zea escribió: > > I am running this script > > on a large

[julia-users] DataFrame type specification

2015-10-22 Thread Andrew Gibb
I have a csv with some data. One of the columns is something I'd always like to be read as a string, although sometimes the value will just be numerals. Is there some way to specify that I want this column to be an AbstractString in readtable? Or perhaps some way to convert that column from