[Haskell-cafe] matrix computations based on the GSL

Glynn Clements glynn at gclements.plus.com
Sat Jul 9 16:01:53 EDT 2005


Keean Schupke wrote:

> >>So the linear operator is translation (ie: + v)... effectively 'plus'
> >>could be viewed as a function which takes a vector and returns a matrix
> >>(operator)
> >>
> >>    (+) :: Vector -> Matrix
> >>    
> >>
> >
> >Since a matrix _is_ not a linear map but only its representation, this
> >would not make sense. As I said (v+) is not a linear map thus there is no
> >matrix which represents it. A linear map f must fulfill
> > f 0 == 0
> >
> >But since
> > v+0 == v
> >  the function (v+) is only a linear map if 'v' is zero.
> >
> > I can't see how to fit in your vector extension by the 1-component.
> >
> >  
> >
> Eh?
> 
> Translation is a linear operation no?

No. It's affine, but not linear. As Henning said, to be linear, it
must map zero to zero.

> Adding vectors translates the
> first by the second
> (or the second by the first - the two are isomorphic)... A translation
> can be represented
> by the matrix:
> 
>     1   0   0   0
>     0   1   0   0
>     0   0   1   0
>     dx dy dz 1
> 
> So the result of "v+" is this matrix.

No. If the above matrix is M, then:

	[x y z w].M = [x+w.dx y+w.dy z+w.dz w]

which isn't a translation.

In the specific case of homogeneous coordinates, where:

	h  [x y z]   = [x y z 1]
	h' [x y z w] = [x/w y/w z/w]

then \v -> h'(h(v).M) is a translation, but M isn't itself a
translation.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Haskell-Cafe mailing list