Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
sina salah
@scraping.team_gitlab
very basic question. Why do I get this error? MethodError: objects of type Int64 are not callable when calling the following function
function hamming(s1, s2)
count(z -> z[1] != z[2], zip(s1,s2))
end
hamming("ssss", "sssd")
Kazi Abu Rousan
@aburousan
Is there some function for using BigInt while using Cuda?
Dmitry Mikushin
@dmikushin
Hello, dear Julia community! I'm developing a C++ native module using libcxxwrap-julia. How should I define a documentation string on a module and on a module function? Unfortunately, libcxxwrap-julia/examples do not seem to show any example.
Talon
@talonmyburgh
Hi all, I'm having some issue creating a Fixpoint type in Julia - which I'm attempting to have extend AbstractArray. Initially the project was created in Python, but now Julia I am having to overload so many functions (more than mentioned here). The project is open source so if anyone can take some time to assist/point me in a better direction I'd really appreciate it. If there is a better forum to elaborate on this problem please let me know. Thank you.
Hasnep
@hasnep:matrix.org
[m]
@talonmyburgh could you link to the project or explain more? Do you mean a fixed point as in an invariant point in mathematics?
Talon
@talonmyburgh
No, I mean a fixed point type as in the binary representation of a real number. See this branch of my repo here. fixpoint.jl has my Fixpoint and complex Fixpoint (CFixpoint). There are some tests scripts and the one which fails is pfb_fixed_test.jl due to me not having sufficient getindex/setindex! functions albeit that I've declared two sorts in fixpoint.jl. Thanks @hasnep:matrix.org .
Hasnep
@hasnep:matrix.org
[m]
@talonmyburgh Have you looked at how FixedPointNumbers.jl works? Could you import it instead of writing your own, or is there some feature you need? In that case, could you extend their implementation? https://github.com/JuliaMath/FixedPointNumbers.jl
Talon
@talonmyburgh
I had looked at it some time back when it lacked some features... seems to have come quite a way since then. Thanks.
Talon
@talonmyburgh
Ah yes, I recall that the reason I did not choose to use the FixedPointNumbers.jl package was that it was limited to Integer types (i.e. 8,16,32... bit Fixed Point numbers) whereas for my research I need a variable bit-width and fractional bit-width. Thanks for the suggestion however.
zhangruxuan
@zhangruxuan
he
Hasnep
@hasnep:matrix.org
[m]
Hi ๐Ÿ‘‹
dionisos
@dionisos2
Hi !
I would like to optimize something like that :
my_dict[key] = get(my_dict, key, 0) +1
dionisos
@dionisos2
Here I "search" for the correct index two times. I feel like there should be a way to get a reference to my_dict[key] if it exists, and add it if not, or modify it otherwises.
So I save a hash call or something like that.
Alik Chebotar
@ochebotar
IntegerD = ceil(FD)
FDGal = FD - IntegerD
print("FDGAL: ", FDGal)
print("\n")
hIdeal = (k) -> sinc.(k.-FDGal)
print("hIdeal: ", hIdeal)
print("\n")
hApprox = hIdeal(idxWindow)
print("hApprox: ", hApprox)
print("\n")
Sig_fd[indm,:] = filt.(hApprox,1,[zeros(1,abs(IntegerD)),Sig[1:end+IntegerD]])
I get the error: ERROR: MethodError: no method matching zeros(::Int64, ::Float64). on the last line. What am I doing wrong?
Hasnep
@hasnep:matrix.org
[m]
@ochebotar The arguments of zeros are the dimensions of the matrix, so they all need to be integers, the error message is telling you that the second argument is a float instead of an integer. The documentation for ceil says ceil(x) returns the nearest integral value of the same type as x that is greater than or equal to x. So unexpectedly, if you give ceil a float it will return a float. You can fix it by casting the value to an integer, like this: IntegerD = Int(ceil(FD)). Hopefully that was helpful!
3 replies
Hasnep
@hasnep:matrix.org
[m]
@ochebotar: Also, you can use println() to get new lines instead of using print(x) and print("\n")
Hasnep
@hasnep:matrix.org
[m]
You're welcome ๐Ÿ˜
Hasnep
@hasnep:matrix.org
[m]
@ochebotar: It's difficult to know what's going wrong without knowing what flit, hApprox, IntegerD or Sig are. Try to narrow down which part of that line is causing the error by running each part separately, maybe start with Sig[1:end+IntegerD] because that doesn't look right to me.
Hasnep
@hasnep:matrix.org
[m]
@ochebotar: Did you manage to fix your error?
Christopher Mayes
@ChristopherMayes

