new ComplexSparseMatrix()
This class represents a m by n complex matrix where only nonzero entries
are stored explicitly. Do not create a ComplexSparseMatrix from its constructor,
instead use static factory methods such as fromTriplet, identity and diag.
Example
let T = new ComplexTriplet(100, 100); T.addEntry(new Complex(3.4, 6.4), 11, 43); T.addEntry(new Complex(6.4, 3.4), 99, 99); let A = ComplexSparseMatrix.fromTriplet(T); let B = ComplexSparseMatrix.identity(10, 10); let d = ComplexDenseMatrix.ones(100, 1); let C = ComplexSparseMatrix.diag(d);
Methods
-
<static> fromTriplet(T)
-
Initializes a complex sparse matrix from a ComplexTriplet object.
Parameters:
Name Type Description Tmodule:LinearAlgebra.ComplexTriplet A complex triplet object containing only the nonzero
entries that need to be stored in this complex sparse matrix.Returns:
-
<static> identity(m, n)
-
Initializes a m by n complex sparse identity matrix.
Parameters:
Name Type Description mnumber The number of rows in this complex sparse matrix.
nnumber The number of columns in this complex sparse matrix.
Returns:
-
<static> diag(d)
-
Initializes a complex sparse diagonal matrix.
Parameters:
Name Type Description dmodule:LinearAlgebra.ComplexDenseMatrix The complex dense vector (d.nCols() == 1) used
to initialize this complex sparse diagonal matrix.Returns:
-
transpose()
-
Returns the transpose of this complex sparse matrix.
Returns:
-
invertDiagonal()
-
Returns the inverse of this diagonal complex sparse matrix.
Returns:
-
conjugate()
-
Returns the conjugate of this complex sparse matrix.
Returns:
-
nRows()
-
Returns the number of rows in this complex sparse matrix.
Returns:
- Type
- number
-
nCols()
-
Returns the number of columns in this complex sparse matrix.
Returns:
- Type
- number
-
nnz()
-
Returns the number of nonzero entries in this complex sparse matrix.
Returns:
- Type
- number
-
frobeniusNorm()
-
Computes the frobenius norm of this complex sparse matrix.
Returns:
- Type
- number
-
subMatrix(r0, r1, c0, c1)
-
Extracts a complex sparse sub-matrix in the range [r0, r1) x [c0, c1), i.e.,
a matrix of size (r1 - r0) x (c1 - c0) starting at indices (r0, c0).Parameters:
Name Type Description r0number The start row index.
r1number The end row index (not included).
c0number The start column index.
c1number The end column index (not included).
Returns:
-
chol()
-
Returns a sparse ComplexCholesky factorization of this complex sparse matrix.
Returns:
-
lu()
-
Returns a sparse ComplexLU factorization of this complex sparse matrix.
Returns:
-
qr()
-
Returns a sparse ComplexQR factorization of this complex sparse matrix.
Returns:
-
toDense()
-
Returns a dense copy of this complex sparse matrix.
Returns:
-
incrementBy(B)
-
A += B
Parameters:
Name Type Description Bmodule:LinearAlgebra.ComplexSparseMatrix The complex sparse matrix added to this complex
sparse matrix. -
decrementBy(B)
-
A -= B
Parameters:
Name Type Description Bmodule:LinearAlgebra.ComplexSparseMatrix The complex sparse matrix subtracted from
this complex sparse matrix. -
scaleBy(s)
-
A *= s
Parameters:
Name Type Description smodule:LinearAlgebra.Complex The complex number this complex sparse matrix is scaled by.
-
plus(B)
-
Returns A + B
Parameters:
Name Type Description Bmodule:LinearAlgebra.ComplexSparseMatrix The complex sparse matrix added to this complex
sparse matrix.Returns:
-
minus(B)
-
Returns A - B
Parameters:
Name Type Description Bmodule:LinearAlgebra.ComplexSparseMatrix The complex sparse matrix subtracted from this
complex sparse matrix.Returns:
-
timesComplex(s)
-
Returns A * s
Parameters:
Name Type Description smodule:LinearAlgebra.Complex The complex number this complex sparse matrix is multiplied by.
Returns:
-
timesDense(X)
-
Returns A * X
Parameters:
Name Type Description Xmodule:LinearAlgebra.ComplexDenseMatrix The complex dense matrix this complex sparse matrix
is multiplied by.Returns:
-
timesSparse(B)
-
Returns A * B
Parameters:
Name Type Description Bmodule:LinearAlgebra.ComplexSparseMatrix The complex sparse matrix this complex sparse matrix
is multiplied by.Returns: