Java Doc for Matrix.java in  » Science » jscience-4.3.1 » org » jscience » mathematics » vector » 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 » jscience 4.3.1 » org.jscience.mathematics.vector 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jscience.mathematics.vector.Matrix

Matrix
abstract public class Matrix implements VectorSpace<Matrix<F>, F>,Ring<Matrix<F>>,ValueType,Realtime(Code)

This class represents a rectangular table of elements of a ring-like algebraic structure.

Instances of this class can be used to resolve system of linear equations involving any kind of Field Field elements (e.g. org.jscience.mathematics.number.Real Real , org.jscience.mathematics.number.Complex Complex , org.jscience.physics.amount.Amount Amount<?> , org.jscience.mathematics.function.Function Function , etc). For example:[code] // Creates a dense matrix (2x2) of Rational numbers. DenseMatrix M = DenseMatrix.valueOf( { Rational.valueOf(23, 45), Rational.valueOf(33, 75) }, { Rational.valueOf(15, 31), Rational.valueOf(-20, 45)}); // Creates a sparse matrix (16x2) of Real numbers. SparseMatrix M = SparseMatrix.valueOf( SparseVector.valueOf(16, Real.ZERO, 0, Real.valueOf(5)), SparseVector.valueOf(16, Real.ZERO, 15, Real.valueOf(-3))); // Creates a floating-point (64 bits) matrix (3x2). Float64Matrix M = Float64Matrix.valueOf( {{ 1.0, 2.0, 3.0}, { 4.0, 5.0, 6.0}}); // Creates a complex single column matrix (1x2). ComplexMatrix M = ComplexMatrix.valueOf( {{ Complex.valueOf(1.0, 2.0), Complex.valueOf(4.0, 5.0)}}).transpose(); // Creates an identity matrix (2x2) for modulo integer. SparseMatrix IDENTITY = SparseMatrix.valueOf( DenseVector.valueOf(ModuloInteger.ONE, ModuloInteger.ONE), ModuloInteger.ZERO); [/code]

Non-commutative field multiplication is supported. Invertible square matrices may form a non-commutative field (also called a division ring). In which case this class may be used to resolve system of linear equations with matrix coefficients.

Implementation Note: Matrices may use javolution.context.StackContext StackContext and javolution.context.ConcurrentContext ConcurrentContext in order to minimize heap allocation and accelerate calculations on multi-core systems.


author:
   Jean-Marie Dautelle
version:
   3.3, December 24, 2006
See Also:    * Wikipedia: Matrix (mathematics)


Field Summary
final protected static  XMLFormat<Matrix>XML
     Holds the default XML representation for matrices.

Constructor Summary
protected  Matrix()
     Default constructor (for sub-classes).

Method Summary
abstract public  Matrix<F>adjoint()
     Returns the adjoint of this matrix.
abstract public  Fcofactor(int i, int j)
     Returns the cofactor of an element in this matrix.
abstract public  Matrix<F>copy()
     Returns a copy of this matrix javolution.context.AllocatorContext allocated by the calling thread (possibly on the stack).
abstract public  Fdeterminant()
     Returns the determinant of this matrix.
public  Matrix<F>divide(Matrix<F> that)
     Returns this matrix divided by the one specified.
Parameters:
  that - the matrix divisor.
public  booleanequals(Matrix<F> that, Comparator<F> cmp)
     Indicates if this matrix can be considered equals to the one specified using the specified comparator when testing for element equality.
public  booleanequals(Object that)
     Indicates if this matrix is strictly equal to the object specified.
Parameters:
  that - the object to compare for equality.
abstract public  Fget(int i, int j)
     Returns a single element from this matrix.