Does anyone know if it is possible to use Roots.find_zero in a CUDA kernel? Below fails:

using CUDA
using Roots

g(x) = (x-1)^2

function kernel(a)
    i = threadIdx().x    
    a[i] = find_zero(g, 0)
    return
end

a = CuArray([1,2,3])
@cuda threads=length(a) kernel(a)

InvalidIRError: compiling kernel kernel(CuDeviceVector{Int64, 1}) resulted in invalid LLVM IR Reason: unsupported dynamic function invocation (call to display(x) in Base.Multimedia at multimedia.jl:324)

Mark Kittisopikul
@mkitti
Where does the call to display come from?
evidlo
@Evidlo:matrix.org
[m]
Is there a way to do something like foo[size(foo) .รท 2] = 0, where foo is a 2D array?
1 reply
evidlo
@Evidlo:matrix.org
[m]
I found that kernel[size(kernel) .รท 2 .+ 1...] = 0 does what I want
and yes, that's what I was looking for
Hasnep
@hasnep:matrix.org
[m]
Nice, I'm glad you figured it out :)
Hayden Jones
@wrq
Insofar as I've looked, there's nothing until Chapter 38 of Julia docs that reveal the existence of multi-line #= comments. I'd love for there to be a "basic syntax" section that covers this, with the other basics.
Hasnep
@hasnep:matrix.org
[m]
I guess that's because it's very rarely used, I think I've seen Stefan Karpinski say that he regrets that syntax
Hayden Jones
@wrq
Not sure how that's relevant? Do Julia users just manually comment individual lines, or do you need to ask Stefan first? Multiline comments just make sense for larger comments.
Hasnep
@hasnep:matrix.org
[m]
I'd guess most Julia users use an IDE that has a keyboard shortcut for commenting multiple lines
If you don't use it then you wouldn't think to document it early on
Hayden Jones
@wrq
I suppose not, though I think quality technical documentation should strive to capture all facets of behavior
Particularly that of such a lofty and self-glorified project like Julia. Not to mention, with such adequate funding and participation
Hasnep
@hasnep:matrix.org
[m]
Hmm, but it is in the documentation though
Hayden Jones
@wrq
38 chapters deep, uncategorized, and unsearchable.
But you're absolutely right, it IS there
Hasnep
@hasnep:matrix.org
[m]
I'd say that documentation should strive to first document best-practices, less important stuff can go nearer the end
But yeah, the search in the Julia docs suuuuucks
Hayden Jones
@wrq
Stefan must not use the search very much ...
Harsh Shah
@harshcrop
Hello Everyone
Hasnep
@hasnep:matrix.org
[m]
Hi Harsh
Have you been using Julia for very long?
Alejandro Reimondo
@aleReimondo
Hello!
My system load (a lot) of functions dynamically (julia source) on demmand. The time spent in compilation while running the first time is too much to be aceptable; most of the functions are reloaded the next time the system is run and used with same type of arguments.
I would like to load the precompiled internals just after the source is reloaded. As my system manage wich functions are loaded, it is good that the system itself manage the loading of the precompilation stuff (for the functions that has run/precompiled in the past).
Where should I start reading to find a way to do the same as precompilation of packages but under the control of my system/app while it is running?
Note that the code loading is dynamic and atomic (generatedwhile running the system in the past), not contained in a package.
Jeremy Zucker
@djinnome
Hi folks, how does one hunt down the library that a function is part of? For context, I expected ContinuousResourceSharer to be part of AlgebraicDynamics.UWDDynam but I still get an error UndefVarError: ContinuousResourceSharer not defined
even after using AlgebraicDynamics.UWDDynam
Am I doing something dumb, or is this something I should take up with the AlgebraicDynamics folks?
Hasnep
@hasnep:matrix.org
[m]
@djinnome: Hi, I'm able to use ContinuousResourceSharer by running using AlgebraicDynamics.UWDDynam and then running UWDDynam.ContinuousResourceSharer. If you don't want to specify UWDDynam each time you can run const ContinuousResourceSharer = UWDDynam.ContinuousResourceSharer