function nestedLoop(depth::Integer, n::Integer, symbArr, len::Integer, k::Integer, num_arr) for i = k:len num_arr[depth-n+1] = symbArr[i] n == 1 && println(num_arr) (n > 1) && nestedLoop(depth, n-1, symbArr, len, i, num_arr) end end function combwithrep(symbArr, n::Integer) len = length(symbArr) num_arr = Array(eltype(symbArr),n) nestedLoop(n, n, symbArr, len, 1, num_arr) end @time combwithrep(["+","-","*","/"], 3)...

I am faced with the following problem: I have a function called TrainModel that runs for a very long time on a single thread. When it finishes computing, it returns a function as an output argument, let's call it f. When I enquire the type of this f, Julia returns:...

using Winston x=[0:0.1:2pi]; y=sin(x) plot(x,y) When I change the range of x, I got the same result as the old range....

I am new to Julia and I am not sure why the last line evaluates to false: type Point{T} x::T y::T end D = [Point(1.,2.) => 42] haskey(D, Point(1., 2.)) #False! Clearly the key exists so what's going on here!? Edit. If I don't use a class Point, it works...

My question is quite similar to this one, but with a difference. I want to create a macro (or whatever) that behaves this way: julia> @my-macro x + 2 :(x + 2) (note that x + 2 is not enclosed in quotes). Is there something like that in Julia? And...

Is there a way to concatenate ArrayViews in Julia, that doesn't copy the underlying data? (I'd also be glad to use a SubArray, if that solves the problem.) In the code below, for example, I want a single ArrayView that references the data in both y1 and y2. julia> x...

I'm having a trouble in building the POE ensemble in julia. I am following this paper and part of this other paper. In julia, I calculate: X = randn(dim, dim) Q, R = qr(X) Q = Q*diagm(sign(diag(R))) ij = (irealiz-1)*dim phases_ens[1+ij:ij+dim] = angle(eigvals(Q)) where dim is the matrix dimension and...

I am pretty new to Julia and this is driving me nuts: type MyType{T<:Number} x::T y::T end Float64 <: Number # this is true MyType{Float64} <: MyType{Number} #this is for some reason false I would of course expect that, if I created two concrete types derived from the same parametric...

In Julia, is there a way to write a macro that branches based on the (compile-time) type of its arguments, at least for arguments whose types can be inferred at compile time? Like, in the example below, I made up a function named code_type that returns the compile-time type of...

On my machine, with the development version of Julia, the command import Distributions takes 6.6 seconds. Is there a way to make this faster? Is static precompilation going to be part of Julia 0.4? _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_) |...

One way to comfortably use an IDE in an interactive language is to interact via the IDE in a command line environment. I am wondering if that is a possibility in Juno. In other words, is there a command line environment as in Matlab, to call functions, give initial values,...

