Java Doc for Matrix.java in  » Science » weka » weka » core » matrix » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » weka » weka.core.matrix 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   weka.core.matrix.Matrix

All known Subclasses:   weka.classifiers.functions.pace.PaceMatrix,
Matrix
public class Matrix implements Cloneable,Serializable(Code)
Jama = Java Matrix class.

The Java Matrix Class provides the fundamental operations of numerical linear algebra. Various constructors create Matrices from two dimensional arrays of double precision floating point numbers. Various "gets" and "sets" provide access to submatrices and matrix elements. Several methods implement basic matrix arithmetic, including matrix addition and multiplication, matrix norms, and element-by-element array operations. Methods for reading and printing matrices are also included. All the operations in this version of the Matrix Class involve real matrices. Complex matrices may be handled in a future version.

Five fundamental matrix decompositions, which consist of pairs or triples of matrices, permutation vectors, and the like, produce results in five decomposition classes. These decompositions are accessed by the Matrix class to compute solutions of simultaneous linear equations, determinants, inverses and other matrix functions. The five decompositions are:

  • Cholesky Decomposition of symmetric, positive definite matrices.
  • LU Decomposition of rectangular matrices.
  • QR Decomposition of rectangular matrices.
  • Singular Value Decomposition of rectangular matrices.
  • Eigenvalue Decomposition of both symmetric and nonsymmetric square matrices.
Example of use:

Solve a linear system A x = b and compute the residual norm, ||b - A x||.

 double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};
 Matrix A = new Matrix(vals);
 Matrix b = Matrix.random(3,1);
 Matrix x = A.solve(b);
 Matrix r = A.times(x).minus(b);
 double rnorm = r.normInf();
 

Adapted from the JAMA package. Additional methods are tagged with the @author tag.
author:
   The Mathworks and NIST
author:
   Fracpete (fracpete at waikato dot ac dot nz)
version:
   $Revision: 1.7 $



Field Summary
protected  double[][]A
     Array for internal storage of elements.
protected  intmn
     Row and column dimensions.

Constructor Summary
public  Matrix(int m, int n)
     Construct an m-by-n matrix of zeros.
public  Matrix(int m, int n, double s)
     Construct an m-by-n constant matrix.
public  Matrix(double[][] A)
     Construct a matrix from a 2-D array.
public  Matrix(double[][] A, int m, int n)
     Construct a matrix quickly without checking arguments.
public  Matrix(double vals, int m)
    
public  Matrix(Reader r)
     Reads a matrix from a reader.

Method Summary
public  MatrixarrayLeftDivide(Matrix B)
    
public  MatrixarrayLeftDivideEquals(Matrix B)
    
public  MatrixarrayRightDivide(Matrix B)
    
public  MatrixarrayRightDivideEquals(Matrix B)
    
public  MatrixarrayTimes(Matrix B)
    
public  MatrixarrayTimesEquals(Matrix B)
    
public  CholeskyDecompositionchol()
    
public  Objectclone()
     Clone the Matrix object.
public  doublecond()
    
public static  MatrixconstructWithCopy(double[][] A)
     Construct a matrix from a copy of a 2-D array.
public  Matrixcopy()
    
public  doubledet()
    
public  EigenvalueDecompositioneig()
    
public  doubleget(int i, int j)
     Get a single element.
Parameters:
  i - Row index.
Parameters:
  j - Column index.
public  double[][]getArray()
     Access the internal two-dimensional array.
public  double[][]getArrayCopy()
     Copy the internal two-dimensional array.
public  intgetColumnDimension()
     Get column dimension.
public  double[]getColumnPackedCopy()
     Make a one-dimensional column packed copy of the internal array.
public  MatrixgetMatrix(int i0, int i1, int j0, int j1)
     Get a submatrix.
public  MatrixgetMatrix(int[] r, int[] c)
     Get a submatrix.
Parameters:
  r - Array of row indices.
Parameters:
  c - Array of column indices.
public  MatrixgetMatrix(int i0, int i1, int[] c)
     Get a submatrix.
Parameters:
  i0 - Initial row index
Parameters:
  i1 - Final row index
Parameters:
  c - Array of column indices.
public  MatrixgetMatrix(int[] r, int j0, int j1)
     Get a submatrix.
public  intgetRowDimension()
     Get row dimension.
public  double[]getRowPackedCopy()
     Make a one-dimensional row packed copy of the internal array.
public static  Matrixidentity(int m, int n)
     Generate identity matrix
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums.
public  Matrixinverse()
    
public  booleanisSquare()
     returns whether the matrix is a square matrix or not.
public  booleanisSymmetric()
     Returns true if the matrix is symmetric.
