using System; using System.Collections.Generic; using System.Linq; using System.Text; using L = Science.Mathematics.LinearAlgebra; namespace Strang3Ed.Chapter10.Section2 { public class Example03 { public Example03() { } private string result; public string Result { get { return result; } } public void Compute() { Science.Mathematics.Complex[,] x = new Science.Mathematics.Complex[3,3]; x[0, 0] = new Science.Mathematics.Complex(1.0, 0.0); x[0, 1] = new Science.Mathematics.Complex(1.0, 0.0); x[0, 2] = new Science.Mathematics.Complex(1.0, 0.0); x[1, 0] = new Science.Mathematics.Complex(1.0, 0.0); x[1, 1] = new Science.Mathematics.Complex(); x[1, 1].Abs = 1.0; x[1, 1].Arg = 2.0 * Math.PI / 3.0; x[1, 2] = new Science.Mathematics.Complex(); x[1, 2].Abs = 1.0; x[1, 2].Arg = 4.0 * Math.PI / 3.0; x[2, 0] = new Science.Mathematics.Complex(1.0, 0.0); x[2, 1] = new Science.Mathematics.Complex(); x[2, 1].Abs = 1.0; x[2, 1].Arg = 4.0 * Math.PI / 3.0; x[2, 2] = new Science.Mathematics.Complex(); x[2, 2].Abs = 1.0; x[2, 2].Arg = 2.0 * Math.PI / 3.0; L.MatrixComplex FF = new L.MatrixComplex(x); L.MatrixComplex F = FF *(1.0 / Math.Sqrt(3.0)); L.MatrixComplex HQ = F.ConjugateTranspose - F; result += HQ.ToString() + "\r\n"; L.MatrixComplex IQ = F.ConjugateTranspose * F; IQ.Chop(); result += IQ.ToString() + "\r\n"; L.MatrixComplex UQ = F.ConjugateTranspose - F.Inverse; UQ.Chop(); result += UQ.ToString() + "\r\n"; L.MatrixComplex IIQ = F * F.Inverse; IIQ.Chop(); result += IIQ.ToString() + "\r\n"; } } } /* 0 0 0 0 0 -I 1 0 +I 1 0 0 +I 1 0 -I 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 */