Re: [fricas-devel] ARRAY2 enhanced

2019-11-23 Thread Waldek Hebisch
Dear Johannes, thanks for the code.  I think that 'array2'
constructor is fine addition.  Concerning 'arrayMultiply',
I agree with Ralf and Bill that this does not fit very well
to existing structure.  Probably best way would be to
allow more general matrices and have '+' in Matrix whenever
argument has '+' and have '*' whenever argument has '+' and '*'.

There may be some difficulty with implementing this, but I
think it is doable and worth doing.


-- 
  Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/E1iYYEr-0003m8-S0%40hera.math.uni.wroc.pl.


Re: [fricas-devel] ARRAY2 enhanced

2019-11-13 Thread Ralf Hemmecke
>> Why I would be against this extension is that TwoDimensionaArray
>> is a data structure domain, i.e., no algebraic operations.
>> 
>> Your operations should live in an "algebraic" domain. But even
>> then I see problems, because + and * will be partial functions
>> (much as in Matrix(Matrix Integer) if it were possible).
> that is very subtle distinction, what should be an arithmetic
> domain, if it has a + and/or a *. Is /\ etc. also an arithmetic
> operation? Do you propagate a meta classification of domains, which -
> right now - only can be in the peoples mind, not in a valid FriCAS
> definition?

You are completely right. There is no definition of a "data structure
domain" in FriCAS. Still, I have the feeling that it's a good idea to
separate data structures with creation and accessor functions from
domains that use them as representation and do operations on these
structures.

> Is the domain Matrix an algebraic domain with all its partial 
> functions + and *? Your argument would had been valid against the 
> creation of a domain Matrix as well.

Sure. But somehow a mathematician is used to the fact that + and * for
matrices only works for compatible ones. In that sense I would rather
aim at allowing more general argument types for Matrix so that
Matrix(Matrix Integer) would be possible. However, I guess nobody has
thought of this before and it would break things in other places as
Bill's experiments seem to indicate.

>> What application do you have in mind?
> 
> block matrices as in the example I gave. I am really using them,
> when I have to split a matrix in subblocks according to orbits of
> group operations.
I'm not saying that we shouldn't have block matrices.

What I see from you example is that your matrices A and B could also be
matrices of type Matrix(INT) and the computations would be exactly the
same except that one doesn't see the block structure of the matrix.

This is where I would ask you to provide a list of operations that you
have in mind should work for "blocked matrices". Currently, I have the
impression, that it would be an option to create a domain
BlockMatrix(R: Ring)
that behaves exactly like Matrix(Integer). However, the internal data
structure would be a record, something like this

  Record(mat: Matrix(R), hsplit: List Z, vsplit: List Z)

with the meaning that when you create

  m: Matrix(INT) := matrix [[2, 1, 2, 3], [1, 3, 1, 0], [7,5,5,3]]
  b: BlockMatrix(INT) := block(m, [1],[1])

it would exactly print as

+[2]   [1  2  3] +
||
|+1+  +- 3  1  0+|
|| |  | ||
++7+  + 5   5  3++

or maybe as

+ 2 |   1  2  3 +
|---+---|
| 1 | - 3  1  0 |
|   |   |
+ 7 |  5   5  3 +

i.e., the matrix splits after the first row and the first column.

So in total it would still be a matrix over the integers (or rather can
be coerced into Matrix(INT)), but with additional information of where
the blocks are.

Of course, one must work out how the split points can be carried over
in a multiplication of such "blocked matrices" and whether for example
one should be allowed to add/multiply b with block(m, [2], [1]).

I think, introducing such a BlockMatrix domain might be the way to go?
Would that satisfy your needs?

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/291e229c-02ab-a92e-93fa-f94af35ac470%40hemmecke.org.


Re: [fricas-devel] ARRAY2 enhanced

2019-11-12 Thread Prof. Dr. Johannes Grabmeier FW



Am 11.11.19 um 22:53 schrieb Ralf Hemmecke:
> On 11/4/19 11:24 PM, Prof. Dr. Johannes Grabmeier privat wrote:
>> Hi all,
>> I have enhanved TwoDimensionalArray to include arithmetic for block
>> matrices and have an operation array2 (similar to matrix for Matrix) for
>> easy creation of two-dimensional array and would suggest to include this
>> into the next version:
> I guess the background of this is relatively clear. FriCAS currently
> forbids the creation of Matrix(Matrix Integer).
>
> (15) -> A := matrix([[A11, A12],[A21, A22]])$Matrix(Matrix Integer)
>
>Matrix(Matrix(Integer)) is not a valid type.
>
> You basically suggest to get around this problem, but extending
> TwoDimensionalArray.
>
> What application do you have in mind?

block matrices as in the example I gave. I am really using them, when I
have to split a matrix in subblocks according to orbits of group operations.

