mikera.matrixx.impl.TransposedMatrix 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.List;
import mikera.matrixx.AMatrix;
import mikera.matrixx.Matrix;
import mikera.vectorz.AVector;
/**
* Class representing a transposed view of another matrix The transposed matrix
* is a reference to the underlying matrix data
*
* @author Mike
*
*/
public class TransposedMatrix extends ADelegatedMatrix {
private static final long serialVersionUID = 4350297037540121584L;
private TransposedMatrix(AMatrix source) {
super(source.columnCount(),source.rowCount(),source);
}
public static AMatrix wrap(AMatrix m) {
if (m instanceof TransposedMatrix)
return ((TransposedMatrix) m).source;
return new TransposedMatrix(m);
}
@Override
public boolean isFullyMutable() {
return source.isFullyMutable();
}
@Override
public boolean isMutable() {
return source.isMutable();
}
@Override
public double get(int row, int column) {
return source.get(column, row);
}
@Override
public void set(int row, int column, double value) {
source.set(column, row, value);
}
@Override
public double unsafeGet(int row, int column) {
return source.unsafeGet(column, row);
}
@Override
public void unsafeSet(int row, int column, double value) {
source.unsafeSet(column, row, value);
}
@Override
public AVector getRow(int row) {
return source.getColumn(row);
}
@Override
public AVector getColumn(int column) {
return source.getRow(column);
}
@Override
public AVector getRowClone(int row) {
return source.getColumnClone(row);
}
@Override
public AVector getColumnClone(int column) {
return source.getRowClone(column);
}
@Override
public AVector getRowView(int row) {
return source.getColumnView(row);
}
@Override
public AVector getColumnView(int column) {
return source.getRowView(column);
}
@Override
public List getRows() {
return source.getColumns();
}
@Override
public List getColumns() {
return source.getRows();
}
@Override
public int sliceCount() {
return source.columnCount();
}
@Override
public double trace() {
return source.trace();
}
@Override
public double diagonalProduct() {
return source.diagonalProduct();
}
@Override
public Matrix toMatrixTranspose() {
return source.toMatrix();
}
@Override
public Matrix toMatrix() {
return source.toMatrixTranspose();
}
@Override
public void copyRowTo(int row, double[] dest, int destOffset) {
source.copyColumnTo(row, dest, destOffset);
}
@Override
public void copyColumnTo(int col, double[] dest, int destOffset) {
source.copyRowTo(col, dest, destOffset);
}
@Override
public void getElements(double[] dest, int destOffset) {
int rc=rowCount();
int cc=columnCount();
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy