[Scilab-users] sparse() to build a block-diagonal matrix?

classic Classic list List threaded Threaded
3 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] sparse() to build a block-diagonal matrix?

Hello,

In the sysdiag() page, it is stated that sparse() can be used to build a block-diagonal matrix:
"Beside this function, you can also use sparse() primitive to build a block diagonal sparse matrix."

But i did not find any description nor example of such a feature in
the sparse() page.
I have quickly tried some "exotic" syntaxes, without result.

Does anyone know if this feature actually exists, and if so what's its syntax?

I know that sysdiag() works also with sparse objects.
There are several issues in the sysdiag() page, and i would like to have clear ideas about the reference to sparse.

Thanks
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: sparse() to build a block-diagonal matrix?

Hi, 

from the first glance on the documentation you show:

"Beside this function, you can also use sparse() primitive to build a block diagonal sparse matrix."

it sound to me that this statement said the sparse could be used to create block diagonal matrix with the similar inputs to sysdiag.


But after a trying to stare at it again... I think it might mean:

" to convert the block diagonal matrix to block diagonal sparse matrix "

which likely is the one shown in the example: 
S=sysdiag([1 2; 3 4], [5 6; 7 8], [9 10; 11 12], [13 14; 15 16])
S=sparse(S)
which simply to say that we could use sparse to convert the full matrix created by sysdiag to sparse?

Thanks.
CL






---- On Mon, 25 Nov 2019 23:02:42 +0800 Samuel Gougeon <[hidden email]> wrote ----

Hello,

In thesysdiag() page, it is stated that sparse() can be used to build a block-diagonal matrix:
"Beside this function, you can also use sparse() primitive to build a block diagonal sparse matrix."

But i did not find any description nor example of such a feature in
the sparse() page.
I have quickly tried some "exotic" syntaxes, without result.

Does anyone know if this feature actually exists, and if so what's its syntax?

I know that sysdiag() works also with sparse objects.
There are several issues in the sysdiag() page, and i would like to have clear ideas about the reference to sparse.

Thanks
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: sparse() to build a block-diagonal matrix?

Le 26/11/2019 à 03:43, Chin Luh Tan a écrit :
Hi, 

from the first glance on the documentation you show:

"Beside this function, you can also use sparse() primitive to build a block diagonal sparse matrix."

it sound to me that this statement said the sparse could be used to create block diagonal matrix with the similar inputs to sysdiag.


But after a trying to stare at it again... I think it might mean:

" to convert the block diagonal matrix to block diagonal sparse matrix "

which likely is the one shown in the example: 
S=sysdiag([1 2; 3 4], [5 6; 7 8], [9 10; 11 12], [13 14; 15 16])
S=sparse(S)
which simply to say that we could use sparse to convert the full matrix created by sysdiag to sparse?


Chin Luh,

You are right.

Yesterday evening i posted a wish to improve sysdiag(), and also to rename it blockdiag() (but both aspects are distinct). I have rewritten sysdiag() as indicated in the wish, and made an additional improvement, that is: When at least one input is sparse, the result is built as a sparse from the beginning, instead of only when the first sparse input is met and included in the result. Hence, the probability of a memory issue is decreased.

Best regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users