public  LUDecompositionlu()
    
public static  voidmain(String[] args)
     Main method for testing this class.
public  Matrixminus(Matrix B)
    
public  MatrixminusEquals(Matrix B)
    
public  doublenorm1()
    
public  doublenorm2()
    
public  doublenormF()
    
public  doublenormInf()
    
public static  MatrixparseMatlab(String matlab)
     creates a matrix from the given Matlab string.
public  Matrixplus(Matrix B)
    
public  MatrixplusEquals(Matrix B)
    
public  voidprint(int w, int d)
     Print the matrix to stdout.
public  voidprint(PrintWriter output, int w, int d)
     Print the matrix to the output stream.
public  voidprint(NumberFormat format, int width)
     Print the matrix to stdout.
public  voidprint(PrintWriter output, NumberFormat format, int width)
     Print the matrix to the output stream.
public  QRDecompositionqr()
    
public static  Matrixrandom(int m, int n)
     Generate matrix with random elements
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums.
public  intrank()
    
public static  Matrixread(BufferedReader input)
     Read a matrix from a stream.
public  LinearRegressionregression(Matrix y, double ridge)
     Performs a (ridged) linear regression.
final public  LinearRegressionregression(Matrix y, double[] w, double ridge)
     Performs a weighted (ridged) linear regression.
public  voidset(int i, int j, double s)
     Set a single element.
public  voidsetMatrix(int i0, int i1, int j0, int j1, Matrix X)
     Set a submatrix.
public  voidsetMatrix(int[] r, int[] c, Matrix X)
     Set a submatrix.
public  voidsetMatrix(int[] r, int j0, int j1, Matrix X)
     Set a submatrix.
public  voidsetMatrix(int i0, int i1, int[] c, Matrix X)
     Set a submatrix.
public  Matrixsolve(Matrix B)
    
public  MatrixsolveTranspose(Matrix B)
    
public  Matrixsqrt()
     returns the square root of the matrix, i.e., X from the equation X*X = A.
Steps in the Calculation (see sqrtm in Matlab):
  1. perform eigenvalue decomposition
    [V,D]=eig(A)
  2. take the square root of all elements in D (only the ones with positive sign are considered for further computation)
    S=sqrt(D)
  3. calculate the root
    X=V*S/V, which can be also written as X=(V'\(V*S)')'

Note: since this method uses other high-level methods, it generates several instances of matrices.

public  SingularValueDecompositionsvd()
    
public  Matrixtimes(double s)
    
public  Matrixtimes(Matrix B)
    
public  MatrixtimesEquals(double s)
    
public  StringtoMatlab()
     converts the Matrix into a single line Matlab string: matrix is enclosed by parentheses, rows are separated by semicolon and single cells by blanks, e.g., [1 2; 3 4].
public  StringtoString()
     Converts a matrix to a string.
public  doubletrace()
     Matrix trace.
public  Matrixtranspose()
     Matrix transpose.
public  Matrixuminus()
    
public  voidwrite(Writer w)
     Writes out a matrix.

Field Detail
A
protected double[][] A(Code)
Array for internal storage of elements.



mn
protected int mn(Code)
Row and column dimensions.




Constructor Detail
Matrix
public Matrix(int m, int n)(Code)
Construct an m-by-n matrix of zeros.
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums.



Matrix
public Matrix(int m, int n, double s)(Code)
Construct an m-by-n constant matrix.
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums.
Parameters:
  s - Fill the matrix with this scalar value.



Matrix
public Matrix(double[][] A)(Code)
Construct a matrix from a 2-D array.
Parameters:
  A - Two-dimensional array of doubles.
throws:
  IllegalArgumentException - All rows must have the same length
See Also:   Matrix.constructWithCopy



Matrix
public Matrix(double[][] A, int m, int n)(Code)
Construct a matrix quickly without checking arguments.
Parameters:
  A - Two-dimensional array of doubles.
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums.



Matrix
public Matrix(double vals, int m)(Code)
Construct a matrix from a one-dimensional packed array
Parameters:
  vals - One-dimensional array of doubles, packed by columns (alaFortran).
Parameters:
  m - Number of rows.
throws:
  IllegalArgumentException - Array length must be a multiple of m.



Matrix
public Matrix(Reader r) throws Exception(Code)
Reads a matrix from a reader. The first line in the file should contain the number of rows and columns. Subsequent lines contain elements of the matrix. (FracPete: taken from old weka.core.Matrix class)
Parameters:
  r - the reader containing the matrix
throws:
  Exception - if an error occurs
See Also:   Matrix.write(Writer)