I'd like to list an "unofficial" Julia package in my package's REQUIRE file. (That is, the package I'd like to list can only be installed with Pkg.clone, not Pkg.add.) How can I configure my package so that this unofficial package gets installed automatically, when someone clones my package?

I'm writing a neural network in Julia that tests random topologies. I've left all indices in an array of nodes that are not occupied by a node (but which may be under a future topology) undefined as it saves memory. When a node in an old topology is no longer...

I'm struggling to understand parametric type creation in julia. I know that I can create a type with the following: type EconData values dates::Array{Date} colnames::Array{ASCIIString} function EconData(values, dates, colnames) if size(values, 1) != size(dates, 1) error("Date/data dimension mismatch.") end if size(values, 2) != size(colnames, 2) error("Name/data dimension mismatch.") end new(values,...

I have a large vector of vectors of strings: There are around 50,000 vectors of strings, each of which contains 2-15 strings of length 1-20 characters. MyScoringOperation is a function which operates on a vector of strings (the datum) and returns an array of 10100 scores (as Float64s). It takes...

I build a new vector type: type MyType x::Vector{Float64} end I want to extend lots of the standard methods, eg addition, subtraction, element-wise comparison, etc to my new type. Do I need to define a method definition for each of them, eg: +(a::MyType, b::MyType) = a.x + b.x -(a::MyType, b::MyType)...

function prealloc() situation=zeros(Int64,3^5,5); i=1; for north=0:2, south=0:2, east=0:2, west=0:2, current=0:2 situation[i,:]=[north, south, east, west, current] i+=1 end situation end prealloc() How could I eliminate more than one row from array in Julia?...

I am using Julia v0.3.5, which comes with WinPython 3.4.2.5 build 4. I am new to Julia. I am testing how fast Julia is compared to using SciPy's BLAS wrapper for ddot(), which has the following arguments: x,y,n,offx,incx,offy,incy. Julia's OpenBLAS library does not have the offset arguments, so I am...

I am trying to write a function that calls several functions that accept named parameters. I'd like the A function to be able to named parameters splatted together in args and pass along the matching arguments to the functions it calls. function A(x, y; args...) B(x; args...) C(y; args...) end...

I would like to initialize a 3d tensor (multi-dimensional array) with the values of the "diagonal Gaussian" exp(-32*(u^2 + 16*(v^2 + w^2))) where u = 1/sqrt(3)*(x+y+z) and v,w are any two coordinates orthogonal to u, discretised on a uniform mesh on [-1,1]^3. The following code achieves this: function gaussian3d(n) q...

Take a look at the following simple code example: Pkg.add("Graphs") using Graphs gd = simple_graph(20, is_directed=true) # directed graph with 20 nodes nodeTo = 2 for nodeFrom in vertices(gd) # add some edges... if(nodeTo != 20) add_edge!(gd, nodeFrom, nodeTo) nodeTo +=1 end end for i in edges(gd) # Print source...

Why am I getting the error message below? (I'm fairly new to metaprogramming in Julia.) Thanks. julia> d = :e :e julia> macroexpand(:(b.$d)) :(b.e) julia> macroexpand(:($d.c)) :(e.c) julia> macroexpand(:(b.$d.c)) ERROR: unsupported or misplaced expression $ julia> macroexpand(:(b.$(d).c)) ERROR: unsupported or misplaced expression $ ...

When generating a not explicitly generated version of a function, @ngenerate runs eval(quote local _F_ $localfunc # Definition of _F_ for the requested value of N _F_ end) Since eval runs in the scope of the current module, not the function, I wonder what is the effect of local in...

I'm trying to figure out how to have a quote block, when evaluated, return a symbol. See the example below. function func(symbol::Symbol) quote z = $symbol symbol end end a = 1 eval(func(:a)) #this returns :symbol. I would like it to return :a z ...

I recently go through some source codes of Julia and find some functions seem mysterious to me. There is some function defined in Julia source code where they have no arguments but do have type annotations. For example: line 20 in abstractarray.jl I try the ndims function a bit, it...

How does one define a type that, like Array, has a concrete/instantiated type parameter? My initial instinct was that it would be like this: immutable Foo{N::Integer} data::Array{Float64, N} end However, this generates the following error: ERROR: syntax: malformed type parameter list The following code is acceptable: immutable Foo{N} data::Array{Float64, N}...

I'm getting stuck on some basics of scope in Julia expressions. Can someone help tell me what is going wrong inside the for loop below? Inside the lopp the first expression works and the second does not, though both work with variables from the global scope. x = 1 glob_obj...

Consider the following code: File C.jl module C export printLength printLength = function(arr) println(lentgh(arr)) end end #module File Main.jl using C main = function() arr = Array(Int64, 4) printLength(arr) end main() Let's try to execute it. $ julia Main.jl ERROR: lentgh not defined in include at /usr/bin/../lib64/julia/sys.so in process_options at...

I'm trying to plot a line segment between the points [1,1] and [0,0] in the surface Z function x^2 + y^2, i've already plotted f with: using PyPlot using Distributions function f(x) return (x[1]^2 + x[2]^2) #return sin(x[1]) + cos(x[2]) end n = 100 x = linspace(-1, 1, n) y...

I would like to create a nested tuple type, that can hold itself, or the particular type it contains. So I thought: typealias NestedTuple{T} Tuple{Union(T,NestedTuple{T}),Union(T,NestedTuple{T})} However this comes up with an error LoadError: UndefVarError: NestedTuple not defined How is this kind of typealias normally done? (I am in julia 0.4)...

I like to develop scripts by running them piecemeal in a Jupyter (nee iJulia) notebook. However, sometimes I need to test things on a remote system and need to make a copy of just the code as a .jl file. Has anyone already written a one-liner or short script that...

Let's say I have buffer=Int[1,2,3,2,3] and token=[2,3]. Is there any preferred way of searching the occurrence of token in buffer to find [2,4] as the answer. Or, perhaps, is there any split equivalent function for the integer arrays in julia? (I know how I can perform this operation using 2...

I tried the following codes but the performance is extremely different among codes. I heard that codes at the top level are not suited for numerical computation, but the performance also seems to depend on whether top-level variables (here, N) appear in the range of for-loops. Is it always better...

I'm looking for a message handler for Julia, because I want to integrate it in a bigger project with other services. The other services are using RabbitMQ, but I have not been able to find any RabbitMQ or ActiveMQ drivers for Julia. Is anyone aware of a message handler driver...

I am working on some projects using Julia v0.3. However, I'd like to test my code in both v0.3 and v0.4 (since some of the people that are going to be using it are already using v0.4). I'm running Ubuntu 14.04 and have installed Julia using apt-get. I know v0.4...

With x = Any[[1,2],[2,3],[3,4],[4,5]], I tried the following line with Julia0.4.0 x[ x .== [3,4] ] but it resulted in an error ERROR: DimensionMismatch("arrays could not be broadcast to a common size") I expected it to give something like Any[ [3,4] ] because x[3] == [3,4] # => true is...

I would like to call File I/O functions (i.e. CreateFile, WriteFile etc) from julia using ccall. Do I have to indicate a library name as a parameter in ccall to call any function from win32 api? If yes, how can I determine the name of the corresponding dll?...

I just read a post from Quora: http://www.quora.com/Is-Julia-ready-for-production-use At the bottom, there's an answer said: 2 ^ 3 ^ 4 = 0 I tried it myself: julia> 2 ^ 3 ^ 4 0 Personally I don't consider this a bug in the language. We can add parenthesis for clarity, both...

I'm gonna explain my problem on a minimal example. Let's say I have three files: A.jl module A export Atype, f type Atype end f = function(x::Atype) println("f called with A") end end #module B.jl module B export Btype, f type Btype end f = function(x::Btype) println("f called with B")...

I recently started learning Julia by coding a simple implementation of Self Organizing Maps. I want the size and dimensions of the map to be specified by the user, which means I can't really use for loops to work on the map arrays because I don't know in advance how...

I am trying to access some complex numbers I wrote to a csv file in julia but I'm having trouble getting it to recognize them. To understand what is happening, consider the following a = [1+2.3im, 2.3+0im] writecsv("test.csv",a) b = readcsv("test.csv") Now, if I interrogate the types julia> typeof(b) Array{Any,2}...

I apologize if this has been answered before, I couldn't find it so far. So how can Float64 be converted into ASCIIString? My attempts julia> parse(5.0) ERROR: `parse` has no method matching parse(::Float64) julia> convert(ASCIIString, 5.0) ERROR: `convert` has no method matching convert(::Type{ASCIIString}, ::Float64) in convert at base.jl:13 julia> parsefloat(5.0)...

The docs for Julia indicate that a valid short-cut to writing out an if statement is the syntax <cond> && <statement> I've used this a lot for error messages, e.g. length(x) < N && error("x is too short"), and it works as expected. However, the following does not work: x...

Hi fellow Julia users, Why does this using HDF5, JLD s = "It would take me 48 hours to recompute this." filename_no_ext = "eric_demo_file" @save filename_no_ext readdir() @load "eric_demo_file" evaluate differently from this? using HDF5, JLD s = "It would take me 48 hours to recompute this." filename_no_ext = "eric_demo_file"...

I have a text file I am (pretty sure) is encoded in UTF16, but I don't know how to load it in Julia. Do I have to load it as bytes and then convert with UTF16String?

So here is the setting. I have multiple composite types defined with their own fields and constructors. Lets show two simplified components here: type component1 x y end type component2 x y z end Now I want to define a new type such that It can save an array of...

Using the output from a computation in julia (working in IJulia), I'd like to draw a figure using matplotlib's patches module (via Steven Johnson's PyCall and PyPlot packages). I've read several related posts on stackoverflow, but I can't seem to get a minimum working example. Could somebody post a simple...

In Julia: In [1]: M1 = [1 3 4; 45 64 33; 456 3 454;] Out [1]: 3x3 Array{Int64,2}: 1 3 4 45 64 33 456 3 454 In [2]: M1 * inv(M1) Out [2]: 3x3 Array{Float64,2}: 1.0 6.93889e-18 -8.67362e-19 0.0 1.0 -2.08167e-17 -1.42109e-14 -8.88178e-16 1.0 M1 * inv(M1) is...

I build a parametric type in julia: type MyType{T} x::T end and for simplicity, I build a type alias for Float64: typealias MT MyType{Float64} I now deliberately cause an error involving MT. For example: y1 = MyType(1.0) y2 = MyType(2.0) y1 + y2 will throw an error because + is...

In IJulia I have a large array/table to display: But it keeps getting cut off: In [1]: rand('a':'z', 100,100) Out[1]: 100x100 Array{Char,2}: 'g' 'n' 's' 'v' 'i' 'b' 'v' 'f' … 'v' 'y' 'p' 'o' 'b' 't' 'x' 'w' 'c' 'y' 'c' 'z' 'g' 'v' 'x' 'w' 'q' 'm' 's'...

I'm giving Julia a go while solving Code Jam problems, in this case Rope Intranet from round 1C 2010 (https://code.google.com/codejam/contest/619102/dashboard) Solution is basically: for tc = 1:int(readline()) n = int(readline()) a = [map(int, split(readline())) for _ = 1:n] ans = 0 for (i, x) in enumerate(a) for y in a[i...

Julia has strftime as a built-in but not gmtime. julia> strftime strftime (generic function with 3 methods) julia> gmtime ERROR: gmtime not defined What is the preferred Julia way to do the equivalent of gmtime? The idea is to turn seconds since the epoch into a time structure in the...

Happy new year! It's January 1st. What week is it? Most people would say that it's the first week of the year. Not julia, however: using Dates for i=2000:2015 println(Date(i), ": first week is ", Dates.week(Date(i))) end results in 2000-01-01: first week is 52 2001-01-01: first week is 1 2002-01-01:...

Is it possible to use the julia language in c++? Does the julia language provides some libraries to include? For now, I am trying to use some funcitons of the julia language in my c++ project. Is this possbile? What could I do? thanks in advance....

Due to the nature of floating-point math, .4 * .4 = 0.16000000000000003 in Julia. I want to get the mathematically correct answer of 0.16, in a CPU-efficient way. I know round() works, but that requires prior knowledge of the number of decimal places the answer occupies, so it isn't a...

Question 1 - upgrade I'm using v"0.3.8" on Windows. I found from http://julialang.org/downloads/ Current Release (v0.3.9) I know I could download the prebuild version and install again. Is there a way to upgrade (from current installed version) to the new version? There's Pkg.update(), it runs for a long time without...

I'm pretty sure this has to be a bug... Ok, so basically, when I pass a Math Constant type to the power (^) function and iterate it several times... The loop is really slow and uses a lot of memory allocation. The example is trivial as it doesnt produce any...

I'm trying to create an array of arrays of a special type in Julia. For example, I want to create a list that saves lists (arrays) of integer values. I need to know how to: Initialize an (empty) list for the arrays Use append!/push! to add an array of a...

I am new to Julia, and I am in the process of porting code from other languages. I am using Julia included in the latest WinPython (beta), which is v0.3.5. From this link, it appears that v0.4 will be released in the next couple of months: https://github.com/JuliaLang/julia/milestones As much as...

Is there a way to resize a chunked dataset in HDF5 using Julia's HDF5.jl? I didn't see anything in the documentation. Looking through the source, all I found was set_dims!(), but that cannot extend a dataset (only shrink it). Does HDF5.jl have the ability to enlarge an existing (chunked) dataset?...

I was able to build it on a tiny computer, but the result now takes up ~ 1 GB of the 1.3 GB I had free. Most of this is in the /deps folder -- this is safe to delete after the build, correct?

function init!(u) n = length(u) dx = 1.0 / (n-1) @fastmath @inbounds @simd for i in 1:n u[i] = sin(2pi*dx*i) end end when I execute above function in IJulia, it prompts below texts: @fastmath not defined ...

I need to find the fixed point of a function f. The algorithm is very simple: Given X, compute f(X) If ||X-f(X)|| is lower than a certain tolerance, exit and return X, otherwise set X equal to f(X) and go back to 1. I'd like to be sure I'm not...

Is there a Julia equivalent of dplyr's bind_cols and bind_rows? Specifically, I'm looking for a bind_rows function which will match column names regardless of order and fill in NA's for non-matching columns Edit: R Example of both: library(dplyr) df1 = data.frame(a = 1, b = 1) df2 = data.frame(b =...

Is there an efficient way to do the following in Julia in one line of code? foldl((prev, x)-> [prev; prev[end] + x] , 0, block_lengths) For example, for block_lengths = [2, 2, 2, 2, 3] the desired output is [0, 2, 4, 6, 8, 11] (I presume that the way...

How can I add a path to my current path in Julia, so that I can organize files and modules in folders, but still access them?

What is the standard way to define a callback function, or a function handle in Julia? Suppose I define function myFun(a, b, c, d) a - 3* b - c * d # The return value end My goal is to fix b = 1, c = 2, d =...

Using example from Andrew Ng's class (finding parameters for Linear Regression using normal equation): With Python: X = np.array([[1, 2104, 5, 1, 45], [1, 1416, 3, 2, 40], [1, 1534, 3, 2, 30], [1, 852, 2, 1, 36]]) y = np.array([[460], [232], [315], [178]]) θ = ((np.linalg.inv(X.T.dot(X))).dot(X.T)).dot(y) print(θ) Result: [[...

I have created a dictionary out of two arrays using zip() like list1 = [1,2,3,4,5] list2 = [6,7,8,9,19] dictionary1 = Dict(zip(list1,ist2)) Now i want to sort this dictionary by key(list1) or by list2. Can somebody show me a way or function, how to realize it?...

Using julia and PyPlot (which looks like it calls matplotlib) I've got a radial log plot ranging from 0dB on the outer edge of the plot to -50dB on the interior: using PyPlot ; theta = 0:0.02:1 * pi ; n = length(theta) ; U = cos( theta ).^2 ;...

I came up with 2 ways to add all the arrays in a pair of composite types. The first way (add_structs_1) takes 4 seconds to run and the second way (add_structs_2) takes 0.15 seconds. But the second way requires a lot more code...I have to explicitly mention each field in...

I'm trying to sum all numbers from 1 to 1000 that are either divisible by 3 or 5. The first attempt is straight forward: ans1 = 0 for x in 3:999 ans1 += x % 3 == 0 || x % 5 == 0 ? x : 0 end When...

Imagine a constructor that takes two arguments and initializes 3 named fields using the values of the two arguments. Something like this: type test1 a b c test1(a,b) = new(a,b,a/b) end This works fine, but what if the value for c is not such a simple expression? What if it...

I'm a newbie to Julia programming language. I am trying to install Adaptive Skip-gram (AdaGram) model on my machine. I'm facing the following problems. Before training a model we need the tokenized file and a dictionary file. Now my question is, what is the input that should be given for...

I have question regarding the plotting package Gadfly for Julia Language. Suppose I have a DataFrame that Looks Like This: DataFrame:(DrinkType, Country, Month, Sales) Coke, UK, April, 500 Coke, US, April, 500 Coke, UK, March, 400 Coke, US, March, 700 I want to generate a bar chart, for each DrinkType,...

UPDATE: Thanks to @rickhg12s for pointing out that it appears I may have stumbled upon a bug. method_exists(<, (MyType, MyType)) is returning true while method_exists(isless, (MyType, MyType)) is returning false. I'm on v0.3.x but @rickhg12s is on the nightly build of v0.4, so I'll file an issue. How do I...

Given a function/expression that yields a single column, how to build a matrix from those columns in Julia? I tried the following (simplified example): column(j) = [j, j, j] # for example my_matrix = Float64[column(j)[i] for i in 1:3, j in 1:4] ==> 3x4 Array{Float64,2}: 1.0 2.0 3.0 4.0 1.0...

Im trying to use findnext on an array of vectors of vectors to be used for coords of other nodes connected to the indexed node in a neural net. findfirst works fine, but findnext causes a crash. I there an easy solution? x = fill!(Array(Vector{Vector{Int64}},5,5,5),[]) push!(x[1,1,1],[1,1]) push!(x[1,1,1],[1,2]) f = findfirst(x[1,1,1],[1,3])...

In Julia, I might want to write a function that returns 0 if the input is less than 1, or returns 2 if the input is greater than or equal to 1. This is a pretty simple function, and the verbosity of a five-line if else construct is probably excessive....

In Julia, I have a function like this: function f(x::Float64, c::Float64) if x <= 0 return(0.0) elseif x <= c return(x / c) else return(1.0) end end The function is type-stable and so will run quickly. However, I want to include the function in a package for general distribution, including...

I have a string x. I think that x is a string representation of a type that is a subtype of Number. For example, x might take the value "Float64". I could check this using: eval(parse(x)) <: Number However, it is possible that x contains something dangerous, like some variant...

Consider the following code function test(m,B) @show typeof(B) all_u = rand(m,10) one_u = all_u[:,1] B*one_u end # Works @show test(3, [1 1 1; 2 2 2]) # Works @show test(2, [1 1; 2 2]) # Fails @show test(1, [1; 2]) The last line fails with `*` has no method matching...

NLopt is a solver for optimization, which implements different optimization algorithms and is implemented in different languages. In order to use the LD_LBFGS algorithm in Julia, does the variable have to be a vector as opposed to a matrix? If yes, once we need to optimize an objective which is...

I've been scratching my head a lot about this. Now, except for the fact that Julia gives out a seemingly backwards result with respect to the lags julia> crosscor([1,2,3,4], [1,2,3,1])' 1x7 Array{Float64,2}: -0.30339 0.0 0.64049 0.13484 -0.37081 -0.40452 0.30339 > print(ccf(c(1,2,3,4), c(1,2,3,1), type="correlation", plot=F)) Autocorrelations of series ‘X’, by lag...

In Julia has anyone implemented the normal distributions pdf or cdf to support arbitrary precision BigFloats. For example this code returns 0.0, when in fact the values should be slightly different. x = parse(BigFloat, "2.1") x_small = float64(x) pdf(Normal(), x) - pdf(Normal(), x_small) ...

I would like to use a subtype of a function parameter in my function definition. Is this possible? For example, I would like to write something like: g{T1, T2<:T1}(x::T1, y::T2) = x + y So that g will be defined for any x::T1 and any y that is a subtype...

I tried to plot it but i got many errors using Winston p1(Prm)=(Prm-0.25)*min(1.5-Prm,0.50) p2(Prm)=0.5*(Prm-0.25)*min(1.5-Prm,0.50) p3(Prm)=(Prm-0.25)*min(2.00-Prm,0.50) plot(p1,p2,p3) ...

I'd coded a Julia function with an array bounds error: function wrong() alphas = [ 0.5, 1, 1.25, 2.0 ] ; theta = 0:0.02:1 * pi ; U = zeros( length(theta), 4 ) ; i = 1 ; j = 1 ; for a = alphas kd = pi *...

I'd like to make a composite type that includes a dictionary as one of its named fields. But the obvious syntax doesn't work. I'm sure there's something fundamental that I don't understand. Here's an example: type myType x::Dict() end Julia says: type: myType: in type definition, expected Type{T<:Top}, got Dict{Any,Any}...

I have a file, test.dat: A 1.00 11 AT 2.00 12 ARE 3.00 13 If I do some action on the third column and write that to a file x=readdlm("test.dat") x[:,3]=x[:,3]*2 writedlm("test2.dat",x) A 1 22 AT 2 24 ARE 3 26 Is there anyway to get this output? A 1.00...

The following lines of code appear in levenberg-marquardt algorithm in the optimization package "Optim": DtD = diagm(Float64[max(x, MIN_DIAGONAL) for x in sum(J.^2,1)]) delta_x = ( J'*J + sqrt(lambda)*DtD ) \ -J'*fcur However, my questions has nothing to do with the algorithm or anything specific to the package. I guess it...

Trying to get into Julia after learning python, and I'm stumbling over some seemingly easy things. I'd like to have a function that takes strings as arguments, but uses one of those arguments as a regular expression to go searching for something. So: function patterncount(string::ASCIIString, kmer::ASCIIString) numpatterns = eachmatch(kmer, string,...

Suppose I have an 2 dimensional array and I want to apply several functions to each of its columns. Ideally I would like to get the results back in the form of a matrix (with one row per function, and one column per input column). The following code generates the...

Let us say that I have an external command called "Busca01.x" which returns three integers separated by tabs, like this: [email protected]: Busca01.x 192 891 9029 So, I can call this from julia and store the result as a string using either readall or readchomp. I need the data as an...

I find difficult to format numbers with Julia : b = 1.111111 bb = @printf "test : %5.2f" b bb test : 1.11 That is fine. using PyPlot annotate(@printf "test : %5.2f" b, xy=[1;1]) test : type: non-boolean (Array{Bool,1}) used in boolean context while loading In[16], in expression starting on...

I've got a symbol that represents the name of a function to be called: julia> func_sym = :tanh I can use that symbol to get the tanh function and call it using: julia> eval(func_sym)(2) 0.9640275800758169 But I'd rather avoid the 'eval' there as it will be called many times and...

I have a type definition corresponding to a C-struct as follows: type fakeCStruct a::Uint8; b::Uint32; end var=fakeCStruct(3,4); How can I pass a pointer to this type as an input argument (i.e. struct CStruct *) for a c-function in ccall? The old documentation (v0.3) suggest using &var in the input argument...

I have been trying to open some RGB images, view the data as a 2D array of HSL pixels, manipulate pixels in HSL space, convert back to RGB and write manipulated image to file. However I don't quite understand how the conversions in the (awesome) julia packages Color and Images...

I'm trying to make a vectorized version of ismatch. Base.ismatch function ismatch(vector::Vector, regex::Regex) [ismatch(regex, string) for string in vector] end This works, but this Base.ismatch function ismatch(vector::Vector{String}, regex::Regex) [ismatch(regex, string) for string in vector] end doesn't because Vector{ASCIIString} <: Vector{String} is false. Is there any way to get around this?...

The goal of this experiment is to compare speed of Matlab and Julia with a small piece of code below. First the Matlab code: >> t = 5000; n = 10000; x = 1:t*n; >> x = reshape(x, t, n); >> tic(); y1 = sum(x(:) .* x(:)); toc() Elapsed time...