001 // --- BEGIN LICENSE BLOCK ---
002 /*
003 * Copyright (c) 2009, Mikio L. Braun
004 * Copyright (c) 2008, Johannes Schaback
005 * Copyright (c) 2009, Jan Saputra M?ller
006 * All rights reserved.
007 *
008 * Redistribution and use in source and binary forms, with or without
009 * modification, are permitted provided that the following conditions are
010 * met:
011 *
012 * * Redistributions of source code must retain the above copyright
013 * notice, this list of conditions and the following disclaimer.
014 *
015 * * Redistributions in binary form must reproduce the above
016 * copyright notice, this list of conditions and the following
017 * disclaimer in the documentation and/or other materials provided
018 * with the distribution.
019 *
020 * * Neither the name of the Technische Universit?t Berlin nor the
021 * names of its contributors may be used to endorse or promote
022 * products derived from this software without specific prior
023 * written permission.
024 *
025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
028 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
029 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
030 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
031 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
032 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
033 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
034 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
035 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
036 */
037 // --- END LICENSE BLOCK ---
038 package org.jblas;
039
040 import org.jblas.exceptions.SizeException;
041 import org.jblas.ranges.Range;
042 import java.io.BufferedReader;
043 import java.io.DataInputStream;
044 import java.io.DataOutputStream;
045 import java.io.FileInputStream;
046 import java.io.FileOutputStream;
047 import java.io.IOException;
048 import java.io.InputStreamReader;
049
050 import java.io.ObjectInputStream;
051 import java.io.ObjectOutputStream;
052 import java.io.PrintWriter;
053 import java.io.Serializable;
054 import java.io.StringWriter;
055 import java.util.AbstractList;
056 import java.util.Arrays;
057 import java.util.Comparator;
058 import java.util.Iterator;
059 import java.util.LinkedList;
060 import java.util.List;
061
062 /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *
111 * <p>To access individual elements, or whole rows and columns, use the following
112 * methods:<p>
113 *
114 * <table class="my">
115 * <tr><th>x.Method<th>Description
116 * <tr><td>x.get(i,j)<td>Get element in row i and column j.
117 * <tr><td>x.put(i, j, v)<td>Set element in row i and column j to value v
118 * <tr><td>x.get(i)<td>Get the ith element of the matrix (traversing rows first).
119 * <tr><td>x.put(i, v)<td>Set the ith element of the matrix (traversing rows first).
120 * <tr><td>x.getColumn(i)<td>Get a copy of column i.
121 * <tr><td>x.putColumn(i, c)<td>Put matrix c into column i.
122 * <tr><td>x.getRow(i)<td>Get a copy of row i.
123 * <tr><td>x.putRow(i, c)<td>Put matrix c into row i.
124 * <tr><td>x.swapColumns(i, j)<td>Swap the contents of columns i and j.
125 * <tr><td>x.swapRows(i, j)<td>Swap the contents of columns i and j.
126 * </table>
127 *
128 * <p>For <tt>get</tt> and <tt>put</tt>, you can also pass integer arrays,
129 * DoubleMatrix objects, or Range objects, which then specify the indices used
130 * as follows:
131 *
132 * <ul>
133 * <li><em>integer array:</em> the elements will be used as indices.
134 * <li><em>DoubleMatrix object:</em> non-zero e058<> /**
063 * A general matrix class for <tt>double</tt> typed values.
064 *
065 * Don't be intimidated by the large number of methods this function defines. Most
066 * are overloads provided for ease of use. For example, for each arithmetic operation,
067 * up to six overloaded versions exist to handle in-place computations, and
068 * scalar arguments.
069 *
070 * <h3>Construction</h3>
071 *
072 * <p>To construct a two-dimensional matrices, you can use the following constructors
073 * and static methods.</p>
074 *
075 * <table class="my">
076 * <tr><th>Method<th>Description
077 * <tr><td>DoubleMatrix(m,n, [value1, value2, value3...])<td>Values are filled in row by row.
078 * <tr><td>DoubleMatrix(new double[][] {{value1, value2, ...}, ...}<td>Inner arrays are columns.
079 * <tr><td>DoubleMatrix.zeros(m,n) <td>Initial values set to 0.0.
080 * <tr><td>DoubleMatrix.ones(m,n) <td>Initial values set to 1.0.
081 * <tr><td>DoubleMatrix.rand(m,n) <td>Values drawn at random between 0.0 and 1.0.
082 * <tr><td>DoubleMatrix.randn(m,n) <td>Values drawn from normal distribution.
083 * <tr><td>DoubleMatrix.eye(n) <td>Unit matrix (values 0.0 except for 1.0 on the diagonal).
084 * <tr><td>DoubleMatrix.diag(array) <td>Diagonal matrix with given diagonal elements.
085 * </table>
086 *
087 * <p>Alternatively, you can construct (column) vectors, if you just supply the length
088 * using the following constructors and static methods.</p>
089 *
090 * <table class="my">
091 * <tr><th>Method<th>Description
092 * <tr><td>DoubleMatrix(m)<td>Constructs a column vector.
093 * <tr><td>DoubleMatrix(new double[] {value1, value2, ...})<td>Constructs a column vector.
094 * <tr><td>DoubleMatrix.zeros(m) <td>Initial values set to 0.0.
095 * <tr><td>DoubleMatrix.ones(m) <td>Initial values set to 1.0.
096 * <tr><td>DoubleMatrix.rand(m) <td>Values drawn at random between 0.0 and 1.0.
097 * <tr><td>DoubleMatrix.randn(m) <td>Values drawn from normal distribution.
098 * </table>
099 *
100 * <p>You can also construct new matrices by concatenating matrices either horziontally
101 * or vertically:</p>
102 *
103 * <table class="my">
104 * <tr><th>Method<th>Description
105 * <tr><td>x.concatHorizontally(y)<td>New matrix will be x next to y.
106 * <tr><td>x.concatVertically(y)<td>New matrix will be x atop y.
107 * </table>
108 *
109 * <h3>Element Access, Copying and Duplication</h3>
110 *