This project has moved and is read-only. For the latest updates, please go here.

Converting a Rectangular Matrix into a Square Matrix

Jun 6, 2012 at 12:28 AM

Is there an easier way to concert a Rectangular Matrix that has the same number of Rows and Columns into a SquareMatrix  so I can Calculate the inverse of the Matrix.

Example

Square = Rectangular.Transpose()*Rectangular;

Inverse=Square.Inverse()

 

Aug 22, 2012 at 9:49 PM

The latest check-in contains an explicit cast to allow this.

// get a rectangular matrix somehow
RectangularMatrix R;
// if the rectangular matrix happens to be square, this will succeed
// if not, it will throw an InvalidCastException
SquareMatrix S = (SquareMatrix) R;
// note that S is not independent of R; they refer to the same
// matrix storage, so changes to S will change R and vice versa

This is not in the 2.0 release, so for now you will need to recompile Meta.Numerics from source to get it. It will be in the 2.1 release.

Aug 24, 2012 at 12:19 AM
Thank you!
From: [email removed]
Sent: Thursday, August 23, 2012 4:10 PM
To: [email removed]
Subject: Re: Converting a Rectangular Matrix into a Square Matrix [metanumerics:358494]

From: ichbin

The latest check-in contains an explicit cast to allow this.

// get a rectangular matrix somehow
RectangularMatrix R;
// if the rectangular matrix happens to be square, this will succeed
// if not, it will throw an InvalidCastException
SquareMatrix S = (SquareMatrix) R;
// note that S is not independent of R; they refer to the same
// matrix storage, so changes to S will change R and vice versa

This is not in the 2.0 release, so for now you will need to recompile Meta.Numerics from source to get it. It will be in the 2.1 release.