Parameters:
  i - the row index (range [0..m[).
Parameters:
  j - the column index (range [0..n[).
abstract public  Vector<F>getColumn(int j)
     Returns the column identified by the specified index in this matrix.
Parameters:
  j - the column index (range [0..n[).
abstract public  Vector<F>getDiagonal()
     Returns the diagonal vector.
abstract public  intgetNumberOfColumns()
     Returns the number of columns n for this matrix.
abstract public  intgetNumberOfRows()
     Returns the number of rows m for this matrix.
abstract public  Vector<F>getRow(int i)
     Returns the row identified by the specified index in this matrix.
Parameters:
  i - the row index (range [0..m[).
public  inthashCode()
     Returns a hash code value for this matrix.
abstract public  Matrix<F>inverse()
     Returns the inverse of this matrix (must be square).
public  booleanisSquare()
     Indicates if this matrix is square.
public  Matrix<F>minus(Matrix<F> that)
     Returns the difference between this matrix and the one specified.
Parameters:
  that - the matrix to be subtracted.
abstract public  Matrix<F>opposite()
     Returns the negation of this matrix.
abstract public  Matrix<F>plus(Matrix<F> that)
     Returns the sum of this matrix with the one specified.
Parameters:
  that - the matrix to be added.
public  Matrix<F>pow(int exp)
     Returns this matrix raised at the specified exponent.
Parameters:
  exp - the exponent.
public  Matrix<F>pseudoInverse()
     Returns the inverse or pseudo-inverse if this matrix if not square.
public  Vector<F>solve(Vector<F> y)
     Solves this matrix for the specified vector (returns x such as this · x = y).
Parameters:
  y - the vector for which the solution is calculated.
public  Matrix<F>solve(Matrix<F> y)
     Solves this matrix for the specified matrix (returns x such as this · x = y).
Parameters:
  y - the matrix for which the solution is calculated.
abstract public  Matrix<F>tensor(Matrix<F> that)
     Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product).
abstract public  Matrix<F>times(F k)
     Returns the product of this matrix by the specified factor.
Parameters:
  k - the coefficient multiplier.
abstract public  Vector<F>times(Vector<F> v)
     Returns the product of this matrix by the specified vector.
Parameters:
  v - the vector.
abstract public  Matrix<F>times(Matrix<F> that)
     Returns the product of this matrix with the one specified.
Parameters:
  that - the matrix multiplier.
final public  StringtoString()
     Returns the text representation of this matrix as a java.lang.String.
public  TexttoText()
     Returns the text representation of this matrix.
public  Ftrace()
     Returns the trace of this matrix.
abstract public  Matrix<F>transpose()
     Returns the transpose of this matrix.
abstract public  Vector<F>vectorization()
     Returns the vectorization of this matrix.

Field Detail
XML
final protected static XMLFormat<Matrix> XML(Code)
Holds the default XML representation for matrices. For example:[code] [/code]




Constructor Detail
Matrix
protected Matrix()(Code)
Default constructor (for sub-classes).




Method Detail
adjoint
abstract public Matrix<F> adjoint()(Code)
Returns the adjoint of this matrix. It is obtained by replacing each element in this matrix with its cofactor and applying a + or - sign according (-1)**(i+j), and then finding the transpose of the resulting matrix. the adjoint of this matrix.
throws:
  DimensionException - if this matrix is not square or ifits dimension is less than 2.



cofactor
abstract public F cofactor(int i, int j)(Code)
Returns the cofactor of an element in this matrix. It is the value obtained by evaluating the determinant formed by the elements not in that particular row or column.
Parameters:
  i - the row index.
Parameters:
  j - the column index. the cofactor of THIS[i,j].
throws:
  DimensionException - matrix is not square or its dimensionis less than 2.



copy
abstract public Matrix<F> copy()(Code)
Returns a copy of this matrix javolution.context.AllocatorContext allocated by the calling thread (possibly on the stack). an identical and independant copy of this matrix.



determinant
abstract public F determinant()(Code)
Returns the determinant of this matrix. this matrix determinant.
throws:
  DimensionException - if this matrix is not square.



divide
public Matrix<F> divide(Matrix<F> that)(Code)
Returns this matrix divided by the one specified.
Parameters:
  that - the matrix divisor. this / that.
throws:
  DimensionException - if that matrix is not square or dimensions do not match.



equals
public boolean equals(Matrix<F> that, Comparator<F> cmp)(Code)
Indicates if this matrix can be considered equals to the one specified using the specified comparator when testing for element equality. The specified comparator may allow for some tolerance in the difference between the matrix elements.
Parameters:
  that - the matrix to compare for equality.
Parameters:
  cmp - the comparator to use when testing for element equality. true if this matrix and the specified matrix areboth matrices with equal elements according to the specifiedcomparator; false otherwise.



equals
public boolean equals(Object that)(Code)
Indicates if this matrix is strictly equal to the object specified.
Parameters:
  that - the object to compare for equality. true if this matrix and the specified object areboth matrices with equal elements; false otherwise.
See Also:   Matrix.equals(Matrix,Comparator)



get
abstract public F get(int i, int j)(Code)
Returns a single element from this matrix.
Parameters:
  i - the row index (range [0..m[).
Parameters:
  j - the column index (range [0..n[). the element read at [i,j].
throws:
  IndexOutOfBoundsException - ((i < 0) || (i >= m)) || ((j < 0) || (j >= n))



getColumn
abstract public Vector<F> getColumn(int j)(Code)
Returns the column identified by the specified index in this matrix.
Parameters:
  j - the column index (range [0..n[). the vector holding the specified column.
throws:
  IndexOutOfBoundsException - (j < 0) || (j >= n)



getDiagonal
abstract public Vector<F> getDiagonal()(Code)
Returns the diagonal vector. the vector holding the diagonal elements.



getNumberOfColumns
abstract public int getNumberOfColumns()(Code)
Returns the number of columns n for this matrix. n, the number of columns.



getNumberOfRows
abstract public int getNumberOfRows()(Code)
Returns the number of rows m for this matrix. m, the number of rows.



getRow
abstract public Vector<F> getRow(int i)(Code)
Returns the row identified by the specified index in this matrix.
Parameters:
  i - the row index (range [0..m[). the vector holding the specified row.
throws:
  IndexOutOfBoundsException - (i < 0) || (i >= m)



hashCode
public int hashCode()(Code)
Returns a hash code value for this matrix. Equals objects have equal hash codes. this matrix hash code value.
See Also:   Matrix.equals



inverse
abstract public Matrix<F> inverse()(Code)
Returns the inverse of this matrix (must be square). 1 / this
throws:
  DimensionException - if this matrix is not square.



isSquare
public boolean isSquare()(Code)
Indicates if this matrix is square. getNumberOfRows() == getNumberOfColumns()



minus
public Matrix<F> minus(Matrix<F> that)(Code)
Returns the difference between this matrix and the one specified.
Parameters:
  that - the matrix to be subtracted. this - that.
throws:
  DimensionException - matrices's dimensions are different.



opposite
abstract public Matrix<F> opposite()(Code)
Returns the negation of this matrix. -this.



plus
abstract public Matrix<F> plus(Matrix<F> that)(Code)
Returns the sum of this matrix with the one specified.
Parameters:
  that - the matrix to be added. this + that.
throws:
  DimensionException - matrices's dimensions are different.



pow
public Matrix<F> pow(int exp)(Code)
Returns this matrix raised at the specified exponent.
Parameters:
  exp - the exponent. thisexp
throws:
  DimensionException - if this matrix is not square.



pseudoInverse
public Matrix<F> pseudoInverse()(Code)
Returns the inverse or pseudo-inverse if this matrix if not square.

Note: To resolve the equation A * X = B, it is usually faster to calculate A.lu().solve(B) rather than A.inverse().times(B).

the inverse or pseudo-inverse of this matrix.



solve
public Vector<F> solve(Vector<F> y)(Code)
Solves this matrix for the specified vector (returns x such as this · x = y).
Parameters:
  y - the vector for which the solution is calculated. x such as this · x = y
throws:
  DimensionException - if that matrix is not square or dimensions do not match.



solve
public Matrix<F> solve(Matrix<F> y)(Code)
Solves this matrix for the specified matrix (returns x such as this · x = y).
Parameters:
  y - the matrix for which the solution is calculated. x such as this · x = y
throws:
  DimensionException - if that matrix is not square or dimensions do not match.



tensor
abstract public Matrix<F> tensor(Matrix<F> that)(Code)
Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product). The default implementation returns a DenseMatrix .
Parameters:
  that - the second matrix. this ⊗ that
See Also:    * Wikipedia: Kronecker Product



times
abstract public Matrix<F> times(F k)(Code)
Returns the product of this matrix by the specified factor.
Parameters:
  k - the coefficient multiplier. this · k



times
abstract public Vector<F> times(Vector<F> v)(Code)
Returns the product of this matrix by the specified vector.
Parameters:
  v - the vector. this · v
throws:
  DimensionException - if v.getDimension() != this.getNumberOfColumns()



times
abstract public Matrix<F> times(Matrix<F> that)(Code)
Returns the product of this matrix with the one specified.
Parameters:
  that - the matrix multiplier. this · that.
throws:
  DimensionException - if this.getNumberOfColumns() != that.getNumberOfRows().



toString
final public String toString()(Code)
Returns the text representation of this matrix as a java.lang.String. toText().toString()



toText
public Text toText()(Code)
Returns the text representation of this matrix. the text representation of this matrix.



trace
public F trace()(Code)
Returns the trace of this matrix. the sum of the diagonal elements.



transpose
abstract public Matrix<F> transpose()(Code)
Returns the transpose of this matrix. A'.



vectorization
abstract public Vector<F> vectorization()(Code)
Returns the vectorization of this matrix. The vectorization of a matrix is the column vector obtain by stacking the columns of the matrix on top of one another. The default implementation returns a DenseVector . the vectorization of this matrix.
See Also:    * Wikipedia: Vectorization.



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.