> > I added two more commits that implement 'one(m,n)' > > and 'identity(n)' as tiny wrappers around some other > > functions. These are pure convenience features. > > > > For some obscure(?) reason I can not call the > > identity function. > > I must admit that I have doubts if the functions are useful > enough to be included. 'identity(n)' essentially saves > typing '1' compared to 'scalarMatrix(n, 1)'. The same > for 'one(n, m)' compared to 'new(n, m, 1)'.
There is also another point about usability: "identity" feels more natural and much easier to remember than "scalarMatrix". The same holds for "one". But maybe I'm a little biased from using octave and numpy ... > This is very small gain. As stated above, its pure convenience for the user. The only (potential) gain is usability. > BTW: Both signature on export list and implementation should > be guarded by the 'if R has SemiRing then ...' Added that. There are two more functions I have in mind. (And which I wanted to use recently.) diagonal Matrix -> Matrix diagonal (Matrix, INT) -> Matrix They extract the diagonal or the n-th off-diagonal of a matrix and put the values into a new matrix (of same shape). What is the best way to do this with the available functions in Fricas? I found there is a "diagonal" function returning a DirectProduct(...) thing. Hence my solution looks like: diagonalMatrix(coerce(diagonal(M))@Vector(...)) which I consider pretty ugly. There must be a better way ... BTW: Thanks for merging the other part. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.
