Java Code Examples for cern.colt.matrix.DoubleMatrix1D#like2D()
The following examples show how to use
cern.colt.matrix.DoubleMatrix1D#like2D() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Algebra.java From database with GNU General Public License v2.0 | 5 votes |
/** * Outer product of two vectors; Sets <tt>A[i,j] = x[i] * y[j]</tt>. * * @param x the first source vector. * @param y the second source vector. * @param A the matrix to hold the results. Set this parameter to <tt>null</tt> to indicate that a new result matrix shall be constructed. * @return A (for convenience only). * @throws IllegalArgumentException if <tt>A.rows() != x.size() || A.columns() != y.size()</tt>. */ public DoubleMatrix2D multOuter(DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) { int rows = x.size(); int columns = y.size(); if (A==null) A = x.like2D(rows,columns); if (A.rows() != rows || A.columns() != columns) throw new IllegalArgumentException(); for (int row = rows; --row >= 0; ) A.viewRow(row).assign(y); for (int column = columns; --column >= 0; ) A.viewColumn(column).assign(x, cern.jet.math.Functions.mult); return A; }
Example 2
Source File: Algebra.java From jAudioGIT with GNU Lesser General Public License v2.1 | 5 votes |
/** * Outer product of two vectors; Sets <tt>A[i,j] = x[i] * y[j]</tt>. * * @param x the first source vector. * @param y the second source vector. * @param A the matrix to hold the results. Set this parameter to <tt>null</tt> to indicate that a new result matrix shall be constructed. * @return A (for convenience only). * @throws IllegalArgumentException if <tt>A.rows() != x.size() || A.columns() != y.size()</tt>. */ public DoubleMatrix2D multOuter(DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) { int rows = x.size(); int columns = y.size(); if (A==null) A = x.like2D(rows,columns); if (A.rows() != rows || A.columns() != columns) throw new IllegalArgumentException(); for (int row = rows; --row >= 0; ) A.viewRow(row).assign(y); for (int column = columns; --column >= 0; ) A.viewColumn(column).assign(x, cern.jet.math.Functions.mult); return A; }
Example 3
Source File: Formatter.java From database with GNU General Public License v2.0 | 4 votes |
/** * Returns a string representation of the given matrix. * @param matrix the matrix to convert. */ public String toString(DoubleMatrix1D matrix) { DoubleMatrix2D easy = matrix.like2D(1,matrix.size()); easy.viewRow(0).assign(matrix); return toString(easy); }
Example 4
Source File: Formatter.java From jAudioGIT with GNU Lesser General Public License v2.1 | 4 votes |
/** * Returns a string representation of the given matrix. * @param matrix the matrix to convert. */ public String toString(DoubleMatrix1D matrix) { DoubleMatrix2D easy = matrix.like2D(1,matrix.size()); easy.viewRow(0).assign(matrix); return toString(easy); }
Example 5
Source File: Algebra.java From database with GNU General Public License v2.0 | 2 votes |
/** * Outer product of two vectors; Returns a matrix with <tt>A[i,j] = x[i] * y[j]</tt>. * * @param x the first source vector. * @param y the second source vector. * @return the outer product </tt>A</tt>. */ private DoubleMatrix2D xmultOuter(DoubleMatrix1D x, DoubleMatrix1D y) { DoubleMatrix2D A = x.like2D(x.size(),y.size()); multOuter(x,y,A); return A; }
Example 6
Source File: Algebra.java From jAudioGIT with GNU Lesser General Public License v2.1 | 2 votes |
/** * Outer product of two vectors; Returns a matrix with <tt>A[i,j] = x[i] * y[j]</tt>. * * @param x the first source vector. * @param y the second source vector. * @return the outer product </tt>A</tt>. */ private DoubleMatrix2D xmultOuter(DoubleMatrix1D x, DoubleMatrix1D y) { DoubleMatrix2D A = x.like2D(x.size(),y.size()); multOuter(x,y,A); return A; }