Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
You need the diagonal of this matrix
Federico Simonetta
@00sapo
diag doesn't return a view if it's on the left side
it's a different thing
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
then [A[1, idx[i, 1], idx[i, 2]] for i in 1:3]
Federico Simonetta
@00sapo
Ok, I was expecting that there was a method to avoid that for
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
but still will be a copy
not I'm aware of, the array comprehension usually does the trick
Federico Simonetta
@00sapo
Is there a way to vectorize a function on the rows of a matrix?
something like CartesianIndex.(idx) but on the rows/columns?
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
f.(eachrow(A))?
Federico Simonetta
@00sapo
doesn't work, in this case at least
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
yeah, CartesianIndex won't work with iterators
n89hnfnqa
@n89hnfnqa:matrix.org
[m]
if you splatter indexes, then it'll work: A[1,CartesianIndex.(eachcol(idx)...)]
BridgingBot
@GitterIRCbot
[irc] <random-jellyfish> is it possible to convert a BigInt to a byte array?
[irc] <Andriamanitra> what do you mean by byte array?
[irc] <Andriamanitra> can you give an example?
[irc] <Andriamanitra> digits(BigInt(239742389234), base=16) probably gets you most of the way there but i'm not sure which data type byte array is
BridgingBot
@GitterIRCbot
[irc] <random-jellyfish> any type that would represent an array of bytes
[irc] <random-jellyfish> Vector{Int8}, Array{Int8}
[irc] <random-jellyfish> Julia should have a data type that can act both as an array and as a number
[irc] <random-jellyfish> a big int type
[irc] <random-jellyfish> e.g. so that you can access bits and bit slices from it, make changes on them
[irc] <random-jellyfish> and at the same time treat the whole thing as a number, be able to add, multiply, divide etc. with other numbers
[irc] <random-jellyfish> this is useful in digital electronics
[irc] <random-jellyfish> to model memories and registers
[irc] <random-jellyfish> BigInt doesn't have support for bit slicing or doing operations on individual bits
BridgingBot
@GitterIRCbot
[irc] <random-jellyfish> I mean it's possible to do it with masks and shifts
[irc] <random-jellyfish> but it would be easier to see it as an array of bits
[irc] <random-jellyfish> or by writing a separate package
BridgingBot
@GitterIRCbot
[irc] <Andriamanitra> maybe you want BitArray instead of BigInt then?
BridgingBot
@GitterIRCbot
[irc] <Andriamanitra> i guess there's no easy way to do regular arithmetic with them but bitshifts and xors etc work
BridgingBot
@GitterIRCbot
[irc] <Andriamanitra> really seems like BigInt(::BitVector) should be a thing but it isn't
BridgingBot
@GitterIRCbot
[irc] <phao> Hi.
[irc] <phao> I remember using Julia a while back and having issues with slow load times associated with the plot package (or something like that). It seemed that this was sort of an issue. Right? Is it still like that? Or am I imagining things? (hehe) Or ... something else?
BridgingBot
@GitterIRCbot
[irc] <AnAverageHuman> it's a little faster now
BridgingBot
@GitterIRCbot
[irc] <phao> Great!
BridgingBot
@GitterIRCbot
[irc] <Andriamanitra> "time to first plot" will always be slower than in interpreted languages but yeah it has improved quite a bit in the recent releases
[irc] <Andriamanitra> if the initial compilation time really bothers you, you could look into using sysimages: https://julialang.github.io/PackageCompiler.jl/dev/sysimages/
[irc] <Andriamanitra> (but take note of the sections about drawbacks)
BridgingBot
@GitterIRCbot
[irc] <dostoyevsky> I tend to run julia in short-lived docker containers, so initial compilation time is like always
BridgingBot
@GitterIRCbot
[irc] <AnAverageHuman> I think in that case you would bake the sysimage into your container creation process
meff
@meff:sunadokei.party
[m]
Fwiw I haven't had issues with "time to first plot" myself, though yeah it's slower than Python
BridgingBot
@GitterIRCbot
[irc] <lolollolololol> how well does julia perform, and especially in async/nonblocking socket programming, what lib does it use for it, etc. anyone can answer this for me?
meff
@meff:sunadokei.party
[m]
I haven't stress tested this lolollolololol, but I've done some async http fetching/parsing and it's certainly a lot faster than Python once JITted
I think the Julia ecosystem is a bit lacking on the server end of socket programming right now, and is probably missing clients for less popular protocols
BridgingBot
@GitterIRCbot
[irc] <john2gb0> is it possible to produce a compiled binary
[irc] <Andriamanitra> yes, although it's not always straight-forward
[irc] <Andriamanitra> this is the package you'll need: https://julialang.github.io/PackageCompiler.jl/dev/
BridgingBot
@GitterIRCbot
[irc] <john2gb0> badly written
[irc] <Andriamanitra> it seems there's also this but i'm not familiar with it myself at all so you'll have to do your own research https://binarybuilder.org/