Mixing Real and Complex Matrix Operations

  • Dr Michael A. Koerber

    First....Matlisp is a tremendous project, IMHO.  Most of my work involves the use of linear algebra to simulate and analyze array-processing systems.  I have always used Matlab for these applications.  I have never considered any other options since development & debug time was too high.  They only other language that I've seen that has had adequate potential to make my job easier is CL....if only I had a large suite of linear algebra routines and graphics.  Matlisp seems to provide the basic solution for me.

    Second...I am currently trying to develop some CL tools for handling array-processing problems that I must deal with and I'm basing this on Matlisp.  If it isn't out-of-line, I'd like to make occasional requests for future features and additions to this package.  Here are two features that I have immediate need for, but which I'm coding around for now:

    1.   All the mixing of Complex and Real matrix operations.  E.g.,  I need to compute exp(I*geo-matrix) where I = sqrt(-1), and geo-matrix is a real Nx1 matrix.  I'd like to write  (SETF THE-ANS (MEXP (SCAL I GEO-MATRIX))) but (SCAL I GEO-MATRIX) fails immediately.  In addition, general forms such as (M* REAL-MAT IMAG-MAT) would be very useful.

    2.  99.9% of all simulations that I run require use of matricies containing complex Gaussian random variables.   Expanding RAND such that

      (SETF X (RAND 5 100 :NORMAL))

    would return a 5x100 real-matrix is essential for some of my work and it would allow expressing

      (SETF X (M+ (RAND 5 100 :NORMAL) (* (SCAL I (RAND 5 100 :NORMAL)))))

    as the required 5x100 matrix of complex random gaussian varients.

    I hope that this isn't too out of line.  As I solve some of these problems myself I can provide them for your consideration.



    • Tunc Simsek

      Tunc Simsek - 2000-08-07

      That you could not scale a real matrix by a complex number is a bug.  A method specialized to that exists and I will look into it.  Also, that you cannot multiply a real and complex matrix is a bug, specialized methods to that exist as well.

      Please do provide any modifications which you feel are useful.

      I'll look into these problems and get back within a few days.


      • Tunc Simsek

        Tunc Simsek - 2000-08-08

        o.k., it seems that the problem is with saving an image.  If I just do:

        (load "start")
        (in-package :matlisp)
        (copy! [1 2] [#c(3 4) 5])

        this works.  But if I save an image as describe in the respective thread, this won't work.
        So I guess that either we're not saving images correctly or CMUCL has a bug.

        I don't have an immediate answer to this, I'll see if I can get some feedback from the newsgroup.

        BTW, what are you using to compute MEXP?


        • Tunc Simsek

          Tunc Simsek - 2000-08-08

          as a temporary fix (that is, until a new release comes out), you can edit the file src/ffi-cmu.lisp

          and comment out (declaim (inline ...)) wherever you see it.  This will work: that is, the technique
          we use to save image and load will work (I just tried it).

          The problem is that the function LOAD-BLAS-&-LAPACK-BINARIES is not doing the right thing:

          1. its not loading DFFTPACK at all
          2. its reloading functions that were inlined

          This problem should be fixed by the next release.


        • Dr Michael A. Koerber

          > BTW, what are you using to compute MEXP?

          I'm using MATLISP:MEXP on a complex matrix...I defined (defconstant I (sqrt -1.0)) and I is used as an argument to the SCAL function.



Log in to post a comment.