Method Detail
arrayLeftDivide
public Matrix arrayLeftDivide(Matrix B)(Code)
Element-by-element left division, C = A.\B
Parameters:
  B - another matrix A.\B



arrayLeftDivideEquals
public Matrix arrayLeftDivideEquals(Matrix B)(Code)
Element-by-element left division in place, A = A.\B
Parameters:
  B - another matrix A.\B



arrayRightDivide
public Matrix arrayRightDivide(Matrix B)(Code)
Element-by-element right division, C = A./B
Parameters:
  B - another matrix A./B



arrayRightDivideEquals
public Matrix arrayRightDivideEquals(Matrix B)(Code)
Element-by-element right division in place, A = A./B
Parameters:
  B - another matrix A./B



arrayTimes
public Matrix arrayTimes(Matrix B)(Code)
Element-by-element multiplication, C = A.*B
Parameters:
  B - another matrix A.*B



arrayTimesEquals
public Matrix arrayTimesEquals(Matrix B)(Code)
Element-by-element multiplication in place, A = A.*B
Parameters:
  B - another matrix A.*B



chol
public CholeskyDecomposition chol()(Code)
Cholesky Decomposition CholeskyDecomposition
See Also:   CholeskyDecomposition



clone
public Object clone()(Code)
Clone the Matrix object.



cond
public double cond()(Code)
Matrix condition (2 norm) ratio of largest to smallest singular value.



constructWithCopy
public static Matrix constructWithCopy(double[][] A)(Code)
Construct a matrix from a copy of a 2-D array.
Parameters:
  A - Two-dimensional array of doubles.
throws:
  IllegalArgumentException - All rows must have the same length



copy
public Matrix copy()(Code)
Make a deep copy of a matrix



det
public double det()(Code)
Matrix determinant determinant



eig
public EigenvalueDecomposition eig()(Code)
Eigenvalue Decomposition EigenvalueDecomposition
See Also:   EigenvalueDecomposition



get
public double get(int i, int j)(Code)
Get a single element.
Parameters:
  i - Row index.
Parameters:
  j - Column index. A(i,j)
throws:
  ArrayIndexOutOfBoundsException -



getArray
public double[][] getArray()(Code)
Access the internal two-dimensional array. Pointer to the two-dimensional array of matrix elements.



getArrayCopy
public double[][] getArrayCopy()(Code)
Copy the internal two-dimensional array. Two-dimensional array copy of matrix elements.



getColumnDimension
public int getColumnDimension()(Code)
Get column dimension. n, the number of columns.



getColumnPackedCopy
public double[] getColumnPackedCopy()(Code)
Make a one-dimensional column packed copy of the internal array. Matrix elements packed in a one-dimensional array by columns.



getMatrix
public Matrix getMatrix(int i0, int i1, int j0, int j1)(Code)
Get a submatrix.
Parameters:
  i0 - Initial row index
Parameters:
  i1 - Final row index
Parameters:
  j0 - Initial column index
Parameters:
  j1 - Final column index A(i0:i1,j0:j1)
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



getMatrix
public Matrix getMatrix(int[] r, int[] c)(Code)
Get a submatrix.
Parameters:
  r - Array of row indices.
Parameters:
  c - Array of column indices. A(r(:),c(:))
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



getMatrix
public Matrix getMatrix(int i0, int i1, int[] c)(Code)
Get a submatrix.
Parameters:
  i0 - Initial row index
Parameters:
  i1 - Final row index
Parameters:
  c - Array of column indices. A(i0:i1,c(:))
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



getMatrix
public Matrix getMatrix(int[] r, int j0, int j1)(Code)
Get a submatrix.
Parameters:
  r - Array of row indices.
Parameters:
  j0 - Initial column index
Parameters:
  j1 - Final column index A(r(:),j0:j1)
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



getRowDimension
public int getRowDimension()(Code)
Get row dimension. m, the number of rows.



getRowPackedCopy
public double[] getRowPackedCopy()(Code)
Make a one-dimensional row packed copy of the internal array. Matrix elements packed in a one-dimensional array by rows.



identity
public static Matrix identity(int m, int n)(Code)
Generate identity matrix
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums. An m-by-n matrix with ones on the diagonal and zeros elsewhere.



inverse
public Matrix inverse()(Code)
Matrix inverse or pseudoinverse inverse(A) if A is square, pseudoinverse otherwise.



isSquare
public boolean isSquare()(Code)
returns whether the matrix is a square matrix or not. true if the matrix is a square matrix



isSymmetric
public boolean isSymmetric()(Code)
Returns true if the matrix is symmetric. (FracPete: taken from old weka.core.Matrix class) boolean true if matrix is symmetric.



