Perl 6 - the future is here, just unevenly distributed

IRC log for #pdl, 2014-12-08

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
16:18 drrho joined #pdl
16:51 drrho joined #pdl
17:37 drrho joined #pdl
17:56 drrho joined #pdl
20:53 Mithaldu how do i add a value to a specific index of a piddle?
20:57 Mithaldu man, it's annoying that the documentation of pdl is all about using magic overload
20:58 Mithaldu ok, set it is
21:22 sivoais Mithaldu: you have to use slice() because it has data-flow
21:22 sivoais like
21:22 sivoais use PDL; $g = sequence(10); $g->slice('4') += 42; $g
21:32 Mithaldu i assume data-flow is parallelization-related?
21:34 Mithaldu anyhow, in a code sequence where i have to use ->at all the time, because there's no other way to actually get numbers fucking out of piddles, i'm not gonna switch to slice for 2 lines
21:34 vicash PDL::NiceSlice ?
21:35 Mithaldu niceslice is a bunch of magical bullshit i don't want to see near my code
21:35 Mithaldu also
21:35 vicash makes sense. it is quite confusing
21:35 Mithaldu it doesn't help me when i need one single number out of a piddle to do math on
21:39 sivoais Mithaldu: data-flow is basically a view into the piddle. That way you can work on a subset of the data and the changes propagate back to the original chunk of memory
21:40 sivoais yeah, PDL isn't really made for working with a single number at a time. You lose out on the C-level looping if you do that
21:41 Mithaldu sivoais: that is orthogonal to what i said
21:41 Mithaldu let me try and rephrase it
21:42 Mithaldu a piddle is a data structure
21:42 Mithaldu it can do 3 things
21:42 Mithaldu 1. put things in
21:42 Mithaldu 2. work on things inside it
21:42 Mithaldu 3. take things out
21:42 Mithaldu it would be nice if the docs were set up as to address each of these on their own
21:43 Mithaldu instead the docs assume everybody just wants to do 2, and remains a hodgepodge where the only measure of resort is to read all of it and memorize all of it
21:44 Mithaldu in my use case 2. isn't even remotely useless
21:44 Mithaldu *useful
21:45 Mithaldu i could do all of my math in normal arrays and be just as quick
21:45 Mithaldu pdl is useful because i can throw numbers in and then tell it to give me a c pointer i can hand to opengl
21:53 sivoais without having to use pack/unpack :-P
21:53 Mithaldu right
21:54 Mithaldu tbh, i'm not even quite sure how i'd do any of this usefully with pack/unpack
21:54 Mithaldu all i know is i have to work with vectors and matrices and it's a pain in the arse because the api is inconsistent
21:57 sivoais Yeah, for me, the sweet spot for (2) is when you have several hundred megs of image data.
21:58 Mithaldu well
21:58 Mithaldu i'll get there
21:58 sivoais hmm, is that because for a matrix, the dimensions are swapped?
21:58 Mithaldu only instead of image data it will be model data
21:58 Mithaldu and maybe 3d textures
21:58 Mithaldu the dimension swapping is the least issue
21:58 Mithaldu let me paste two lines of c code
21:58 Mithaldu m_AngleH = 360.0f - ToDegree(asin(HTarget.z));
21:59 Mithaldu m_pos.y += STEP_SCALE;
21:59 Mithaldu HTarget and m_pos are piddles in my perl code
21:59 Mithaldu but unlike the c code which can use the same kind of syntax for reading and writing
22:00 Mithaldu i have to use one type of api for reading
22:00 Mithaldu and another for writing
22:00 Mithaldu or i say fuck it and do this
22:00 Mithaldu $self->AngleH( 360 - math_3d::ToDegree( asin( $HTarget->at( 2 ) ) ) );
22:00 sivoais how many values are in the piddles?
22:00 Mithaldu $pos->set( 1, $pos->at( 1 ) + STEP_SCALE );
22:00 Mithaldu it won't parallelize, but at least any newbie can read it and it remains consistent
22:00 Mithaldu 3
22:01 Mithaldu it's just 3d vectors
22:01 sivoais ah, I see. And you're not doing this for k 3D vectors?
22:01 Mithaldu mind, the annoying part is that there is no other way to do the first line
22:02 sivoais just 1 3D vector at a time?
22:02 Mithaldu i assume by k you mean "multiple"
22:02 Mithaldu it's the camera of a 3d view
22:02 Mithaldu it has a bunch of vectors, position, target, up
22:02 Mithaldu and to all of them i have to do different things
22:02 sivoais yeah
22:02 Mithaldu and that every frame
22:02 Mithaldu but i also need the pointer to the c data
22:03 sivoais if it's just an operation on a single vector, I would just use Inline::C
22:04 Mithaldu i've done that for a different operation, rotation of a vector
22:04 Mithaldu but honestly, it's a gigantic pain in the ass
22:04 Mithaldu if only for the fact that it needs to run gcc
22:05 Mithaldu also, the camera itself needs to remain accessible from the perl code
22:05 Mithaldu since i need to change the vectors depending on user input
22:06 sivoais Mithaldu: have you looked at the PDL C-API? that could reduce the pain, I think.
22:06 sivoais can't do much about the call to gcc though :-/
22:07 sivoais oh, I saw this the other day <https://metacpan.org/pod/Convert::Binary::C>
22:08 Mithaldu https://github.com/wchristian/ogldev/blob/perl/Common/math_3d.pm
22:08 Mithaldu it doesn't help that the documentation for that is extremely obscure as well
22:08 sivoais ah, I remember this code
22:08 Mithaldu i only got this far by trial and error and even then i don't know if it can be better
22:08 sivoais it is. the docs need a lot of overhaul. I totally agree with you there
22:09 Mithaldu http://matrix.cpantesters.org/?dist=Convert-Binary-C+0.76
22:09 Mithaldu not acceptable
22:09 sivoais ouch!
22:09 Mithaldu and last updated 2011
22:10 Mithaldu i might poke at it to see if i can make it less undisciplined
22:18 sivoais hmm, I'll have to take a look at your code some more later. There are some parts that can be made more PDL-y :-D
22:18 sivoais and then we can benchmark :-P
22:18 * sivoais .oO( PDLlic should totally be a thing )
22:19 sivoais speaking of graphics programming, I was also looking at Alien::SDL. That's one complex build. I wonder what can be done with Alien::Base to make that easier.
22:20 Mithaldu the one thing i'd like is a simple way to have ->x/y/z without too much magic
22:20 Mithaldu also keep in mind that i'm aiming to have it read roughly the same as the c code i'm porting
22:21 Mithaldu that way people can follow the tutorial without me needing to actually rewrite the tutorial text
22:22 sivoais ah, I see... interesting. I think I see a potential way of doing that with a PDL subclass
22:23 Mithaldu right
22:26 Mithaldu also sometimes the inline c stuff just fails to compile
22:26 Mithaldu it'll throw an error and if i rerun it it'll work
22:27 sivoais weird. which system?
22:28 jberger you really shouldn't need any of that pack/unpack
22:28 Mithaldu sivoais: windows, dmake
22:29 Mithaldu i never bothered to dig into it, since rerunning it fixes things, but eh
22:29 jberger $pdl->at(new_coords) .= $pdl->at(old_coords)
22:29 Mithaldu jberger: well i'm not using any unpack
22:30 sivoais ah. mohawk is the person to bug on that. he maintains dmake now. I know you're around... :-D
22:31 Mithaldu i'm not sure if it is a dmake error
22:31 Mithaldu kind of feels like a race condition
22:31 Mithaldu jberger: i suspect i didn't load in the stuff for that kind of overload to work
22:31 sivoais jberger: won't work ;-) at() returns a Perl scalar
22:32 jberger hmmm, good point
22:32 Mithaldu ah, so .= must have a pdl on the other end
22:32 Mithaldu yeah, that's kind of the whole thing i was griping about above
22:32 jberger Mithaldu: yeah, you need to slice it to the certian position
22:32 jberger I just forgot which method
22:32 Mithaldu there's no consistent api for putting in numbers and taking out numbers with the same operation
22:32 Mithaldu only other piddles
22:32 jberger there are probably "where" tricks for that too
22:33 jberger Mithaldu: for that you probably need to use PDLPp
22:33 jberger though it wouldn't be too awful I suspect
22:33 Mithaldu i think i'll just stick to what i ahve
22:33 * jberger wishes run4flat was around
22:33 Mithaldu it's workable and good enough
22:33 Mithaldu just needs better docs
22:40 Mithaldu i guess i should also note that performance is a minor concern right now
22:40 Mithaldu i'm still working on actually making all the required bits work in the first place
22:40 Mithaldu once they are, i can think about "GO FASTER"
22:41 Mithaldu the rotate was an exception because it was hilariously slow in perl
22:48 Mithaldu goddamn, this guy added 217 megabytes of stuff to his github repo
22:48 Mithaldu no wonder my push is taking ages

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary