Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-09-10 Thread 9il via Digitalmars-d
On Tuesday, 20 March 2018 at 12:10:08 UTC, Nordlöw wrote: On Tuesday, 13 March 2018 at 03:37:36 UTC, 9il wrote: I have a lot of work for next months, but looking for a good opportunity to make Mat happen. Sounds great. In which repo will these changes happen? It is planned to be in

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-20 Thread Nordlöw via Digitalmars-d
On Tuesday, 13 March 2018 at 03:37:36 UTC, 9il wrote: I have a lot of work for next months, but looking for a good opportunity to make Mat happen. Sounds great. In which repo will these changes happen?

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-19 Thread 9il via Digitalmars-d
On Thursday, 15 March 2018 at 14:13:25 UTC, jmh530 wrote: On Thursday, 15 March 2018 at 12:49:22 UTC, jmh530 wrote: [snip] It looks like it should expand the alias earlier. No problem with auto foo (T)(S!(1, T) v) {}; Also, this issue also shows up in mir.ndslice.traits. I had to do the

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-15 Thread jmh530 via Digitalmars-d
On Thursday, 15 March 2018 at 05:04:42 UTC, 9il wrote: [snip] BTW, could you please help with the following issue?! struct S(int b, T) { } alias V(T) = S!(1, T); auto foo (T)(V!T v) { } void main() { V!double v; foo(v); } Error: template onlineapp.foo cannot deduce function from

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-15 Thread jmh530 via Digitalmars-d
On Thursday, 15 March 2018 at 12:49:22 UTC, jmh530 wrote: [snip] It looks like it should expand the alias earlier. No problem with auto foo (T)(S!(1, T) v) {}; Also, this issue also shows up in mir.ndslice.traits. I had to do the equivalent of isV below. It doesn't work to do the alternate

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-15 Thread jmh530 via Digitalmars-d
On Thursday, 15 March 2018 at 05:04:42 UTC, 9il wrote: [snip] BTW, could you please help with the following issue?! struct S(int b, T) { } alias V(T) = S!(1, T); auto foo (T)(V!T v) { } void main() { V!double v; foo(v); } Error: template onlineapp.foo cannot deduce function from

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread 9il via Digitalmars-d
On Wednesday, 14 March 2018 at 16:16:55 UTC, Andrei Alexandrescu wrote: On 03/14/2018 01:01 AM, 9il wrote: On Tuesday, 13 March 2018 at 17:10:03 UTC, jmh530 wrote: "Note that using row-major ordering may require more memory and time than column-major ordering, because the routine must

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread 9il via Digitalmars-d
On Wednesday, 14 March 2018 at 12:45:24 UTC, jmh530 wrote: On Wednesday, 14 March 2018 at 05:01:38 UTC, 9il wrote: Maybe we should use only column major order. --Ilya In my head I had been thinking that the Mat type you want to introduce would be just an alias to a 2-dimensional Slice with

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread 9il via Digitalmars-d
On Tuesday, 13 March 2018 at 17:10:03 UTC, jmh530 wrote: [1] mir-lapack uses Canonical slices in many of these functions. I assume this is correct, but I have a nagging feeling that I should compare the results of some of these functions with another language to really convince myself...When

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Paul O'Neil via Digitalmars-d
On 03/14/2018 02:33 AM, 9il wrote: On Wednesday, 14 March 2018 at 05:40:42 UTC, Manu wrote: I'd like to understand why implement a distinct vector type, rather than just a Nx1/1xN matrix? This is just and API quesiton of how elements of Nx1/1xN matrix should be accessed. E.g. should one

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread jmh530 via Digitalmars-d
On Wednesday, 14 March 2018 at 23:30:55 UTC, Sam Potter wrote: [snip] OTOH, the fact that D doesn't have a REPL may kill it from the get go (hard to do exploratory data analysis). There is one in dlang-community (there might be others, can't recall), but it does not yet support Windows and

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Manu via Digitalmars-d
On 14 March 2018 at 09:16, Andrei Alexandrescu via Digitalmars-d wrote: > On 03/14/2018 01:01 AM, 9il wrote: >> >> On Tuesday, 13 March 2018 at 17:10:03 UTC, jmh530 wrote: >>> >>> "Note that using row-major ordering may require more memory and time than >>>

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Sam Potter via Digitalmars-d
On Wednesday, 14 March 2018 at 22:17:49 UTC, jmh530 wrote: On Wednesday, 14 March 2018 at 20:21:15 UTC, Sam Potter wrote: Sure. The key word in my statement was "ideally". :-) For what it's worth, there is already an "informal spec" in the form of the high-level interface for numerical

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread jmh530 via Digitalmars-d
On Wednesday, 14 March 2018 at 20:21:15 UTC, Sam Potter wrote: Sure. The key word in my statement was "ideally". :-) For what it's worth, there is already an "informal spec" in the form of the high-level interface for numerical linear algebra and sci. comp. that has been developed (over

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Sam Potter via Digitalmars-d
On Wednesday, 14 March 2018 at 17:36:18 UTC, bachmeier wrote: On Wednesday, 14 March 2018 at 17:22:16 UTC, Sam Potter wrote: Ideally data structures and algorithms covering this would be in the standard library? I sure hope not. At least not for a long time anyway. It would be hard to make

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread bachmeier via Digitalmars-d
On Wednesday, 14 March 2018 at 17:22:16 UTC, Sam Potter wrote: Ideally data structures and algorithms covering this would be in the standard library? I sure hope not. At least not for a long time anyway. It would be hard to make any progress if it were in the standard library. At this stage

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Sam Potter via Digitalmars-d
On Wednesday, 14 March 2018 at 16:16:55 UTC, Andrei Alexandrescu wrote: Maybe we should use only column major order. --Ilya Has row-major fallen into disuse? Leaving aside interop between libraries and domains where row major is often used (e.g. computer graphics), the issue is semantic, I

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread jmh530 via Digitalmars-d
On Wednesday, 14 March 2018 at 16:16:55 UTC, Andrei Alexandrescu wrote: Has row-major fallen into disuse? [snip] C has always been row major and is not in disuse (the GSL library has gsl_matrix and that is row-major). However, Fortran and many linear algebra languages/frameworks have also

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread Andrei Alexandrescu via Digitalmars-d
On 03/14/2018 01:01 AM, 9il wrote: On Tuesday, 13 March 2018 at 17:10:03 UTC, jmh530 wrote: "Note that using row-major ordering may require more memory and time than column-major ordering, because the routine must transpose the row-major order to the column-major order required by the

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread jmh530 via Digitalmars-d
On Wednesday, 14 March 2018 at 05:01:38 UTC, 9il wrote: Maybe we should use only column major order. --Ilya In my head I had been thinking that the Mat type you want to introduce would be just an alias to a 2-dimensional Slice with a particular SliceKind and iterator. Am I right on that?

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-14 Thread 9il via Digitalmars-d
On Wednesday, 14 March 2018 at 05:40:42 UTC, Manu wrote: I'd like to understand why implement a distinct vector type, rather than just a Nx1/1xN matrix? This is just and API quesiton of how elements of Nx1/1xN matrix should be accessed. E.g. should one specify one or two arguments to access

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread Manu via Digitalmars-d
On 12 March 2018 at 20:37, 9il via Digitalmars-d wrote: > Hi All, > > The Dlang multidimensional range type, ndslice, is a struct composed a an > iterator, lengths and possibly strides. It does not own memory and does not > know anything about its content. ndslice is

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread 9il via Digitalmars-d
On Tuesday, 13 March 2018 at 17:10:03 UTC, jmh530 wrote: "Note that using row-major ordering may require more memory and time than column-major ordering, because the routine must transpose the row-major order to the column-major order required by the underlying LAPACK routine." Maybe we

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread bachmeier via Digitalmars-d
On Tuesday, 13 March 2018 at 22:08:10 UTC, jmh530 wrote: With respect to interacting with libraries, I agree that a user should choose either row-order or column-order and stick to it. But what options are available for the user of a column-major language (or array library) to call mir if mir

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 21:04:28 UTC, bachmeier wrote: What I have settled on is Row(x,2), which returns a range that works with foreach. I tried x[_,2] to return Row(x,2) but didn't like reading it, so I went with x[_all,2] instead. Similarly for Col(x,2) and x[2,_all]. The exact form

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread bachmeier via Digitalmars-d
On Tuesday, 13 March 2018 at 12:09:04 UTC, jmh530 wrote: On Tuesday, 13 March 2018 at 10:39:29 UTC, 9il wrote: On Tuesday, 13 March 2018 at 05:36:06 UTC, J-S Caux wrote: Your suggestion [4] that matrix[i] returns a Vec is perhaps too inflexible. What one needs sometimes is to return a row,

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 16:40:13 UTC, 9il wrote: On Tuesday, 13 March 2018 at 14:13:02 UTC, jmh530 wrote: [snip] I'm not sure I understand what your syntax solution does... matrix(j, i) == matrix[i, j] (reversed order) Hopefully, I made the issue more clean in my response to Martin.

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 15:47:36 UTC, Martin Tschierschke wrote: I think for mathematics it is more important for easy handling, to be able to get the element of a matrix a_ij by a(i,j) and not only by a[i-1,j-1]. [snip] I didn't really address this in my other post. What you're

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 15:47:36 UTC, Martin Tschierschke wrote: On Tuesday, 13 March 2018 at 14:13:02 UTC, jmh530 wrote: [...] https://en.wikipedia.org/wiki/Row-_and_column-major_order I think for mathematics it is more important for easy handling, to be able to get the element of a

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread 9il via Digitalmars-d
On Tuesday, 13 March 2018 at 14:13:02 UTC, jmh530 wrote: On Tuesday, 13 March 2018 at 13:02:45 UTC, Ilya Yaroshenko wrote: On Tuesday, 13 March 2018 at 12:23:23 UTC, jmh530 wrote: [...] Good point. Would matrix(j, i) syntax solve this issue? One of reasons to introduce Mat is API

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread Martin Tschierschke via Digitalmars-d
On Tuesday, 13 March 2018 at 14:13:02 UTC, jmh530 wrote: [...] https://en.wikipedia.org/wiki/Row-_and_column-major_order I think for mathematics it is more important for easy handling, to be able to get the element of a matrix a_ij by a(i,j) and not only by a[i-1,j-1]. The underlying

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 13:02:45 UTC, Ilya Yaroshenko wrote: On Tuesday, 13 March 2018 at 12:23:23 UTC, jmh530 wrote: On Tuesday, 13 March 2018 at 10:35:15 UTC, 9il wrote: On Tuesday, 13 March 2018 at 04:35:53 UTC, jmh530 wrote: [snip] What's TMMat? TMat is a transposed matrix. Not

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread Ilya Yaroshenko via Digitalmars-d
On Tuesday, 13 March 2018 at 12:23:23 UTC, jmh530 wrote: On Tuesday, 13 March 2018 at 10:35:15 UTC, 9il wrote: On Tuesday, 13 March 2018 at 04:35:53 UTC, jmh530 wrote: [snip] What's TMMat? TMat is a transposed matrix. Not sure for now if it would be required. There are some people who

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 10:35:15 UTC, 9il wrote: On Tuesday, 13 March 2018 at 04:35:53 UTC, jmh530 wrote: [snip] What's TMMat? TMat is a transposed matrix. Not sure for now if it would be required. There are some people who like being able to specify a whether a matrix has column

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 12:16:27 UTC, jmh530 wrote: Some kind of improvement that replaces 0 .. $ with some shorter syntax has been brought up in the past. https://github.com/libmir/mir-algorithm/issues/53 Sorry for double post.

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 10:39:29 UTC, 9il wrote: On Tuesday, 13 March 2018 at 05:36:06 UTC, J-S Caux wrote: Your suggestion [4] that matrix[i] returns a Vec is perhaps too inflexible. What one needs sometimes is to return a row, or a column of a matrix, so a notation like matrix[i, ..]

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread Martin Tschierschke via Digitalmars-d
On Tuesday, 13 March 2018 at 03:37:36 UTC, 9il wrote: [...] 5. Clever `=` expression based syntax. For example: // performs CBLAS call of GEMM and does zero memory allocations C = alpha * A * B + beta * C; [...] My answer is: Yes. If D with Lubeck would have such a convenient way to

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 10:39:29 UTC, 9il wrote: On Tuesday, 13 March 2018 at 05:36:06 UTC, J-S Caux wrote: Your suggestion [4] that matrix[i] returns a Vec is perhaps too inflexible. What one needs sometimes is to return a row, or a column of a matrix, so a notation like matrix[i, ..]

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread 9il via Digitalmars-d
On Tuesday, 13 March 2018 at 05:36:06 UTC, J-S Caux wrote: Your suggestion [4] that matrix[i] returns a Vec is perhaps too inflexible. What one needs sometimes is to return a row, or a column of a matrix, so a notation like matrix[i, ..] or matrix[.., j] returning respectively a row or

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-13 Thread 9il via Digitalmars-d
On Tuesday, 13 March 2018 at 04:35:53 UTC, jmh530 wrote: 5. Clever `=` expression based syntax. For example: // performs CBLAS call of GEMM and does zero memory allocations C = alpha * A * B + beta * C; You might want to explain this in more detail. I saw expression and my head went

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-12 Thread J-S Caux via Digitalmars-d
On Tuesday, 13 March 2018 at 03:37:36 UTC, 9il wrote: Hi All, The Dlang multidimensional range type, ndslice, is a struct composed a an iterator, lengths and possibly strides. It does not own memory and does not know anything about its content. ndslice is a faster and extended version of

Re: Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-12 Thread jmh530 via Digitalmars-d
On Tuesday, 13 March 2018 at 03:37:36 UTC, 9il wrote: [snip] 4. matrix[i] returns a Vec and increase ARC, matrix[i, j] returns a content of the cell. I'm not 100% sold on matrix[i] returning a Vec instead of a 1-dimensional matrix. R does something similar and you have to convert things

Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?

2018-03-12 Thread 9il via Digitalmars-d
Hi All, The Dlang multidimensional range type, ndslice, is a struct composed a an iterator, lengths and possibly strides. It does not own memory and does not know anything about its content. ndslice is a faster and extended version of numpy.ndarray. After some work on commercial projects