lu
public LUDecomposition lu()(Code)
LU Decomposition LUDecomposition
See Also:   LUDecomposition



main
public static void main(String[] args)(Code)
Main method for testing this class.



minus
public Matrix minus(Matrix B)(Code)
C = A - B
Parameters:
  B - another matrix A - B



minusEquals
public Matrix minusEquals(Matrix B)(Code)
A = A - B
Parameters:
  B - another matrix A - B



norm1
public double norm1()(Code)
One norm maximum column sum.



norm2
public double norm2()(Code)
Two norm maximum singular value.



normF
public double normF()(Code)
Frobenius norm sqrt of sum of squares of all elements.



normInf
public double normInf()(Code)
Infinity norm maximum row sum.



parseMatlab
public static Matrix parseMatlab(String matlab) throws Exception(Code)
creates a matrix from the given Matlab string.
Parameters:
  matlab - the matrix in matlab format the matrix represented by the given string
See Also:   Matrix.toMatlab()



plus
public Matrix plus(Matrix B)(Code)
C = A + B
Parameters:
  B - another matrix A + B



plusEquals
public Matrix plusEquals(Matrix B)(Code)
A = A + B
Parameters:
  B - another matrix A + B



print
public void print(int w, int d)(Code)
Print the matrix to stdout. Line the elements up in columns with a Fortran-like 'Fw.d' style format.
Parameters:
  w - Column width.
Parameters:
  d - Number of digits after the decimal.



print
public void print(PrintWriter output, int w, int d)(Code)
Print the matrix to the output stream. Line the elements up in columns with a Fortran-like 'Fw.d' style format.
Parameters:
  output - Output stream.
Parameters:
  w - Column width.
Parameters:
  d - Number of digits after the decimal.



print
public void print(NumberFormat format, int width)(Code)
Print the matrix to stdout. Line the elements up in columns. Use the format object, and right justify within columns of width characters. Note that is the matrix is to be read back in, you probably will want to use a NumberFormat that is set to US Locale.
Parameters:
  format - A Formatting object for individual elements.
Parameters:
  width - Field width for each column.
See Also:   java.text.DecimalFormat.setDecimalFormatSymbols



print
public void print(PrintWriter output, NumberFormat format, int width)(Code)
Print the matrix to the output stream. Line the elements up in columns. Use the format object, and right justify within columns of width characters. Note that is the matrix is to be read back in, you probably will want to use a NumberFormat that is set to US Locale.
Parameters:
  output - the output stream.
Parameters:
  format - A formatting object to format the matrix elements
Parameters:
  width - Column width.
See Also:   java.text.DecimalFormat.setDecimalFormatSymbols



qr
public QRDecomposition qr()(Code)
QR Decomposition QRDecomposition
See Also:   QRDecomposition



random
public static Matrix random(int m, int n)(Code)
Generate matrix with random elements
Parameters:
  m - Number of rows.
Parameters:
  n - Number of colums. An m-by-n matrix with uniformly distributed random elements.



rank
public int rank()(Code)
Matrix rank effective numerical rank, obtained from SVD.



read
public static Matrix read(BufferedReader input) throws java.io.IOException(Code)
Read a matrix from a stream. The format is the same the print method, so printed matrices can be read back in (provided they were printed using US Locale). Elements are separated by whitespace, all the elements for each row appear on a single line, the last row is followed by a blank line.

Note: This format differs from the one that can be read via the Matrix(Reader) constructor! For that format, the write(Writer) method is used (from the original weka.core.Matrix class).
Parameters:
  input - the input stream.
See Also:   Matrix.Matrix(Reader)
See Also:   Matrix.write(Writer)




regression
public LinearRegression regression(Matrix y, double ridge)(Code)
Performs a (ridged) linear regression. (FracPete: taken from old weka.core.Matrix class)
Parameters:
  y - the dependent variable vector
Parameters:
  ridge - the ridge parameter the coefficients
throws:
  IllegalArgumentException - if not successful



regression
final public LinearRegression regression(Matrix y, double[] w, double ridge)(Code)
Performs a weighted (ridged) linear regression. (FracPete: taken from old weka.core.Matrix class)
Parameters:
  y - the dependent variable vector
Parameters:
  w - the array of data point weights
Parameters:
  ridge - the ridge parameter the coefficients
throws:
  IllegalArgumentException - if the wrong number of weights wereprovided.



set
public void set(int i, int j, double s)(Code)
Set a single element.
Parameters:
  i - Row index.
Parameters:
  j - Column index.
Parameters:
  s - A(i,j).
throws:
  ArrayIndexOutOfBoundsException -



