[Scilab-users] Re : Re: opposite to 'diag' keyword

paul.carrico at free.fr paul.carrico at free.fr
Wed Jun 17 09:22:12 CEST 2015


No

A basic example:

-->A = [1 0 0 0 ; 0 6 0 0 ; 0 0 -5 0 ; 0 0 0 31]
 A  =
 
    1.    0.    0.    0.   
    0.    6.    0.    0.   
    0.    0.  - 5.    0.   
    0.    0.    0.    31.  
 
-->B = diag(A)
 B  =
 
    1.   
    6.   
  - 5.   
    31.  
 

how a rebuild A from B .... 

NB: 
- the purpose is to find a basic but fast way to build a symmetrical matrix using the following syntax for example : K = K +Kd + K'
- where K is the triangle upper (or lower) matrix and Kd is the diagonal
- I want to decrease the amount of memory in avoiding to use a (nxn) matrix


Paul

----- Mail d'origine -----
De: jbaudais at insa-rennes.fr <Jean-Yves.Baudais at insa-rennes.fr>
À: users at lists.scilab.org
Envoyé: Wed, 17 Jun 2015 09:14:39 +0200 (CEST)
Objet: Re: [Scilab-users] opposite to 'diag' keyword

Hello,

Le 17/06/2015 09:05, paul.carrico at free.fr a écrit :
> The question is quite basic: I'm trying to opposite to 'diag' keyword in order to build a diagonal matrix from a vector, but I fail so far ... what is the trick?

   The diag help says "diagonal including or extracting"
 > diag([1 2])
gives the matrix [1 0;0 2]
   Is it the "opposite" you want?

--Jean-Yves
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list