Questions tagged [julia]

The Julia programming language is fast, expressive and dynamic. By aggressively targeting technical computing it has become a robust general purpose language. It addresses the two-language problem by combining the ease of use of high-level languages such as R and Python with the performance of C and Fortran.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

How to use GPU parallel computing to accelarate the for loop?

I am a fresh person on Julia, my question is: there is a piece of code that contains a large matrix. The matrix elements are calculated by nesting four for loops. Now I want to accelerate the ...
YixiuBai's user avatar
0 votes
0 answers
18 views

What are Mesh and Surf equivalents of MATLAB in Julia?

MATLAB has two distinct mesh and surf functions. I found the surface function in Julia, which is similar to the surf in MATLAB. Is there an equivalent of mesh in Julia? The difference is that, surf ...
Archisman Panigrahi's user avatar
0 votes
0 answers
13 views

julia HTTP.WebSockets.open() timeouts not working

Neither of the timeouts for HTTP.WebSockets.open() work. I expect the connect timeout to timeout when the internet is down and it cant connect, and idle timeout to timeout when its actively connected ...
BAR's user avatar
  • 15.5k
0 votes
0 answers
23 views

how to set the format of the ticks of the colorbar when plotting the heatmap in Julia?

I'm new to Julia and have trouble plotting using Julia. On the right side of the above plots, The ticks of the colorbar in Hx_trs, and Hz_trs are not readable. I want to print it in scientific ...
donggun's user avatar
  • 33
-2 votes
0 answers
21 views

Issue with optimization to solve UC problem using Gurobi and Julia - I tried running it but faced this error

ERROR: Result index of attribute MathOptInterface.VariablePrimal(1) out of bounds. There are currently 0 solution(s) in the model. Stacktrace: [1] check_result_index_bounds@ C:\Users\hj0959.julia\...
FatimaKl's user avatar
1 vote
0 answers
26 views

Open hdf5 dataframe in Julia

I saved a pandas dataframe with df.to_hdf("myfile.h5", key='my_df'). The file is composed of a bunch of numerical columns with 100 entries each. How can I open the same file in Julia as a ...
nop nop's user avatar
  • 73
0 votes
1 answer
14 views

Julia JuMP Error when initializing variable: MethodError: no method matching (::Colon)(::Int64, ::Vector{Vector{Int64}})

I have a problem in Julia JuMP and I would really appreciate some help. I am currently trying to initialize a variable that I called X. X represents the quantity of demand element e satisfied from ...
leonard26ba's user avatar
0 votes
1 answer
32 views

julia - Why do single functions in vector passed as arguments not work

