Examples of SizeException


Examples of org.jblas.exceptions.SizeException

    }

    /** Throws SizeException unless matrices can be multiplied with one another. */
    public void assertMultipliesWith(FloatMatrix a) {
        if (!multipliesWith(a)) {
            throw new SizeException("Number of columns of left matrix must be equal to number of rows of right matrix.");
        }
    }
View Full Code Here

Examples of org.jblas.exceptions.SizeException

    }

    /** Throws SizeException unless matrices have the same length. */
    public void assertSameLength(FloatMatrix a) {
        if (!sameLength(a)) {
            throw new SizeException("Matrices must have same length (is: " + length + " and " + a.length + ")");
        }
    }
View Full Code Here

Examples of org.jblas.exceptions.SizeException

    }

    /** Throw SizeException unless matrix is square. */
    public void assertSquare() {
        if (!isSquare()) {
            throw new SizeException("Matrix must be square!");
        }
    }
View Full Code Here

Examples of org.jblas.exceptions.SizeException

     * resizing result is tried, which fails if result == this or result == other.
     */
    private void ensureResultLength(FloatMatrix other, FloatMatrix result) {
        if (!sameLength(result)) {
            if (result == this || result == other) {
                throw new SizeException("Cannot resize result matrix because it is used in-place.");
            }
            result.resize(rows, columns);
        }
    }
View Full Code Here

Examples of org.jblas.exceptions.SizeException

        assertMultipliesWith(other);
        if (result.rows != rows || result.columns != other.columns) {
            if (result != this && result != other) {
                result.resize(rows, other.columns);
            } else {
                throw new SizeException("Cannot resize result matrix because it is used in-place.");
            }
        }

        if (result == this || result == other) {
            /* actually, blas cannot do multiplications in-place. Therefore, we will fake by
View Full Code Here

Examples of org.jblas.exceptions.SizeException

     * Rank one-updates
     */
    /** Computes a rank-1-update A = A + alpha * x * y'. */
    public FloatMatrix rankOneUpdate(float alpha, FloatMatrix x, FloatMatrix y) {
        if (rows != x.length) {
            throw new SizeException("Vector x has wrong length (" + x.length + " != " + rows + ").");
        }
        if (columns != y.length) {
            throw new SizeException("Vector y has wrong length (" + x.length + " != " + columns + ").");
        }

        SimpleBlas.ger(alpha, x, y, this);
        return this;
    }
View Full Code Here

Examples of org.jblas.exceptions.SizeException

   * @param columns number of columns of the resulting matrix
   * @return a matrix with dimensions rows * columns whose diagonal elements are filled by x
   */
  public static ComplexFloatMatrix diag(ComplexFloatMatrix x, int rows, int columns) {
    if (x.length > rows || x.length > columns) {
      throw new SizeException("Length of diagonal matrix must be larger than both rows and columns.");
    }
   
    ComplexFloatMatrix m = new ComplexFloatMatrix(rows, columns);

    for (int i = 0; i < x.length; i++)
View Full Code Here

Examples of org.jblas.exceptions.SizeException

    return get(0);
  }
 
  public static ComplexFloatMatrix concatHorizontally(ComplexFloatMatrix A, ComplexFloatMatrix B) {
    if (A.rows != B.rows)
      throw new SizeException("Matrices don't have same number of rows.");
   
    ComplexFloatMatrix result = new ComplexFloatMatrix(A.rows, A.columns + B.columns);
    SimpleBlas.copy(A, result);
    NativeBlas.ccopy(B.length, B.data, 0, 1, result.data, A.length, 1);
    return result;
View Full Code Here

Examples of org.jblas.exceptions.SizeException

    return result;
  }

  public static ComplexFloatMatrix concatVertically(ComplexFloatMatrix A, ComplexFloatMatrix B) {
    if (A.columns != B.columns)
      throw new SizeException("Matrices don't have same number of columns.");
   
    ComplexFloatMatrix result = new ComplexFloatMatrix(A.rows + B.rows, A.columns);

    for (int i = 0; i < A.columns; i++) {
      NativeBlas.ccopy(A.rows, A.data, A.index(0, i), 1, result.data, result.index(0, i), 1);
View Full Code Here

Examples of org.jblas.exceptions.SizeException

    return get(rindices.findIndices(), cindices.findIndices());
  }
 
  private void checkLength(int l) {
    if (length != l)
      throw new SizeException("Matrix does not have the necessary length (" + length + " != " + l + ").");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.