Dear Francois, *

I'd like to concentrate on your function "columnBasis".  I think that the other
functions are less important.

+ First of all, I'd *really* like to call it columnnSpace: M -> List Col.  This
  is standard terminology, as far as I can tell.  At least, it's also the term
  used on wikipedia.  As a synonym, we probably should have - analogous to
  basis$ALGPKG, a function basis: List Col -> List Col.  But maybe this should
  go into a different package, maybe

  VectorCollectionFunctions(R: Ring, L: Collection Vector R)

  or some such.  But really, that should be done in a second step.

+ The documentation could link to http://en.wikipedia.org/wiki/Row_space

+ Your code can be made slightly more efficient.

+ We only need an Euclidean domain for your code (and the maths) to work.  In
  fact, Integers are a prime example.  Although, I must admit that in this case
  the names are slightly confusing, because we obtain a Q-basis of the
  columnSpace, where Q is the quotient field of R.

  The code should actually go into MATCAT$matcat.spad.pamphlet.  You also have
  to make it available for RectangularMatrix.  There should be an entry in
  RectangularMatrixCategory$matcat.spad.pamphlet, right after rowEchelon.  The
  implementation can go as default into this category, because you need only
  row and rowEchelon.

* if you like to invest more time, I think it would be *very* worthwhile to
  check whether we can make RectangularMatrixCategory inherit from
  MatrixCategory.  As far as I can see, the only problem is that currently a
  domain having DirectProductCategory(n, R) is not a FiniteLinearAggregate R.
  But otherwise, I do not see a good reason for that restriction.

  In any case, that's a DIFFERENT task.

-------------------------------------------------------------------------------
\verb|columnSpace| extracts from the columns of $M$ a basis for the space they
generate.  The columns of $M$ that generate the space correspond to those
columns in the row echelon form of $M$ whose first non-zero entry is non-zero.
As an example, let $M$ be the matrix
\begin{verbatim}
         +2  1  0  2+
         |          |
         |2  0  3  0|
         |          |
         +2  1  0  1+
\end{verbatim}
Its row-echelon form is
\begin{verbatim}
         +2  0   3   0+
         |            |
         |0  1  - 3  0|
         |            |
         +0  0   0   1+
\end{verbatim}
And indeed, \verb|[[2,2,2],[1,0,1],[2,0,1]]| is a $\mathbb Q$-basis of the
column space.

    columnSpace M ==
        M2 := rowEchelon M
        basis: List Col := []
        n: Integer := ncols M
        m: Integer := nrows M
        indRow: Integer := 1
        for k in 1..n while indRow <= m repeat
            if not zero?(M2.(indRow, k)) then
                basis := cons(column(M, k), basis)
                indRow := indRow + 1
        reverse! basis

Reversing the extracted columns is not strictly necessary, but makes the result
look more natural.
-------------------------------------------------------------------------------

+ concerning the other functions, I think that the only one worth adding is the
  one about the intersection of two bases, which I'd like to call something
  like "intersection", and which could also live in VectorCollectionFunctions.

  Again that's ANOTHER task.

* Finally, the above *really* suggests that we might want to have a domain
  whose elements are bases of a given vector space.  But I guess that we would
  need aldor for that to do it properly.  (It's similar to the problem that an
  element of PermutationGroup is not a Group...)  Hm, but the domain would
  actually be quite straigtforward.  And it does have structure:

  +: (%, %) -> %  -- sum of two spaces
  *: (%, %) -> %  -- intersection of two spaces
  0: () -> %      -- zero space

  Well, again, that's for later.

Francois, could you please write a testcase for the functions, in the form

testcase "columnSpace"
assertEquals("columnSpace nicematrix", "result")
assertEquals("columnSpace anothernicematrix", "anotheresult")

Martin


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to