I have a demo here of passing functions as parameters to another function. But its not working in all cases. The issue is im getting: ::Vector{typeof(is_valid_wallet_address)} instead of Vector{...
BAR's user avatar
  • 15.5k
0 votes
1 answer
32 views

Julia ForwardDiff no method matching error

I'm trying to implement the automatic difference method by using the ForwardDiff packages. using LinearAlgebra import ForwardDiff function OLS(X,Y,beta) f = (Y - X*beta)'*(Y - X*beta) end n = ...
zlqs1985's user avatar
  • 509
0 votes
1 answer
44 views

cumsum in Julia with reset at 0

Looking for an efficient solution that performs a cumulative sum that reset on zeros. For example: 3×3 Matrix{Float64}: 1.0 2.0 3.0 0.0 5.0 6.0 10.0 0.0 9.0 the desired output is 3×3 Matrix{...
Thomas Jalabert's user avatar
1 vote
2 answers
29 views

Boostrap of Dataframe for Re-estimation

I have a given dataset and want to create a bootstrap (with resampling) of 10 replicates of the dataframe and have new ids assigned to them in the final dataset. Please guide me on this. Random.seed!(...
Parsshava Mehta's user avatar
2 votes
1 answer
45 views

Fill array recursively in Julia using dot-notation and views

I am using Julia 1.9.0 and I’m trying to fill an array using views and dot notation where each entry depends on the preceding one(s). Say, I want the first 10 entries of the Fibonacci series in my ...
Intbes's user avatar
  • 23
1 vote
1 answer
29 views

convert String31 datetime format into datetime in julia

i have a dataframe with Time colume wiht String31 format. how can i convert this foramt into datetime. i use Datetime method but it raised an error:: str_1=data_raw.Time[1,:] DateTime(str_1, "...
erfanvahdat's user avatar
0 votes
0 answers
32 views

How can I optimize my Julia code for a slow for loop and innerjoin when working with large data frames?

I have two data frames, df and state_df. using DataFrames, DataFramesMeta df = DataFrame( period = 1:10, inv = [1; repeat([missing], 9)], price = [10, 11, 11, 10, 11, 10, 10, 10, 10, 11] )...
Satoshi's user avatar
1 vote
1 answer
28 views

How to pretty-print matrix to file through Logger output in Julia?

I want to log large matrices and I would like to log them in a way that makes them easily readable directly out of the resulting text file. The most straight-forward way looks like using Logger but ...
aquaticapetheory's user avatar
0 votes
1 answer
33 views

Filtering while using the aggregating function in Julia DatraFrames: can we?

is there a way I can use 'combine' and filter inside the aggregate function? Let's think about the domain of the fields field1= ["A","B","C"] field2=["X","...
Eliezer Otero's user avatar
0 votes
1 answer
22 views

How to use julia's HTTP.Websockets with a path and query string URL?

Say I want my client to connect to the websocket url = "ws://api.mysite.com/v1/user-stream?id=1". How do I use HTTP.WebSockets server to handle this sort of url and parse path and query ...
BAR's user avatar
  • 15.5k
1 vote
1 answer
63 views

Draw random numbers from a custom probability density function in Julia

I would like to draw random numbers from a modified exponential distribution: p(x) = C * a * Exp[-(a*x)^b] with C=1/Gamma[1 + 1/b] for normalization. How can I do this in julia? Unfortunately I have ...
HighwayJohn's user avatar
0 votes
1 answer
35 views

Axis labeling for subplots

The following code generates this image I want the "y"-axis label to be "Space" and the "x"-axis label to be "time" for the left subplot. However, I am failing ...
KZ-Spectra's user avatar
0 votes
1 answer
39 views

Eigenvalues for a sparse matrix

I have a large sparse matrix, A: 44668×44668 SparseMatrixCSC{Any, Int64} with 32219901 stored entries I just want eigenvalues of it, ideally all of them, but also setting on a few of the most positive ...
AlexQueue's user avatar
  • 6,315
0 votes
2 answers
39 views

Julia: elegant way to identify 2 strings

I wonder there is an elegant way to indentify 2 strings by Julia. I mean,there are 2 strings, for example 1.I think this is good 2.This is good, I think Both are the same meaning of course, but ...
onoke's user avatar
  • 59
1 vote
1 answer
33 views

Custom use of brackets like NamedTuple

Brackets in Julia are used for Parametric Types as far as I encountered by now. There is however one example of curly brackets being used in a different way: NamedTuple{(:a, :b)}((1, 2)) This ...
Raumschifffan's user avatar
0 votes
1 answer
26 views

Fully exit julia scipt in interactive REPL

I am starting a julia REPL in my project directory with julia --project. Then I include("scripts/main.jl") in the REPL which runs some HTTP and WS servers. If I hit ctrl-c to exit the ...
BAR's user avatar
  • 15.5k
3 votes
1 answer
28 views

Julia Typing/Inheritance

Note: I found this post and read this part of Julia's documentation, but I couldn't figure it out yet. Therefore, I wrote this post. Suppose we have the following two structs: struct A x end ...
fakl's user avatar
  • 105
1 vote
1 answer
24 views

GameZero.jl Actor() method unable to use specified image

When trying out GameZero.jl, the Actor() method is not finding the specified file location. When entering something like: ship = Actor("C:/path/to/images/image.png"; pos=(100, 100), angle=90)...
Jonathan F.'s user avatar
0 votes
1 answer
22 views

How can you specialize broadcasting in julia?

I want to write custom method for the broadcast operation f.(v) for my custom function f. What do I need to do for this?
Felix B.'s user avatar
  • 813
1 vote
0 answers
26 views

What MIME type is the tuple type passing to its elements to display them?

If I implement show(::IO, MIME"text/plain", m::MyType) then this is called by Arrays but not by Tuples. What MIME type are tuples passing to MyType?
Felix B.'s user avatar
  • 813
0 votes
0 answers
55 views

How to compute fourrier transform on computer?

I would like to compute the fourrier transform nummerially. As a simple example I chose a box function given by function step(x) if abs(x) < a return 1 else return 0 end end which has the ...
TheFibonacciEffect's user avatar
0 votes
0 answers
25 views

julia - HTTP.WebSockets timeouts not working

Neither of the timeouts for HTTP.WebSockets.open() work. I expect the connect timeout to timeout when the internet is down and it cant connect, and idle timeout to timeout when its actively connected ...
BAR's user avatar
  • 15.5k
1 vote
2 answers
39 views

julia - Better way to wait on @async loop

This async loop will immediately go to the next line. What is the best way to wait when there is no need for a condition? @async while true sleep(1) end # Must be async or first loop will never ...
BAR's user avatar
  • 15.5k
0 votes
0 answers
26 views

julia - How to refactor a utils.jl file

I have a utils.jl file in my main project that I want to refactor out into the MyProjectBase.jl package. I normally do a include("utils.jl") in the MyProject.jl module which lets me use it ...
BAR's user avatar
  • 15.5k
3 votes
1 answer
51 views

Overhead when using vector-valued functions in Julia

I have noticed that, in Julia, the execution speed of my code slows down dramatically when using vector-valued functions. Consider the following MWE: using BenchmarkTools function f_scalar(x::Float64)...
Andreas's user avatar
  • 73
0 votes
0 answers
8 views

How to use LoggingExtras DatetimeRotatingFileLogger in UTC date

I want to use the DatetimeRotatingFileLogger in YYYY-MM-DD format but have the datetime input in UTC instead of local computer time. Is this a bad idea or is there a way? https://github.com/...
BAR's user avatar
  • 15.5k
0 votes
1 answer
47 views

How to generate a vector with ones at a certain place?

I have a vector with ascending numbers like (2,3,6,10). Now I need to generate a second vector, where all entries in the called items are 1 and all others are 0, so (0,1,1,0,0,1,0,0,0,1). My attempt ...
Olorin's user avatar
  • 1
0 votes
1 answer
27 views

How to set axis ranges with density plot in CairoMakie?

Is it possible to fix the range of x and y axis in a density plot with CairoMakie ? For an example, I would like to fix the range of x axis from 10 to 100 and force the y axis to start from 0 (I want ...
JeanJouX's user avatar
  • 2,555
0 votes
1 answer
37 views

How can I implement an integration termination callback in DifferentialEquations.jl to solve an ODE?

Need help implementing a integration termination callback in DifferentialEquations.jl. Greetings, I have the code function height(dh, h, p, t) dh[1] = -1*sqrt(h[1]) end h0 = [14] ...
G. Church's user avatar
1 vote
0 answers
53 views

Julia, optim.jl fails to converge, residual function

I'm currently attempting to minimize a function in Julia using the Optim.jl library. However, I'm facing some difficulties as I'm unable to obtain the desired results for some unknown reason Optim.jl ...
user19416164's user avatar
0 votes
0 answers
32 views

Julia lang animation from vector of figures

I am using Julia and all I am trying to do, is to chain 100 figures into an animation. (I do NOT want to change parameters within a plot in my figure) I can't make it work for hours now, although I ...
yanscha's user avatar
1 vote
1 answer
37 views

Multiple lines on top of each other in Julia Plots

I am using julia plots for plotting different data, however three of the dataseries are almost the same while a fourth is very different. How can I plot the lines and make it clear that there are ...
TheFibonacciEffect's user avatar
1 vote
1 answer
45 views

Stepwise decrease GPU utility followed by out of memory error

I am running a 3D image segmentation deep learning training pipeline on a GCloud VM and am noticing a stepwise decrease of the GPU utility after about 25 epochs and an out of memory error after 32 ...
ita's user avatar
  • 115
1 vote
1 answer
46 views

How to convert a mxn matrix into a vector with same rows?

I'm trying to convert a Matrix into SVector in Julia. Following is a sample of how to create a matrix p=randn(Point3,100) p_mat=collect(reshape(reduce(vcat,p),3,length(p))') Here is the matrix. I've ...
h612's user avatar
  • 504
0 votes
2 answers
23 views

What is a syntax for generating the Unicode hexadecimal value of a character in Julia as a `String`?

What is a syntax for generating the Unicode hexadecimal value of a character in Julia as a String? To generate the Unicode hexadecimal value of a character <char> as a UInt32, one can execute ...
hieroglyph's user avatar
2 votes
3 answers
45 views

Julia symbolic differentiation

Though I've looked through several pages documenting various differentiation tools in Julia, I have yet to find the following simple functionality. I want to define a function which is differentiable ...
Frank Seidl's user avatar
0 votes
1 answer
35 views

3D surface plot with provided coordinate with PlotlyJS in Julia

As stated in the question, I would like to plot a function, f(x, y) which is represented in a vector [x, y, f(x, y)]. So clearly the [x, y] is the desired coordinate. I looked up in their official ...
Alphaharrius's user avatar
0 votes
2 answers
59 views

How to efficiently parallelize accumulation task in Julia using @threads?

I'm new to multithreading. I am trying to do an accumulation task in Julia, similar to the following: a = collect(1:5) b = 0.0 for i = 1:5 b += a[6-i] + i end I would like to parallelize this ...
Minotaur 's user avatar
1 vote
2 answers
72 views

Julia: Return Minimum Date in DataFrame

The question is fairly simple. How do I return the minimum purchase date for each customer using Tidier? using Tidier, DataFrames, Plots, CSV #params f = "path" df = CSV.File(f) |> ...
rwdvc's user avatar
  • 453
0 votes
1 answer
44 views

Export the name of the input argument in a function as a string

Following this post, I defined a macro inside a function: macro Name(arg) string(arg) end function myfunc(df) @Name df end tf = 3 myfunc(tf) What I want is: ''tf'' But what I actually got ...
Likan Zhan's user avatar
  • 1,046
0 votes
1 answer
32 views

How to plot large error bars on logarithmic scale in Julia language?

I need to plot a graph of a power law curve on logarithmic scale with error bar. However, sometimes the error can have a very large amplitude and ends up returning an error "No strict ticks found&...
João Vitor Vieira Flauzino's user avatar
1 vote
1 answer
32 views

Julia function not capturing all variables in scope

I'm having a strange issue where only some of the global variables in scope are available to the callback function. I figure I'm missing a key concept of scoping in julia but need some guidance. ...
BAR's user avatar
  • 15.5k
0 votes
0 answers
33 views

How to generate power law noise (colored noise) in Julia given an exponent?

Is there an equivalent function in Julia that does the same as the R language function TK95? This function generates colored noise (noise with a power law in Fourier spectra) just by receiving the ...
João Vitor Vieira Flauzino's user avatar

1
2 3 4 5
240