[Scilab-users] Empty matrix

classic Classic list List threaded Threaded
8 messages Options
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Empty matrix

Hello,

Thanks to the discussion started by Samuel and the document provided by Rafael (de Boor 1990)
(see http://mailinglists.scilab.org/Scilab-users-Is-cond-0-or-1-bug-15579-td4037987.html )
I discovered this astonishing mathematical object: the empty matrix.

Our only use of this in Scilab is the validity of limit cases.
If we don't have to test the emptiness of a matrix,
it makes the life easier.

However, we also expect that the behavior of such matrices is consistent with the linear algebra.

========== Linear algebra of empty matrices ==========

So a few elements: let us consider a field K (usually K is ℝ or ℂ).
The zero vector space is K^0 = {0}.
This is the most trivial vector space, its dimension is 0 (geometrically it is a point).

Let us now consider E, a K-vector space of dimension n.
There is one unique linear map from E to K^0 which can be represented by the n × 0 empty matrix.
There is also a unique linear map from K^0 to E which can be represented by the 0 × n empty matrix.
And there is a unique linear map from K^0 to K^0 which is represented by the 0 × 0 empty matrix.

The product of the 0 × n matrix by a n × p matrix is the 0 × p empty matrix.
The product of a m × n matrix by the n × 0 matrix is the m × 0 empty matrix.
The product of the m × 0 matrix by the 0 × p matrix is the zeros(m, p) matrix.

So the product of two empty matrices is not always an empty matrix…

Additionally: the 0 × 0 empty matrix is Id0, the identity of K^0.
It is thus a regular matrix.
As the identity, it explains why det([]) = 1
and why some considere that cond([]) = 1 (as for any identity matrix) although it breaks the formula using the norms.

========== About Scilab ==========

Scilab consider only one empty matrix, the 0 × 0, denoted [].
The following features are correct:

sum([]) == 0 // identity element of addition

prod([]) == 1 // identity element of product, also convention for the empty product

inv([]) == []

[]^-1 == [] // but a warning message shows up

cond([]) == 1 // however this is imho more a matter of conventions and 0 is also correct

[]\[] == []

[]/[] == []

linsolve([], []) == []// but a warning message shows up

[]\[0] == []

[0]/[] == []

linsolve([], [0]) == []

The following features are obviously wrong and misleading:

det([]) == 0 // should be 1

linsolve([], [1 1]) == -1 // or can someone explain this result

The following features are algebraically wrong but are acceptable as rules to process special cases
such as a result of find(), e.g. find(a<b) with incidentally a = 1 and b = 0

A + [] == [] // the sum is an internal operation so it is only valid when A = []

A*[] == [] // not always, even not always defined, depends on the dimension of A, see above

[]\[1 1] == [] // only []\[] or []\zeros(n, 1) should be defined as the result of []*x can only be [] or zeros(n, 1)

[1 1]/[] == [] // same as above

========== What do I expect ? ==========

Not much (-: it is more a kind of state of the art, food for thoughts.

The two bugs det([]) == 0 and linsolve([], [1 1]) == -1 should be fixed.

I think it would be better if Scilab sticks with the linear algebra,
just because some teacher could say to their students "play a little bit with Scilab"
and you know where this kind of experiments can lead :-D
but I don't think it is important for the calculation.

However, checking the consistency of the dimensions for + and * is a good rule
and it should imho be done even when [] is involved
(unless people use intensively this feature for some obscure reasons).

However, note that Matlab consider three empty matrices:
[] (0 × 0), 0 × 1 and 1 × 0
the two later cannot be defined as such but can be easily obtained with
find(ones(2, 1) < zeros(2, 1))
and Matlab checks the dimension consistency for + and *.

Also note that R processes all the product with empty matrices correctly:
play a little bit with things like

M <- matrix(, nrow=2, ncol=0)

and the like.

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Empty matrix

Hi Christophe,

Quite impressive summary.

Fyi, the following reference on empty matrices algebra is extremelly good (and it even refers to de Boor memo and some previous ideas on the subject):

Nett, C. N.  and W. M. Haddad [1993] "A system-theoretic appropriate realization of the empty matrix concept," IEEE Transactions on Automatic Control, vol. 38, no. 5, pp. 771-775

Nett and Haddad define empty matrices of size []mxn and argue that "the empty matrix concept has the  potential to provide an elegant, general means for transparently  handling special cases in matrix formulas corresponding to the absence of one or more of the matrices involved."

Another interesting message from that article:
" ... we have purposely avoided any and all discussion of anything but the purely algebraic properties of empty matrices. For example, we have purposely not discussed the determinant, eigenvalues, singular values, or norm of an empty matrix. The reason for this is because we feel strongly that the empty matrix concept has utility only from a purely algebraic standpoint. Note, however, that determinants, eigenvalues, singular values, and norms of  empty matrices are considered in the current version of MATLAB."

Regards,
Rafael

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

[Scilab-users] orthogonal polynomials

In reply to this post by Christophe Dang Ngoc Chan
Hello,

I wish to use orthogonal polynmials within Scilab. Axxording to
"ttps://atoms.scilab.org/toolboxes/Ortpol",  I do

      atomsInstall('Ortpol')

and I get the answer

atomsInstallList: The package "Ortpol" is not registered.
Please check on the ATOMS repository that it is available for Scilab 6.0
on Windows.
If it is, run atomsSystemUpdate() before trying atomsInstall(..) again.

Where did I go wrong ? Is there a workaround ? Thank you in advance for
your help.

Jean-Philippe Grivet



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

_______________________________________________
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: orthogonal polynomials

Hello,

Le 06/06/2018 à 16:46, Jean-Philippe Grivet a écrit :

> Hello,
>
> I wish to use orthogonal polynmials within Scilab. Axxording to
> "ttps://atoms.scilab.org/toolboxes/Ortpol",  I do
>
>      atomsInstall('Ortpol')
>
> and I get the answer
>
> atomsInstallList: The package "Ortpol" is not registered.
> Please check on the ATOMS repository that it is available for Scilab
> 6.0 on Windows.
> If it is, run atomsSystemUpdate() before trying atomsInstall(..) again.

As the message suggests it, you have checked on the ATOMS repository that
Ortpol was not available for Scilab 6.0 on Windows.

>
> Where did I go wrong ? Is there a workaround ? Thank you in advance
> for your help.

Ortpol is now ported to Scilab 6.0 (+ some examples fixed). You may do:

atomsSystemUpdate()
atomsInstall Ortpol
exit
// Start a new session
atomsLoad Ortpol


Samuel

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

Re: orthogonal polynomials

Thank you Samuel. However, there are some remaining bugs !When I launch
Scilab, I ger the following d=series of messages:

Start Linalg
Start Makematrix
Start Specfun
Start Helptbx
Start Distfun
Start Stixbox
Start Apifun
     Load macros
     Load help
     Type "help apifun_overview" for quick start.
Start Ortpol
     Load macros
     Load help
     Load demos
     Type "help ortpol_overview" for quick start.
     Type "demo_gui()" and search for "Ortpol" for Demonstrations.

So far so good. I type help ortôl_overview and I am redirected to the
last help^page I l consulted ("disp" in the present case). Back to the
console, I write demo_gui() and chose ortpoly in the popup menu. Scilab
replies

à la ligne   -11 du fichier exécuté
C:\Users\grivet\AppData\Local\SCILAB~1.1\contrib\Ortpol\0315DD~1.1\demos\Ortpol.dem.gateway.sce
à la ligne    41 de la fonction demo_gui_update (
C:\Users\grivet\AppData\Local\scilab-6.0.1\modules\demo_tools\macros\demo_gui_update.sci
ligne 58 )
get_absolute_file_path : Le fichier ortpol.dem.gateway.sce n'est pas
ouvert dans Scilab.

Further question: What should I do to uninstall these modules ?

JP Grivet



Le 09/06/2018 à 12:11, Samuel Gougeon a écrit :

> Hello,
>
> Le 06/06/2018 à 16:46, Jean-Philippe Grivet a écrit :
>> Hello,
>>
>> I wish to use orthogonal polynmials within Scilab. Axxording to
>> "ttps://atoms.scilab.org/toolboxes/Ortpol",  I do
>>
>>      atomsInstall('Ortpol')
>>
>> and I get the answer
>>
>> atomsInstallList: The package "Ortpol" is not registered.
>> Please check on the ATOMS repository that it is available for Scilab
>> 6.0 on Windows.
>> If it is, run atomsSystemUpdate() before trying atomsInstall(..) again.
>
> As the message suggests it, you have checked on the ATOMS repository that
> Ortpol was not available for Scilab 6.0 on Windows.
>
>>
>> Where did I go wrong ? Is there a workaround ? Thank you in advance
>> for your help.
>
> Ortpol is now ported to Scilab 6.0 (+ some examples fixed). You may do:
>
> atomsSystemUpdate()
> atomsInstall Ortpol
> exit
> // Start a new session
> atomsLoad Ortpol
>
>
> Samuel
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

_______________________________________________
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: orthogonal polynomials

Le 09/06/2018 à 18:59, Jean-Philippe Grivet a écrit :

> Thank you Samuel. However, there are some remaining bugs !When I
> launch Scilab, I ger the following d=series of messages:
>
> Start Linalg
> Start Makematrix
> Start Specfun
> Start Helptbx
> Start Distfun
> Start Stixbox
> Start Apifun
>     Load macros
>     Load help
>     Type "help apifun_overview" for quick start.
> Start Ortpol
>     Load macros
>     Load help
>     Load demos
>     Type "help ortpol_overview" for quick start.
>     Type "demo_gui()" and search for "Ortpol" for Demonstrations.
>
> So far so good. I type help ortôl_overview and I am redirected to the
> last help^page I l consulted ("disp" in the present case).

You must close and reopen the help browser, to make it aware of the new
loaded modules and their documentation.

> Back to the console, I write demo_gui() and chose ortpoly in the popup
> menu. Scilab replies
>
> à la ligne   -11 du fichier exécuté
> C:\Users\grivet\AppData\Local\SCILAB~1.1\contrib\Ortpol\0315DD~1.1\demos\Ortpol.dem.gateway.sce
> à la ligne    41 de la fonction demo_gui_update (
> C:\Users\grivet\AppData\Local\scilab-6.0.1\modules\demo_tools\macros\demo_gui_update.sci
> ligne 58 )
> get_absolute_file_path : Le fichier ortpol.dem.gateway.sce n'est pas
> ouvert dans Scilab.

I get the same error, indeed. Please report it on the Ortpol forge.

>
> Further question: What should I do to uninstall these modules ?

Which ones? Linalg to Apifun, that you did not required? There are
dependencies of Ortpol. If you uninstall them, some Ortpol code will fail.

To uninstall Ortpol:
--> atomsRemove Ortpol
This will also uninstall its dependencies, provided that they are not
used by some other modules installed intentionnaly.

Samuel

_______________________________________________
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: orthogonal polynomials

In reply to this post by jean-philippe grivet
Le 09/06/2018 à 18:59, Jean-Philippe Grivet a écrit :

> Thank you Samuel. However, there are some remaining bugs !When I
> launch Scilab, I ger the following d=series of messages:
>
> Start Linalg
> Start Makematrix
> Start Specfun
> Start Helptbx
> Start Distfun
> Start Stixbox
> Start Apifun
>     Load macros
>     Load help
>     Type "help apifun_overview" for quick start.
> Start Ortpol
>     Load macros
>     Load help
>     Load demos
>     Type "help ortpol_overview" for quick start.
>     Type "demo_gui()" and search for "Ortpol" for Demonstrations.
>
> So far so good. I type help ortôl_overview and I am redirected to the
> last help^page I l consulted ("disp" in the present case). Back to the
> console, I write demo_gui() and chose ortpoly in the popup menu.
> Scilab replies
>
> à la ligne   -11 du fichier exécuté
> C:\Users\grivet\AppData\Local\SCILAB~1.1\contrib\Ortpol\0315DD~1.1\demos\Ortpol.dem.gateway.sce
> à la ligne    41 de la fonction demo_gui_update (
> C:\Users\grivet\AppData\Local\scilab-6.0.1\modules\demo_tools\macros\demo_gui_update.sci
> ligne 58 )
> get_absolute_file_path : Le fichier ortpol.dem.gateway.sce n'est pas
> ouvert dans Scilab.

This is now fixed in the 0.3.2 version. You may do
--> atomsSystemUpdate(); atomsUpdate Ortpol

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

Re: {EXT} Re: Empty matrix

In reply to this post by Rafael Guerra
Hello,

> De : users [mailto:[hidden email]] De la part de Rafael Guerra
> Envoyé : mardi 5 juin 2018 23:42
>
> Fyi, the following reference on empty matrices algebra is extremelly good [...]
> Nett, C. N.  and W. M. Haddad [1993] "A system-theoretic appropriate realization of the empty matrix concept,"
> IEEE Transactions on Automatic Control, vol. 38, no. 5, pp. 771-775

Thanks for this reference. It can be found here:
https://haddad.gatech.edu/journal/00277245.pdf

Some quotations:

"The elegance afforded by the empty matrix approach can
potentially be exploited to great advantage in the context of
large-scale software development. Indeed, the traditional approach
to special cases one must include in the software explicit
checks for special cases along with appropriate provisions for
each special case. This would be done for each matrix formula
implemented in the software with potential for special cases of
the type described above. Using the empty matrix approach, one
would simply introduce the empty matrix as an object, or data
type, and then code its algebraic realization. This would be done
only once. Subsequent code would then be devoid of cumbersome
explicit checks and provisions for special cases of the type
described above."

" Additionally,
the examples are used to show how the empty matrix concept
can be utilized to transparently handle static and/or single
vector input, single vector output (SVISVO) systems within the
more general context of dynamic, two vector input, two vector
output (TVITVO) systems"

So, it seems that having a correct algebraic handling of the empty matrixes
could be of great interest for some users.

I might post a wish on Bugzilla but not right now,
so if someone else is willing to do this...

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users