public void GetInverseNotPositiveDefiniteTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3, 3); ComplexFloatCholeskyDecomp dcd = new ComplexFloatCholeskyDecomp(a); dcd.GetInverse(); }
public void Current() { ComplexFloatMatrix test = new ComplexFloatMatrix(new ComplexFloat[2, 2] { { 1f, 2f }, { 3f, 4f } }); IEnumerator enumerator = test.GetEnumerator(); bool movenextresult; movenextresult = enumerator.MoveNext(); Assert.IsTrue(movenextresult); Assert.AreEqual(enumerator.Current, test[0, 0]); movenextresult = enumerator.MoveNext(); Assert.IsTrue(movenextresult); Assert.AreEqual(enumerator.Current, test[1, 0]); movenextresult = enumerator.MoveNext(); Assert.IsTrue(movenextresult); Assert.AreEqual(enumerator.Current, test[0, 1]); movenextresult = enumerator.MoveNext(); Assert.IsTrue(movenextresult); Assert.AreEqual(enumerator.Current, test[1, 1]); movenextresult = enumerator.MoveNext(); Assert.IsFalse(movenextresult); }
public void NonSymmFactorTest() { ComplexFloatMatrix b = new ComplexFloatMatrix(3); b[0, 0] = 2; b[0, 1] = 1; b[0, 2] = 1; b[1, 0] = 1; b[1, 1] = 2; b[1, 2] = 0; b[2, 0] = 0; b[2, 1] = 0; b[2, 2] = 3; ComplexFloatCholeskyDecomp dcd = new ComplexFloatCholeskyDecomp(b); Assert.AreEqual(dcd.Factor[0, 0].Real, 1.414, TOLERENCE); Assert.AreEqual(dcd.Factor[0, 1].Real, 0.000, TOLERENCE); Assert.AreEqual(dcd.Factor[0, 2].Real, 0.000, TOLERENCE); Assert.AreEqual(dcd.Factor[1, 0].Real, 0.707, TOLERENCE); Assert.AreEqual(dcd.Factor[1, 1].Real, 1.225, TOLERENCE); Assert.AreEqual(dcd.Factor[1, 2].Real, 0.000, TOLERENCE); Assert.AreEqual(dcd.Factor[2, 0].Real, 0.000, TOLERENCE); Assert.AreEqual(dcd.Factor[2, 1].Real, 0.000, TOLERENCE); Assert.AreEqual(dcd.Factor[2, 2].Real, 1.732, TOLERENCE); }
///<summary>Calculates the inverse of the matrix.</summary> ///<returns>the inverse of the matrix.</returns> ///<exception cref="NotPositiveDefiniteException">A is not positive definite.</exception> public ComplexFloatMatrix GetInverse() { Compute(); if (!ispd) { throw new NotPositiveDefiniteException(); } else { #if MANAGED var ret = ComplexFloatMatrix.CreateIdentity(order); ret = Solve(ret); return(ret); #else ComplexFloat[] inverse = new ComplexFloat[l.data.Length]; Array.Copy(l.data, inverse, l.data.Length); Lapack.Potri.Compute(Lapack.UpLo.Lower, order, inverse, order); ComplexFloatMatrix ret = new ComplexFloatMatrix(order, order); ret.data = inverse; for (int i = 0; i < order; i++) { for (int j = 0; j < order; j++) { if (j > i) { ret.data[j * order + i] = ComplexMath.Conjugate(ret.data[i * order + j]); } } } return(ret); #endif } }
public void GetInverseSingularTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3, 3); ComplexFloatLUDecomp dlu = new ComplexFloatLUDecomp(a); dlu.GetInverse(); }
/// <summary>Performs the QR factorization.</summary> protected override void InternalCompute() { int m = matrix.Rows; int n = matrix.Columns; #if MANAGED int minmn = m < n ? m : n; r_ = new ComplexFloatMatrix(matrix); // create a copy ComplexFloatVector[] u = new ComplexFloatVector[minmn]; for (int i = 0; i < minmn; i++) { u[i] = Householder.GenerateColumn(r_, i, m - 1, i); Householder.UA(u[i], r_, i, m - 1, i + 1, n - 1); } q_ = ComplexFloatMatrix.CreateIdentity(m); for (int i = minmn - 1; i >= 0; i--) { Householder.UA(u[i], q_, i, m - 1, i, m - 1); } #else qr = ComplexFloatMatrix.ToLinearComplexArray(matrix); jpvt = new int[n]; jpvt[0] = 1; Lapack.Geqp3.Compute(m, n, qr, m, jpvt, out tau); r_ = new ComplexFloatMatrix(m, n); // Populate R for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (i <= j) { r_.data[j * m + i] = qr[(jpvt[j]-1) * m + i]; } else { r_.data[j * m + i] = ComplexFloat.Zero; } } } q_ = new ComplexFloatMatrix(m, m); for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if (j < n) q_.data[j * m + i] = qr[j * m + i]; else q_.data[j * m + i] = ComplexFloat.Zero; } } if( m < n ){ Lapack.Ungqr.Compute(m, m, m, q_.data, m, tau); } else{ Lapack.Ungqr.Compute(m, m, n, q_.data, m, tau); } #endif for (int i = 0; i < m; i++) { if (q_[i, i] == 0) isFullRank = false; } }
///<summary>Constructor for SVD decomposition class.</summary> ///<param name="matrix">The matrix to decompose.</param> ///<exception cref="ArgumentNullException">matrix is null.</exception> public ComplexFloatSVDDecomp(IROComplexFloatMatrix matrix) { if (matrix == null) { throw new System.ArgumentNullException("matrix cannot be null."); } this.matrix = new ComplexFloatMatrix(matrix); }
public void CurrentException() { ComplexFloatMatrix test = new ComplexFloatMatrix(new ComplexFloat[2, 2] { { 1f, 2f }, { 3f, 4f } }); IEnumerator enumerator = test.GetEnumerator(); object value = enumerator.Current; }
public void IsSingularTest() { Assert.IsFalse(lu.IsSingular); ComplexFloatMatrix b = new ComplexFloatMatrix(3); ComplexFloatLUDecomp dlu = new ComplexFloatLUDecomp(b); Assert.IsTrue(dlu.IsSingular); }
private static void zscalColumn(ComplexFloatMatrix A, int Col, int Start, ComplexFloat z) { // A part of column Col of matrix A from row Start to end multiply by z for (int i = Start; i < A.RowLength; i++) { A[i, Col] = A[i, Col] * z; } }
///<summary>Solves a system on linear equations, AX=B, where A is the factored matrixed.</summary> ///<param name="B">RHS side of the system.</param> ///<returns>the solution matrix, X.</returns> ///<exception cref="ArgumentNullException">B is null.</exception> ///<exception cref="SingularMatrixException">Ais singular.</exception> ///<exception cref="ArgumentException">The number of rows of A and B must be the same.</exception> public ComplexFloatMatrix Solve(IROComplexFloatMatrix B) { if (B == null) { throw new System.ArgumentNullException("B cannot be null."); } Compute(); if (singular) { throw new SingularMatrixException(); } else { if (B.Rows != order) { throw new System.ArgumentException("Matrix row dimensions must agree."); } #if MANAGED // Copy right hand side with pivoting int nx = B.Columns; ComplexFloatMatrix X = Pivot(B); // Solve L*Y = B(piv,:) for (int k = 0; k < order; k++) { for (int i = k + 1; i < order; i++) { for (int j = 0; j < nx; j++) { X.data[i][j] -= X.data[k][j] * factor[i][k]; } } } // Solve U*X = Y; for (int k = order - 1; k >= 0; k--) { for (int j = 0; j < nx; j++) { X.data[k][j] /= factor[k][k]; } for (int i = 0; i < k; i++) { for (int j = 0; j < nx; j++) { X.data[i][j] -= X.data[k][j] * factor[i][k]; } } } return(X); #else ComplexFloat[] rhs = ComplexFloatMatrix.ToLinearComplexArray(B); Lapack.Getrs.Compute(Lapack.Transpose.NoTrans, order, B.Columns, factor, order, pivots, rhs, B.Rows); ComplexFloatMatrix ret = new ComplexFloatMatrix(order, B.Columns); ret.data = rhs; return(ret); #endif } }
///<summary>Solves a system on linear equations, AX=B, where A is the factored matrixed.</summary> ///<param name="B">RHS side of the system.</param> ///<returns>the solution matrix, X.</returns> ///<exception cref="ArgumentNullException">B is null.</exception> ///<exception cref="NotPositiveDefiniteException">A is not positive definite.</exception> ///<exception cref="ArgumentException">The number of rows of A and B must be the same.</exception> public ComplexFloatMatrix Solve(IROComplexFloatMatrix B) { if (B == null) { throw new System.ArgumentNullException("B cannot be null."); } Compute(); if (!ispd) { throw new NotPositiveDefiniteException(); } else { if (B.Rows != order) { throw new System.ArgumentException("Matrix row dimensions must agree."); } #if MANAGED // Copy right hand side. int cols = B.Columns; var X = new ComplexFloatMatrix(B); for (int c = 0; c < cols; c++) { // Solve L*Y = B; for (int i = 0; i < order; i++) { ComplexFloat sum = B[i, c]; for (int k = i - 1; k >= 0; k--) { sum -= l.data[i][k] * X.data[k][c]; } X.data[i][c] = sum / l.data[i][i]; } // Solve L'*X = Y; for (int i = order - 1; i >= 0; i--) { ComplexFloat sum = X.data[i][c]; for (int k = i + 1; k < order; k++) { sum -= ComplexMath.Conjugate(l.data[k][i]) * X.data[k][c]; } X.data[i][c] = sum / ComplexMath.Conjugate(l.data[i][i]); } } return(X); #else ComplexFloat[] rhs = ComplexFloatMatrix.ToLinearComplexArray(B); Lapack.Potrs.Compute(Lapack.UpLo.Lower, order, B.Columns, l.data, order, rhs, B.Rows); ComplexFloatMatrix ret = new ComplexFloatMatrix(order, B.Columns); ret.data = rhs; return(ret); #endif } }
private static ComplexFloat zdotc(ComplexFloatMatrix A, int Col1, int Col2, int Start) { ComplexFloat z = ComplexFloat.Zero; for (int i = Start; i < A.RowLength; i++) { z += A[i, Col2] * ComplexMath.Conjugate(A[i, Col1]); } return(z); }
public void ForEach() { ComplexFloatMatrix test = new ComplexFloatMatrix(new ComplexFloat[2, 2] { { 1f, 2f }, { 3f, 4f } }); foreach (ComplexFloat f in test) { Assert.IsTrue(test.Contains(f)); } }
public void CurrentException() { Assert.Throws(typeof(InvalidOperationException), () => { var test = new ComplexFloatMatrix(new ComplexFloat[2, 2] { { 1f, 2f }, { 3f, 4f } }); IEnumerator enumerator = test.GetEnumerator(); object value = enumerator.Current; }); }
public void CtorDimensions() { ComplexFloatMatrix test = new ComplexFloatMatrix(2,2); Assert.AreEqual(test.RowLength, 2); Assert.AreEqual(test.ColumnLength, 2); Assert.AreEqual(test[0,0], ComplexFloat.Zero); Assert.AreEqual(test[0,1], ComplexFloat.Zero); Assert.AreEqual(test[1,0], ComplexFloat.Zero); Assert.AreEqual(test[1,1], ComplexFloat.Zero); }
public void CtorInitialValues() { ComplexFloatMatrix test = new ComplexFloatMatrix(2,2,new ComplexFloat(1,1)); Assert.AreEqual(test.RowLength, 2); Assert.AreEqual(test.ColumnLength, 2); ComplexFloat value = new ComplexFloat(1,1); Assert.AreEqual(test[0,0], value); Assert.AreEqual(test[0,1], value); Assert.AreEqual(test[1,0], value); Assert.AreEqual(test[1,1], value); }
private static void zswap(ComplexFloatMatrix A, int Col1, int Col2) { // swap columns Col1,Col2 ComplexFloat z; for (int i = 0; i < A.RowLength; i++) { z = A[i, Col1]; A[i, Col1] = A[i, Col2]; A[i, Col2] = z; } }
///<summary>Computes the algorithm.</summary> protected override void InternalCompute() { #if MANAGED l = new ComplexFloatMatrix(matrix); for (int j = 0; j < order; j++) { ComplexFloat[] rowj = l.data[j]; float d = 0.0f; for (int k = 0; k < j; k++) { ComplexFloat[] rowk = l.data[k]; ComplexFloat s = ComplexFloat.Zero; for (int i = 0; i < k; i++) { s += rowk[i] * rowj[i]; } rowj[k] = s = (matrix.data[j][k] - s) / l.data[k][k]; d = d + (s * ComplexMath.Conjugate(s)).Real; } d = matrix.data[j][j].Real - d; if (d <= 0.0) { ispd = false; return; } l.data[j][j] = new ComplexFloat((float)System.Math.Sqrt(d)); for (int k = j + 1; k < order; k++) { l.data[j][k] = ComplexFloat.Zero; } } #else ComplexFloat[] factor = new ComplexFloat[matrix.data.Length]; Array.Copy(matrix.data, factor, matrix.data.Length); int status = Lapack.Potrf.Compute(Lapack.UpLo.Lower, order, factor, order); if (status != 0) { ispd = false; } l = new ComplexFloatMatrix(order); l.data = factor; for (int i = 0; i < order; i++) { for (int j = 0; j < order; j++) { if (j > i) { l.data[j * order + i] = 0; } } } #endif }
private static float dznrm2Column(ComplexFloatMatrix A, int Col, int Start) { // dznrm2Column returns the euclidean norm of a vector, // which is a part of column Col in matrix A, beginning from Start to end of column // so that dznrm2Column := sqrt( conjg( matrix' )*matrix ) float s = 0; for (int i = Start; i < A.RowLength; i++) { s += (A[i, Col] * ComplexMath.Conjugate(A[i, Col])).Real; } return((float)System.Math.Sqrt(s)); }
///<summary>Solves a system on linear equations, AX=B, where A is the factored matrixed.</summary> ///<param name="B">RHS side of the system.</param> ///<returns>the solution vector, X.</returns> ///<exception cref="ArgumentNullException">B is null.</exception> ///<exception cref="NotPositiveDefiniteException">A is not positive definite.</exception> ///<exception cref="ArgumentException">The number of rows of A and the length of B must be the same.</exception> public ComplexFloatVector Solve(IROComplexFloatVector B) { if (B == null) { throw new System.ArgumentNullException("B cannot be null."); } Compute(); if (!ispd) { throw new NotPositiveDefiniteException(); } else { if (B.Length != order) { throw new System.ArgumentException("The length of B must be the same as the order of the matrix."); } #if MANAGED // Copy right hand side. var X = new ComplexFloatVector(B); // Solve L*Y = B; for (int i = 0; i < order; i++) { ComplexFloat sum = B[i]; for (int k = i - 1; k >= 0; k--) { sum -= l.data[i][k] * X.data[k]; } X.data[i] = sum / l.data[i][i]; } // Solve L'*X = Y; for (int i = order - 1; i >= 0; i--) { ComplexFloat sum = X.data[i]; for (int k = i + 1; k < order; k++) { sum -= ComplexMath.Conjugate(l.data[k][i]) * X.data[k]; } X.data[i] = sum / ComplexMath.Conjugate(l.data[i][i]); } return(X); #else ComplexFloat[] rhs = ComplexFloatMatrix.ToLinearComplexArray(B); Lapack.Potrs.Compute(Lapack.UpLo.Lower, order, 1, l.data, order, rhs, B.Length); ComplexFloatVector ret = new ComplexFloatVector(order, B.Length); ret.data = rhs; return(ret); #endif } }
public void SquareDecomp() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0, 0] = new ComplexFloat(1.1f, 1.1f); a[0, 1] = new ComplexFloat(2.2f, -2.2f); a[0, 2] = new ComplexFloat(3.3f, 3.3f); a[1, 0] = new ComplexFloat(4.4f, -4.4f); a[1, 1] = new ComplexFloat(5.5f, 5.5f); a[1, 2] = new ComplexFloat(6.6f, -6.6f); a[2, 0] = new ComplexFloat(7.7f, 7.7f); a[2, 1] = new ComplexFloat(8.8f, -8.8f); a[2, 2] = new ComplexFloat(9.9f, 9.9f); ComplexFloatQRDecomp qrd = new ComplexFloatQRDecomp(a); ComplexFloatMatrix qq = qrd.Q.GetConjugateTranspose() * qrd.Q; ComplexFloatMatrix qr = qrd.Q * qrd.R; ComplexFloatMatrix I = ComplexFloatMatrix.CreateIdentity(3); // determine the maximum relative error double MaxError = 0.0; for (int i = 0; i < 3; i++) { for (int j = 0; i < 3; i++) { double E = ComplexMath.Absolute((qq[i, j] - I[i, j])); if (E > MaxError) { MaxError = E; } } } Assert.IsTrue(MaxError < 1.0E-6); MaxError = 0.0; for (int i = 0; i < 3; i++) { for (int j = 0; i < 3; i++) { double E = ComplexMath.Absolute((qr[i, j] - a[i, j]) / a[i, j]); if (E > MaxError) { MaxError = E; } } } Assert.IsTrue(MaxError < 2.4E-6); }
static ComplexFloatCholeskyDecompTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0,0] = 2; a[0,1] = new ComplexFloat(1,-1); a[0,2] = 0; a[1,0] = new ComplexFloat(1,-1); a[1,1] = 2; a[1,2] = 0; a[2,0] = 0; a[2,1] = 0; a[2,2] = 3; cd = new ComplexFloatCholeskyDecomp(a); }
///<summary>Computes the algorithm.</summary> protected override void InternalCompute() { #if MANAGED l = new ComplexFloatMatrix(matrix); for (int j = 0; j < order; j++) { ComplexFloat[] rowj = l.data[j]; float d = 0.0f; for (int k = 0; k < j; k++) { ComplexFloat[] rowk = l.data[k]; ComplexFloat s = ComplexFloat.Zero; for (int i = 0; i < k; i++) { s += rowk[i]*rowj[i]; } rowj[k] = s = (matrix.data[j][k] - s)/l.data[k][k]; d = d + (s*ComplexMath.Conjugate(s)).Real; } d = matrix.data[j][j].Real - d; if ( d <= 0.0 ) { ispd = false; return; } l.data[j][j] = new ComplexFloat((float)System.Math.Sqrt(d)); for (int k = j+1; k < order; k++) { l.data[j][k] = ComplexFloat.Zero; } } #else ComplexFloat[] factor = new ComplexFloat[matrix.data.Length]; Array.Copy(matrix.data, factor, matrix.data.Length); int status = Lapack.Potrf.Compute(Lapack.UpLo.Lower, order, factor, order); if (status != 0 ) { ispd = false; } l = new ComplexFloatMatrix(order); l.data = factor; for (int i = 0; i < order; i++) { for (int j = 0; j < order; j++) { if ( j > i) { l.data[j*order+i] = 0; } } } #endif }
static ComplexFloatLUDecompTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0,0] = new ComplexFloat(-1,1); a[0,1] = 5; a[0,2] = 6; a[1,0] = 3; a[1,1] = -6; a[1,2] = 1; a[2,0] = 6; a[2,1] = 8; a[2,2] = 9; lu = new ComplexFloatLUDecomp(a); }
private static void zdrot(ComplexFloatMatrix A, int Col1, int Col2, float c, float s) { // applies a plane rotation, where the c=cos and s=sin // Col1, Col2 - rotated columns of A ComplexFloat z; for (int i = 0; i < A.RowLength; i++) { z = c * A[i, Col1] + s * A[i, Col2]; A[i, Col2] = c * A[i, Col2] - s * A[i, Col1]; A[i, Col1] = z; } }
public static bool AreEqual(ComplexFloatMatrix f1, ComplexFloatMatrix f2, float delta) { if (f1.RowLength != f2.RowLength) return false; if (f1.ColumnLength != f2.ColumnLength) return false; for (int i = 0; i < f1.RowLength; i++) { for (int j = 0; j < f1.ColumnLength; j++) { if (!AreEqual(f1[i, j], f2[i, j], delta)) return false; } } return true; }
public void SquareDecomp() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0,0] = new ComplexFloat(1.1f, 1.1f); a[0,1] = new ComplexFloat(2.2f, -2.2f); a[0,2] = new ComplexFloat(3.3f, 3.3f); a[1,0] = new ComplexFloat(4.4f, -4.4f); a[1,1] = new ComplexFloat(5.5f, 5.5f); a[1,2] = new ComplexFloat(6.6f, -6.6f); a[2,0] = new ComplexFloat(7.7f, 7.7f); a[2,1] = new ComplexFloat(8.8f, -8.8f); a[2,2] = new ComplexFloat(9.9f, 9.9f); ComplexFloatQRDecomp qrd = new ComplexFloatQRDecomp(a); ComplexFloatMatrix qq = qrd.Q.GetConjugateTranspose()*qrd.Q; ComplexFloatMatrix qr = qrd.Q*qrd.R; ComplexFloatMatrix I = ComplexFloatMatrix.CreateIdentity(3); // determine the maximum relative error double MaxError = 0.0; for (int i = 0; i < 3; i++) { for (int j = 0; i < 3; i++) { double E = ComplexMath.Absolute((qq[i, j] - I[i, j])); if (E > MaxError) { MaxError = E; } } } Assert.IsTrue(MaxError < 1.0E-6); MaxError = 0.0; for (int i = 0; i < 3; i++) { for (int j = 0; i < 3; i++) { double E = ComplexMath.Absolute((qr[i, j] - a[i, j]) / a[i, j]); if (E > MaxError) { MaxError = E; } } } Assert.IsTrue(MaxError < 2.4E-6); }
///<summary>Constructor for LU decomposition class. The constructor performs the factorization and the upper and ///lower matrices are accessible by the <c>U</c> and <c>L</c> properties.</summary> ///<param name="matrix">The matrix to factor.</param> ///<exception cref="ArgumentNullException">matrix is null.</exception> ///<exception cref="NotSquareMatrixException">matrix is not square.</exception> public ComplexFloatLUDecomp(IROComplexFloatMatrix matrix) { if (matrix == null) { throw new System.ArgumentNullException("matrix cannot be null."); } if (matrix.Rows != matrix.Columns) { throw new NotSquareMatrixException("Matrix must be square."); } order = matrix.Columns; this.matrix = new ComplexFloatMatrix(matrix); }
static ComplexFloatLUDecompTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0, 0] = new ComplexFloat(-1, 1); a[0, 1] = 5; a[0, 2] = 6; a[1, 0] = 3; a[1, 1] = -6; a[1, 2] = 1; a[2, 0] = 6; a[2, 1] = 8; a[2, 2] = 9; lu = new ComplexFloatLUDecomp(a); }
///<summary>Constructor for Cholesky decomposition class. The constructor performs the factorization of a Hermitian positive ///definite matrax and the Cholesky factored matrix is accessible by the <c>Factor</c> property. The factor is the lower ///triangular factor.</summary> ///<param name="matrix">The matrix to factor.</param> ///<exception cref="ArgumentNullException">matrix is null.</exception> ///<exception cref="NotSquareMatrixException">matrix is not square.</exception> ///<remarks>This class only uses the lower triangle of the input matrix. It ignores the ///upper triangle.</remarks> public ComplexFloatCholeskyDecomp(IROComplexFloatMatrix matrix) { if ( matrix == null ) { throw new System.ArgumentNullException("matrix cannot be null."); } if ( matrix.Rows != matrix.Columns ) { throw new NotSquareMatrixException("Matrix must be square."); } order = matrix.Columns; this.matrix = new ComplexFloatMatrix(matrix); }
static ComplexFloatCholeskyDecompTest() { ComplexFloatMatrix a = new ComplexFloatMatrix(3); a[0, 0] = 2; a[0, 1] = new ComplexFloat(1, -1); a[0, 2] = 0; a[1, 0] = new ComplexFloat(1, -1); a[1, 1] = 2; a[1, 2] = 0; a[2, 0] = 0; a[2, 1] = 0; a[2, 2] = 3; cd = new ComplexFloatCholeskyDecomp(a); }
private ComplexFloatMatrix Pivot(IROComplexFloatMatrix B) { int m = B.Rows; int n = B.Columns; ComplexFloatMatrix ret = new ComplexFloatMatrix(m, n); for (int i = 0; i < pivots.Length; i++) { for (int j = 0; j < n; j++) { ret.data[i][j] = B[pivots[i], j]; } } return(ret); }
///<summary>Solves a system on linear equations, AX=B, where A is the factored matrixed.</summary> ///<param name="B">RHS side of the system.</param> ///<returns>the solution vector, X.</returns> ///<exception cref="ArgumentNullException">B is null.</exception> ///<exception cref="SingularMatrixException">A is singular.</exception> ///<exception cref="ArgumentException">The number of rows of A and the length of B must be the same.</exception> public ComplexFloatVector Solve(IROComplexFloatVector B) { if (B == null) { throw new System.ArgumentNullException("B cannot be null."); } Compute(); if (singular) { throw new SingularMatrixException(); } else { if (B.Length != order) { throw new System.ArgumentException("The length of B must be the same as the order of the matrix."); } #if MANAGED // Copy right hand side with pivoting ComplexFloatVector X = Pivot(B); // Solve L*Y = B(piv,:) for (int k = 0; k < order; k++) { for (int i = k + 1; i < order; i++) { X[i] -= X[k] * factor[i][k]; } } // Solve U*X = Y; for (int k = order - 1; k >= 0; k--) { X[k] /= factor[k][k]; for (int i = 0; i < k; i++) { X[i] -= X[k] * factor[i][k]; } } return(X); #else ComplexFloat[] rhs = ComplexFloatMatrix.ToLinearComplexArray(B); Lapack.Getrs.Compute(Lapack.Transpose.NoTrans, order, 1, factor, order, pivots, rhs, rhs.Length); return(new ComplexFloatVector(rhs)); #endif } }
public void CtorCopy() { ComplexFloatMatrix a = new ComplexFloatMatrix(2,2); a[0,0] = new ComplexFloat(1,1); a[0,1] = new ComplexFloat(2,2); a[1,0] = new ComplexFloat(3,3); a[1,1] = new ComplexFloat(4,4); ComplexFloatMatrix b = new ComplexFloatMatrix(a); Assert.AreEqual(a.RowLength, b.RowLength); Assert.AreEqual(a.ColumnLength, b.ColumnLength); Assert.AreEqual(a[0,0], b[0,0]); Assert.AreEqual(a[0,1], b[0,1]); Assert.AreEqual(a[1,0], b[1,0]); Assert.AreEqual(a[1,1], b[1,1]); }
///<summary>Multiply a <c>ComplexFloatVector</c> with another <c>ComplexFloatVector</c> as x*y^T</summary> ///<param name="lhs"><c>ComplexFloatVector</c> as left hand operand.</param> ///<param name="rhs"><c>ComplexFloatVector</c> as right hand operand.</param> ///<returns><c>ComplexFloatVector</c> with results.</returns> public static ComplexFloatMatrix operator *(ComplexFloatVector lhs, ComplexFloatVector rhs) { ComplexFloatMatrix ret = new ComplexFloatMatrix(lhs.data.Length, rhs.data.Length); #if MANAGED for (int i = 0; i < lhs.data.Length; i++) { for (int j = 0; j < rhs.data.Length; j++) { ret[i, j] = lhs.data[i] * rhs.data[j]; } } #else Blas.Geru.Compute(Blas.Order.ColumnMajor, lhs.data.Length, rhs.data.Length, 1, lhs.data, 1, rhs.data, 1, ret.data, lhs.data.Length); #endif return(ret); }
public void IsPositiveDefiniteTest() { Assert.IsTrue(cd.IsPositiveDefinite); ComplexFloatMatrix b = new ComplexFloatMatrix(3); b[0, 0] = -2; b[0, 1] = 1; b[0, 2] = 0; b[1, 0] = 1; b[1, 1] = 2; b[1, 2] = 0; b[2, 0] = 0; b[2, 1] = 0; b[2, 2] = 3; ComplexFloatCholeskyDecomp dcd = new ComplexFloatCholeskyDecomp(b); Assert.IsFalse(dcd.IsPositiveDefinite); }
public void WTest() { ComplexFloatMatrix test = wsvd.U * wsvd.W * wsvd.V.GetConjugateTranspose(); float e; float me = 0; for (int i = 0; i < test.RowLength; i++) { for (int j = 0; j < test.ColumnLength; j++) { e = ComplexMath.Absolute((wa[i, j] - test[i, j]) / wa[i, j]); if (e > me) { me = e; } } } Assert.IsTrue(me < TOLERENCE, "Maximum Error = " + me.ToString()); }
public static bool AreEqual(ComplexFloatMatrix f1, ComplexFloatMatrix f2, float delta) { if (f1.RowLength != f2.RowLength) { return(false); } if (f1.ColumnLength != f2.ColumnLength) { return(false); } for (int i = 0; i < f1.RowLength; i++) { for (int j = 0; j < f1.ColumnLength; j++) { if (!AreEqual(f1[i, j], f2[i, j], delta)) { return(false); } } } return(true); }
private void SetLU() { l = new ComplexFloatMatrix(order, order); u = new ComplexFloatMatrix(order, order); /* Finalize L and U */ #if MANAGED for (int i = 0; i < order; i++) { for (int j = 0; j < order; j++) { if (i > j) { l.data[i][j] = factor[i][j]; } else { u.data[i][j] = factor[i][j]; } } l.data[i][i] = ComplexFloat.One; } #else for (int i = 0; i < order; i++) { for (int j = 0; j < order; j++) { if (i > j) { l.data[j * order + i] = factor[j * order + i]; } else { u.data[j * order + i] = factor[j * order + i]; } } l.data[i * order + i] = ComplexFloat.One; } #endif }
public void NonSymmFactorTest() { ComplexFloatMatrix b = new ComplexFloatMatrix(3); b[0,0] = 2; b[0,1] = 1; b[0,2] = 1; b[1,0] = 1; b[1,1] = 2; b[1,2] = 0; b[2,0] = 0; b[2,1] = 0; b[2,2] = 3; ComplexFloatCholeskyDecomp dcd = new ComplexFloatCholeskyDecomp(b); Assert.AreEqual(dcd.Factor[0,0].Real,1.414,TOLERENCE); Assert.AreEqual(dcd.Factor[0,1].Real,0.000,TOLERENCE); Assert.AreEqual(dcd.Factor[0,2].Real,0.000,TOLERENCE); Assert.AreEqual(dcd.Factor[1,0].Real,0.707,TOLERENCE); Assert.AreEqual(dcd.Factor[1,1].Real,1.225,TOLERENCE); Assert.AreEqual(dcd.Factor[1,2].Real,0.000,TOLERENCE); Assert.AreEqual(dcd.Factor[2,0].Real,0.000,TOLERENCE); Assert.AreEqual(dcd.Factor[2,1].Real,0.000,TOLERENCE); Assert.AreEqual(dcd.Factor[2,2].Real,1.732,TOLERENCE); }
public void SetupTestCases() { a = new ComplexFloatMatrix(3); a[0,0] = new ComplexFloat(1.1f, 1.1f); a[0,1] = new ComplexFloat(2.2f, -2.2f); a[0,2] = new ComplexFloat(3.3f, 3.3f); a[1,0] = new ComplexFloat(4.4f, -4.4f); a[1,1] = new ComplexFloat(5.5f, 5.5f); a[1,2] = new ComplexFloat(6.6f, -6.6f); a[2,0] = new ComplexFloat(7.7f, 7.7f); a[2,1] = new ComplexFloat(8.8f, -8.8f); a[2,2] = new ComplexFloat(9.9f, 9.9f); svd = new ComplexFloatSVDDecomp(a, true); wa = new ComplexFloatMatrix(2,4); wa[0,0] = new ComplexFloat(1.1f, 1.1f); wa[0,1] = new ComplexFloat(2.2f, -2.2f); wa[0,2] = new ComplexFloat(3.3f, 3.3f); wa[0,3] = new ComplexFloat(4.4f, -4.4f); wa[1,0] = new ComplexFloat(5.5f, 5.5f); wa[1,1] = new ComplexFloat(6.6f, -6.6f); wa[1,2] = new ComplexFloat(7.7f, 7.7f); wa[1,3] = new ComplexFloat(8.8f, -8.8f); wsvd = new ComplexFloatSVDDecomp(wa, true); la = new ComplexFloatMatrix(4,2); la[0,0] = new ComplexFloat(1.1f, 1.1f); la[0,1] = new ComplexFloat(2.2f, -2.2f); la[1,0] = new ComplexFloat(3.3f, 3.3f); la[1,1] = new ComplexFloat(4.4f, -4.4f); la[2,0] = new ComplexFloat(5.5f, 5.5f); la[2,1] = new ComplexFloat(6.6f, -6.6f); la[3,0] = new ComplexFloat(7.7f, 7.7f); la[3,1] = new ComplexFloat(8.8f, -8.8f); lsvd = new ComplexFloatSVDDecomp(la, true); }
/// <summary> /// Get a copy of the Toeplitz matrix. /// </summary> public ComplexFloatMatrix GetMatrix() { int i, j; // allocate memory for the matrix ComplexFloatMatrix tm = new ComplexFloatMatrix(m_Order); #if MANAGED // fill top row ComplexFloat[] top = tm.data[0]; Array.Copy(m_LeftColumn.data, 0, top, 0, m_Order); if (m_Order > 1) { // fill bottom row (reverse order) ComplexFloat[] bottom = tm.data[m_Order - 1]; for (i = 0, j = m_Order - 1; i < m_Order; i++, j--) { bottom[i] = m_LeftColumn[j]; } // fill rows in-between for (i = 1, j = m_Order - 1 ; j > 1; i++) { Array.Copy(top, 0, tm.data[i], i, j--); Array.Copy(bottom, j, tm.data[i], 0, i); } } #else if (m_Order > 1) { ComplexFloat[] top = new ComplexFloat[m_Order]; Array.Copy(m_LeftColumn.data, 0, top, 0, m_Order); tm.SetRow(0, top); // fill bottom row (reverse order) ComplexFloat[] bottom = new ComplexFloat[m_Order]; for (i = 0, j = m_Order - 1; i < m_Order; i++, j--) { bottom[i] = m_LeftColumn[j]; } // fill rows in-between for (i = 1, j = m_Order - 1 ; j > 0; i++) { ComplexFloat[] temp = new ComplexFloat[m_Order]; Array.Copy(top, 0, temp, i, j--); Array.Copy(bottom, j, temp, 0, i); tm.SetRow(i, temp); } } else { Array.Copy(m_LeftColumn.data, 0, tm.data, 0, m_Order); } #endif return tm; }
/// <summary> /// Invert a symmetric square Toeplitz matrix. /// </summary> /// <param name="T">The left-most column of the symmetric Toeplitz matrix.</param> /// <returns>The inverse matrix.</returns> /// <exception cref="ArgumentNullException"> /// <B>T</B> is a null reference. /// </exception> /// <exception cref="RankException"> /// The length of <B>T</B> must be greater than zero. /// </exception> /// <exception cref="SingularMatrixException"> /// The Toeplitz matrix or one of the the leading sub-matrices is singular. /// </exception> /// <remarks> /// This static member combines the <b>UDL</b> decomposition and Trench's algorithm into a /// single algorithm. When compared to the non-static member it requires minimal data storage /// and suffers from no speed penalty. /// <para> /// Trench's algorithm requires <b>N</b> squared FLOPS, compared to <b>N</b> cubed FLOPS /// if we simply solved a linear Toeplitz system with a right-side identity matrix (<b>N</b> is the matrix order). /// </para> /// </remarks> public static ComplexFloatMatrix Inverse(IROComplexFloatVector T) { ComplexFloatMatrix X; // check parameters if (T == null) { throw new System.ArgumentNullException("T"); } else if (T.Length < 1) { throw new System.RankException("The length of T must be greater than zero."); } else if (T.Length == 1) { X = new ComplexFloatMatrix(1); X[0, 0] = ComplexFloat.One / T[0]; } else { int N = T.Length; ComplexFloat f, g; int i, j, l, k, m, n; X = new ComplexFloatMatrix(N); // calculate the predictor coefficients ComplexFloatVector Y = ComplexFloatSymmetricLevinson.YuleWalker(T); // calculate gamma f = T[0]; for (i = 1, j = 0; i < N; i++, j++) { f += T[i] * Y[j]; } g = ComplexFloat.One / f; // calculate first row of inverse X[0, 0] = g; for (i = 1, j = 0; i < N; i++, j++) { X[0, i] = g * Y[j]; } // calculate successive rows of upper wedge for (i = 0, j = 1, k = N - 2; i < N / 2; i++, j++, k--) { for (l = j, m = i, n = N-1-j; l < N - j; l++, m++, n--) { X[j, l] = X[i, m] + g * (Y[i] * Y[m] - Y[k] * Y[n]); } } // this is symmetric matrix ... for (i = 0; i <= N / 2; i++) { for (j = i + 1; j < N - i; j++) { X[j, i] = X[i, j]; } } // and a persymmetric matrix. for (i = 0, j = N - 1; i < N; i++, j--) { for (k = 0, l = N - 1; k < j; k++, l--) { X[l, j] = X[i, k]; } } } return X; }
/// <summary> /// Solve a symmetric square Toeplitz system with a right-side matrix. /// </summary> /// <param name="T">The left-most column of the Toeplitz matrix.</param> /// <param name="Y">The right-side matrix of the system.</param> /// <returns>The solution matrix.</returns> /// <exception cref="ArgumentNullException"> /// <B>T</B> and/or <B>Y</B> are null references /// </exception> /// <exception cref="RankException"> /// The length of <B>T</B> does not match the number of rows in <B>Y</B>. /// </exception> /// <exception cref="SingularMatrixException"> /// The Toeplitz matrix or one of the the leading sub-matrices is singular. /// </exception> /// <remarks> /// This method solves the linear system <B>AX</B> = <B>Y</B>. Where /// <B>T</B> is a symmetric square Toeplitz matrix, <B>X</B> is an unknown /// matrix and <B>Y</B> is a known matrix. /// <para> /// This static member combines the <b>UDL</b> decomposition and the calculation of the solution into a /// single algorithm. When compared to the non-static member it requires minimal data storage /// and suffers from no speed penalty. /// </para> /// </remarks> public static ComplexFloatMatrix Solve(IROComplexFloatVector T, IROComplexFloatMatrix Y) { ComplexFloatMatrix X; // check parameters if (T == null) { throw new System.ArgumentNullException("T"); } else if (Y == null) { throw new System.ArgumentNullException("Y"); } else if (T.Length != Y.Columns) { throw new RankException("The length of T and Y are not equal."); } else { // allocate memory int N = T.Length; int M = Y.Rows; X = new ComplexFloatMatrix(N, M); // solution matrix ComplexFloatVector Z = new ComplexFloatVector(N); // temporary storage vector ComplexFloat e; // prediction error int i, j, l, m; // setup zero order solution e = T[0]; if (e == ComplexFloat.Zero) { throw new SingularMatrixException("The Toeplitz matrix or one of the the leading sub-matrices is singular."); } for (m = 0; m < M; m++) { X[0, m] = Y[0,m] / T[0]; } if (N > 1) { ComplexFloatVector a = new ComplexFloatVector(N - 1); // prediction coefficients ComplexFloat p; // reflection coefficient ComplexFloat inner; // inner product ComplexFloat k; // calculate solution for successive orders for (i = 1; i < N; i++) { // calculate first inner product inner = T[i]; for (j = 0, l = i - 1; j < i - 1; j++, l--) { inner += a[j] * T[l]; } // update predictor coefficients p = -(inner / e); for (j = 0, l = i - 2; j < i - 1; j++, l--) { Z[j] = a[j] + p * a[l]; } // copy vector for (j = 0; j < i - 1; j++) { a[j] = Z[j]; } a[i - 1] = p; e *= (ComplexFloat.One - p * p); if (e == ComplexFloat.Zero) { throw new SingularMatrixException("The Toeplitz matrix or one of the the leading sub-matrices is singular."); } // update the solution matrix for (m = 0; m < M; m++) { // retrieve a copy of solution column for (j = 0; j < i; j++) { Z[j] = X[j, m]; } // calculate second inner product inner = Y[i, m]; for (j = 0, l = i; j < i; j++, l--) { inner -= Z[j] * T[l]; } // update solution vector k = inner / e; for (j = 0, l = i - 1; j < i; j++, l--) { Z[j] = Z[j] + k * a[l]; } Z[j] = k; // store solution column in matrix for (j = 0; j <= i; j++) { X[j, m] = Z[j]; } } } } } return X; }
public void Invert() { ComplexFloatMatrix a = new ComplexFloatMatrix(2,2); a[0,0] = new ComplexFloat(2); a[0,1] = new ComplexFloat(4); a[1,0] = new ComplexFloat(3); a[1,1] = new ComplexFloat(7); a.Invert(); Assert.AreEqual(a[0,0].Real, 3.500,TOLERENCE); Assert.AreEqual(a[0,1].Real, -2.000,TOLERENCE); Assert.AreEqual(a[1,0].Real, -1.500,TOLERENCE); Assert.AreEqual(a[1,1].Real, 1.000,TOLERENCE); }
public void GetTransposeLong() { ComplexFloatMatrix a = new ComplexFloatMatrix(3,2); a[0,0] = new ComplexFloat(1); a[0,1] = new ComplexFloat(2); a[1,0] = new ComplexFloat(3); a[1,1] = new ComplexFloat(4); a[2,0] = new ComplexFloat(5); a[2,1] = new ComplexFloat(6); ComplexFloatMatrix b = a.GetTranspose(); Assert.AreEqual(b[0,0], a[0,0]); Assert.AreEqual(b[0,1], a[1,0]); Assert.AreEqual(b[0,2], a[2,0]); Assert.AreEqual(b[1,0], a[0,1]); Assert.AreEqual(b[1,1], a[1,1]); Assert.AreEqual(b[1,2], a[2,1]); Assert.AreEqual(b.RowLength, a.ColumnLength); Assert.AreEqual(b.ColumnLength, a.RowLength); }
public void SetupTestCases() { // unit testing values - order 1 LC1 = new ComplexFloatVector(1); LC1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR1 = new ComplexFloatVector(1); TR1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); L1 = new ComplexFloatMatrix(1); L1[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D1 = new ComplexFloatVector(1); D1[0] = new ComplexFloat(+5.0000000E-001f, -5.0000000E-001f); U1 = new ComplexFloatMatrix(1); U1[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det1 = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); I1 = new ComplexFloatMatrix(1); I1[0, 0] = new ComplexFloat(+5.0000000E-001f, -5.0000000E-001f); X1 = new ComplexFloatVector(1); X1[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Y1 = new ComplexFloatVector(1); Y1[0] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); // unit testing values - order 2 LC2 = new ComplexFloatVector(2); LC2[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); LC2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); TR2 = new ComplexFloatVector(2); TR2[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); TR2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); L2 = new ComplexFloatMatrix(2); L2[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L2[1, 0] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f); L2[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D2 = new ComplexFloatVector(2); D2[0] = new ComplexFloat(+1.6666667E-001f, -1.6666667E-001f); D2[1] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f); U2 = new ComplexFloatMatrix(2); U2[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U2[0, 1] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f); U2[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det2 = new ComplexFloat(-4.0000000E+000f, +1.8000000E+001f); I2 = new ComplexFloatMatrix(2); I2[0, 0] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f); I2[0, 1] = new ComplexFloat(+2.3529412E-002f, +1.0588235E-001f); I2[1, 0] = new ComplexFloat(+2.3529412E-002f, +1.0588235E-001f); I2[1, 1] = new ComplexFloat(+1.2352941E-001f, -1.9411765E-001f); X2 = new ComplexFloatVector(2); X2[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X2[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); Y2 = new ComplexFloatVector(2); Y2[0] = new ComplexFloat(+7.0000000E+000f, +3.0000000E+000f); Y2[1] = new ComplexFloat(+8.0000000E+000f, +6.0000000E+000f); // unit testing values - order 3 LC3 = new ComplexFloatVector(3); LC3[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); LC3[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); LC3[2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); TR3 = new ComplexFloatVector(3); TR3[0] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); TR3[1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); TR3[2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L3 = new ComplexFloatMatrix(3); L3[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L3[1, 0] = new ComplexFloat(-3.3333333E-001f, +3.3333333E-001f); L3[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L3[2, 0] = new ComplexFloat(-1.7073171E-001f, -3.6585366E-002f); L3[2, 1] = new ComplexFloat(-2.9878049E-001f, +3.1097561E-001f); L3[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D3 = new ComplexFloatVector(3); D3[0] = new ComplexFloat(+1.6666667E-001f, -1.6666667E-001f); D3[1] = new ComplexFloat(+1.4634146E-001f, -1.8292683E-001f); D3[2] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f); U3 = new ComplexFloatMatrix(3); U3[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U3[0, 1] = new ComplexFloat(-1.6666667E-001f, +1.6666667E-001f); U3[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U3[0, 2] = new ComplexFloat(-1.5243902E-001f, +1.2804878E-001f); U3[1, 2] = new ComplexFloat(-1.5853659E-001f, +7.3170732E-002f); U3[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det3 = new ComplexFloat(-6.4000000E+001f, +3.9000000E+001f); I3 = new ComplexFloatMatrix(3); I3[0, 0] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f); I3[0, 1] = new ComplexFloat(-9.4356418E-003f, +4.1125156E-002f); I3[0, 2] = new ComplexFloat(+1.9583408E-003f, +4.8068364E-002f); I3[1, 0] = new ComplexFloat(+1.5310664E-002f, +1.0307994E-001f); I3[1, 1] = new ComplexFloat(+1.3637173E-001f, -1.9814848E-001f); I3[1, 2] = new ComplexFloat(-9.4356418E-003f, +4.1125156E-002f); I3[2, 0] = new ComplexFloat(-3.2223607E-002f, +2.7238740E-002f); I3[2, 1] = new ComplexFloat(+1.5310664E-002f, +1.0307994E-001f); I3[2, 2] = new ComplexFloat(+1.4776571E-001f, -1.9120527E-001f); X3 = new ComplexFloatVector(3); X3[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X3[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X3[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); Y3 = new ComplexFloatVector(3); Y3[0] = new ComplexFloat(+8.0000000E+000f, +3.0000000E+000f); Y3[1] = new ComplexFloat(+1.1000000E+001f, +6.0000000E+000f); Y3[2] = new ComplexFloat(+1.4000000E+001f, +9.0000000E+000f); // unit testing values - order 4 LC4 = new ComplexFloatVector(4); LC4[0] = new ComplexFloat(+4.0000000E+000f, +4.0000000E+000f); LC4[1] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); LC4[2] = new ComplexFloat(+2.0000000E+000f, +2.0000000E+000f); LC4[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR4 = new ComplexFloatVector(4); TR4[0] = new ComplexFloat(+4.0000000E+000f, +4.0000000E+000f); TR4[1] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR4[2] = new ComplexFloat(+2.0000000E+000f, +2.0000000E+000f); TR4[3] = new ComplexFloat(+3.0000000E+000f, +3.0000000E+000f); L4 = new ComplexFloatMatrix(4); L4[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[1, 0] = new ComplexFloat(-7.5000000E-001f, +0.0000000E+000f); L4[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[2, 0] = new ComplexFloat(+7.6923077E-002f, +0.0000000E+000f); L4[2, 1] = new ComplexFloat(-7.6923077E-001f, +0.0000000E+000f); L4[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L4[3, 0] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); L4[3, 1] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); L4[3, 2] = new ComplexFloat(-8.1818182E-001f, +0.0000000E+000f); L4[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D4 = new ComplexFloatVector(4); D4[0] = new ComplexFloat(+1.2500000E-001f, -1.2500000E-001f); D4[1] = new ComplexFloat(+1.5384615E-001f, -1.5384615E-001f); D4[2] = new ComplexFloat(+1.4772727E-001f, -1.4772727E-001f); D4[3] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); U4 = new ComplexFloatMatrix(4); U4[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 1] = new ComplexFloat(-2.5000000E-001f, +0.0000000E+000f); U4[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 2] = new ComplexFloat(-5.3846154E-001f, +0.0000000E+000f); U4[1, 2] = new ComplexFloat(+1.5384615E-001f, +0.0000000E+000f); U4[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U4[0, 3] = new ComplexFloat(-8.1818182E-001f, +0.0000000E+000f); U4[1, 3] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); U4[2, 3] = new ComplexFloat(+9.0909091E-002f, +0.0000000E+000f); U4[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det4 = new ComplexFloat(-6.4000000E+002f, +0.0000000E+000f); I4 = new ComplexFloatMatrix(4); I4[0, 0] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[0, 1] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[0, 2] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[0, 3] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[1, 0] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[1, 1] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[1, 2] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[1, 3] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[2, 0] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[2, 1] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[2, 2] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); I4[2, 3] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 0] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 1] = new ComplexFloat(+1.2500000E-002f, -1.2500000E-002f); I4[3, 2] = new ComplexFloat(-1.1250000E-001f, +1.1250000E-001f); I4[3, 3] = new ComplexFloat(+1.3750000E-001f, -1.3750000E-001f); X4 = new ComplexFloatVector(4); X4[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X4[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X4[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X4[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); Y4 = new ComplexFloatVector(4); Y4[0] = new ComplexFloat(+2.4000000E+001f, +2.4000000E+001f); Y4[1] = new ComplexFloat(+2.2000000E+001f, +2.2000000E+001f); Y4[2] = new ComplexFloat(+2.4000000E+001f, +2.4000000E+001f); Y4[3] = new ComplexFloat(+3.0000000E+001f, +3.0000000E+001f); // unit testing values - order 5 LC5 = new ComplexFloatVector(5); LC5[0] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); LC5[1] = new ComplexFloat(+4.0000000E+000f, +1.0000000E+000f); LC5[2] = new ComplexFloat(+3.0000000E+000f, +1.0000000E+000f); LC5[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); LC5[4] = new ComplexFloat(+0.0000000E+000f, +0.0000000E+000f); TR5 = new ComplexFloatVector(5); TR5[0] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); TR5[1] = new ComplexFloat(+1.0000000E+000f, +4.0000000E+000f); TR5[2] = new ComplexFloat(+1.0000000E+000f, +3.0000000E+000f); TR5[3] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR5[4] = new ComplexFloat(+0.0000000E+000f, +0.0000000E+000f); L5 = new ComplexFloatMatrix(5); L5[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[1, 0] = new ComplexFloat(-8.0769231E-001f, -3.8461538E-002f); L5[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[2, 0] = new ComplexFloat(+3.8400000E-002f, +1.1200000E-002f); L5[2, 1] = new ComplexFloat(-8.1280000E-001f, -7.0400000E-002f); L5[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[3, 0] = new ComplexFloat(+2.2603093E-001f, +9.7680412E-002f); L5[3, 1] = new ComplexFloat(+8.8659794E-002f, -4.9484536E-002f); L5[3, 2] = new ComplexFloat(-8.9149485E-001f, -2.3788660E-001f); L5[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L5[4, 0] = new ComplexFloat(-1.1100961E-001f, +5.9189712E-002f); L5[4, 1] = new ComplexFloat(+2.3807881E-001f, +1.3619525E-001f); L5[4, 2] = new ComplexFloat(+1.0797070E-001f, +5.4774906E-003f); L5[4, 3] = new ComplexFloat(-8.0625940E-001f, -2.8594254E-001f); L5[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D5 = new ComplexFloatVector(5); D5[0] = new ComplexFloat(+1.9230769E-001f, -3.8461538E-002f); D5[1] = new ComplexFloat(+1.8080000E-001f, +9.4400000E-002f); D5[2] = new ComplexFloat(+1.8015464E-001f, +8.8402062E-002f); D5[3] = new ComplexFloat(+1.5698660E-001f, +6.5498707E-002f); D5[4] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); U5 = new ComplexFloatMatrix(5); U5[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 1] = new ComplexFloat(-3.4615385E-001f, -7.3076923E-001f); U5[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 2] = new ComplexFloat(-5.6320000E-001f, -4.9760000E-001f); U5[1, 2] = new ComplexFloat(+8.9600000E-002f, -3.0720000E-001f); U5[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 3] = new ComplexFloat(-7.7757732E-001f, +1.8298969E-002f); U5[1, 3] = new ComplexFloat(+7.0103093E-002f, -4.5773196E-001f); U5[2, 3] = new ComplexFloat(+5.9536082E-002f, -3.1520619E-001f); U5[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U5[0, 4] = new ComplexFloat(-3.8732272E-001f, +5.0102819E-001f); U5[1, 4] = new ComplexFloat(-3.1309322E-001f, -3.3622620E-001f); U5[2, 4] = new ComplexFloat(+6.0556288E-002f, -3.9414442E-001f); U5[3, 4] = new ComplexFloat(-7.6951473E-002f, -2.3979216E-001f); U5[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det5 = new ComplexFloat(+5.0900000E+002f, -4.2310000E+003f); I5 = new ComplexFloatMatrix(5); I5[0, 0] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); I5[0, 1] = new ComplexFloat(+2.2939970E-004f, -4.3279784E-002f); I5[0, 2] = new ComplexFloat(+3.0931791E-002f, -6.1154404E-002f); I5[0, 3] = new ComplexFloat(-3.3198751E-002f, -7.1638344E-002f); I5[0, 4] = new ComplexFloat(-9.0017358E-002f, +6.1172024E-002f); I5[1, 0] = new ComplexFloat(-1.1644584E-001f, -8.9749247E-002f); I5[1, 1] = new ComplexFloat(+1.4442611E-001f, +1.0032784E-001f); I5[1, 2] = new ComplexFloat(-1.2433728E-002f, -5.1220119E-003f); I5[1, 3] = new ComplexFloat(+4.7268453E-002f, -1.4096573E-005f); I5[1, 4] = new ComplexFloat(-3.3198751E-002f, -7.1638344E-002f); I5[2, 0] = new ComplexFloat(+1.7345558E-002f, +6.6582631E-003f); I5[2, 1] = new ComplexFloat(-1.2410964E-001f, -1.0040846E-001f); I5[2, 2] = new ComplexFloat(+1.4624793E-001f, +1.1547147E-001f); I5[2, 3] = new ComplexFloat(-1.2433728E-002f, -5.1220119E-003f); I5[2, 4] = new ComplexFloat(+3.0931791E-002f, -6.1154404E-002f); I5[3, 0] = new ComplexFloat(+3.1622138E-002f, +3.4957299E-002f); I5[3, 1] = new ComplexFloat(+2.3108689E-002f, -1.2234063E-002f); I5[3, 2] = new ComplexFloat(-1.2410964E-001f, -1.0040846E-001f); I5[3, 3] = new ComplexFloat(+1.4442611E-001f, +1.0032784E-001f); I5[3, 4] = new ComplexFloat(+2.2939970E-004f, -4.3279784E-002f); I5[4, 0] = new ComplexFloat(-2.1293920E-002f, +3.7434662E-003f); I5[4, 1] = new ComplexFloat(+3.1622138E-002f, +3.4957299E-002f); I5[4, 2] = new ComplexFloat(+1.7345558E-002f, +6.6582631E-003f); I5[4, 3] = new ComplexFloat(-1.1644584E-001f, -8.9749247E-002f); I5[4, 4] = new ComplexFloat(+1.6335863E-001f, +5.3379923E-002f); X5 = new ComplexFloatVector(5); X5[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X5[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X5[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X5[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); X5[4] = new ComplexFloat(+5.0000000E+000f, +0.0000000E+000f); Y5 = new ComplexFloatVector(5); Y5[0] = new ComplexFloat(+1.4000000E+001f, +2.2000000E+001f); Y5[1] = new ComplexFloat(+2.6000000E+001f, +3.2000000E+001f); Y5[2] = new ComplexFloat(+3.5000000E+001f, +3.7000000E+001f); Y5[3] = new ComplexFloat(+4.4000000E+001f, +3.0000000E+001f); Y5[4] = new ComplexFloat(+5.2000000E+001f, +1.4000000E+001f); // unit testing values - order 10 LC10 = new ComplexFloatVector(10); LC10[0] = new ComplexFloat(+1.0000000E+001f, +1.0000000E+000f); LC10[1] = new ComplexFloat(+9.0000000E+000f, +1.0000000E+000f); LC10[2] = new ComplexFloat(+8.0000000E+000f, +1.0000000E+000f); LC10[3] = new ComplexFloat(+7.0000000E+000f, +1.0000000E+000f); LC10[4] = new ComplexFloat(+6.0000000E+000f, +1.0000000E+000f); LC10[5] = new ComplexFloat(+5.0000000E+000f, +1.0000000E+000f); LC10[6] = new ComplexFloat(+4.0000000E+000f, +1.0000000E+000f); LC10[7] = new ComplexFloat(+3.0000000E+000f, +1.0000000E+000f); LC10[8] = new ComplexFloat(+2.0000000E+000f, +1.0000000E+000f); LC10[9] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10 = new ComplexFloatVector(10); TR10[0] = new ComplexFloat(+1.0000000E+001f, +1.0000000E+000f); TR10[1] = new ComplexFloat(+1.0000000E+000f, +9.0000000E+000f); TR10[2] = new ComplexFloat(+1.0000000E+000f, +8.0000000E+000f); TR10[3] = new ComplexFloat(+1.0000000E+000f, +2.0000000E+000f); TR10[4] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10[5] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); TR10[6] = new ComplexFloat(+1.0000000E+000f, +4.0000000E+000f); TR10[7] = new ComplexFloat(+1.0000000E+000f, +3.0000000E+000f); TR10[8] = new ComplexFloat(+1.0000000E+000f, +2.0000000E+000f); TR10[9] = new ComplexFloat(+1.0000000E+000f, +1.0000000E+000f); L10 = new ComplexFloatMatrix(10); L10[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[1, 0] = new ComplexFloat(-9.0099010E-001f, -9.9009901E-003f); L10[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[2, 0] = new ComplexFloat(+7.2554049E-003f, +4.5437889E-003f); L10[2, 1] = new ComplexFloat(-8.9835104E-001f, -1.7149139E-002f); L10[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[3, 0] = new ComplexFloat(+8.1190931E-003f, +4.8283630E-003f); L10[3, 1] = new ComplexFloat(+8.5500220E-003f, +3.8783605E-003f); L10[3, 2] = new ComplexFloat(-8.9685128E-001f, -2.5375839E-002f); L10[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[4, 0] = new ComplexFloat(+9.0797285E-003f, +5.0413564E-003f); L10[4, 1] = new ComplexFloat(+9.5223197E-003f, +3.9833209E-003f); L10[4, 2] = new ComplexFloat(+1.3594954E-002f, +1.3510004E-003f); L10[4, 3] = new ComplexFloat(-9.0106887E-001f, -3.2599942E-002f); L10[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[5, 0] = new ComplexFloat(+1.0110174E-002f, +5.1587582E-003f); L10[5, 1] = new ComplexFloat(+1.0553084E-002f, +3.9861933E-003f); L10[5, 2] = new ComplexFloat(+1.4900585E-002f, +9.5517949E-004f); L10[5, 3] = new ComplexFloat(+1.4574245E-002f, -1.1129242E-003f); L10[5, 4] = new ComplexFloat(-9.0776628E-001f, -3.8281015E-002f); L10[5, 5] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[6, 0] = new ComplexFloat(+1.1163789E-002f, +5.1884795E-003f); L10[6, 1] = new ComplexFloat(+1.1597112E-002f, +3.8999115E-003f); L10[6, 2] = new ComplexFloat(+1.6188452E-002f, +4.4138654E-004f); L10[6, 3] = new ComplexFloat(+1.5752309E-002f, -1.7871732E-003f); L10[6, 4] = new ComplexFloat(+1.4568519E-002f, -5.3100094E-003f); L10[6, 5] = new ComplexFloat(-9.1612446E-001f, -3.9858108E-002f); L10[6, 6] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[7, 0] = new ComplexFloat(+1.2250407E-002f, +5.1493111E-003f); L10[7, 1] = new ComplexFloat(+1.2666180E-002f, +3.7419578E-003f); L10[7, 2] = new ComplexFloat(+1.7480233E-002f, -1.7281679E-004f); L10[7, 3] = new ComplexFloat(+1.6920428E-002f, -2.5592884E-003f); L10[7, 4] = new ComplexFloat(+1.5502251E-002f, -6.3119298E-003f); L10[7, 5] = new ComplexFloat(+1.0175586E-002f, -6.2706520E-003f); L10[7, 6] = new ComplexFloat(-9.2129653E-001f, -4.0086723E-002f); L10[7, 7] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[8, 0] = new ComplexFloat(+1.3361099E-002f, +5.0636594E-003f); L10[8, 1] = new ComplexFloat(+1.3753926E-002f, +3.5354454E-003f); L10[8, 2] = new ComplexFloat(+1.8776835E-002f, -8.5571402E-004f); L10[8, 3] = new ComplexFloat(+1.8083822E-002f, -3.3986502E-003f); L10[8, 4] = new ComplexFloat(+1.6416076E-002f, -7.3767089E-003f); L10[8, 5] = new ComplexFloat(+1.0693868E-002f, -7.1281839E-003f); L10[8, 6] = new ComplexFloat(+8.4803223E-003f, -7.7622936E-003f); L10[8, 7] = new ComplexFloat(-9.2544568E-001f, -3.8329752E-002f); L10[8, 8] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); L10[9, 0] = new ComplexFloat(+1.4514517E-002f, +4.9086455E-003f); L10[9, 1] = new ComplexFloat(+1.4876264E-002f, +3.2557272E-003f); L10[9, 2] = new ComplexFloat(+2.0088847E-002f, -1.6446645E-003f); L10[9, 3] = new ComplexFloat(+1.9247642E-002f, -4.3429207E-003f); L10[9, 4] = new ComplexFloat(+1.7306259E-002f, -8.5413384E-003f); L10[9, 5] = new ComplexFloat(+1.1183742E-002f, -8.0532599E-003f); L10[9, 6] = new ComplexFloat(+8.7870452E-003f, -8.6470170E-003f); L10[9, 7] = new ComplexFloat(+6.7700213E-003f, -5.2124680E-003f); L10[9, 8] = new ComplexFloat(-9.2836000E-001f, -3.8752385E-002f); L10[9, 9] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); D10 = new ComplexFloatVector(10); D10[0] = new ComplexFloat(+9.9009901E-002f, -9.9009901E-003f); D10[1] = new ComplexFloat(+6.8010260E-002f, +5.2693294E-002f); D10[2] = new ComplexFloat(+6.8503012E-002f, +5.2264825E-002f); D10[3] = new ComplexFloat(+6.8598237E-002f, +5.1618595E-002f); D10[4] = new ComplexFloat(+6.8466983E-002f, +5.0945485E-002f); D10[5] = new ComplexFloat(+6.8034270E-002f, +5.0441605E-002f); D10[6] = new ComplexFloat(+6.7730052E-002f, +5.0175369E-002f); D10[7] = new ComplexFloat(+6.7391349E-002f, +5.0080104E-002f); D10[8] = new ComplexFloat(+6.7234262E-002f, +4.9912171E-002f); D10[9] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); U10 = new ComplexFloatMatrix(10); U10[0, 0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 1] = new ComplexFloat(-1.8811881E-001f, -8.8118812E-001f); U10[1, 1] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 2] = new ComplexFloat(-3.0868450E-001f, -8.2968120E-001f); U10[1, 2] = new ComplexFloat(+8.1788201E-002f, -1.3059729E-001f); U10[2, 2] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 3] = new ComplexFloat(-6.9271338E-001f, -4.1101317E-001f); U10[1, 3] = new ComplexFloat(+3.0656677E-001f, -4.4856765E-001f); U10[2, 3] = new ComplexFloat(+7.8629842E-002f, -1.3672690E-001f); U10[3, 3] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 4] = new ComplexFloat(-7.5308973E-001f, -1.7764936E-001f); U10[1, 4] = new ComplexFloat(-2.1811893E-002f, -2.3257783E-001f); U10[2, 4] = new ComplexFloat(+3.0081682E-001f, -4.5300731E-001f); U10[3, 4] = new ComplexFloat(+7.3373192E-002f, -1.4180544E-001f); U10[4, 4] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 5] = new ComplexFloat(-6.6968846E-001f, +1.6997563E-001f); U10[1, 5] = new ComplexFloat(-1.4411312E-001f, -3.0897730E-001f); U10[2, 5] = new ComplexFloat(-3.1145914E-002f, -2.3117177E-001f); U10[3, 5] = new ComplexFloat(+2.9376277E-001f, -4.5405633E-001f); U10[4, 5] = new ComplexFloat(+6.6435695E-002f, -1.4363825E-001f); U10[5, 5] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 6] = new ComplexFloat(-3.6546783E-001f, +1.3495818E-001f); U10[1, 6] = new ComplexFloat(-3.3276275E-001f, +6.1455619E-002f); U10[2, 6] = new ComplexFloat(-1.4928934E-001f, -3.0660365E-001f); U10[3, 6] = new ComplexFloat(-3.6720508E-002f, -2.2950990E-001f); U10[4, 6] = new ComplexFloat(+2.8936799E-001f, -4.5408893E-001f); U10[5, 6] = new ComplexFloat(+6.2044535E-002f, -1.4415916E-001f); U10[6, 6] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 7] = new ComplexFloat(-2.2796156E-001f, +2.1789305E-001f); U10[1, 7] = new ComplexFloat(-1.4794186E-001f, -5.5572852E-002f); U10[2, 7] = new ComplexFloat(-3.3492680E-001f, +6.5840476E-002f); U10[3, 7] = new ComplexFloat(-1.5249085E-001f, -3.0276392E-001f); U10[4, 7] = new ComplexFloat(-4.0507028E-002f, -2.2608317E-001f); U10[5, 7] = new ComplexFloat(+2.8587453E-001f, -4.5245103E-001f); U10[6, 7] = new ComplexFloat(+5.8369087E-002f, -1.4290942E-001f); U10[7, 7] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 8] = new ComplexFloat(-1.8901586E-001f, +3.4805079E-002f); U10[1, 8] = new ComplexFloat(-5.2426683E-002f, +1.9340427E-001f); U10[2, 8] = new ComplexFloat(-1.4964696E-001f, -5.4033437E-002f); U10[3, 8] = new ComplexFloat(-3.3763728E-001f, +6.7573088E-002f); U10[4, 8] = new ComplexFloat(-1.5560000E-001f, -3.0169126E-001f); U10[5, 8] = new ComplexFloat(-4.3805054E-002f, -2.2544210E-001f); U10[6, 8] = new ComplexFloat(+2.8335018E-001f, -4.5271747E-001f); U10[7, 8] = new ComplexFloat(+5.5874343E-002f, -1.4345634E-001f); U10[8, 8] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); U10[0, 9] = new ComplexFloat(-1.9701952E-001f, +6.3155749E-002f); U10[1, 9] = new ComplexFloat(-4.2642564E-003f, -1.6090427E-002f); U10[2, 9] = new ComplexFloat(-5.3607239E-002f, +1.9546918E-001f); U10[3, 9] = new ComplexFloat(-1.5130367E-001f, -5.1953666E-002f); U10[4, 9] = new ComplexFloat(-3.4040569E-001f, +7.0063213E-002f); U10[5, 9] = new ComplexFloat(-1.5894822E-001f, -2.9987956E-001f); U10[6, 9] = new ComplexFloat(-4.7450414E-002f, -2.2408765E-001f); U10[7, 9] = new ComplexFloat(+2.8041710E-001f, -4.5254539E-001f); U10[8, 9] = new ComplexFloat(+5.2922147E-002f, -1.4361015E-001f); U10[9, 9] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); Det10 = new ComplexFloat(+3.6568548E+010f, +2.4768517E+010f); I10 = new ComplexFloatMatrix(10); I10[0, 0] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); I10[0, 1] = new ComplexFloat(+1.0691834E-002f, -6.9924390E-003f); I10[0, 2] = new ComplexFloat(+4.1309398E-002f, -1.6380491E-002f); I10[0, 3] = new ComplexFloat(+7.9682744E-003f, -1.7380034E-002f); I10[0, 4] = new ComplexFloat(+4.2659401E-003f, -2.8007075E-002f); I10[0, 5] = new ComplexFloat(-2.6301184E-002f, -1.2239617E-002f); I10[0, 6] = new ComplexFloat(-7.5562748E-003f, -1.1009683E-002f); I10[0, 7] = new ComplexFloat(-1.3317795E-002f, +1.0434171E-002f); I10[0, 8] = new ComplexFloat(+5.1470750E-004f, -1.2906015E-003f); I10[0, 9] = new ComplexFloat(-1.6347168E-002f, -5.5689657E-003f); I10[1, 0] = new ComplexFloat(-6.0294731E-002f, -4.8784282E-002f); I10[1, 1] = new ComplexFloat(+5.7037418E-002f, +5.5989338E-002f); I10[1, 2] = new ComplexFloat(-2.8067888E-002f, +6.7497836E-003f); I10[1, 3] = new ComplexFloat(+3.3576008E-002f, -4.6936404E-004f); I10[1, 4] = new ComplexFloat(+3.2614353E-003f, +8.4914935E-003f); I10[1, 5] = new ComplexFloat(+2.8539068E-002f, -1.5668319E-002f); I10[1, 6] = new ComplexFloat(-1.9485222E-002f, -1.7952100E-003f); I10[1, 7] = new ComplexFloat(+5.4035811E-003f, -2.0272674E-002f); I10[1, 8] = new ComplexFloat(-1.3705944E-002f, +1.1564861E-002f); I10[1, 9] = new ComplexFloat(+5.1470750E-004f, -1.2906015E-003f); I10[2, 0] = new ComplexFloat(+7.1308213E-004f, -1.2546164E-005f); I10[2, 1] = new ComplexFloat(-6.0272601E-002f, -4.8871146E-002f); I10[2, 2] = new ComplexFloat(+5.7219842E-002f, +5.5680641E-002f); I10[2, 3] = new ComplexFloat(-2.8112753E-002f, +6.6173592E-003f); I10[2, 4] = new ComplexFloat(+3.3454600E-002f, -6.5413224E-004f); I10[2, 5] = new ComplexFloat(+3.0216929E-003f, +8.5724569E-003f); I10[2, 6] = new ComplexFloat(+2.8435161E-002f, -1.5684889E-002f); I10[2, 7] = new ComplexFloat(-1.9514358E-002f, -1.6393606E-003f); I10[2, 8] = new ComplexFloat(+5.4035811E-003f, -2.0272674E-002f); I10[2, 9] = new ComplexFloat(-1.3317795E-002f, +1.0434171E-002f); I10[3, 0] = new ComplexFloat(+1.0191444E-003f, -1.4239535E-004f); I10[3, 1] = new ComplexFloat(+9.9108704E-004f, -2.5251613E-004f); I10[3, 2] = new ComplexFloat(-5.9819166E-002f, -4.9484148E-002f); I10[3, 3] = new ComplexFloat(+5.7389952E-002f, +5.5227507E-002f); I10[3, 4] = new ComplexFloat(-2.8106424E-002f, +6.0757008E-003f); I10[3, 5] = new ComplexFloat(+3.3259014E-002f, -8.2858379E-004f); I10[3, 6] = new ComplexFloat(+2.9250084E-003f, +8.3171088E-003f); I10[3, 7] = new ComplexFloat(+2.8435161E-002f, -1.5684889E-002f); I10[3, 8] = new ComplexFloat(-1.9485222E-002f, -1.7952100E-003f); I10[3, 9] = new ComplexFloat(-7.5562748E-003f, -1.1009683E-002f); I10[4, 0] = new ComplexFloat(+1.1502413E-003f, +1.6639121E-005f); I10[4, 1] = new ComplexFloat(+1.1380402E-003f, -1.0980979E-004f); I10[4, 2] = new ComplexFloat(+1.3977289E-003f, -5.8000250E-004f); I10[4, 3] = new ComplexFloat(-5.9700112E-002f, -4.9533948E-002f); I10[4, 4] = new ComplexFloat(+5.7405368E-002f, +5.5059022E-002f); I10[4, 5] = new ComplexFloat(-2.8274330E-002f, +6.2766221E-003f); I10[4, 6] = new ComplexFloat(+3.3259014E-002f, -8.2858379E-004f); I10[4, 7] = new ComplexFloat(+3.0216929E-003f, +8.5724569E-003f); I10[4, 8] = new ComplexFloat(+2.8539068E-002f, -1.5668319E-002f); I10[4, 9] = new ComplexFloat(-2.6301184E-002f, -1.2239617E-002f); I10[5, 0] = new ComplexFloat(+1.5848813E-003f, +2.8852793E-004f); I10[5, 1] = new ComplexFloat(+1.5972212E-003f, +1.1105891E-004f); I10[5, 2] = new ComplexFloat(+2.0644546E-003f, -4.7842310E-004f); I10[5, 3] = new ComplexFloat(+1.9356717E-003f, -7.4622243E-004f); I10[5, 4] = new ComplexFloat(-5.9306111E-002f, -4.9933722E-002f); I10[5, 5] = new ComplexFloat(+5.7405368E-002f, +5.5059022E-002f); I10[5, 6] = new ComplexFloat(-2.8106424E-002f, +6.0757008E-003f); I10[5, 7] = new ComplexFloat(+3.3454600E-002f, -6.5413224E-004f); I10[5, 8] = new ComplexFloat(+3.2614353E-003f, +8.4914935E-003f); I10[5, 9] = new ComplexFloat(+4.2659401E-003f, -2.8007075E-002f); I10[6, 0] = new ComplexFloat(+1.5061253E-003f, +6.6650996E-004f); I10[6, 1] = new ComplexFloat(+1.5609115E-003f, +4.9307536E-004f); I10[6, 2] = new ComplexFloat(+2.1665459E-003f, +1.9121555E-005f); I10[6, 3] = new ComplexFloat(+2.1027094E-003f, -2.7790747E-004f); I10[6, 4] = new ComplexFloat(+1.9356717E-003f, -7.4622243E-004f); I10[6, 5] = new ComplexFloat(-5.9700112E-002f, -4.9533948E-002f); I10[6, 6] = new ComplexFloat(+5.7389952E-002f, +5.5227507E-002f); I10[6, 7] = new ComplexFloat(-2.8112753E-002f, +6.6173592E-003f); I10[6, 8] = new ComplexFloat(+3.3576008E-002f, -4.6936404E-004f); I10[6, 9] = new ComplexFloat(+7.9682744E-003f, -1.7380034E-002f); I10[7, 0] = new ComplexFloat(+1.4282653E-003f, +8.8920966E-004f); I10[7, 1] = new ComplexFloat(+1.5084436E-003f, +7.2160481E-004f); I10[7, 2] = new ComplexFloat(+2.1887064E-003f, +3.2867753E-004f); I10[7, 3] = new ComplexFloat(+2.1665459E-003f, +1.9121555E-005f); I10[7, 4] = new ComplexFloat(+2.0644546E-003f, -4.7842310E-004f); I10[7, 5] = new ComplexFloat(+1.3977289E-003f, -5.8000250E-004f); I10[7, 6] = new ComplexFloat(-5.9819166E-002f, -4.9484148E-002f); I10[7, 7] = new ComplexFloat(+5.7219842E-002f, +5.5680641E-002f); I10[7, 8] = new ComplexFloat(-2.8067888E-002f, +6.7497836E-003f); I10[7, 9] = new ComplexFloat(+4.1309398E-002f, -1.6380491E-002f); I10[8, 0] = new ComplexFloat(+8.3509562E-004f, +9.5832342E-004f); I10[8, 1] = new ComplexFloat(+9.3009336E-004f, +8.5497971E-004f); I10[8, 2] = new ComplexFloat(+1.5084436E-003f, +7.2160481E-004f); I10[8, 3] = new ComplexFloat(+1.5609115E-003f, +4.9307536E-004f); I10[8, 4] = new ComplexFloat(+1.5972212E-003f, +1.1105891E-004f); I10[8, 5] = new ComplexFloat(+1.1380402E-003f, -1.0980979E-004f); I10[8, 6] = new ComplexFloat(+9.9108704E-004f, -2.5251613E-004f); I10[8, 7] = new ComplexFloat(-6.0272601E-002f, -4.8871146E-002f); I10[8, 8] = new ComplexFloat(+5.7037418E-002f, +5.5989338E-002f); I10[8, 9] = new ComplexFloat(+1.0691834E-002f, -6.9924390E-003f); I10[9, 0] = new ComplexFloat(+7.2861524E-004f, +1.0511118E-003f); I10[9, 1] = new ComplexFloat(+8.3509562E-004f, +9.5832342E-004f); I10[9, 2] = new ComplexFloat(+1.4282653E-003f, +8.8920966E-004f); I10[9, 3] = new ComplexFloat(+1.5061253E-003f, +6.6650996E-004f); I10[9, 4] = new ComplexFloat(+1.5848813E-003f, +2.8852793E-004f); I10[9, 5] = new ComplexFloat(+1.1502413E-003f, +1.6639121E-005f); I10[9, 6] = new ComplexFloat(+1.0191444E-003f, -1.4239535E-004f); I10[9, 7] = new ComplexFloat(+7.1308213E-004f, -1.2546164E-005f); I10[9, 8] = new ComplexFloat(-6.0294731E-002f, -4.8784282E-002f); I10[9, 9] = new ComplexFloat(+6.7024327E-002f, +4.9751098E-002f); X10 = new ComplexFloatVector(10); X10[0] = new ComplexFloat(+1.0000000E+000f, +0.0000000E+000f); X10[1] = new ComplexFloat(+2.0000000E+000f, +0.0000000E+000f); X10[2] = new ComplexFloat(+3.0000000E+000f, +0.0000000E+000f); X10[3] = new ComplexFloat(+4.0000000E+000f, +0.0000000E+000f); X10[4] = new ComplexFloat(+5.0000000E+000f, +0.0000000E+000f); X10[5] = new ComplexFloat(+6.0000000E+000f, +0.0000000E+000f); X10[6] = new ComplexFloat(+7.0000000E+000f, +0.0000000E+000f); X10[7] = new ComplexFloat(+8.0000000E+000f, +0.0000000E+000f); X10[8] = new ComplexFloat(+9.0000000E+000f, +0.0000000E+000f); X10[9] = new ComplexFloat(+1.0000000E+001f, +0.0000000E+000f); Y10 = new ComplexFloatVector(10); Y10[0] = new ComplexFloat(+6.4000000E+001f, +1.4200000E+002f); Y10[1] = new ComplexFloat(+8.1000000E+001f, +1.6400000E+002f); Y10[2] = new ComplexFloat(+1.0500000E+002f, +1.7500000E+002f); Y10[3] = new ComplexFloat(+1.3500000E+002f, +1.7400000E+002f); Y10[4] = new ComplexFloat(+1.7000000E+002f, +1.6000000E+002f); Y10[5] = new ComplexFloat(+2.0900000E+002f, +1.7600000E+002f); Y10[6] = new ComplexFloat(+2.5100000E+002f, +1.9200000E+002f); Y10[7] = new ComplexFloat(+2.9500000E+002f, +1.9700000E+002f); Y10[8] = new ComplexFloat(+3.4000000E+002f, +1.3500000E+002f); Y10[9] = new ComplexFloat(+3.8500000E+002f, +5.5000000E+001f); // Tolerances Tolerance1 = 1.000E-06f; Tolerance2 = 2.000E-06f; Tolerance3 = 1.000E-06f; Tolerance4 = 1.000E-05f; Tolerance5 = 1.000E-05f; Tolerance10 = 5.000E-05f; }
public void TransposeSquare() { ComplexFloatMatrix a = new ComplexFloatMatrix(2,2); a[0,0] = new ComplexFloat(1); a[0,1] = new ComplexFloat(2); a[1,0] = new ComplexFloat(3); a[1,1] = new ComplexFloat(4); a.Transpose(); Assert.AreEqual(a[0,0], new ComplexFloat(1)); Assert.AreEqual(a[0,1], new ComplexFloat(3)); Assert.AreEqual(a[1,0], new ComplexFloat(2)); Assert.AreEqual(a[1,1], new ComplexFloat(4)); }
public void CtorCopyNull() { ComplexFloatMatrix a = null; ComplexFloatMatrix b = new ComplexFloatMatrix(a); }
public void ToArray() { ComplexFloatMatrix a = new ComplexFloatMatrix(2); a[0,0] = new ComplexFloat(1,1); a[0,1] = new ComplexFloat(2,2); a[1,0] = new ComplexFloat(3,3); a[1,1] = new ComplexFloat(4,4); ComplexFloat[,] b = a.ToArray(); Assert.AreEqual(a[0,0], b[0,0]); Assert.AreEqual(a[0,1], b[0,1]); Assert.AreEqual(a[1,0], b[1,0]); Assert.AreEqual(a[1,1], b[1,1]); }
public void TestHashCode() { ComplexFloatMatrix a = new ComplexFloatMatrix(2); a[0,0] = new ComplexFloat(1,1); a[0,1] = new ComplexFloat(2,2); a[1,0] = new ComplexFloat(3,3); a[1,1] = new ComplexFloat(4,4); int hash = a.GetHashCode(); Assert.AreEqual(hash, 7); }
public void Equals() { ComplexFloatMatrix a = new ComplexFloatMatrix(2,2,new ComplexFloat(4,4)); ComplexFloatMatrix b = new ComplexFloatMatrix(2,2,new ComplexFloat(4,4)); ComplexFloatMatrix c = new ComplexFloatMatrix(2,2); c[0,0] = new ComplexFloat(4,4); c[0,1] = new ComplexFloat(4,4); c[1,0] = new ComplexFloat(4,4); c[1,1] = new ComplexFloat(4,4); ComplexFloatMatrix d = new ComplexFloatMatrix(2,2,5); ComplexFloatMatrix e = null; FloatMatrix f = new FloatMatrix(2,2,4); Assert.IsTrue(a.Equals(b)); Assert.IsTrue(b.Equals(a)); Assert.IsTrue(a.Equals(c)); Assert.IsTrue(b.Equals(c)); Assert.IsTrue(c.Equals(b)); Assert.IsTrue(c.Equals(a)); Assert.IsFalse(a.Equals(d)); Assert.IsFalse(d.Equals(b)); Assert.IsFalse(a.Equals(e)); Assert.IsFalse(a.Equals(f)); }
/// <summary> /// Solve a symmetric square Toeplitz system with a right-side matrix. /// </summary> /// <param name="Y">The right-hand side of the system.</param> /// <returns>The solution matrix.</returns> /// <exception cref="ArgumentNullException"> /// Parameter <B>Y</B> is a null reference. /// </exception> /// <exception cref="RankException"> /// The number of rows in <B>Y</B> is not equal to the number of rows in the Toeplitz matrix. /// </exception> /// <exception cref="SingularMatrixException"> /// The Toeplitz matrix or one of the the leading sub-matrices is singular. /// </exception> /// <remarks> /// This member solves the linear system <B>TX</B> = <B>Y</B>, where <B>T</B> is /// a symmetric square Toeplitz matrix, <B>X</B> is the unknown solution matrix /// and <B>Y</B> is a known matrix. /// <para> /// The class implicitly decomposes the inverse Toeplitz matrix into a <b>UDL</b> factorisation /// using the Levinson algorithm, and then calculates the solution matrix. /// </para> /// </remarks> public ComplexFloatMatrix Solve(IROComplexFloatMatrix Y) { ComplexFloatMatrix X; // check parameters if (Y == null) { throw new System.ArgumentNullException("Y"); } else if (m_Order != Y.Columns) { throw new RankException("The numer of rows in Y is not equal to the number of rows in the Toeplitz matrix."); } Compute(); if (m_IsSingular == true) { throw new SingularMatrixException("The Toeplitz matrix or one of the the leading sub-matrices is singular."); } int M = Y.Rows; int i, j, l, m; // index/loop variables ComplexFloat[] Inner; // inner product ComplexFloat[] G; // scaling constant ComplexFloat[] A; // reference to current order coefficients ComplexFloat scalar; // allocate memory for solution X = new ComplexFloatMatrix(m_Order, M); Inner = new ComplexFloat[M]; G = new ComplexFloat[M]; // setup zero order solution scalar = ComplexFloat.One / m_LeftColumn[0]; for (m = 0; m < M; m++) { #if MANAGED X.data[0][m] = scalar * Y[0,m]; #else X.data[m*m_Order] = scalar * Y[0,m]; #endif } // solve systems of increasing order for (i = 1; i < m_Order; i++) { // calculate inner product for (m = 0; m < M; m++) { #if MANAGED Inner[m] = Y[i,m]; #else Inner[m] = Y[i,m]; #endif } for (j = 0, l = i; j < i; j++, l--) { scalar = m_LeftColumn[l]; for (m = 0; m < M; m++) { #if MANAGED Inner[m] -= scalar * X.data[j][m]; #else Inner[m] -= scalar * X.data[m*m_Order+j]; #endif } } // get the current predictor coefficients row A = m_LowerTriangle[i]; // update the solution matrix for (m = 0; m < M; m++) { G[m] = m_Diagonal[i] * Inner[m]; } for (j = 0; j <= i; j++) { scalar = A[j]; for (m = 0; m < M; m++) { #if MANAGED X.data[j][m] += scalar * G[m]; #else X.data[m*m_Order+j] += scalar * G[m]; #endif } } } return X; }
public void CtorMultDimFloatLong() { float[,] values= new float[3,2]; values[0,0] = 0; values[0,1] = 1; values[1,0] = 2; values[1,1] = 3; values[2,0] = 4; values[2,1] = 5; ComplexFloatMatrix test = new ComplexFloatMatrix(values); Assert.AreEqual(test.RowLength, 3); Assert.AreEqual(test.ColumnLength, 2); Assert.AreEqual(test[0,0].Real, values[0,0]); Assert.AreEqual(test[0,1].Real, values[0,1]); Assert.AreEqual(test[1,0].Real, values[1,0]); Assert.AreEqual(test[1,1].Real, values[1,1]); Assert.AreEqual(test[2,0].Real, values[2,0]); Assert.AreEqual(test[2,1].Real, values[2,1]); }
/// <summary> /// Get the inverse of the Toeplitz matrix. /// </summary> /// <returns>The inverse matrix.</returns> /// <exception cref="SingularMatrixException"> /// The Toeplitz matrix or one of the the leading sub-matrices is singular. /// </exception> /// <remarks> /// The class implicitly decomposes the inverse Toeplitz matrix into a <b>UDL</b> factorisation /// using the Levinson algorithm, before using Trench's algorithm to complete /// the calculation of the inverse. /// <para> /// Trench's algorithm requires approximately <b>N</b> squared FLOPS, compared to <b>N</b> cubed FLOPS /// if we simply multiplied the <b>UDL</b> factors (<b>N</b> is the matrix order). /// </para> /// </remarks> public ComplexFloatMatrix GetInverse() { Compute(); if (m_IsSingular == true) { throw new SingularMatrixException("The Toeplitz matrix or one of the the leading sub-matrices is singular."); } ComplexFloatMatrix I = new ComplexFloatMatrix(m_Order); // the solution matrix ComplexFloat[] A = m_LowerTriangle[m_Order-1]; ComplexFloat A1, A2, scale; #if MANAGED ComplexFloat[] current, previous; // references to rows in the solution int i, j, k, l; // setup the first row in wedge scale = m_Diagonal[m_Order-1]; current = I.data[0]; for (i = 0, j = m_Order - 1; i < m_Order; i++, j--) { current[i] = scale* A[j]; } // calculate values in the rest of the wedge for (i = 1; i < (1 + m_Order) / 2; i++) { previous = current; current = I.data[i]; A1 = A[m_Order - i - 1]; A2 = A[i - 1]; for (j = i, k = i - 1, l = m_Order - i - 1; j < m_Order - i; j++, k++, l--) { current[j] = previous[k] + scale * (A1 * A[l] - A2 * A[k]); } } #else int i, j, k, l; // setup the first row in wedge scale = m_Diagonal[m_Order-1]; for (i = 0, j = m_Order - 1; i < m_Order; i++, j--) { I[0, i] = scale* A[j]; } // calculate values in the rest of the wedge for (i = 1; i < (1 + m_Order) / 2; i++) { A1 = A[m_Order - i - 1]; A2 = A[i - 1]; for (j = i, k = i - 1, l = m_Order - i - 1; j < m_Order - i; j++, k++, l--) { I[i, j] = I[i - 1, k] + scale * (A1 * A[l] - A2 * A[k]); } } #endif // this is symmetric matrix ... for (i = 0; i < (1 + m_Order) / 2; i++) { for (j = i; j < m_Order - i; j++) { I[j, i] = I[i, j]; } } // and a persymmetric matrix. for (i = 0, j = m_Order - 1; i < m_Order; i++, j--) { for (k = 0, l = m_Order - 1; k < j; k++, l--) { I[l, j] = I[i, k]; } } return I; }
public void GetTransposeSquare() { ComplexFloatMatrix a = new ComplexFloatMatrix(2,2); a[0,0] = new ComplexFloat(1); a[0,1] = new ComplexFloat(2); a[1,0] = new ComplexFloat(3); a[1,1] = new ComplexFloat(4); ComplexFloatMatrix b = a.GetTranspose(); Assert.AreEqual(b[0,0], a[0,0]); Assert.AreEqual(b[0,1], a[1,0]); Assert.AreEqual(b[1,0], a[0,1]); Assert.AreEqual(b[1,1], a[1,1]); }
public void TransposeLong() { ComplexFloatMatrix a = new ComplexFloatMatrix(3,2); a[0,0] = new ComplexFloat(1); a[0,1] = new ComplexFloat(2); a[1,0] = new ComplexFloat(3); a[1,1] = new ComplexFloat(4); a[2,0] = new ComplexFloat(5); a[2,1] = new ComplexFloat(6); a.Transpose(); Assert.AreEqual(a[0,0], new ComplexFloat(1)); Assert.AreEqual(a[0,1], new ComplexFloat(3)); Assert.AreEqual(a[0,2], new ComplexFloat(5)); Assert.AreEqual(a[1,0], new ComplexFloat(2)); Assert.AreEqual(a[1,1], new ComplexFloat(4)); Assert.AreEqual(a[1,2], new ComplexFloat(6)); Assert.AreEqual(a.RowLength, 2); Assert.AreEqual(a.ColumnLength, 3); }
public void CtorMultDimFloatNull() { float[,] values = null; ComplexFloatMatrix test = new ComplexFloatMatrix(values); }