All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mikera.matrixx.impl.ATriangularMatrix Maven / Gradle / Ivy

Go to download

Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.

There is a newer version: 0.67.0
Show newest version
package mikera.matrixx.impl;

import mikera.vectorz.AVector;
import mikera.vectorz.util.DoubleArrays;
import mikera.vectorz.util.ErrorMessages;

/**
 * Abstract base class for densely packed triangular matrices (upper and lower)
 * 
 * @author Mike
 */
public abstract class ATriangularMatrix extends AArrayMatrix {
	private static final long serialVersionUID = -5557895922040729998L;

	protected ATriangularMatrix(double[] data, int rows, int cols) {
		super(data, rows, cols);
	}
	
	@Override
	public boolean isFullyMutable() {
		return false;
	}
	
	@Override
	public boolean isMutable() {
		return true;
	}
	
	@Override
	public boolean isPackedArray() {
		// not packed in the sense that it is not a fully dense packed array
		return false;
	}
	
	@Override
	public abstract AVector getBand(int i);
	
	@Override
	public double determinant() { 
		if (rows!=cols) throw new IllegalArgumentException(ErrorMessages.nonSquareMatrix(this));
		return this.diagonalProduct();
	}

	@Override
	public boolean isZero() {
		return DoubleArrays.isZero(data);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy