[Haskell-cafe] matrix computations based on the GSL
Henning Thielemann
lemming at henning-thielemann.de
Thu Jul 7 10:07:25 EDT 2005
On Thu, 7 Jul 2005, Henning Thielemann wrote:
> > Also note that if you have several vectors x for which you want to compute
> > the dot product with metric A, and if you want to do this efficiently,
> > you'll have to convert your list of vectors into a matrix anyways.
>
> If you bundle some vectors as columns in matrix B and want to compute
> norms with respect to matrix A writing
> B^T * A * B
> you will not only get the norms of the vectors in B but also many mixed
> scalar products. This example shows to me that matrices are not simply
> collections of vectors.
Let me elaborate on that:
In some cases putting vectors as columns into a matrix then applying a
matrix operation on this matrix leads to the same like to 'map' a
matrix-vector operation to a list of vectors. But in other cases (as the
one above) this is not what you want. I consider it as an incidence not as
a general principle if this kind of extension works.
Let's consider another example: The basic definition of the Fourier
transform is for vectors. MatLab wants to make the effect of vector
operations consistent for row and column vectors, thus
>> fft([1,0])
ans =
1 1
>> fft([1;0])
ans =
1
1
What is the most natural extension to matrices? I would say it is the
composition of a row-wise Fourier transform and a column-wise transform.
This interpretation would have the special cases shown above. It would
yield fft([1,0;0,0]) = [1,1;1,1]
But MatLab says
>> fft([1,0;0,0])
ans =
1 0
1 0
That is by default it considers the Fourier transform as a column-wise
transform - but in the special case of a 1-row matrix it behaves
completely different.
More information about the Haskell-Cafe
mailing list