digitalmars.D.announce - dlib - d utility library
- Timur Gafarov <gecko0307 gmail.com> Sep 28 2012
- "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> Sep 28 2012
- "Danny Arends" <Danny.Arends gmail.com> Sep 28 2012
- "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> Sep 28 2012
- "Peter Alexander" <peter.alexander.au gmail.com> Sep 28 2012
- Timur Gafarov <gecko0307 gmail.com> Sep 29 2012
- Jacob Carlborg <doob me.com> Sep 29 2012
- Dmitry Olshansky <dmitry.olsh gmail.com> Sep 29 2012
- Dmitry Olshansky <dmitry.olsh gmail.com> Sep 29 2012
- Rory McGuire <rjmcguire gmail.com> Sep 29 2012
dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos. Currently dlib contains the following packages: dlib.core - standard algorithms, data structures, useful templates, etc. dlib.functional - some functional programming idioms (HOFs, combiners, quantifiers, etc.) dlib.math - linear algebra (vectors, matrices, quaternions, etc.) dlib.geometry - computational geometry (ray casting, primitives, etc.) dlib.image - image processing (filters, color correction, graphics formats I/O, support for 8 and 16-bit RGBA buffers and floating point operations). http://code.google.com/p/dlib/
Sep 28 2012
On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos. Currently dlib contains the following packages: dlib.core - standard algorithms, data structures, useful templates, etc. dlib.functional - some functional programming idioms (HOFs, combiners, quantifiers, etc.) dlib.math - linear algebra (vectors, matrices, quaternions, etc.) dlib.geometry - computational geometry (ray casting, primitives, etc.) dlib.image - image processing (filters, color correction, graphics formats I/O, support for 8 and 16-bit RGBA buffers and floating point operations). http://code.google.com/p/dlib/
Apart from a description of the project this site seems empty! Is there anywhere a person can download the source code/try this out. Thanks. Craig
Sep 28 2012
Apart from a description of the project this site seems empty! Is there anywhere a person can download the source code/try this out.
If you want to browse it online (without check-out): http://code.google.com/p/dlib/source/browse/ Gr, Danny
Sep 28 2012
On Friday, 28 September 2012 at 13:29:05 UTC, Danny Arends wrote:Apart from a description of the project this site seems empty! Is there anywhere a person can download the source code/try this out.
If you want to browse it online (without check-out): http://code.google.com/p/dlib/source/browse/ Gr, Danny
Thanks. Now I was able to find it. Craig
Sep 28 2012
On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos.
A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i]; I've also noticed that you've provided Matrix2x2 and Matrix4x4 as separate structs from the more generic Matrix. I'm guessing this is for specialisation. A more idiomatic way to handle this would be to use template specialisation to provide the optimised versions. That way, when people use Matrix!(T, 2, 2) they get all the benefits of Matrix2x2!T as well.
Sep 28 2012
28.09.2012 20:47, Peter Alexander пишет:On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos.
A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i]; I've also noticed that you've provided Matrix2x2 and Matrix4x4 as separate structs from the more generic Matrix. I'm guessing this is for specialisation. A more idiomatic way to handle this would be to use template specialisation to provide the optimised versions. That way, when people use Matrix!(T, 2, 2) they get all the benefits of Matrix2x2!T as well.
Thanks! I didn't realize that about vectors. I'm interested in performance optimization, so I will fix that as soon as possible. As for matrices - I used Matrix4x4 for a long time (that was just the simplest way), and recently introduced that generalized version. Eventually I will port everything into it.
Sep 29 2012
On 2012-09-28 19:47, Peter Alexander wrote:A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i];
Isn't the whole point of the array operators that it gives the compiler more semantic understanding of the code. Just as a foreach-loop does compared to a for-loop. So the compiler should be able to optimize this and generated the most optimal code. But the compiler might not be that good. -- /Jacob Carlborg
Sep 29 2012
On 28-Sep-12 21:47, Peter Alexander wrote:On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos.
A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i];
(if size is fixed and is small e.g. < 10). foreach (i; TypeTuple!(1, 2, 3, 4 ... )) //too bad we still don't have static Iota in Phobos { arrayof[i] += v.arrayof[i]; } -- Dmitry Olshansky
Sep 29 2012
On 29-Sep-12 20:39, Dmitry Olshansky wrote:On 28-Sep-12 21:47, Peter Alexander wrote:On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos.
A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i];
(if size is fixed and is small e.g. < 10). foreach (i; TypeTuple!(1, 2, 3, 4 ... ))
//too bad we still don't have static Iota in Phobos { arrayof[i] += v.arrayof[i]; }
-- Dmitry Olshansky
Sep 29 2012
--14dae93b5c5863e73204cad6db29 Content-Type: text/plain; charset=UTF-8 On Sep 29, 2012 2:55 PM, "Jacob Carlborg" <doob me.com> wrote:On 2012-09-28 19:47, Peter Alexander wrote:A note on your Vector implementation. Currently you use the vector operators, e.g. Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i];
Isn't the whole point of the array operators that it gives the compiler
compared to a for-loop. So the compiler should be able to optimize this and generated the most optimal code. But the compiler might not be that good.-- /Jacob Carlborg
--14dae93b5c5863e73204cad6db29 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p><br> On Sep 29, 2012 2:55 PM, "Jacob Carlborg" <<a href=3D"mailto:d= oob me.com">doob me.com</a>> wrote:<br> ><br> > On 2012-09-28 19:47, Peter Alexander wrote:<br> ><br> >> A note on your Vector implementation. Currently you use the vector= <br> >> operators, e.g.<br> >><br> >> =C2=A0 =C2=A0 =C2=A0Vector!(T,size) opAddAssign (Vector!(T,size) v= )<br> >> =C2=A0 =C2=A0 =C2=A0body<br> >> =C2=A0 =C2=A0 =C2=A0{<br> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0arrayof[] +=3D v.arrayof[];<br> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return this;<br> >> =C2=A0 =C2=A0 =C2=A0}<br> >><br> >> This is fine for large vectors, but (correct me if I'm wrong),= your<br> >> vector class appears to be designed for small vectors. Those vecto= r ops<br> >> currently call a asm optimised function that uses SIMD instruction= s in a<br> >> loop - it works well for larger vectors with hundreds of elements,= but<br> >> for small vectors it's significantly faster to just use:<br> >><br> >> foreach (i; 0..size)<br> >> =C2=A0 =C2=A0 =C2=A0arrayof[i] +=3D v.arrayof[i];<br> ><br> ><br> > Isn't the whole point of the array operators that it gives the com= piler more semantic understanding of the code. Just as a foreach-loop does = compared to a for-loop. So the compiler should be able to optimize this and= generated the most optimal code. But the compiler might not be that good.<= br> ><br> > -- <br> > /Jacob Carlborg<br> +1<br> </p> --14dae93b5c5863e73204cad6db29--
Sep 29 2012









"Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> 