public final class RawStore extends Object implements PhysicalStore<Double>
PhysicalStore.Factory<N extends Number,I extends PhysicalStore<N>>
MatrixStore.LogicalBuilder<N extends Number>
Group.Additive<S>, Group.Multiplicative<S>
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
ScalarOperation.Addition<T,N extends Number>, ScalarOperation.Division<T,N extends Number>, ScalarOperation.Multiplication<T,N extends Number>, ScalarOperation.Subtraction<T,N extends Number>
TransformableRegion.ColumnsRegion<N extends Number>, TransformableRegion.FillByMultiplying<N extends Number>, TransformableRegion.LimitRegion<N extends Number>, TransformableRegion.OffsetRegion<N extends Number>, TransformableRegion.ReceiverRegion<N extends Number>, TransformableRegion.RowsRegion<N extends Number>, TransformableRegion.TransposedRegion<N extends Number>
Mutate2D.Exchangeable, Mutate2D.Fillable<N extends Number>, Mutate2D.Mixable<N extends Number>, Mutate2D.Modifiable<N extends Number>, Mutate2D.ModifiableReceiver<N extends Number>, Mutate2D.Receiver<N extends Number>
Mutate1D.Sortable
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,?>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.RowColumnCallback, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
Structure1D.BasicMapper<T>, Structure1D.IndexCallback, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallback
Access2D.Aggregatable<N extends Number>, Access2D.Collectable<N extends Number,R extends Mutate2D.Receiver<N>>, Access2D.Elements, Access2D.ElementView<N extends Number>, Access2D.IndexOf, Access2D.Sliceable<N extends Number>, Access2D.Visitable<N extends Number>
Modifier and Type | Field and Description |
---|---|
double[][] |
data |
static PhysicalStore.Factory<Double,RawStore> |
FACTORY |
COMPLEX, PRIMITIVE, QUATERNION, RATIONAL
Constructor and Description |
---|
RawStore(Access2D<?> template) |
RawStore(double[][] A)
Construct a matrix from a 2-D array.
|
RawStore(double[][] A,
int m,
int n)
Construct a matrix quickly without checking arguments.
|
RawStore(double[] elements,
int structure)
Construct a matrix from a one-dimensional packed array
|
RawStore(int m,
int n)
Construct an m-by-n matrix of zeros.
|
RawStore(int m,
int n,
double s)
Construct an m-by-n constant matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Access2D<?> supplied) |
void |
add(long row,
long col,
double addend) |
void |
add(long row,
long col,
Number addend) |
Double |
aggregateAll(Aggregator aggregator) |
List<Double> |
asList() |
RawStore |
conjugate()
Returns the conjugate transpose of this matrix.
|
static RawStore |
constructWithCopy(double[][] A)
Construct a matrix from a copy of a 2-D array.
|
RawStore |
copy()
Make a deep copy of a matrix
|
double[][] |
copyOfData()
Copy the internal two-dimensional array.
|
long |
count()
count() == countRows() * countColumns()
|
long |
countColumns() |
long |
countRows() |
double |
doubleValue(long row,
long col)
Extracts one element of this matrix as a double.
|
boolean |
equals(Object other) |
void |
exchangeColumns(long colA,
long colB) |
void |
exchangeRows(long rowA,
long rowB) |
void |
fillAll(Double value) |
void |
fillAll(NullaryFunction<Double> supplier) |
void |
fillByMultiplying(Access1D<Double> left,
Access1D<Double> right) |
void |
fillColumn(long row,
long col,
Double value) |
void |
fillColumn(long row,
long col,
NullaryFunction<Double> supplier) |
void |
fillDiagonal(long row,
long col,
Double value) |
void |
fillDiagonal(long row,
long col,
NullaryFunction<Double> supplier) |
void |
fillMatching(Access1D<?> source)
Will fill the elements of [this] with the corresponding input values, and in the process (if
necessary) convert the elements to the correct type:
|
void |
fillMatching(Access1D<Double> left,
BinaryFunction<Double> function,
Access1D<Double> right) |
void |
fillMatching(Access1D<Double> left,
BinaryFunction<Double> function,
Double right)
Deprecated.
v39
|
void |
fillMatching(Double left,
BinaryFunction<Double> function,
Access1D<Double> right)
Deprecated.
v39
|
void |
fillOne(long row,
long col,
Access1D<?> values,
long valueIndex) |
void |
fillOne(long row,
long col,
Double value) |
void |
fillOne(long row,
long col,
NullaryFunction<Double> supplier) |
void |
fillRange(long first,
long limit,
Double value) |
void |
fillRange(long first,
long limit,
NullaryFunction<Double> supplier) |
void |
fillRow(long row,
long col,
Double value) |
void |
fillRow(long row,
long col,
NullaryFunction<Double> supplier) |
MatrixStore<Double> |
get() |
Double |
get(long row,
long col) |
RawStore |
getMatrix(int[] r,
int j0,
int j1)
Deprecated.
v39
|
RawStore |
getMatrix(int i0,
int i1,
int j0,
int j1)
Deprecated.
v39
|
int |
hashCode() |
long |
indexOfLargest() |
long |
indexOfLargestInColumn(long row,
long col) |
long |
indexOfLargestInRange(long first,
long limit) |
long |
indexOfLargestInRow(long row,
long col) |
long |
indexOfLargestOnDiagonal(long first) |
boolean |
isAbsolute(long index) |
boolean |
isAbsolute(long row,
long col) |
boolean |
isSmall(long index,
double comparedTo) |
boolean |
isSmall(long row,
long col,
double comparedTo) |
void |
modifyAll(UnaryFunction<Double> modifier) |
void |
modifyColumn(long row,
long col,
UnaryFunction<Double> modifier) |
void |
modifyDiagonal(long row,
long col,
UnaryFunction<Double> modifier) |
void |
modifyMatching(Access1D<Double> left,
BinaryFunction<Double> function) |
void |
modifyMatching(BinaryFunction<Double> function,
Access1D<Double> right) |
void |
modifyOne(long row,
long col,
UnaryFunction<Double> modifier) |
void |
modifyRange(long first,
long limit,
UnaryFunction<Double> modifier) |
void |
modifyRow(long row,
long col,
UnaryFunction<Double> modifier) |
RawStore |
multiply(MatrixStore<Double> right) |
Double |
multiplyBoth(Access1D<Double> leftAndRight)
Assumes [leftAndRight] is a vector and will calulate [leftAndRight]H[this][leftAndRight]
|
PhysicalStore.Factory<Double,RawStore> |
physical() |
static RawStore |
random(int m,
int n)
Generate matrix with random elements
|
static RawStore |
read(BufferedReader input)
Read a matrix from a stream.
|
TransformableRegion<Double> |
regionByColumns(int... columns) |
TransformableRegion<Double> |
regionByLimits(int rowLimit,
int columnLimit) |
TransformableRegion<Double> |
regionByOffsets(int rowOffset,
int columnOffset) |
TransformableRegion<Double> |
regionByRows(int... rows) |
TransformableRegion<Double> |
regionByTransposing() |
void |
set(long row,
long col,
double value) |
void |
set(long row,
long col,
Number value) |
void |
substituteBackwards(Access2D<Double> body,
boolean unitDiagonal,
boolean conjugated,
boolean hermitian)
Will solve the equation system [A][X]=[B] where:
[body][this]=[this] is [A][X]=[B] ("this" is the right hand side, and it will be overwritten with
the solution).
[A] is upper/right triangular
|
void |
substituteForwards(Access2D<Double> body,
boolean unitDiagonal,
boolean conjugated,
boolean identity)
Will solve the equation system [A][X]=[B] where:
[body][this]=[this] is [A][X]=[B] ("this" is the right hand side, and it will be overwritten with
the solution).
[A] is lower/left triangular
|
void |
supplyTo(TransformableRegion<Double> receiver) |
PrimitiveScalar |
toScalar(long row,
long column) |
String |
toString() |
void |
transformLeft(Householder<Double> transformation,
int firstColumn) |
void |
transformLeft(Rotation<Double> transformation)
As in
MatrixStore.premultiply(Access1D) where the left/parameter matrix is a plane rotation. |
void |
transformRight(Householder<Double> transformation,
int firstRow) |
void |
transformRight(Rotation<Double> transformation)
As in
MatrixStore.multiply(MatrixStore) where the right/parameter matrix is a plane rotation. |
RawStore |
transpose()
RawStore transpose.
|
void |
visitAll(VoidFunction<Double> visitor) |
void |
visitColumn(long row,
long col,
VoidFunction<Double> visitor) |
void |
visitDiagonal(long row,
long col,
VoidFunction<Double> visitor) |
void |
visitRange(long first,
long limit,
VoidFunction<Double> visitor) |
void |
visitRow(long row,
long col,
VoidFunction<Double> visitor) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
modifyAny
add, aggregateColumn, aggregateDiagonal, aggregateRange, aggregateRow, equals, firstInColumn, firstInColumn, firstInColumn, firstInRow, firstInRow, firstInRow, isHermitian, isNormal, isSmall, limitOfColumn, limitOfColumn, limitOfColumn, limitOfRow, limitOfRow, limitOfRow, logical, multiply, multiply, multiply, negate, norm, operateOnAll, premultiply, reduceColumns, reduceRows, signum, sliceColumn, sliceDiagonal, sliceRange, sliceRow, subtract, visitOne
operateOnAny, operateOnColumns, operateOnMatching, operateOnMatching, operateOnRows
operateOnAll, operateOnAll, operateOnAll, operateOnAll, operateOnAll
collect
visitColumn, visitDiagonal, visitOne, visitRow
aggregateColumn, aggregateDiagonal, aggregateRow, reduceColumns, reduceRows
sliceColumn, sliceDiagonal, sliceRow
isColumnSmall, isColumnSmall, isRowSmall, isRowSmall
isAllSmall
indexOfLargestInColumn, indexOfLargestInRow, indexOfLargestOnDiagonal
modifyColumn, modifyDiagonal, modifyMatchingInColumns, modifyMatchingInColumns, modifyMatchingInRows, modifyMatchingInRows, modifyOne, modifyRow
isAcceptable
copyComplexArgument, copyComplexImaginary, copyComplexModulus, copyComplexModulusAndArgument, copyComplexReal, copyComplexRealAndImaginary, reset
fillColumn, fillColumn, fillColumn, fillColumn, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillOne, fillOne, fillOne, fillRow, fillRow, fillRow, fillRow
column, column, column, column, column, count, index, index, isEmpty, isFat, isScalar, isSquare, isTall, isVector, loopAll, loopColumn, loopColumn, loopDiagonal, loopMatching, loopRow, loopRow, mapperOf, row, row, row, row, row
fillMatching
index, loopAll, loopMatching, loopRange, mapper, size
asCollectable2D, asPrimitive2D, byteValue, byteValue, columns, doubleValue, elements, equals, floatValue, floatValue, get, intValue, intValue, longValue, longValue, newPrimitiveColumnCollectable, newPrimitiveRowCollectable, rows, shortValue, shortValue, toRawCopy2D, toString, wrap, wrap
asCollectable1D, asPrimitive1D, axpy, dot, equals, hashCode, nonzeros, supplyTo, toRawCopy1D, toString, wrap, wrap, wrap
public static PhysicalStore.Factory<Double,RawStore> FACTORY
public final double[][] data
public RawStore(Access2D<?> template)
public RawStore(double[] elements, int structure)
elements
- One-dimensional array of doubles, packed by columns (ala Fortran).structure
- Number of rows.IllegalArgumentException
- Array length must be a multiple of m.public RawStore(double[][] A)
A
- Two-dimensional array of doubles.IllegalArgumentException
- All rows must have the same lengthconstructWithCopy(double[][])
public RawStore(double[][] A, int m, int n)
A
- Two-dimensional array of doubles.m
- Number of rows.n
- Number of colums.public RawStore(int m, int n)
m
- Number of rows.n
- Number of colums.public RawStore(int m, int n, double s)
m
- Number of rows.n
- Number of colums.s
- Fill the matrix with this scalar value.public static RawStore constructWithCopy(double[][] A)
A
- Two-dimensional array of doubles.IllegalArgumentException
- All rows must have the same lengthpublic static RawStore random(int m, int n)
m
- Number of rows.n
- Number of colums.public static RawStore read(BufferedReader input) throws IOException
input
- the input stream.IOException
public void accept(Access2D<?> supplied)
public Double aggregateAll(Aggregator aggregator)
aggregateAll
in interface MatrixStore<Double>
aggregateAll
in interface Access1D.Aggregatable<Double>
public List<Double> asList()
asList
in interface PhysicalStore<Double>
public RawStore conjugate()
MatrixStore
conjugate
in interface VectorSpace<MatrixStore<Double>,Double>
conjugate
in interface MatrixStore<Double>
VectorSpace.conjugate()
public RawStore copy()
copy
in interface MatrixStore<Double>
public double[][] copyOfData()
public long count()
Structure2D
count
in interface Structure1D
count
in interface Structure2D
public long countColumns()
countColumns
in interface Structure2D
public long countRows()
countRows
in interface Structure2D
public double doubleValue(long row, long col)
Access2D
doubleValue
in interface MatrixStore<Double>
doubleValue
in interface Access2D<Double>
row
- A row index.col
- A column index.public void exchangeColumns(long colA, long colB)
exchangeColumns
in interface TransformableRegion<Double>
exchangeColumns
in interface Mutate2D.Exchangeable
public void exchangeRows(long rowA, long rowB)
exchangeRows
in interface TransformableRegion<Double>
exchangeRows
in interface Mutate2D.Exchangeable
public void fillAll(Double value)
fillAll
in interface Mutate1D.Fillable<Double>
public void fillAll(NullaryFunction<Double> supplier)
fillAll
in interface Mutate1D.Fillable<Double>
public void fillByMultiplying(Access1D<Double> left, Access1D<Double> right)
fillByMultiplying
in interface TransformableRegion<Double>
public void fillColumn(long row, long col, Double value)
fillColumn
in interface Mutate2D.Fillable<Double>
public void fillColumn(long row, long col, NullaryFunction<Double> supplier)
fillColumn
in interface Mutate2D.Fillable<Double>
public void fillDiagonal(long row, long col, Double value)
fillDiagonal
in interface Mutate2D.Fillable<Double>
public void fillDiagonal(long row, long col, NullaryFunction<Double> supplier)
fillDiagonal
in interface Mutate2D.Fillable<Double>
public void fillMatching(Access1D<?> source)
Mutate1D.Fillable
Will fill the elements of [this] with the corresponding input values, and in the process (if necessary) convert the elements to the correct type:
this(i) = values(i)
fillMatching
in interface Mutate1D.Fillable<Double>
public void fillMatching(Access1D<Double> left, BinaryFunction<Double> function, Access1D<Double> right)
fillMatching
in interface Mutate1D.Fillable<Double>
@Deprecated public void fillMatching(Access1D<Double> left, BinaryFunction<Double> function, Double right)
@Deprecated public void fillMatching(Double left, BinaryFunction<Double> function, Access1D<Double> right)
public void fillOne(long row, long col, Access1D<?> values, long valueIndex)
fillOne
in interface Mutate2D.Fillable<Double>
public void fillOne(long row, long col, Double value)
fillOne
in interface Mutate2D.Fillable<Double>
public void fillOne(long row, long col, NullaryFunction<Double> supplier)
fillOne
in interface Mutate2D.Fillable<Double>
public void fillRange(long first, long limit, Double value)
fillRange
in interface Mutate1D.Fillable<Double>
public void fillRange(long first, long limit, NullaryFunction<Double> supplier)
fillRange
in interface Mutate1D.Fillable<Double>
public void fillRow(long row, long col, Double value)
fillRow
in interface Mutate2D.Fillable<Double>
public void fillRow(long row, long col, NullaryFunction<Double> supplier)
fillRow
in interface Mutate2D.Fillable<Double>
public MatrixStore<Double> get()
get
in interface Supplier<MatrixStore<Double>>
get
in interface ElementsSupplier<Double>
get
in interface MatrixStore<Double>
@Deprecated public RawStore getMatrix(int i0, int i1, int j0, int j1)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indices@Deprecated public RawStore getMatrix(int[] r, int j0, int j1)
r
- Array of row indices.j0
- Initial column indexj1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indicespublic long indexOfLargest()
indexOfLargest
in interface Access1D.IndexOf
public long indexOfLargestInColumn(long row, long col)
indexOfLargestInColumn
in interface Access2D.IndexOf
row
- First row to investigatecol
- The columnpublic long indexOfLargestInRange(long first, long limit)
indexOfLargestInRange
in interface Access1D.IndexOf
public long indexOfLargestInRow(long row, long col)
indexOfLargestInRow
in interface Access2D.IndexOf
row
- The rowcol
- The first column to investigatepublic long indexOfLargestOnDiagonal(long first)
indexOfLargestOnDiagonal
in interface Access2D.IndexOf
first
- The first row/column to investigatepublic boolean isAbsolute(long index)
isAbsolute
in interface Access1D.Elements
isAbsolute
in interface Access2D.Elements
Scalar.isAbsolute()
public boolean isAbsolute(long row, long col)
isAbsolute
in interface MatrixStore<Double>
isAbsolute
in interface Access2D.Elements
Scalar.isAbsolute()
public boolean isSmall(long index, double comparedTo)
isSmall
in interface Access1D.Elements
isSmall
in interface Access2D.Elements
NormedVectorSpace.isSmall(double)
public boolean isSmall(long row, long col, double comparedTo)
isSmall
in interface MatrixStore<Double>
isSmall
in interface Access2D.Elements
NormedVectorSpace.isSmall(double)
public void modifyAll(UnaryFunction<Double> modifier)
modifyAll
in interface Mutate1D.Modifiable<Double>
public void modifyColumn(long row, long col, UnaryFunction<Double> modifier)
modifyColumn
in interface Mutate2D.Modifiable<Double>
public void modifyDiagonal(long row, long col, UnaryFunction<Double> modifier)
modifyDiagonal
in interface Mutate2D.Modifiable<Double>
public void modifyMatching(Access1D<Double> left, BinaryFunction<Double> function)
modifyMatching
in interface Mutate1D.Modifiable<Double>
public void modifyMatching(BinaryFunction<Double> function, Access1D<Double> right)
modifyMatching
in interface Mutate1D.Modifiable<Double>
public void modifyOne(long row, long col, UnaryFunction<Double> modifier)
modifyOne
in interface Mutate2D.Modifiable<Double>
public void modifyRange(long first, long limit, UnaryFunction<Double> modifier)
modifyRange
in interface Mutate1D.Modifiable<Double>
public void modifyRow(long row, long col, UnaryFunction<Double> modifier)
modifyRow
in interface Mutate2D.Modifiable<Double>
public RawStore multiply(MatrixStore<Double> right)
multiply
in interface Operation.Multiplication<MatrixStore<Double>>
multiply
in interface MatrixStore<Double>
right
- The multiplicandthis * multiplicand
.public Double multiplyBoth(Access1D<Double> leftAndRight)
MatrixStore
multiplyBoth
in interface MatrixStore<Double>
leftAndRight
- The argument vectorpublic PhysicalStore.Factory<Double,RawStore> physical()
physical
in interface ElementsSupplier<Double>
public TransformableRegion<Double> regionByColumns(int... columns)
regionByColumns
in interface TransformableRegion<Double>
public TransformableRegion<Double> regionByLimits(int rowLimit, int columnLimit)
regionByLimits
in interface TransformableRegion<Double>
public TransformableRegion<Double> regionByOffsets(int rowOffset, int columnOffset)
regionByOffsets
in interface TransformableRegion<Double>
public TransformableRegion<Double> regionByRows(int... rows)
regionByRows
in interface TransformableRegion<Double>
public TransformableRegion<Double> regionByTransposing()
regionByTransposing
in interface TransformableRegion<Double>
public void substituteBackwards(Access2D<Double> body, boolean unitDiagonal, boolean conjugated, boolean hermitian)
PhysicalStore
substituteBackwards
in interface PhysicalStore<Double>
body
- The equation system body parameters [A]unitDiagonal
- TODOconjugated
- true if the upper/right part of body is actually stored in the lower/left part of the
matrix, and the elements conjugated.hermitian
- TODOpublic void substituteForwards(Access2D<Double> body, boolean unitDiagonal, boolean conjugated, boolean identity)
PhysicalStore
substituteForwards
in interface PhysicalStore<Double>
body
- The equation system body parameters [A]unitDiagonal
- true if body has ones on the diagonalconjugated
- TODOpublic void supplyTo(TransformableRegion<Double> receiver)
supplyTo
in interface MatrixStore<Double>
supplyTo
in interface Access2D.Collectable<Double,TransformableRegion<Double>>
public PrimitiveScalar toScalar(long row, long column)
toScalar
in interface MatrixStore<Double>
public void transformLeft(Householder<Double> transformation, int firstColumn)
transformLeft
in interface PhysicalStore<Double>
public void transformLeft(Rotation<Double> transformation)
PhysicalStore
As in MatrixStore.premultiply(Access1D)
where the left/parameter matrix is a plane rotation.
Multiplying by a plane rotation from the left means that [this] gets two of its rows updated to new combinations of those two (current) rows.
There are two ways to transpose/invert a rotation. Either you negate the angle or you interchange the two indeces that define the rotation plane.
transformLeft
in interface PhysicalStore<Double>
PhysicalStore.transformRight(Rotation)
public void transformRight(Householder<Double> transformation, int firstRow)
transformRight
in interface PhysicalStore<Double>
public void transformRight(Rotation<Double> transformation)
PhysicalStore
As in MatrixStore.multiply(MatrixStore)
where the right/parameter matrix is a plane rotation.
Multiplying by a plane rotation from the right means that [this] gets two of its columns updated to new combinations of those two (current) columns.
There result is undefined if the two input indeces are the same (in which case the rotation plane is undefined).
transformRight
in interface PhysicalStore<Double>
PhysicalStore.transformLeft(Rotation)
public RawStore transpose()
transpose
in interface ElementsSupplier<Double>
transpose
in interface MatrixStore<Double>
transpose
in interface Stream2D<Double,MatrixStore<Double>,TransformableRegion<Double>,ElementsSupplier<Double>>
public void visitAll(VoidFunction<Double> visitor)
visitAll
in interface Access1D.Visitable<Double>
public void visitColumn(long row, long col, VoidFunction<Double> visitor)
visitColumn
in interface Access2D.Visitable<Double>
public void visitDiagonal(long row, long col, VoidFunction<Double> visitor)
visitDiagonal
in interface Access2D.Visitable<Double>
public void visitRange(long first, long limit, VoidFunction<Double> visitor)
visitRange
in interface Access1D.Visitable<Double>
public void visitRow(long row, long col, VoidFunction<Double> visitor)
visitRow
in interface Access2D.Visitable<Double>
Copyright © 2019 Optimatika. All rights reserved.