Read-only forum archive

Get size of bigintmat

Get size of bigintmat

monomial · Tue Sep 27, 2016 4:19 pm

Hi all,

if I call size for a bigintmat, it will cause an error.

Code:
> bigintmat mymat[2][4] = 1,2,3,4,5,6,8;
> size(mymat);                                                                                                                                               
   ? size(`bigintmat`) failed                                                                                                                               
   ? expected size(`bigint`)
   ? expected size(`number`)
   ? expected size(`resolution`)
   ? expected size(`string`)
   ? expected size(`poly`)
   ? expected size(`vector`)
   ? expected size(`ideal`)
   ? expected size(`module`)
   ? expected size(`matrix`)
   ? expected size(`intvec`)
   ? expected size(`intmat`)
   ? expected size(`list`)
   ? expected size(`ring`)
How can I get the total number of entries of a bigintmat besides explicit conversion to intmat? I'd like to be able to call size(mymat) where mymat is of type bigintmat.

Re: Get size of bigintmat

vinay · Wed Sep 28, 2016 9:23 am

The size function in Singular for a matrix is very misleading, though may be useful is some situations. Further as per the man page of size, it does not accept bigintmat.

The best way to get the size of a matrix / intmat / bigintmat is to use nrows and ncols functions.

Code:
> bigintmat mymat[2][4] = 1,2,3,4,5,6,8;
> nrows (mymat);
> ncols (mymat);



VInay