<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Calibri">Hello,<br>
<br>
diag works both ways:<br>
<br>
</font><br>
<div class="moz-cite-prefix">Le 17/06/2015 09:22,
<a class="moz-txt-link-abbreviated" href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a> a écrit :<br>
</div>
<blockquote
cite="mid:1806214808.556968627.1434525732642.JavaMail.root@zimbra5-e1.priv.proxad.net"
type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<br>
<tt>-->A = [1 0 0 0 ; 0 6 0 0 ; 0 0 -5 0 ; 0 0 0 31]</tt><tt><br>
</tt><tt> A =</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> 1. 0. 0. 0. </tt><tt><br>
</tt><tt> 0. 6. 0. 0. </tt><tt><br>
</tt><tt> 0. 0. - 5. 0. </tt><tt><br>
</tt><tt> 0. 0. 0. 31. </tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt>-->B = diag(A)</tt><tt><br>
</tt><tt> B =</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> 1. </tt><tt><br>
</tt><tt> 6. </tt><tt><br>
</tt><tt> - 5. </tt><tt><br>
</tt><tt> 31. </tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt>-->C = diag(B)</tt><tt><br>
</tt><tt> C =</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> 1. 0. 0. 0. </tt><tt><br>
</tt><tt> 0. 6. 0. 0. </tt><tt><br>
</tt><tt> 0. 0. - 5. 0. </tt><tt><br>
</tt><tt> 0. 0. 0. 31. </tt><br>
<blockquote
cite="mid:1806214808.556968627.1434525732642.JavaMail.root@zimbra5-e1.priv.proxad.net"
type="cite">
<pre wrap="">
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: <a class="moz-txt-link-abbreviated" href="mailto:jbaudais@insa-rennes.fr">jbaudais@insa-rennes.fr</a> <a class="moz-txt-link-rfc2396E" href="mailto:Jean-Yves.Baudais@insa-rennes.fr"><Jean-Yves.Baudais@insa-rennes.fr></a>
À: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
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, <a class="moz-txt-link-abbreviated" href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a> a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap="">
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
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Pierre-Aimé Agnel
R&D Projects Manager
Phone: +33.1.80.77.04.67
Mobile: +33.6.82.49.35.23
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a> </pre>
</body>
</html>