package com.imsl.test.example.math; import com.imsl.math.*; /** *

* Computes the SVD factorization of a complex matrix.

* The singular value decomposition of a matrix is performed. The generalized * inverse and rank of the matrix are also computed. * * @see Code * @see Output */ public class ComplexSVDEx1 { public static void main(String args[]) throws ComplexSVD.DidNotConvergeException { Complex a[][] = { {new Complex(1.0, 2.0), new Complex(3.0, 2.0), new Complex(1.0, -4.0)}, {new Complex(3.0, -2.0), new Complex(2.0, -4.0), new Complex(1.0, 3.0)}, {new Complex(4.0, 3.0), new Complex(-2.0, 1.0), new Complex(1.0, 4.0)}, {new Complex(2.0, -1.0), new Complex(3.0, 0.0), new Complex(3.0, -1.0)}, {new Complex(1.0, -5.0), new Complex(2.0, -5.0), new Complex(2.0, 2.0)}, {new Complex(1.0, 2.0), new Complex(4.0, -2.0), new Complex(2.0, -3.0)} }; // Compute the SVD factorization of A. ComplexSVD svd = new ComplexSVD(a); // Print U, S, V and the Moore-Penrose inverse. new PrintMatrix("U").print(svd.getU()); new PrintMatrix("S").print(svd.getS()); new PrintMatrix("V").print(svd.getV()); new PrintMatrix("Inverse").print(svd.getInverse()); // Find the rank of A. int rank = svd.getRank(); System.out.println("rank = " + rank); } }