>
> Why I would be against this extension is that TwoDimensionaArray is a
> data structure domain, i.e., no algebraic operations.
>
> Your operations should live in an "algebraic" domain. But even then I
> see problems, because + and * will be partial functions (much as in
> Matrix(Matrix Integer) if it were possible).
that is very subtle distinction, what should be an arithmetic domain, if
it has a + and/or a *. Is /\ etc. also an arithmetic operation? Do you
propagate a meta classification of domains, which - right now - only can
be in the peoples mind, not in a valid FriCAS definition?

Is the domain Matrix an algebraic domain with all its partial functions
+ and *? Your argument would had been valid against the creation of a
domain Matrix as well.

I do not care, if someone, rewrites/enhances Matrix to allow Matrix
Matrix Integer e.g., I would be content, from the practical point, one
simply should be able to use block matrices and sophisticated meta
discussions should not hinder practical implementations.
>
> A good motivation for your extensions would help to consider them for
> FriCAS.
>
> Ralf
>

-- 
Mit freundlichen Grüßen

Johannes Grabmeier

Fraktionsvorsitzender 
FREIE WÄHLER, Stadtrat Deggendorf

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-151-681-70756
Fax: +49-(0)-322-241-92688

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/2a2795ad-9251-93f5-d005-d93e040871aa%40grabmeier.net.


Re: [fricas-devel] ARRAY2 enhanced

2019-11-11 Thread Bill Page
On Mon, Nov 11, 2019 at 4:53 PM Ralf Hemmecke  wrote:
>
> On 11/4/19 11:24 PM, Prof. Dr. Johannes Grabmeier privat wrote:
> > Hi all,
> > I have enhanved TwoDimensionalArray to include arithmetic for block
> > matrices and have an operation array2 (similar to matrix for Matrix) for
> > easy creation of two-dimensional array and would suggest to include this
> > into the next version:
>
> I guess the background of this is relatively clear. FriCAS currently
> forbids the creation of Matrix(Matrix Integer).
>
> (15) -> A := matrix([[A11, A12],[A21, A22]])$Matrix(Matrix Integer)
>
>Matrix(Matrix(Integer)) is not a valid type.
>

Yes. Currently MatrixCategory expects R:AbelianMonoid as a parameter.
But a domain that exports MatrixCategory itself is not an
AbelianMonoid because MatrixCategory does not provide 0 as the unique
identity (there are many possible zero matrices of different
dimensions).

As far as I can see MatrixCategory requires 0 only for rather
technical reasons involving the initialization of the ARRAY2
representation. So in principle it should be possible to change
MatrixCategory to require only R:AbelianSemiGroup and then to also
export AbelianSemiGroup.  This would enable constructions such as the
above.

> You basically suggest to get around this problem, but extending
> TwoDimensionalArray.
>
> What application do you have in mind?
>
> Why I would be against this extension is that TwoDimensionaArray is a
> data structure domain, i.e., no algebraic operations.
>

+1 I am also against this for the same reason.

> Your operations should live in an "algebraic" domain. But even then I
> see problems, because + and * will be partial functions (much as in
> Matrix(Matrix Integer) if it were possible).
>
> A good motivation for your extensions would help to consider them for
> FriCAS.
>

I have done some preliminary experiments using AbelianSemiGroup but it
seems a little more difficult than I thought since apparently a few
other domains are affected by the change. If there is some interest in
this I could try a little harder to get this to work.

Bill.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAC6x94TROoOn77gLXE0A5AbmszZgL3AZt0U6VyEhCH1jCSP19Q%40mail.gmail.com.


Re: [fricas-devel] ARRAY2 enhanced

2019-11-11 Thread Ralf Hemmecke
On 11/4/19 11:24 PM, Prof. Dr. Johannes Grabmeier privat wrote:
> Hi all,
> I have enhanved TwoDimensionalArray to include arithmetic for block
> matrices and have an operation array2 (similar to matrix for Matrix) for
> easy creation of two-dimensional array and would suggest to include this
> into the next version:

I guess the background of this is relatively clear. FriCAS currently
forbids the creation of Matrix(Matrix Integer).

(15) -> A := matrix([[A11, A12],[A21, A22]])$Matrix(Matrix Integer)

   Matrix(Matrix(Integer)) is not a valid type.

You basically suggest to get around this problem, but extending
TwoDimensionalArray.

What application do you have in mind?

Why I would be against this extension is that TwoDimensionaArray is a
data structure domain, i.e., no algebraic operations.

Your operations should live in an "algebraic" domain. But even then I
see problems, because + and * will be partial functions (much as in
Matrix(Matrix Integer) if it were possible).

A good motivation for your extensions would help to consider them for
FriCAS.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/22bdd7af-bed9-b76a-6edc-6384614903fe%40hemmecke.org.