setMatrix
public void setMatrix(int i0, int i1, int j0, int j1, Matrix X)(Code)
Set a submatrix.
Parameters:
  i0 - Initial row index
Parameters:
  i1 - Final row index
Parameters:
  j0 - Initial column index
Parameters:
  j1 - Final column index
Parameters:
  X - A(i0:i1,j0:j1)
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



setMatrix
public void setMatrix(int[] r, int[] c, Matrix X)(Code)
Set a submatrix.
Parameters:
  r - Array of row indices.
Parameters:
  c - Array of column indices.
Parameters:
  X - A(r(:),c(:))
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



setMatrix
public void setMatrix(int[] r, int j0, int j1, Matrix X)(Code)
Set a submatrix.
Parameters:
  r - Array of row indices.
Parameters:
  j0 - Initial column index
Parameters:
  j1 - Final column index
Parameters:
  X - A(r(:),j0:j1)
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



setMatrix
public void setMatrix(int i0, int i1, int[] c, Matrix X)(Code)
Set a submatrix.
Parameters:
  i0 - Initial row index
Parameters:
  i1 - Final row index
Parameters:
  c - Array of column indices.
Parameters:
  X - A(i0:i1,c(:))
throws:
  ArrayIndexOutOfBoundsException - Submatrix indices



solve
public Matrix solve(Matrix B)(Code)
Solve A*X = B
Parameters:
  B - right hand side solution if A is square, least squares solution otherwise



solveTranspose
public Matrix solveTranspose(Matrix B)(Code)
Solve X*A = B, which is also A'*X' = B'
Parameters:
  B - right hand side solution if A is square, least squares solution otherwise.



sqrt
public Matrix sqrt()(Code)
returns the square root of the matrix, i.e., X from the equation X*X = A.
Steps in the Calculation (see sqrtm in Matlab):
  1. perform eigenvalue decomposition
    [V,D]=eig(A)
  2. take the square root of all elements in D (only the ones with positive sign are considered for further computation)
    S=sqrt(D)
  3. calculate the root
    X=V*S/V, which can be also written as X=(V'\(V*S)')'

Note: since this method uses other high-level methods, it generates several instances of matrices. This can be problematic with large matrices.

Examples:

  1.  X =
     5   -4    1    0    0
     -4    6   -4    1    0
     1   -4    6   -4    1
     0    1   -4    6   -4
     0    0    1   -4    5
     sqrt(X) =
     2   -1   -0   -0   -0 
     -1    2   -1    0   -0 
     0   -1    2   -1    0 
     -0    0   -1    2   -1 
     -0   -0   -0   -1    2 
     Matrix m = new Matrix(new double[][]{{5,-4,1,0,0},{-4,6,-4,1,0},{1,-4,6,-4,1},{0,1,-4,6,-4},{0,0,1,-4,5}});
     
  2.  X =
     7   10
     15   22
     sqrt(X) =
     1.5667    1.7408
     2.6112    4.1779
     Matrix m = new Matrix(new double[][]{{7, 10},{15, 22}});
     
sqrt(A)



svd
public SingularValueDecomposition svd()(Code)
Singular Value Decomposition SingularValueDecomposition
See Also:   SingularValueDecomposition



times
public Matrix times(double s)(Code)
Multiply a matrix by a scalar, C = s*A
Parameters:
  s - scalar s*A



times
public Matrix times(Matrix B)(Code)
Linear algebraic matrix multiplication, A * B
Parameters:
  B - another matrix Matrix product, A * B
throws:
  IllegalArgumentException - Matrix inner dimensions must agree.



timesEquals
public Matrix timesEquals(double s)(Code)
Multiply a matrix by a scalar in place, A = s*A
Parameters:
  s - scalar replace A by s*A



toMatlab
public String toMatlab()(Code)
converts the Matrix into a single line Matlab string: matrix is enclosed by parentheses, rows are separated by semicolon and single cells by blanks, e.g., [1 2; 3 4]. the matrix in Matlab single line format



toString
public String toString()(Code)
Converts a matrix to a string. (FracPete: taken from old weka.core.Matrix class) the converted string



trace
public double trace()(Code)
Matrix trace. sum of the diagonal elements.



transpose
public Matrix transpose()(Code)
Matrix transpose. A'



uminus
public Matrix uminus()(Code)
Unary minus -A



write
public void write(Writer w) throws Exception(Code)
Writes out a matrix. The format can be read via the Matrix(Reader) constructor. (FracPete: taken from old weka.core.Matrix class)
Parameters:
  w - the output Writer
throws:
  Exception - if an error occurs
See Also:   Matrix.Matrix(Reader)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.