mikera.matrixx.impl.BlockDiagonalMatrix Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vectorz Show documentation
Show all versions of vectorz Show documentation
Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.
package mikera.matrixx.impl;
import java.util.Arrays;
import mikera.arrayz.ISparse;
import mikera.matrixx.AMatrix;
import mikera.vectorz.util.IntArrays;
/**
* Class representing a square, block diagonal matrix.
*
* Each block on the main diagonal must be a square matrix, but need not itself be diagonal.
*
* @author Mike
*
*/
public class BlockDiagonalMatrix extends ABlockMatrix implements ISparse {
private static final long serialVersionUID = -8569790012901451992L;
private final AMatrix[] mats;
private final int[] sizes;
private final int[] offsets;
private final int blockCount;
private BlockDiagonalMatrix(AMatrix[] newMats) {
super(sumRowCounts(newMats),sumColumnCounts(newMats));
blockCount=newMats.length;
mats=newMats;
sizes=new int[blockCount];
offsets=new int[blockCount+1];
int totalSize=0;
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy