EigenJS
The goal of this project is to port Eigen library into JavaScript for linear algebar.
Installation
- OS X (XCode & Command Line Tools)
- Linux (GCC >= 4.8):
$ npm install eigenjs
- Windows7/8 (Visual Studio 2012):
$ npm install eigenjs --msvs_version=2012
API
- Complex
- Complex Class Methods
- Complex(real, [imag])
- Complex.polar(scalar, scalar)
- Complex.cos(scalar)
- Complex.cos(comp)
- Complex.cosh(scalar)
- Complex.cosh(comp)
- Complex.exp(scalar)
- Complex.exp(comp)
- Complex.log(scalar)
- Complex.log(comp)
- Complex.log10(scalar)
- Complex.log10(comp)
- Complex.pow(scalar, scalar)
- Complex.pow(scalar, comp)
- Complex.pow(comp, scalar)
- Complex.pow(comp, comp)
- Complex.sin(scalar)
- Complex.sin(comp)
- Complex.sinh(scalar)
- Complex.sinh(comp)
- Complex.sqrt(scalar)
- Complex.sqrt(comp)
- Complex.tan(scalar)
- Complex.tan(comp)
- Complex.tanh(scalar)
- Complex.tanh(comp)
- Complex.acos(scalar)
- Complex.acos(comp)
- Complex.acosh(scalar)
- Complex.acosh(comp)
- Complex.asin(scalar)
- Complex.asin(comp)
- Complex.asinh(scalar)
- Complex.asinh(comp)
- Complex.atan(scalar)
- Complex.atan(comp)
- Complex.atanh(scalar)
- Complex.atanh(comp)
- Complex Instance Methods
- comp.abs()
- comp.arg()
- comp.norm()
- comp.conj()
- comp.proj(scalar)
- comp.proj(comp)
- comp.add(scalar)
- comp.add(comp)
- comp.adda(scalar)
- comp.adda(comp)
- comp.sub(scalar)
- comp.sub(comp)
- comp.suba(scalar)
- comp.suba(comp)
- comp.mul(scalar)
- comp.mul(comp)
- comp.mul(mat)
- comp.mul(vec)
- comp.mul(rvec)
- comp.mul(mblock)
- comp.mul(vblock)
- comp.mul(rvblock)
- comp.mul(cmat)
- comp.mul(cvec)
- comp.mul(crvec)
- comp.mul(cmblock)
- comp.mul(cvblock)
- comp.mul(crvblock)
- comp.mula(scalar)
- comp.mula(comp)
- comp.div(scalar)
- comp.div(comp)
- comp.diva(scalar)
- comp.diva(comp)
- comp.equals(scalar)
- comp.equals(comp)
- comp.isApprox(comp, [prec = 1e-12])
- comp.toString()
- Complex Properties
- Complex Class Methods
- Matrix
- Matrix Class Methods
- Matrix(mat)
- Matrix(vec)
- Matrix(rvec)
- Matrix(mblock)
- Matrix(vblock)
- Matrix(rvblock)
- Matrix(rows, cols)
- Matrix.Zero(n)
- Matrix.Zero(rows, cols)
- Matrix.Ones(n)
- Matrix.Ones(rows, cols)
- Matrix.Constant(rows, cols, scalar)
- Matrix.Constant(rows, cols, comp)
- Matrix.Random(n)
- Matrix.Random(rows, cols)
- Matrix.Identity(n)
- Matrix.Identity(rows, cols)
- Matrix Instance Methods
- mat.rows()
- mat.cols()
- mat.set(row, col, scalar)
- mat.set(scalar_array)
- mat.get(row, col)
- mat.assign(mat)
- mat.assign(vec)
- mat.assign(rvec)
- mat.assign(mblock)
- mat.assign(vblock)
- mat.assign(rvblock)
- mat.value()
- mat.setZero()
- mat.setOnes()
- mat.setConstant(scalar)
- mat.setRandom()
- mat.setIdentity()
- mat.setDiagonal(index, vec)
- mat.setDiagonal(index, rvec)
- mat.block(startRow, startCol, blockRows, blockCols)
- mat.row(n)
- mat.col(n)
- mat.topRows(n)
- mat.bottomRows(n)
- mat.middleRows(startRow, n)
- mat.leftCols(n)
- mat.rightCols(n)
- mat.middleCols(startCol, n)
- mat.topLeftCorner(cRows, cCols)
- mat.topRightCorner(cRows, cCols)
- mat.bottomLeftCorner(cRows, cCols)
- mat.bottomRightCorner(cRows, cCols)
- mat.replicate(rowFactor, colFactor)
- mat.add(mat)
- mat.add(vec)
- mat.add(rvec)
- mat.add(mblock)
- mat.add(vblock)
- mat.add(rvblock)
- mat.add(cmat)
- mat.add(cvec)
- mat.add(crvec)
- mat.add(cmblock)
- mat.add(cvblock)
- mat.add(crvblock)
- mat.adda(mat)
- mat.adda(vec)
- mat.adda(rvec)
- mat.adda(mblock)
- mat.adda(vblock)
- mat.adda(rvblock)
- mat.sub(mat)
- mat.sub(vec)
- mat.sub(rvec)
- mat.sub(mblock)
- mat.sub(vblock)
- mat.sub(rvblock)
- mat.sub(cmat)
- mat.sub(cvec)
- mat.sub(crvec)
- mat.sub(cmblock)
- mat.sub(cvblock)
- mat.sub(crvblock)
- mat.suba(mat)
- mat.suba(vec)
- mat.suba(rvec)
- mat.suba(mblock)
- mat.suba(vblock)
- mat.suba(rvblock)
- mat.mul(scalar)
- mat.mul(comp)
- mat.mul(mat)
- mat.mul(vec)
- mat.mul(rvec)
- mat.mul(mblock)
- mat.mul(vblock)
- mat.mul(rvblock)
- mat.mul(cmat)
- mat.mul(cvec)
- mat.mul(crvec)
- mat.mul(cmblock)
- mat.mul(cvblock)
- mat.mul(crvblock)
- mat.mula(scalar)
- mat.mula(mat)
- mat.mula(vec)
- mat.mula(rvec)
- mat.mula(mblock)
- mat.mula(vblock)
- mat.mula(rvblock)
- mat.div(scalar)
- mat.div(comp)
- mat.diva(scalar)
- mat.transpose()
- mat.conjugate()
- mat.adjoint()
- mat.determinant()
- mat.inverse()
- mat.trace()
- mat.diagonal([index = 0])
- mat.norm()
- mat.redux(func)
- mat.sum()
- mat.prod()
- mat.mean()
- mat.visit(func)
- mat.maxCoeff()
- mat.maxCoeff(obj)
- mat.maxCoeff(func)
- mat.minCoeff()
- mat.minCoeff(obj)
- mat.minCoeff(func)
- mat.equals(mat)
- mat.equals(vec)
- mat.equals(rvec)
- mat.equals(mblock)
- mat.equals(vblock)
- mat.equals(rvblock)
- mat.isApprox(mat, [prec = 1e-12])
- mat.isApprox(vec, [prec = 1e-12])
- mat.isApprox(rvec, [prec = 1e-12])
- mat.isApprox(mblock, [prec = 1e-12])
- mat.isApprox(vblock, [prec = 1e-12])
- mat.isApprox(rvblock, [prec = 1e-12])
- mat.isSquare()
- mat.isZero([prec = 1e-12])
- mat.isOnes([prec = 1e-12])
- mat.isIdentity([prec = 1e-12])
- mat.isDiagonal([prec = 1e-12])
- mat.all()
- mat.any()
- mat.count()
- mat.allFinite()
- mat.hasNaN()
- mat.partialPivLu()
- mat.fullPivLu()
- mat.toString([options])
- Matrix Class Methods
- Complex Matrix
- Complex Matrix Class Methods
- CMatrix(mat)
- CMatrix(vec)
- CMatrix(rvec)
- CMatrix(mblock)
- CMatrix(vblock)
- CMatrix(rvblock)
- CMatrix(cmat)
- CMatrix(cvec)
- CMatrix(crvec)
- CMatrix(cmblock)
- CMatrix(cvblock)
- CMatrix(crvblock)
- CMatrix(rows, cols)
- CMatrix.Zero(n)
- CMatrix.Zero(rows, cols)
- CMatrix.Ones(n)
- CMatrix.Ones(rows, cols)
- CMatrix.Constant(rows, cols, scalar)
- CMatrix.Constant(rows, cols, comp)
- CMatrix.Random(n)
- CMatrix.Random(rows, cols)
- CMatrix.Identity(n)
- CMatrix.Identity(rows, cols)
- Complex Matrix Instance Methods
- cmat.rows()
- cmat.cols()
- cmat.set(row, col, comp)
- cmat.set(comp_array)
- cmat.get(row, col)
- cmat.assign(mat)
- cmat.assign(vec)
- cmat.assign(rvec)
- cmat.assign(mblock)
- cmat.assign(vblock)
- cmat.assign(rvblock)
- cmat.assign(cmat)
- cmat.assign(cvec)
- cmat.assign(crvec)
- cmat.assign(cmblock)
- cmat.assign(cvblock)
- cmat.assign(crvblock)
- cmat.value()
- cmat.setZero()
- cmat.setOnes()
- cmat.setConstant(scalar)
- cmat.setConstant(comp)
- cmat.setRandom()
- cmat.setIdentity()
- cmat.setDiagonal(index, vec)
- cmat.setDiagonal(index, rvec)
- cmat.setDiagonal(index, cvec)
- cmat.setDiagonal(index, crvec)
- cmat.block(startRow, startCol, blockRows, blockCols)
- cmat.row(n)
- cmat.col(n)
- cmat.topRows(n)
- cmat.bottomRows(n)
- cmat.middleRows(startRow, n)
- cmat.leftCols(n)
- cmat.rightCols(n)
- cmat.middleCols(startCol, n)
- cmat.topLeftCorner(cRows, cCols)
- cmat.topRightCorner(cRows, cCols)
- cmat.bottomLeftCorner(cRows, cCols)
- cmat.bottomRightCorner(cRows, cCols)
- cmat.replicate(rowFactor, colFactor)
- cmat.add(mat)
- cmat.add(vec)
- cmat.add(rvec)
- cmat.add(mblock)
- cmat.add(vblock)
- cmat.add(rvblock)
- cmat.add(cmat)
- cmat.add(cvec)
- cmat.add(crvec)
- cmat.add(cmblock)
- cmat.add(cvblock)
- cmat.add(crvblock)
- cmat.adda(mat)
- cmat.adda(vec)
- cmat.adda(rvec)
- cmat.adda(mblock)
- cmat.adda(vblock)
- cmat.adda(rvblock)
- cmat.adda(cmat)
- cmat.adda(cvec)
- cmat.adda(crvec)
- cmat.adda(cmblock)
- cmat.adda(cvblock)
- cmat.adda(crvblock)
- cmat.sub(mat)
- cmat.sub(vec)
- cmat.sub(rvec)
- cmat.sub(mblock)
- cmat.sub(vblock)
- cmat.sub(rvblock)
- cmat.sub(cmat)
- cmat.sub(cvec)
- cmat.sub(crvec)
- cmat.sub(cmblock)
- cmat.sub(cvblock)
- cmat.sub(crvblock)
- cmat.suba(mat)
- cmat.suba(vec)
- cmat.suba(rvec)
- cmat.suba(mblock)
- cmat.suba(vblock)
- cmat.suba(rvblock)
- cmat.suba(cmat)
- cmat.suba(cvec)
- cmat.suba(crvec)
- cmat.suba(cmblock)
- cmat.suba(cvblock)
- cmat.suba(crvblock)
- cmat.mul(scalar)
- cmat.mul(comp)
- cmat.mul(mat)
- cmat.mul(vec)
- cmat.mul(rvec)
- cmat.mul(mblock)
- cmat.mul(vblock)
- cmat.mul(rvblock)
- cmat.mul(cmat)
- cmat.mul(cvec)
- cmat.mul(crvec)
- cmat.mul(cmblock)
- cmat.mul(cvblock)
- cmat.mul(crvblock)
- cmat.mula(scalar)
- cmat.mula(comp)
- cmat.mula(mat)
- cmat.mula(vec)
- cmat.mula(rvec)
- cmat.mula(mblock)
- cmat.mula(vblock)
- cmat.mula(rvblock)
- cmat.mula(cmat)
- cmat.mula(cvec)
- cmat.mula(crvec)
- cmat.mula(cmblock)
- cmat.mula(cvblock)
- cmat.mula(crvblock)
- cmat.div(scalar)
- cmat.div(comp)
- cmat.diva(scalar)
- cmat.diva(comp)
- cmat.transpose()
- cmat.conjugate()
- cmat.adjoint()
- cmat.determinant()
- cmat.inverse()
- cmat.trace()
- cmat.diagonal([index = 0])
- cmat.norm()
- cmat.redux(func)
- cmat.sum()
- cmat.prod()
- cmat.mean()
- cmat.visit(func)
- cmat.equals(cmat)
- cmat.equals(cvec)
- cmat.equals(crvec)
- cmat.equals(cmblock)
- cmat.equals(cvblock)
- cmat.equals(crvblock)
- cmat.isApprox(cmat, [prec = 1e-12])
- cmat.isApprox(cvec, [prec = 1e-12])
- cmat.isApprox(crvec, [prec = 1e-12])
- cmat.isApprox(cmblock, [prec = 1e-12])
- cmat.isApprox(cvblock, [prec = 1e-12])
- cmat.isApprox(crvblock, [prec = 1e-12])
- cmat.isSquare()
- cmat.isZero([prec = 1e-12])
- cmat.isOnes([prec = 1e-12])
- cmat.isIdentity([prec = 1e-12])
- cmat.isDiagonal([prec = 1e-12])
- cmat.allFinite()
- cmat.hasNaN()
- cmat.partialPivLu()
- cmat.fullPivLu()
- cmat.toString([options])
- Complex Matrix Class Methods
- Vector inherits from Matrix
- Vector Class Methods
- Vector Instance Methods
- vec.set(row, scalar)
- vec.set(scalar_array)
- vec.get(row)
- vec.setLinSpaced(low, high)
- vec.setLinSpaced(size, low, high)
- vec.block(startRow, blockRows)
- vec.head(n)
- vec.tail(n)
- vec.dot(mat)
- vec.dot(vec)
- vec.dot(rvec)
- vec.dot(mblock)
- vec.dot(vblock)
- vec.dot(rvblock)
- vec.dot(cmat)
- vec.dot(cvec)
- vec.dot(crvec)
- vec.dot(cmblock)
- vec.dot(cvblock)
- vec.dot(crvblock)
- vec.asDiagonal()
- vec.normalize()
- vec.maxCoeff()
- vec.maxCoeff(obj)
- vec.maxCoeff(func)
- vec.minCoeff()
- vec.minCoeff(obj)
- vec.minCoeff(func)
- Complex Vector inherits from CMatrix
- Complex Vector Class Methods
- Complex Vector Instance Methods
- cvec.set(row, comp)
- cvec.set(comp_array)
- cvec.get(row)
- cvec.block(startRow, blockRows)
- cvec.head(n)
- cvec.tail(n)
- cvec.dot(mat)
- cvec.dot(vec)
- cvec.dot(rvec)
- cvec.dot(mblock)
- cvec.dot(vblock)
- cvec.dot(rvblock)
- cvec.dot(cmat)
- cvec.dot(cvec)
- cvec.dot(crvec)
- cvec.dot(cmblock)
- cvec.dot(cvblock)
- cvec.dot(crvblock)
- cvec.asDiagonal()
- cvec.normalize()
- Row Vector inherits from Matrix
- Row Vector Class Methods
- Row Vector Instance Methods
- rvec.set(col, scalar)
- rvec.set(scalar_array)
- rvec.get(col)
- rvec.setLinSpaced(low, high)
- rvec.setLinSpaced(size, low, high)
- rvec.block(startCol, blockCols)
- rvec.head(n)
- rvec.tail(n)
- rvec.dot(mat)
- rvec.dot(vec)
- rvec.dot(rvec)
- rvec.dot(mblock)
- rvec.dot(vblock)
- rvec.dot(rvblock)
- rvec.dot(cmat)
- rvec.dot(cvec)
- rvec.dot(crvec)
- rvec.dot(cmblock)
- rvec.dot(cvblock)
- rvec.dot(crvblock)
- rvec.asDiagonal()
- rvec.normalize()
- rvec.maxCoeff()
- rvec.maxCoeff(obj)
- rvec.maxCoeff(func)
- rvec.minCoeff()
- rvec.minCoeff(obj)
- rvec.minCoeff(func)
- Complex Row Vector inherits from CMatrix
- Complex Row Vector Class Methods
- CRowVector(mat)
- CRowVector(vec)
- CRowVector(rvec)
- CRowVector(mblock)
- CRowVector(vblock)
- CRowVector(rvblock)
- CRowVector(cmat)
- CRowVector(cvec)
- CRowVector(crvec)
- CRowVector(cmblock)
- CRowVector(cvblock)
- CRowVector(crvblock)
- CRowVector(cols)
- CRowVector(comp_array)
- CRowVector.Constant(cols, scalar)
- CRowVector.Constant(cols, comp)
- Complex Row Vector Instance Methods
- crvec.set(col, comp)
- crvec.set(comp_array)
- crvec.get(col)
- crvec.block(startCol, blockCols)
- crvec.head(n)
- crvec.tail(n)
- crvec.dot(mat)
- crvec.dot(vec)
- crvec.dot(rvec)
- crvec.dot(mblock)
- crvec.dot(vblock)
- crvec.dot(rvblock)
- crvec.dot(cmat)
- crvec.dot(cvec)
- crvec.dot(crvec)
- crvec.dot(cmblock)
- crvec.dot(cvblock)
- crvec.dot(crvblock)
- crvec.asDiagonal()
- crvec.normalize()
- Complex Row Vector Class Methods
- Matrix Block inherits from Matrix
- Complex Matrix Block inherits from CMatrix
- Vector Block inherits from Vector and MatrixBlock
- Complex Vector Block inherits from CVector and CMatrixBlock
- Row Vector Block inherits from RowVector and MatrixBlock
- Complex Row Vector Block inherits from CRowVector and CMatrixBlock
- Partial Pivoting LU
- Complex Partial Pivoting LU
- Full Pivoting LU
- Complex Full Pivoting LU
Complex
Complex Class Methods
Complex(real, [imag])
var C = Complex c = 3 -4;console;
c = (3,-4)
Complex.polar(scalar, scalar)
var C = Complex rho = 5 theta = -09272952180016122 c = C;console;console;console;
(5,0.927295)3.0000000000000004-3.9999999999999996
Complex.cos(scalar)
Complex.cos(comp)
var C = Complex c1 = MathPI/4 0 c2 = C;console;
(0.707107,-0)
Complex.cosh(scalar)
Complex.cosh(comp)
var C = Complex c1 = 0 0 c2 = C;console;
(1,0)
Complex.exp(scalar)
Complex.exp(comp)
var C = Complex c1 = 1 0 c2 = C;console;
(2.71828,0)
Complex.log(scalar)
Complex.log(comp)
var C = Complex c1 = MathE 0 c2 = C;console;
(1,0)
Complex.log10(scalar)
Complex.log10(comp)
var C = Complex c1 = 1000 0 c2 = C;console;
(3,0)
Complex.pow(scalar, scalar)
Complex.pow(scalar, comp)
Complex.pow(comp, scalar)
Complex.pow(comp, comp)
var C = Complex c = Cconsole;
(8,0)
Complex.sin(scalar)
Complex.sin(comp)
var C = Complex c1 = MathPI/4 0 c2 = C;console;
(0.707107,0)
Complex.sinh(scalar)
Complex.sinh(comp)
var C = Complex c1 = 0 0 c2 = C;console;
(0,0)
Complex.sqrt(scalar)
Complex.sqrt(comp)
var C = Complex c1 = 9 0 c2 = C;console;
(3,0)
Complex.tan(scalar)
Complex.tan(comp)
var C = Complex c1 = MathPI/4 0 c2 = C;console;
(1,0)
Complex.tanh(scalar)
Complex.tanh(comp)
var C = Complex c1 = Infinity 0 c2 = C;console;
(1,0)
Complex.acos(scalar)
Complex.acos(comp)
var C = Complex c1 = 1 0 c2 = C;console;
(0,0)
Complex.acosh(scalar)
Complex.acosh(comp)
var C = Complex c1 = 154308 0 c2 = C;console;
(0.999999,0)
Complex.asin(scalar)
Complex.asin(comp)
var C = Complex c1 = 1 0 c2 = C;console;
(1.5708,7.82511e-09)
Complex.asinh(scalar)
Complex.asinh(comp)
var C = Complex c1 = 1 0 c2 = C;console;
(0.881374,0)
Complex.atan(scalar)
Complex.atan(comp)
var C = Complex c1 = Infinity 0 c2 = C;console;
(1.5708,0)
Complex.atanh(scalar)
Complex.atanh(comp)
var C = Complex c1 = 1 0 c2 = C;console;
(inf,0)
Complex Instance Methods
comp.abs()
var C = Complex c = 3 -4;console;
5
comp.arg()
var C = Complex c = 3 -4;console;console;
-0.9272952180016122(3.0000000000000004,-3.9999999999999996)
comp.norm()
var C = Complex c = 3 -4;console;
25
comp.conj()
var C = Complex c = 3 -4;console;
(3,4)
comp.proj(scalar)
comp.proj(comp)
var C = Complex c1 = 0 -Infinity c2 = C;console;
(inf, -0)
comp.add(scalar)
comp.add(comp)
var C = Complex c1 = 3 0 c2 = 0 4 c3 = c1;console;
(3,4)
comp.adda(scalar)
comp.adda(comp)
var C = Complex c1 = 3 0 c2 = 0 4;c1;console;
(3,4)
comp.sub(scalar)
comp.sub(comp)
var C = Complex c1 = 3 4 c2 = 2 -3 c3 = c1;console;
(1,7)
comp.suba(scalar)
comp.suba(comp)
var C = Complex c1 = 5 8 c2 = -3 4;c1;console;
(8,4)
comp.mul(scalar)
comp.mul(comp)
comp.mul(mat)
comp.mul(vec)
comp.mul(rvec)
comp.mul(mblock)
comp.mul(vblock)
comp.mul(rvblock)
comp.mul(cmat)
comp.mul(cvec)
comp.mul(crvec)
comp.mul(cmblock)
comp.mul(cvblock)
comp.mul(crvblock)
var C = Complex c1 = 1 8 c2 = 6 4 c3 = c1;console;
(-26,52)
comp.mula(scalar)
comp.mula(comp)
var C = Complex c1 = 3 1 c2 = 2 4c1;console;
(2,14)
comp.div(scalar)
comp.div(comp)
var C = Complex c1 = 4 8 c2 = 2 0 c3 = c1;console;
(2,4)
comp.diva(scalar)
comp.diva(comp)
var C = Complex c1 = 3 9 c2 = 9 0c1;console;
(0.333333,1)
comp.equals(scalar)
comp.equals(comp)
var C = Complex c1 = 1 0 c2 = c1;console;
true
comp.isApprox(comp, [prec = 1e-12])
var C = Complex c1 = 1/3 0 c2 = 03333 0;console;
true
comp.toString()
var C = Complex c = 3 -4;console;
(3,-4)
Complex Properties
comp.real
comp.imag
var C = Complex c = 3 -4;creal = 6;cimag = 8;console;
(6,8)
Matrix
Matrix Class Methods
Matrix(mat)
Matrix(vec)
Matrix(rvec)
Matrix(mblock)
Matrix(vblock)
Matrix(rvblock)
var M = Matrix mat = 2 3 mat2 = mat;console;console;
mat = 0.381981 -0.373117 -0.866239-0.0467884 -0.981309 -0.885573 mat2 = 0.381981 -0.373117 -0.866239-0.0467884 -0.981309 -0.885573
Matrix(rows, cols)
var M = Matrix mat = 2 3;console;
mat =0 0 00 0 0
Matrix.Zero(n)
Matrix.Zero(rows, cols)
var M = Matrix mat = M;console;
mat =0 0 00 0 0
Matrix.Ones(n)
Matrix.Ones(rows, cols)
var M = Matrix mat = M;console;
mat =1 1 11 1 1
Matrix.Constant(rows, cols, scalar)
Matrix.Constant(rows, cols, comp)
var M = Matrix mat = M;console;
mat =0.6 0.6 0.6 0.60.6 0.6 0.6 0.60.6 0.6 0.6 0.60.6 0.6 0.6 0.6
Matrix.Random(n)
Matrix.Random(rows, cols)
var M = Matrix mat = M;console;
mat =-0.421952 -0.671276 0.547419 0.260209 -0.13622 0.464891
Matrix.Identity(n)
Matrix.Identity(rows, cols)
var M = Matrix mat1 = M mat2 = M;console;console;
mat1 =1 00 1mat2 =1 0 00 1 0
Matrix Instance Methods
mat.rows()
mat.cols()
var M = Matrix mat = 2 3;console;console;
23
mat.set(row, col, scalar)
var M = Matrix mat = 2 2;mat ;console;
mat =1 23 4
mat.set(scalar_array)
var M = Matrix mat = 3 3;mat;console;
mat =1 2 34 5 67 8 9
mat.get(row, col)
var M = Matrix mat = 2 2;mat;console;console;
1 23 4
mat.assign(mat)
mat.assign(vec)
mat.assign(rvec)
mat.assign(mblock)
mat.assign(vblock)
mat.assign(rvblock)
var M = Matrix mat = M;mat;console;
mat =0 0 0 00 0 0 00 0 0 00 0 0 0
mat.value()
Returns the unique coefficient of a 1x1 expression
var M = Matrix mat = M;console;
-0.7131525574778916
mat.setZero()
var M = Matrix mat = 3 3;console;console;
mat = 0.244911 -0.752925 -0.562905 0.215088 -0.406688 -0.750836 0.983236 0.800109 0.695126 mat =0 0 00 0 00 0 0
mat.setOnes()
var M = Matrix mat = 3 3;console;console;
mat =0 0 00 0 00 0 0 mat =1 1 11 1 11 1 1
mat.setConstant(scalar)
var M = Matrix mat = 3 3;console;console;
mat =0 0 00 0 00 0 0 mat =0.6 0.6 0.60.6 0.6 0.60.6 0.6 0.6
mat.setRandom()
var M = Matrix mat = 3 3;console;console;
mat =0 0 00 0 00 0 0 mat = -0.292434 -0.0673437 0.283946 -0.938224 0.154289 0.283845 -0.725773 -0.862362 0.583097
mat.setIdentity()
var M = Matrix mat = 3 3;console;console;
mat =0 0 00 0 00 0 0 mat =1 0 00 1 00 0 1
mat.setDiagonal(index, vec)
mat.setDiagonal(index, rvec)
var M = Matrix mat = 3 3 dia = mat;console;dia;console;
mat =0 0 00 0 00 0 0 mat = 0 -0.294006 0 0 0 0.634569 0 0 0
mat.block(startRow, startCol, blockRows, blockCols)
var M = Matrix mat = 4 4 mblock = mat;mblock;console;
mat = 1 0 0 0 0 -0.822352 0.533723 0 0 0.721993 0.287646 0 0 0 0 1
mat.row(n)
var Eigen = M = EigenMatrix RV = EigenRowVector mat = 3 3 mblock = mat;mblock;console;
mat = 0 0 0-0.843392 -0.891355 0.991578 0 0 0
mat.col(n)
var Eigen = M = EigenMatrix V = EigenVector mat = 3 3 mblock = mat;mblock;console;
mat = 0 0.674939 0 0 -0.303923 0 0 -0.0302965 0
mat.topRows(n)
Returns a block consisting of the top rows of *this.
var M = Matrix mat = 4 4;console;
7 9 -5 3-2 -6 1 0
mat.bottomRows(n)
Returns a block consisting of the bottom rows of *this.
var M = Matrix mat = 4 4;console;
6 -3 0 9 6 6 3 9
mat.middleRows(startRow, n)
Returns a block consisting of a range of rows of *this.
var M = Matrix mat = 4 4;console;
-2 -6 1 0 6 -3 0 9
mat.leftCols(n)
Returns a block consisting of the left columns of *this.
var M = Matrix mat = 4 4;console;
7 9-2 -6 6 -3 6 6
mat.rightCols(n)
Returns a block consisting of the right columns of *this.
var M = Matrix mat = 4 4;console;
-5 3 1 0 0 9 3 9
mat.middleCols(startCol, n)
Returns a block consisting of a range of columns of *this.
var M = Matrix mat = 4 4;console;
9 -5-6 1-3 0 6 3
mat.topLeftCorner(cRows, cCols)
Returns a block consisting of a top-left corner of *this.
var M = Matrix mat = 4 4;console;
7 9-2 -6
mat.topRightCorner(cRows, cCols)
Returns a block consisting of a top-right corner of *this.
var M = Matrix mat = 4 4;console;
-5 3 1 0
mat.bottomLeftCorner(cRows, cCols)
Returns a block consisting of a bottom-left corner of *this.
var M = Matrix mat = 4 4;console;
6 -3 6 6
mat.bottomRightCorner(cRows, cCols)
Returns a block consisting of a bottom-right corner of *this.
var M = Matrix mat = 4 4;console;
0 93 9
mat.replicate(rowFactor, colFactor)
var M = Matrix mat = 3 1;console;
7 7 7 7 7-2 -2 -2 -2 -2 6 6 6 6 6 7 7 7 7 7-2 -2 -2 -2 -2 6 6 6 6 6
mat.add(mat)
mat.add(vec)
mat.add(rvec)
mat.add(mblock)
mat.add(vblock)
mat.add(rvblock)
mat.add(cmat)
mat.add(cvec)
mat.add(crvec)
mat.add(cmblock)
mat.add(cvblock)
mat.add(crvblock)
var M = Matrix mat1 = 2 2 mat2 = 2 2 mat3;mat1;mat2;mat3 = mat1;console;
mat3 = 6 9 9 12
mat.adda(mat)
mat.adda(vec)
mat.adda(rvec)
mat.adda(mblock)
mat.adda(vblock)
mat.adda(rvblock)
var M = Matrix mat1 = 2 2 mat2 = 2 2;mat1;mat2;mat1;console;
mat1 = 6 9 9 12
mat.sub(mat)
mat.sub(vec)
mat.sub(rvec)
mat.sub(mblock)
mat.sub(vblock)
mat.sub(rvblock)
mat.sub(cmat)
mat.sub(cvet)
mat.sub(crvet)
mat.sub(cmblock)
mat.sub(cvblock)
mat.sub(crvblock)
var M = Matrix mat1 = 2 2 mat2 = 2 2 mat3;mat1;mat2;mat3 = mat1;console;
mat3 =-4 -3-5 -4
mat.suba(mat)
mat.suba(vec)
mat.suba(rvec)
mat.suba(mblock)
mat.suba(vblock)
mat.suba(rvblock)
var M = Matrix mat1 = 2 2 mat2 = 2 2;mat1;mat2;mat1;console;
mat1 =-4 -3-5 -4
mat.mul(scalar)
mat.mul(comp)
mat.mul(mat)
mat.mul(vec)
mat.mul(rvec)
mat.mul(mblock)
mat.mul(vblock)
mat.mul(rvblock)
mat.mul(cmat)
mat.mul(cvec)
mat.mul(crvec)
mat.mul(cvblock)
mat.mul(crvblock)
var M = Matrix mat1 = 2 3 vec = 3 1 mat2;mat1;vec;mat2 = mat1;console;
mat2 =3782
mat.mula(scalar)
mat.mula(mat)
mat.mula(vec)
mat.mula(rvec)
mat.mula(mblock)
mat.mula(vblock)
mat.mula(rvblock)
var M = Matrix mat = 2 3 vec = 3 1;mat;vec;mat;console;
mat =3782
mat.div(scalar)
mat.div(comp)
var M = Matrix mat1 = 2 2 mat2;mat1;mat2 = mat1;console;
mat2 =0.5 11.5 2
mat.diva(scalar)
var M = Matrix mat = 2 2;mat;mat;console;
mat =0.5 11.5 2
mat.transpose()
var M = Matrix mat1 = 3 2 mat2 = mat1;console;console;
mat1 = -0.112813 -0.325566-0.0500345 0.213005 -0.930346 -0.022705mat2 = -0.112813 -0.0500345 -0.930346 -0.325566 0.213005 -0.022705
mat.conjugate()
var M = Matrix mat1 = 2 2 mat2 = mat1;console;
true
mat.adjoint()
var M = Matrix mat1 = 3 2 mat2 = mat1;console;console;
mat1 = 0.997487 0.0670765 0.770148 -0.645138 -0.12185 -0.835853mat2 = 0.997487 0.770148 -0.121850.0670765 -0.645138 -0.835853
mat.determinant()
Returns the determinant of this matrix. This method uses class PartialPivLU.
var M = Matrix mat = 2 2;console;console;
mat = 0.132371 -0.813862 0.758326 -0.58171 det = 0.540171350604003
mat.inverse()
Returns the matrix inverse of this matrix. This method uses class PartialPivLU.
var M = Matrix mat = 3 3 inv = mat;console;
inv =-24 18 5 20 -15 -4 -5 4 1
mat.trace()
var M = Matrix mat = 2 3 tr = mat;console;console;
mat =1 2 34 5 6 tr = 6
mat.diagonal([index = 0])
var M = Matrix mat = 4 4;console;console;
9 1 96 6
mat.norm()
Returns the Frobenius norm.
var M = Matrix mat = 3 3;console;
16.881943016134134
mat.redux(func)
- func
Function
The result of a full redux operation on the whoie matrix or vector usingfunc
.
var M = Matrix mat = 3 3 { return a + b; };console;
45
mat.sum()
var M = Matrix mat = 3 3;console;
45
mat.prod()
var M = Matrix mat = 3 3;console;
362880
mat.mean()
var M = Matrix mat = 3 3;console;
5
mat.visit(func)
- func
Function
Applies thefunc
to the whole coefficients of the matrix or vector.
var M = Matrix mat = 3 3;mat;
mat(0, 0) = 1mat(1, 0) = 4mat(2, 0) = 7mat(0, 1) = 2mat(1, 1) = 5mat(2, 1) = 8mat(0, 2) = 3mat(1, 2) = 6mat(2, 2) = 9
mat.maxCoeff()
var M = Matrix mat = 3 3;console;console;
mat = 0.175793 -0.547068 -0.959701 0.561311 -0.579446 0.297471-0.0382309 -0.743676 -0.411312 max = 0.5613114636211243
mat.maxCoeff(obj)
- obj
Object
var M = Matrix mat = 3 3 obj = {};console;console;console;
mat = -0.68294 0.690895 -0.698356-0.174138 -0.119934 0.733219-0.743578 0.262349 -0.795382 max = 0.7332185766348702obj = {"maxCoeff":0.7332185766348702,"rowId":1,"colId":2}
mat.maxCoeff(func)
- func
Function
var M = Matrix mat = 3 3 { console; };console;console;
mat =-0.552622 -0.355055 0.1410040.0814275 0.58272 -0.13819 0.552011 -0.217758 -0.551142 rowId = 1, colId = 1max = 0.5827204285109044
mat.minCoeff()
var M = Matrix mat = 3 3;console;console;
mat =-0.725041 0.511321 0.29833 0.233345 -0.22101 0.0355704-0.167162 -0.514649 -0.168438 min = -0.7250411527813604
mat.minCoeff(obj)
- obj
Object
var M = Matrix mat = 3 3 obj = {};console;console;console;
mat = 0.74568 0.870563 -0.82341 0.636928 -0.455949 0.944912 0.855648 0.872564 -0.87055 min = -0.8705498761825962obj = {"minCoeff":-0.8705498761825962,"rowId":2,"colId":2}
mat.minCoeff(func)
- func
Function
var M = Matrix mat = 3 3 { console; };console;console;
0.371743 0.261372 0.144462-0.111958 0.884582 -0.02937 0.314765 -0.823458 0.378298 rowId = 2, colId = 1min = -0.8234578174648144
mat.equals(mat)
mat.equals(vec)
mat.equals(rvec)
mat.equals(mblock)
mat.equals(vblock)
mat.equals(rvblock)
var M = Matrix mat1 = 2 2 mat2 = 2 2 mat3 = 2 2;mat1;mat2;mat3;console;
true
mat.isApprox(mat, [prec = 1e-12])
mat.isApprox(vec, [prec = 1e-12])
mat.isApprox(rvec, [prec = 1e-12])
mat.isApprox(mblock, [prec = 1e-12])
mat.isApprox(vblock, [prec = 1e-12])
mat.isApprox(rvblock, [prec = 1e-12])
var M = Matrix mat1 = 2 2 mat2 = 2 2;mat1;mat2;console;
true
mat.isSquare()
var M = Matrix mat1 = 4 4 mat2 = 3 2;console;console;
truefalse
mat.isZero([prec = 1e-12])
var M = Matrix mat = 2 3;console;console;
falsetrue
mat.isOnes([prec = 1e-12])
var M = Matrix mat = 2 3;console;console;
falsetrue
mat.isIdentity([prec = 1e-12])
var M = Matrix mat = 3 3;console;console;
falsetrue
mat.isDiagonal([prec = 1e-12])
var M = Matrix mat = 3 3;console;console;
falsetrue
mat.all()
Returns true if all coefficients are true.
var M = Matrix mat = 3 3 1;console;mat;console;
mat =1 1 11 1 11 1 1true mat =0 1 11 1 11 1 1false
mat.any()
Returns true if at least one coefficient is true.
var M = Matrix mat = 3 3;console;mat;console;
mat =0 0 00 0 00 0 0false mat =1 0 00 0 00 0 0true
mat.count()
Returns the number of coefficients which evaluate to true.
var M = Matrix mat = 3 3;mat;console;console;
mat =0 1 10 1 10 1 1 6
mat.allFinite()
Returns true if *this contains only finite numbers, i.e., no NaN and no +/-INF values.
var M = Matrix mat = 3 3;console;mat;console;
mat = 0.202332 0.271506 -0.887678 0.592388 -0.806422 0.799406 0.26443 0.461303 -0.389755true mat = inf 0.271506 -0.887678 0.592388 -0.806422 0.799406 0.26443 0.461303 -0.389755false
mat.hasNaN()
Returns true if *this contains at least one Not A Number (NaN).
var M = Matrix mat = 3 3;console;mat;console;
mat =0 0 00 0 00 0 0false mat = 0 0 0 0 nan 0 0 0 0true
mat.partialPivLu()
Returns the partial-pivoting LU decomposition of *this.
var M = Matrix mat = 3 3 pplu = mat;console;console;console;
P =0 0 10 1 01 0 0 L = 1 0 00.8 1 00.2 -1 1 U = 5 6 3 0 -2.8 3.6 0 0 8
mat.fullPivLu()
Returns the full-pivoting LU decomposition of *this.
var M = Matrix mat = 2 4 fplu = mat;console;console;console;console;
P =0 11 0 L = 1 00.75 1 U = 4 -1 2 1 0 1.75 -0.5 0.25 Q =0 0 0 10 0 1 00 1 0 01 0 0 0
mat.toString([options])
- options
Object
- precision
Number
Default=6
. The number of digits for floating point values. - fullPrecision
Booleam
Default=false
. If set to true, then the number of digits will be computed to match the full precision of each floating-point type. - dontAlignCols
Booleam
Default=false
. If set to true, it allows to disable the alignment of columnt, resulting in faster code. - coeffSeparator
String
Default=' '
. The string printed between two coefficients of the same row. - rowSeparator
String
Default=''
. The string printed between two rows. - rowPrefix
String
Default=''
. The string printed at the beginning of each row. - rowSuffix
String
Default=''
. The string printed at the end of each row. - matPrefix
String
Default=''
. The string printed at the beginning of the matrix. - matSuffix
String
Default=''
. The string printed at the end of the matrix.
- precision
var M = Matrix mat = 3 3 cleanfmt = precision: 4 coeffSeparator: ", " rowSeparator: "\n" rowPrefix: "[" rowSuffix: "]" ;console;console;
mat = 0.611558 0.725525 -0.550208 0.457785 -0.0968169 0.6576620.000162166 0.797849 -0.68232 mat =[ 0.6116, 0.7255, -0.5502][ 0.4578, -0.09682, 0.6577][0.0001622, 0.7978, -0.6823]
Complex Matrix
Complex Matrix Class Methods
CMatrix(mat)
CMatrix(vec)
CMatrix(rvec)
CMatrix(mblock)
CMatrix(vblock)
CMatrix(rvblock)
CMatrix(cmat)
CMatrix(cvec)
CMatrix(crvec)
CMatrix(cmblock)
CMatrix(cvblock)
CMatrix(crvblock)
var CM = CMatrix cmat = 2 3 cmat2 = cmat;console;console;
cmat = (-0.947988,-0.839555) (-0.502409,0.00732418) (0.402069,-0.422384) (-0.40669,0.758583) (-0.902474,0.124615) (0.992439,-0.0813283) cmat2 = (-0.947988,-0.839555) (-0.502409,0.00732418) (0.402069,-0.422384) (-0.40669,0.758583) (-0.902474,0.124615) (0.992439,-0.0813283)
CMatrix(rows, cols)
var CM = CMatrix cmat = 2 3;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)
CMatrix.Zero(n)
CMatrix.Zero(rows, cols)
var CM = CMatrix cmat = CM;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)
CMatrix.Ones(n)
CMatrix.Ones(rows, cols)
var CM = CMatrix cmat = CM;console;
cmat =(1,0) (1,0) (1,0)(1,0) (1,0) (1,0)
CMatrix.Constant(rows, cols, scalar)
CMatrix.Constant(rows, cols, comp)
var CM = CMatrix cmat = CM;console;
cmat =(0.6,0) (0.6,0) (0.6,0) (0.6,0)(0.6,0) (0.6,0) (0.6,0) (0.6,0)(0.6,0) (0.6,0) (0.6,0) (0.6,0)(0.6,0) (0.6,0) (0.6,0) (0.6,0)
CMatrix.Random(n)
CMatrix.Random(rows, cols)
var CM = CMatrix cmat = CM;console;
cmat = (0.827048,0.18844) (-0.130621,0.648239) (-0.946608,0.364096)(-0.895631,-0.864291) (0.952898,-0.648834) (-0.646252,0.440248)
CMatrix.Identity(n)
CMatrix.Identity(rows, cols)
var CM = CMatrix cmat1 = CM cmat2 = CM;console;console;
cmat1 =(1,0) (0,0)(0,0) (1,0)cmat2 =(1,0) (0,0) (0,0)(0,0) (1,0) (0,0)
Complex Matrix Instance Methods
cmat.rows()
cmat.cols()
var CM = CMatrix cmat = 2 3;console;console;
23
cmat.set(row, col, comp)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;cmat ;console;
cmat =(1,1) (2,2)(3,3) (4,4)
cmat.set(comp_array)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 3 3;cmat;console;
cmat =(1,1) (2,2) (3,3)(4,4) (5,5) (6,6)(7,7) (8,8) (9,9)
cmat.get(row, col)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;cmat;console;console;
(1,1) (2,2)(3,3) (4,4)
cmat.assign(mat)
cmat.assign(vec)
cmat.assign(rvec)
cmat.assign(mblock)
cmat.assign(vblock)
cmat.assign(rvblock)
cmat.assign(cmat)
cmat.assign(cvec)
cmat.assign(crvec)
cmat.assign(cmblock)
cmat.assign(cvblock)
cmat.assign(crvblock)
var CM = CMatrix cmat = CM;cmat;console;
cmat =(0,0) (0,0) (0,0) (0,0)(0,0) (0,0) (0,0) (0,0)(0,0) (0,0) (0,0) (0,0)(0,0) (0,0) (0,0) (0,0)
cmat.value()
Returns the unique coefficient of a 1x1 expression
var CM = CMatrix cmat = CM;console;
(-0.402467,-0.259974)
cmat.setZero()
var CM = CMatrix cmat = 3 3;console;console;
cmat = (0.828056,-0.856655) (0.192893,-0.0390696) (-0.477729,0.812314) (0.200923,0.904817) (-0.643549,-0.129635) (0.566937,0.514797)(-0.740525,0.00155845) (-0.780958,0.437884) (0.194337,0.223802) cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)
cmat.setOnes()
var CM = CMatrix cmat = 3 3;console;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0) cmat =(1,0) (1,0) (1,0)(1,0) (1,0) (1,0)(1,0) (1,0) (1,0)
cmat.setConstant(scalar)
cmat.setConstant(comp)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 3 3;console;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0) cmat =(6,8) (6,8) (6,8)(6,8) (6,8) (6,8)(6,8) (6,8) (6,8)
cmat.setRandom()
var CM = CMatrix cmat = 3 3;console;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0) cmat = (0.298345,0.285858) (-0.693147,0.286686) (-0.91605,-0.0576106) (0.410026,-0.685715) (0.33597,0.656071) (-0.261633,0.736407)(-0.808358,-0.0710831) (0.588954,0.544957) (0.800236,-0.434336)
mat.setIdentity()
var CM = CMatrix cmat = 3 3;console;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0) cmat =(1,0) (0,0) (0,0)(0,0) (1,0) (0,0)(0,0) (0,0) (1,0)
mat.setDiagonal(index, vec)
mat.setDiagonal(index, rvec)
mat.setDiagonal(index, cvec)
mat.setDiagonal(index, crvec)
var CM = CMatrix cmat = 3 3 dia = cmat;console;dia;console;
cmat = 0.103146 0.540894 0.490517-0.433484 0.804028 0.127162 0.438421 -0.707295 -0.785343 cmat = 0.103146 0 0.490517-0.433484 0.804028 0 0.438421 -0.707295 -0.785343
cmat.block(startRow, startCol, blockRows, blockCols)
var CM = CMatrix cmat = 4 4 cmblock = cmat;cmblock;console;
cmat = (1,0) (0,0) (0,0) (0,0) (0,0) (0.490586,-0.722033) (-0.380859,0.895456) (0,0) (0,0) (0.794101,0.457882) (-0.068657,0.081439) (0,0) (0,0) (0,0) (0,0) (1,0)
cmat.row(n)
var Eigen = CM = EigenCMatrix CRV = EigenCRowVector cmat = 3 3 cmblock = cmat;cmblock;console;
cmat = (0,0) (0,0) (0,0)(0.500827,-0.595426) (0.677855,0.716979) (0.271854,-0.943846) (0,0) (0,0) (0,0)
cmat.col(n)
var Eigen = CM = EigenCMatrix CV = EigenCVector cmat = 3 3 cmblock = cmat;cmblock;console;
cmat = (0,0) (-0.97615,-0.147) (0,0) (0,0) (-0.630134,-0.661642) (0,0) (0,0) (-0.211411,0.819724) (0,0)
cmat.topRows(n)
Returns a block consisting of the top rows of *this.
var CM = CMatrix cmat = 4 2;console;
(1,2) (3,4)(5,6) (7,8)
cmat.bottomRows(n)
Returns a block consisting of the bottom rows of *this.
var CM = CMatrix cmat = 4 2;console;
(9,10) (11,12)(13,14) (15,16)
cmat.middleRows(startRow, n)
Returns a block consisting of a range of rows of *this.
var CM = CMatrix cmat = 4 2;console;
(5,6) (7,8) (9,10) (11,12)
cmat.leftCols(n)
Returns a block consisting of the left columns of *this.
var CM = CMatrix cmat = 4 2;console;
(1,2) (5,6) (9,10)(13,14)
cmat.rightCols(n)
Returns a block consisting of the right columns of *this.
var CM = CMatrix cmat = 4 2;console;
(3,4) (7,8)(11,12)(15,16)
cmat.middleCols(startCol, n)
Returns a block consisting of a range of columns of *this.
var CM = CMatrix cmat = 4 2;console;
(3,4) (7,8)(11,12)(15,16)
cmat.topLeftCorner(cRows, cCols)
Returns a block consisting of a top-left corner of *this.
var CM = CMatrix cmat = 4 2;console;
(1,2)(5,6)
cmat.topRightCorner(cRows, cCols)
Returns a block consisting of a top-right corner of *this.
var CM = CMatrix cmat = 4 2;console;
(3,4)(7,8)
cmat.bottomLeftCorner(cRows, cCols)
Returns a block consisting of a bottom-left corner of *this.
var CM = CMatrix cmat = 4 2;console;
(9,10)(13,14)
cmat.bottomRightCorner(cRows, cCols)
Returns a block consisting of a bottom-right corner of *this.
var CM = CMatrix cmat = 4 2;console;
(11,12)(15,16)
cmat.replicate(rowFactor, colFactor)
var CM = CMatrix cmat = 3 1;console;
(7,0) (7,0) (7,0) (7,0) (7,0)(-2,0) (-2,0) (-2,0) (-2,0) (-2,0) (6,0) (6,0) (6,0) (6,0) (6,0) (7,0) (7,0) (7,0) (7,0) (7,0)(-2,0) (-2,0) (-2,0) (-2,0) (-2,0) (6,0) (6,0) (6,0) (6,0) (6,0)
cmat.add(mat)
cmat.add(vec)
cmat.add(rvec)
cmat.add(mblock))
cmat.add(vblock)
cmat.add(rvblock)
cmat.add(cmat)
cmat.add(cvec)
cmat.add(crvec)
cmat.add(cmblock)
cmat.add(cvblock)
cmat.add(crvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2 cmat3;cmat1;cmat2;cmat3 = cmat1;console;
cmat3 = (6,1) (8,2)(10,10) (12,12)
cmat.adda(mat)
cmat.adda(vec)
cmat.adda(rvec)
cmat.adda(mblock)
cmat.adda(vblock)
cmat.adda(rvblock)
cmat.adda(cmat)
cmat.adda(cvec)
cmat.adda(crvec)
cmat.adda(cmblock)
cmat.adda(cvblock)
cmat.adda(crvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2;cmat1;cmat2;cmat1;console;
cmat1 = (6,1) (8,2)(10,3) (12,4)
cmat.sub(mat)
cmat.sub(vec)
cmat.sub(rvec)
cmat.sub(mblock)
cmat.sub(vblock)
cmat.sub(rvblock)
cmat.sub(cmat)
cmat.sub(cvec)
cmat.sub(crvec)
cmat.sub(cmblock)
cmat.sub(cvblock)
cmat.sub(crvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2 cmat3;cmat1;cmat2;cmat3 = cmat1;console;
cmat3 =(-4,1) (-4,2)(-4,3) (-4,4)
cmat.suba(mat)
cmat.suba(vec)
cmat.suba(rvec)
cmat.suba(mblock)
cmat.suba(vblock)
cmat.suba(rvblock)
cmat.suba(cmat)
cmat.suba(cvec)
cmat.suba(crvec)
cmat.suba(cmblock)
cmat.suba(vblock)
cmat.suba(rvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2;cmat1;cmat2;cmat1;console;
mat1 =(-4,1) (-4,2)(-4,3) (-4,4)
cmat.mul(scalar)
cmat.mul(comp)
cmat.mul(mat)
cmat.mul(vec)
cmat.mul(rvec)
cmat.mul(mblock)
cmat.mul(vblock)
cmat.mul(rvblock)
cmat.mul(cmat)
cmat.mul(cvec)
cmat.mul(crvec)
cmat.mul(cmblock)
cmat.mul(cvblock)
cmat.mul(crvblock)
var Eigen = C = EigenComplex M = EigenMatrix CM = EigenCMatrix cmat1 = 2 3 vec = 3 1 cmat2;cmat1;vec;cmat2 = cmat1;console;
mat2 =(14,14)(32,32)
cmat.mula(scalar)
cmat.mula(comp)
cmat.mula(mat)
cmat.mula(vec)
cmat.mula(rvec)
cmat.mula(mblock)
cmat.mula(vblock)
cmat.mula(rvblock)
cmat.mula(cmat)
cmat.mula(cvec)
cmat.mula(crvec)
cmat.mula(cmblock)
cmat.mula(cvblock)
cmat.mula(crvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 3 c = 1 -1;cmat;cmat;console;
cmat = (2,0) (4,0) (6,0) (8,0) (10,0) (12,0)
cmat.div(scalar)
cmat.div(comp)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2;cmat1;cmat2 = cmat1;console;
cmat2 =(0.5,0.5) (1,1)(1.5,1.5) (2,2)
cmat.diva(scalar)
cmat.diva(comp)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2cmat;cmat;console;
cmat =(0.5,0.5) (1,1)(1.5,1.5) (2,2)
cmat.transpose()
var CM = CMatrix cmat1 = 3 2 cmat2 = cmat1;console;console;
cmat1 =(-0.0175928,0.317664) (0.0405036,0.744415) (0.980286,-0.33036) (-0.617894,-0.94324)(-0.360953,-0.543819) (0.958967,-0.649626)cmat2 =(-0.0175928,0.317664) (0.980286,-0.33036) (-0.360953,-0.543819) (0.0405036,0.744415) (-0.617894,-0.94324) (0.958967,-0.649626)
cmat.conjugate()
var CM = CMatrix cmat1 = 2 2 cmat2 = cmat1;console;console;
cmat1 = (-0.241556,0.172337) (0.87717,0.591998)(0.472778,-0.0217244) (-0.291438,-0.198262)cmat2 =(-0.241556,-0.172337) (0.87717,-0.591998) (0.472778,0.0217244) (-0.291438,0.198262)
cmat.adjoint()
var CM = CMatrix cmat1 = 3 2 cmat2 = cmat1;console;console;
cmat1 =(-0.431879,-0.597577) (0.956798,0.90183) (0.525477,-0.313942) (-0.943631,0.390357) (-0.415382,0.66716) (0.737088,0.238193)cmat2 = (-0.431879,0.597577) (0.525477,0.313942) (-0.415382,-0.66716) (0.956798,-0.90183) (-0.943631,-0.390357) (0.737088,-0.238193)
cmat.determinant()
Returns the determinant of this matrix. This method uses class CPartialPivLU.
var CM = CMatrix cmat = 2 2;console;console;
cmat = (0.528893,-0.900902) (-0.307532,-0.690669) (0.541616,0.947563) (-0.072443,0.450036) det = (-0.120764,0.968768)
cmat.inverse()
Returns the matrix inverse of this matrix. This method uses class CPartialPivLU.
var CM = CMatrix cmat = 3 3 inv = cmat;console;
inv =(-24,0) (18,0) (5,0) (20,0) (-15,0) (-4,0)(-5,-0) (4,0) (1,0)
cmat.trace()
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 3 tr = cmat;console;console;
cmat =(1,0) (2,0) (3,0)(4,0) (5,6) (7,0) tr = (6,6)
cmat.diagonal([index = 0])
var CM = CMatrix cmat = CM;console;console;
cmat = (0.345978,0.85694) (0.99589,-0.0742672) (-0.763035,-0.329107) (0.592024,0.15202) (-0.20903,0.834369) (0.692856,0.838519) (0.345978,0.85694)(-0.20903,0.834369)
cmat.norm()
Returns the Frobenius norm.
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;console;
14.866068747318506
cmat.redux(func)
- func
Function
The result of a full redux operation on the whoie matrix or vector usingfunc
.
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2 { return a; };console;
(16,20)
cmat.sum()
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;console;
(16,20)
cmat.prod()
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;console;
(-755,-540)
cmat.mean()
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 2;console;
(4,5)
cmat.visit(func)
- func
Function
Applies thefunc
to the whole coefficients of the matrix or vector.
var CM = CMatrix cmat = 3 3;cmat;
cmat(0, 0) = (1,0)cmat(1, 0) = (4,0)cmat(2, 0) = (7,0)cmat(0, 1) = (2,0)cmat(1, 1) = (5,0)cmat(2, 1) = (8,0)cmat(0, 2) = (3,0)cmat(1, 2) = (6,0)cmat(2, 2) = (9,0)
cmat.equals(cmat)
cmat.equals(cvec)
cmat.equals(crvec)
cmat.equals(cmblock)
cmat.equals(cvblock)
cmat.equals(crvblock)
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2 cmat3 = 2 2;cmat1;cmat2;cmat3;console;
true
cmat.isApprox(cmat, [prec = 1e-12])
cmat.isApprox(cvec, [prec = 1e-12])
cmat.isApprox(crvec, [prec = 1e-12])
cmat.isApprox(cmblock, [prec = 1e-12])
cmat.isApprox(cvblock, [prec = 1e-12])
cmat.isApprox(crvblock, [prec = 1e-12])
var Eigen = C = EigenComplex CM = EigenCMatrix cmat1 = 2 2 cmat2 = 2 2;cmat1;cmat2;console;
true
cmat.isSquare()
var CM = CMatrix cmat1 = 4 4 cmat2 = 3 2;console;console;
truefalse
cmat.isZero([prec = 1e-12])
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 3;console;console;
falsetrue
cmat.isOnes([prec = 1e-12])
var Eigen = C = EigenComplex CM = EigenCMatrix cmat = 2 3;console;console;
falsetrue
cmat.isIdentity([prec = 1e-12])
var CM = CMatrix cmat = 3 3;console;console;
falsetrue
cmat.isDiagonal([prec = 1e-12])
var CM = CMatrix cmat = 3 3;console;console;
falsetrue
cmat.allFinite()
Returns true if *this contains only finite numbers, i.e., no NaN and no +/-INF values.
var CM = CMatrix cmat = 3 3;console;cmat;console;
cmat = (-0.0193897,0.117036) (-0.236475,-0.431972) (0.261242,0.687658) (-0.982734,-0.815806) (-0.153287,-0.292975) (-0.532892,-0.314321) (0.750476,-0.742562) (-0.0286768,0.0286941) (-0.790602,0.352619)true cmat = (inf,0) (-0.236475,-0.431972) (0.261242,0.687658) (-0.982734,-0.815806) (-0.153287,-0.292975) (-0.532892,-0.314321) (0.750476,-0.742562) (-0.0286768,0.0286941) (-0.790602,0.352619)false
cmat.hasNaN()
Returns true if *this contains at least one Not A Number (NaN).
var CM = CMatrix cmat = 3 3;console;cmat;console;
cmat =(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)(0,0) (0,0) (0,0)false cmat = (0,0) (0,0) (0,0) (0,0) (nan,0) (0,0) (0,0) (0,0) (0,0)true
cmat.partialPivLu()
Returns the partial-pivoting LU decomposition of *this.
var CM = CMatrix cmat = 3 3 cpplu = cmat;console;console;console;
P =(0,0) (0,0) (1,0)(0,0) (1,0) (0,0)(1,0) (0,0) (0,0) L = (1,0) (0,0) (0,0)(0.8,0) (1,0) (0,0)(0.2,0) (-1,-0) (1,0) U = (5,0) (6,0) (3,0) (0,0) (-2.8,0) (3.6,0) (0,0) (0,0) (8,0)
cmat.fullPivLu()
Returns the full-pivoting LU decomposition of *this.
var CM = CMatrix cmat = 2 4 cfplu = cmat;console;console;console;console;
P =(0,0) (1,0)(1,0) (0,0) L = (1,0) (0,0)(0.75,0) (1,0) U = (4,0) (-1,0) (2,0) (1,0) (0,0) (1.75,0) (-0.5,0) (0.25,0) Q =(0,0) (0,0) (0,0) (1,0)(0,0) (0,0) (1,0) (0,0)(0,0) (1,0) (0,0) (0,0)(1,0) (0,0) (0,0) (0,0)
cmat.toString([options])
- options
Object
- precision
Number
Default=6
. The number of digits for floating point values. - fullPrecision
Booleam
Default=false
. If set to true, then the number of digits will be computed to match the full precision of each floating-point type. - dontAlignCols
Booleam
Default=false
. If set to true, it allows to disable the alignment of columnt, resulting in faster code. - coeffSeparator
String
Default=' '
. The string printed between two coefficients of the same row. - rowSeparator
String
Default=''
. The string printed between two rows. - rowPrefix
String
Default=''
. The string printed at the beginning of each row. - rowSuffix
String
Default=''
. The string printed at the end of each row. - matPrefix
String
Default=''
. The string printed at the beginning of the matrix. - matSuffix
String
Default=''
. The string printed at the end of the matrix.
- precision
var CM = CMatrix cmat = 3 3 octavefmt = coeffSeparator: ", " rowSeparator: ";\n" rowPrefix: "[" rowSuffix: "]" ;console;console;
cmat =(-0.881059,0.0362337) (-0.272438,-0.865992) (-0.230511,-0.192664) (0.979223,-0.201546) (-0.723588,0.651508) (-0.105755,0.579535) (0.624409,0.438373) (-0.109684,0.538095) (0.244085,0.332142) cmat =[(-0.881059,0.0362337), (-0.272438,-0.865992), (-0.230511,-0.192664)];[ (0.979223,-0.201546), (-0.723588,0.651508), (-0.105755,0.579535)];[ (0.624409,0.438373), (-0.109684,0.538095), (0.244085,0.332142)]
Vector
Vector Class Methods
Vector(mat)
Vector(vec)
Vector(rvec)
Vector(mblock)
Vector(vblock)
Vector(rvblock)
var V = Vector vec = 3 vec2 = vec;console;console;
vec =-0.777518 0.25226-0.262954 vec2 =-0.777518 0.25226-0.262954
Vector(rows)
var V = Vector vec = 3;console;
vec =000
Vector(scalar_array)
var V = Vector vec = 1 2 3;console;
vec =123
Vector.Constant(rows, scalar)
Vector.Constant(rows, comp)
var V = Vector vec = V;console;
vec =0.60.60.60.6
Vector.LinSpaced(size, low, high)
Sets a linearly space vector.
var V = Vector vec = V;console;
vec = 00.25 0.50.75 1
Vector Instance Methods
vec.set(row, scalar)
var V = Vector vec = 3;vec;vec;vec;console;
vec =123
vec.set(scalar_array)
var V = Vector vec = 3;vec;console;
vec =123
vec.get(row)
var V = Vector vec = 1 2 3;console;console;console;
123
vec.setLinSpaced(low, high)
Sets a linearly space vector.
var V = Vector vec = 5;console;vec;console;
vec =00000 vec = 00.25 0.50.75 1
vec.setLinSpaced(size, low, high)
Sets a linearly space vector.
var V = Vector vec = 3;console;vec;console;
vec =-0.498866-0.440048 0.118123 vec = 00.25 0.50.75 1
vec.block(startRow, blockRows)
var V = Vector vec = 1 2 3 4 vblock = vec;console;
vblock =23
vec.head(n)
var V = Vector vec = 1 2 3 4 vblock = vec;console;
vblock =12
vec.tail(n)
var V = Vector vec = 1 2 3 4 vblock = vec;console;
vblock =34
vec.dot(mat)
vec.dot(vec)
vec.dot(rvec)
vec.dot(mblock)
vec.dot(vblock)
vec.dot(rvblock)
vec.dot(cmat)
vec.dot(cvec)
vec.dot(crvec)
vec.dot(cmblock)
vec.dot(cvblock)
vec.dot(crvblock)
Returns the dot product of *this with other.
var V = Vector vec1 = 1 2 3 vec2 = 4 5 6;console;
32
vec.asDiagonal()
var V = Vector vec = 3 dia = vec;console;console;
vec = 0.593699 0.299713-0.718297 dia = 0.593699 0 0 0 0.299713 0 0 0 -0.718297
vec.normalize()
var V = Vector vec = 1 2 3 ;vec;console;
vec =0.2672610.5345220.801784
vec.maxCoeff()
var V = Vector vec = 3;console;console;
vec = 0.604974-0.210128 0.37608 max = 0.6049735153117093
vec.maxCoeff(obj)
- obj
Object
var V = Vector vec = 3 obj = {};console;console;console;
vec =-0.887644 -0.63168-0.644859 max = -0.631679946385175obj = {"maxCoeff":-0.631679946385175,"rowId":1,"colId":0}
vec.maxCoeff(func)
- func
Function
var V = Vector vec = 3 { console; };console;console;
vec =-0.006325-0.304345 0.875084 rowId = 2, colId = 0max = 0.8750841114088352
vec.minCoeff()
var V = Vector vec = 3;console;console;
vec = 0.311621 -0.59179-0.210911 min = -0.5917897846511517
vec.minCoeff(obj)
- obj
Object
var V = Vector vec = 3 obj = {};console;console;console;
vec = 0.413097 0.9239-0.0150985 min = -0.015098494950262165obj = {"minCoeff":-0.015098494950262165,"rowId":2,"colId":0}
vec.minCoeff(func)
- func
Function
var V = Vector vec = 3 { console; };console;console;
vec =-0.277781-0.668038 0.286223 rowId = 1, colId = 0min = -0.668037947112712
Complex Vector
Complex Vector Class Methods
CVector(mat)
CVector(vec)
CVector(rvec)
CVector(mblock)
CVector(vblock)
CVector(rvblock)
CVector(cmat)
CVector(cvec)
CVector(crvec)
CVector(cmblock)
CVector(cvblock)
CVector(crvblock)
var CV = CVector cvec = 3 cvec2 = cvec;console;console;
cvec = (0.97863,-0.172027)(0.743826,-0.517891)(-0.194503,0.984235) cvec2 = (0.97863,-0.172027)(0.743826,-0.517891)(-0.194503,0.984235)
CVector(rows)
var CV = CVector cvec = 3;console;
cvec =000
CVector(comp_array)
var Eigen = C = EigenComplex CV = EigenVector cvec = 1 3 ;console;
cvec =(1,0)(2,4)(3,0)
CVector.Constant(rows, scalar)
CVector.Constant(rows, comp)
var CV = CVector cvec = CV;console;
cvec =(0.6,0)(0.6,0)(0.6,0)(0.6,0)
Complex Vector Instance Methods
cvec.set(row, comp)
var Eigen = C = EigenComplex CV = EigenCVector cvec = 3;cvec;cvec;cvec;console;
cvec =(1,0)(2,4)(3,0)
cvec.set(comp_array)
var Eigen = C = EigenComplex CV = EigenCVector cvec = 3;cvec;console;
cvec =(1,0)(2,4)(3,0)
cvec.get(row)
var Eigen = C = EigenComplex CV = EigenCVector cvec = 1 3 ;console;console;console;
(1,0)(2,4)(3,0)
cvec.block(startRow, blockRows)
var Eigen = C = EigenComplex CV = EigenCVector cvec = 1 2 cvblock = cvec;console;
cvblock =(2,0)(3,0)
cvec.head(n)
var CV = CVector cvec = 1 2 cvblock = cvec;console;
cvblock =(1,0)(2,0)
cvec.tail(n)
var CV = CVector cvec = 1 2 cvblock = cvec;console;
cvblock =(3,0)(4,0)
cvec.dot(mat)
cvec.dot(vec)
cvec.dot(rvec)
cvec.dot(mblock)
cvec.dot(vblock)
cvec.dot(rvblock)
cvec.dot(cmat)
cvec.dot(cvec)
cvec.dot(crvec)
cvec.dot(cmblock)
cvec.dot(cvblock)
cvec.dot(crvblock)
Returns the dot product of *this with other.
This function returns the hermitian (sesquilinear) dot product, conjugate-linear in the first variable and linear in the second variable.
var Eigen = C = EigenComplex CV = EigenCVector cvec1 = cvec2 = 4 5 6;console;
(32,-32)
cvec.asDiagonal()
var CV = CVecotr cvec = 3 dia = cvec;console;console;
cvec = (-0.350871,0.918551)(0.0934938,-0.649058)(-0.725789,-0.339967) dia = (-0.350871,0.918551) (0,0) (0,0) (0,0) (0.0934938,-0.649058) (0,0) (0,0) (0,0) (-0.725789,-0.339967)
cvec.normalize()
var Eigen = C = EigenComplex CV = EigenCVector cvec = 1 4 ;cvec;console;
cvec = (0.182574,0)(0.365148,0.547723) (0.730297,0)
Row Vector
Row Vector Class Methods
RowVector(mat)
RowVector(vec)
RowVector(rvec)
RowVector(mblock)
RowVector(vblock)
RowVector(rvblock)
var RV = RowVector rvec = 3 rvec2 = rvec;console;console;
rvec =-0.0369638 0.749797 -0.15956 rvec2 =-0.0369638 0.749797 -0.15956
RowVector(cols)
var RV = RowVector rvec = 3;console;
rvec =0 0 0
RowVector(scalar_array)
var RV = RowVector rvec = 1 2 3;console;
rvec =1 2 3
RowVector.Constant(cols, scalar)
RowVector.Constant(cols, comp)
var RV = RVector rvec = RV;console;
rvec =0.6 0.6 0.6 0.6
RowVector.LinSpaced(size, low, high)
Sets a linearly space vector.
var RV = RowVector rvec = RV;console;
rvec = 1 0.75 0.5 0.25 0
Row Vector Instance Methods
rvec.set(col, scalar)
var RV = RowVector rvec = 3;rvec;rvec;rvec;console;
rvec =1 2 3
rvec.set(scalar_array)
var RV = RowVector rvec = 3;rvec;console;
rvec =1 2 3
rvec.get(col)
var RV = RowVector rvec = 1 2 3;console;console;console;
123
rvec.setLinSpaced(low, high)
Sets a linearly space vector.
var RV = RowVector rvec = 5;console;rvec;console;
rvec =0 0 0 0 0 rvec = 1 0.75 0.5 0.25 0
rvec.setLinSpaced(size, low, high)
Sets a linearly space vector.
var RV = RowVector rvec = 3;console;rvec;console;
rvec = 0.829713 0.985904 0.0914511 rvec = 1 0.75 0.5 0.25 0
rvec.block(startCol, blockCols)
var RV = RowVector rvec = 1 2 3 4 rvblock = rvec;console;
rvblock =2 3
rvec.head(n)
var RV = RowVector rvec = 1 2 3 4 rvblock = rvec;console;
rvblock =1 2
rvec.tail(n)
var RV = RowVector rvec = 1 2 3 4 rvblock = rvec;console;
rvblock =3 4
rvec.dot(mat)
rvec.dot(vec)
rvec.dot(rvec)
rvec.dot(mblock)
rvec.dot(vblock)
rvec.dot(rvblock)
rvec.dot(cmat)
rvec.dot(cvec)
rvec.dot(crvec)
rvec.dot(cmblock)
rvec.dot(cvblock)
rvec.dot(crvblock)
Returns the dot product of *this with other.
var RV = RowVector rvec1 = 1 2 3 rvec2 = 4 5 6;console;
32
rvec.asDiagonal()
var RV = RowVector rvec = 3 dia = rvec;console;console;
rvec =0.00429723 0.223465 -0.221164 dia =0.00429723 0 0 0 0.223465 0 0 0 -0.221164
rvec.normalize()
var RV = RVector rvec = 1 2 3;rvec;console;
rvec =0.267261 0.534522 0.801784
rvec.maxCoeff()
var RV = RowVector rvec = 3;console;console;
rvec =-0.487994 0.283088 -0.14679 max = 0.28308759503210323
rvec.maxCoeff(obj)
- obj
Object
var RV = RowVector rvec = 3 obj = {};console;console;console;
rvec =0.402709 0.332409 0.800923 max = 0.8009226330560273obj = {"maxCoeff":0.8009226330560273,"rowId":0,"colId":2}
rvec.maxCoeff(func)
- func
Function
var RV = RowVector rvec = 3 { console; };console;console;
rvec = 0.713395 0.0274691 -0.326461 rowId = 0, colId = 0max = 0.7133948633975324
rvec.minCoeff()
var RV = RowVector rvec = 3;console;console;
rvec = 0.349846 -0.129927 0.316636 min = -0.1299270163895222
rvec.minCoeff(obj)
- obj
Object
var RV = RowVector rvec = 3 obj = {};console;console;console;
rvec = 0.451323 -0.614237 0.512448 min = -0.6142373744464653obj = {"minCoeff":-0.6142373744464653,"rowId":0,"colId":1}
rvec.minCoeff(func)
- func
Function
var RV = RowVector rvec = 3 { console; };console;console;
rvec =-0.816445 0.0135587 -0.118738 rowId = 0, colId = 0min = -0.8164447219187602
Complex Row Vector
Complex Row Vector Class Methods
CRowVector(mat)
CRowVector(vec)
CRowVector(rvec)
CRowVector(mblock)
CRowVector(vblock)
CRowVector(rvblock)
CRowVector(cmat)
CRowVector(cvec)
CRowVector(crvec)
CRowVector(cmblock)
CRowVector(cvblock)
CRowVector(crvblock)
var CRV = CRowVector crvec = 3 crvec2 = crvec;console;console;
crvec =(-0.456363,-0.0965678) (0.985458,0.584867) (-0.136223,0.491867) crvec2 =(-0.456363,-0.0965678) (0.985458,0.584867) (-0.136223,0.491867)
CRowVector(cols)
var CRV = CRowVector crvec = 3;console;
cvec =(0,0) (0,0) (0,0)
CRowVector(comp_array)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 3;console;
crvec =(1,0) (2,4) (3,0)
CRowVector.Constant(cols, scalar)
CRowVector.Constant(cols, comp)
var CRV = CRVector crvec = CRV;console;
crvec =(0.6,0) (0.6,0) (0.6,0) (0.6,0)
Complex Row Vector Instance Methods
crvec.set(col, comp)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 3;crvec;crvec;crvec;console;
cvec =(1,0) (2,4) (3,0)
crvec.set(comp_array)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 3;crvec;console;
crvec =(1,0) (2,4) (3,0)
crvec.get(col)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 3;console;console;console;
(1,0)(2,4)(3,0)
crvec.block(startCol, blockCols)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 2 crvblock = crvec;console;
crvblock =(2,0) (3,0)
crvec.head(n)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 2 crvblock = crvec;console;
crvblock =(1,0) (2,0)
crvec.tail(n)
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 2 crvblock = crvec;console;
crvblock =(3,0) (4,0)
crvec.dot(mat)
crvec.dot(vec)
crvec.dot(rvec)
crvec.dot(mblock)
crvec.dot(vblock)
crvec.dot(rvblock)
crvec.dot(cmat)
crvec.dot(cvec)
crvec.dot(crvec)
crvec.dot(cmblock)
crvec.dot(cvblock)
crvec.dot(crvblock)
Returns the dot product of *this with other.
This function returns the hermitian (sesquilinear) dot product, conjugate-linear in the first variable and linear in the second variable.
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec1 = crvec2 = 4 5 6;console;
(32,-32)
crvec.asDiagonal()
var Eigen = CRV = EigenCRowVector crvec = 3 dia = crvec;console;console;
crvec = (-0.52811,0.0530528) (-0.340944,-0.248457) (0.185028,-0.228998) dia = (-0.52811,0.0530528) (0,0) (0,0) (0,0) (-0.340944,-0.248457) (0,0) (0,0) (0,0) (0.185028,-0.228998)
crvec.normalize()
var Eigen = C = EigenComplex CRV = EigenCRowVector crvec = 1 4;crvec;console;
crvec = (0.182574,0) (0.365148,0.547723) (0.730297,0)
Matrix Block
Matrix Block Class Methods
MatrixBlock(mat, startRow, startCol, blockRows, blockCols)
MatrixBlock(mblock, startRow, startCol, blockRows, blockCols)
var Eigen = M = EigenMatrix MB = EigenMatrixBlock mat = 4 4 mblock = mat 1 1 2 2;console;console;
mat = 0.63505 0.904788 -0.727407 0.187778 -0.709806 0.764849 0.467046 -0.0105777 0.295743 0.813348 -0.350211 0.221291 0.557679 -0.0634692 -0.000702816 -0.76436mblock = 0.764849 0.467046 0.813348 -0.350211
Matrix Block Instance Methods
Complex Matrix Block
Complex Matrix Block Class Methods
CMatrixBlock(cmat, startRow, startCol, blockRows, blockCols)
CMatrixBlock(cmblock, startRow, startCol, blockRows, blockCols)
var Eigen = CM = EigenCMatrix CMB = EigenCMatrixBlock cmat = 3 3 cmblock = cmat 1 1 2 1;console;console;
cmat = (0.24353,-0.983476) (0.689103,-0.238167) (0.931696,-0.989139) (0.72236,0.70887) (-0.870838,-0.17097) (-0.463351,0.45267)(-0.0298291,0.662265) (0.513237,-0.0206502) (0.0326769,-0.799212)cmblock = (-0.870838,-0.17097)(0.513237,-0.0206502)
Complex Matrix Block Instance Methods
Vector Block
Vector Block Class Methods
VectorBlock(vec, startRow, blockRows)
VectorBlock(vblock, startRow, blockRows)
var Eigen = V = EigenVector VB = EigenVectorBlock vec = 4 vblock = vec 1 2;console;console;
vec = 0.588843 0.686789 0.856138-0.895627vblock =0.6867890.856138
Vector Block Instance Methods
Complex Vector Block
Complex Vector Block Class Methods
CVectorBlock(cvec, startRow, blockRows)
CVectorBlock(cvblock, startRow, blockRows)
var Eigen = CV = EigenCVector CVB = EigenCVectorBlock cvec = 4 cvblock = cvec 1 2;console;console;
cvec = (0.152345,0.457992) (-0.536544,0.301383) (-0.65206,0.819627)(-0.523377,-0.399041)cvblock =(-0.536544,0.301383) (-0.65206,0.819627)
Complex Vector Block Instance Methods
Row Vector Block
Row Vector Block Class Methods
RowVectorBlock(rvec, startCol, blockCols)
RowVectorBlock(rvblock, startCol, blockCols)
var Eigen = RV = EigenRowVector RVB = EigenRowVectorBlock rvec = 4 rvblock = rvec 1 2;console;console;
rvec = 0.922803 -0.45235 -0.640183 0.439847rvblock = -0.45235 -0.640183
Row Vector Block Instance Methods
Complex Row Vector Block
Complex Row Vector Block Class Methods
CRowVectorBlock(crvec, startCol, blockCols)
CRowVectorBlock(crvblock, startCol, blockCols)
var Eigen = CRV = EigenCRowVector CRVB = EigenCRowVectorBlock crvec = 4 crvblock = crvec 1 2;console;console;
crvec =(0.707337,0.220289) (0.397833,0.371915) (0.782186,0.199594) (0.575888,0.951467)crvblock =(0.397833,0.371915) (0.782186,0.199594)
Complex Row Vector Block Instance Methods
Partial Pivoting LU
This class represents a LU decomposition of a square invertible matrix, with partial pivoting: the matrix A is decomposed as PA = LU where L is unit-lower-triangular, U is upper-triangular, and P is a permutation matrix.
Partial Pivoting LU Class Methods
PartialPivLU(mat)
PartialPivLU(mblock)
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat P = pplu L = pplu U = pplu;console;
1 4 54 2 65 6 3
Partial Pivoting LU Instance Methods
pplu.permutationP()
Returns the permutation matrix P.
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat;console;
P =0 0 10 1 01 0 0
pplu.matrixL()
Returns the unit-lower-triangular matrix L.
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat;console;
L = 1 0 00.8 1 00.2 -1 1
pplu.matrixU()
Returns the upper-triangular matrix U.
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat;console;
U = 5 6 3 0 -2.8 3.6 0 0 8
pplu.determinant()
Returns the determinant of the matrix of which *this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the LU decomposition has already been computed.
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat;console;console;
112112
pplu.inverse()
Returns the inverse of the matrix of which *this is the LU decomposition.
The matrix being decomposed here is assumed to be invertible. If you need to check for invertibility, use class FullPivLU instead.
var Eigen = M = EigenMatrix PPLU = EigenPartialPivLU mat = 3 3 pplu = mat;console;
true
pplu.solve(mat)
pplu.solve(vec)
This method returns the solution x to the equation Ax=b, where A is the matrix of which *this is the LU decomposition.
var Eigen = M = EigenMatrix V = EigenVector PPLU = EigenPartialPivLU mat = 3 3 b = 24 26 26 pplu = mat;console;
x =123
Complex Partial Pivoting LU
This class represents a LU decomposition of a square invertible matrix, with partial pivoting: the matrix A is decomposed as PA = LU where L is unit-lower-triangular, U is upper-triangular, and P is a permutation matrix.
Complex Partial Pivoting LU Class Methods
CPartialPivLU(cmat)
CPartialPivLU(cmblock)
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat P = cpplu L = cpplu U = cpplu;console;
(1,0) (4,0) (5,0)(4,0) (2,0) (6,0)(5,0) (6,0) (3,0)
Complex Partial Pivoting LU Instance Methods
cpplu.permutationP()
Returns the permutation matrix P.
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat;console;
P =(0,0) (0,0) (1,0)(0,0) (1,0) (0,0)(1,0) (0,0) (0,0)
cpplu.matrixL()
Returns the unit-lower-triangular matrix L.
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat;console;
L = (1,0) (0,0) (0,0)(0.8,0) (1,0) (0,0)(0.2,0) (-1,-0) (1,0)
cpplu.matrixU()
Returns the upper-triangular matrix U.
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat;console;
U = (5,0) (6,0) (3,0) (0,0) (-2.8,0) (3.6,0) (0,0) (0,0) (8,0)
cpplu.determinant()
Returns the determinant of the complex matrix of which *this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the complex square matrix) as the LU decomposition has already been computed.
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat;console;console;
(112,-0)(112,-0)
cpplu.inverse()
Returns the inverse of the complex matrix of which *this is the LU decomposition.
The complex matrix being decomposed here is assumed to be invertible. If you need to check for invertibility, use class CFullPivLU instead.
var Eigen = CM = EigenCMatrix CPPLU = EigenCPartialPivLU cmat = 3 3 cpplu = cmat;console;
true
cpplu.solve(cmat)
cpplu.solve(cvec)
This method returns the solution x to the equation Ax=b, where A is the matrix of which *this is the LU decomposition.
var Eigen = CM = EigenCMatrix CV = EigenCVector CPPLU = EigenCPartialPivLU cmat = 3 3 b = 24 26 26 cpplu = cmat;console;
x =(1,0)(2,0)(3,0)
Full Pivoting LU
This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is decomposed as PAQ = LU where L is unit-lower-triangular, U is upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any zeros are at the end.
This decomposition provides the generic approach to solving systems of linear equations, computing the rank, invertibility, inverse, kernel, and determinant.
This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix, working with the SVD allows to select the smallest singular values of the matrix, something that the LU decomposition doesn't see.
Full Pivoting LU Class Methods
FullPivLU(mat)
FullPivLU(mblock)
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 5 fplu = mat P = fplu L = fplu U = fplu Q = fplu;console;
1 3 0 2 -1 0 0 1 4 -3 1 2 1 6 -4
Full Pivoting LU Instance Methods
fplu.permutationP()
Returns the permutation matrix P.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 5 fplu = mat;console;
P =0 0 11 0 00 1 0
fplu.permutationQ()
Returns the permutation matrix Q.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 5 fplu = mat;console;
Q =0 0 1 0 00 1 0 0 00 0 0 1 01 0 0 0 00 0 0 0 1
fplu.matrixL()
Returns the unit-lower-triangular matrix L.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 5 fplu = mat;console;
L = 1 0 0 0.333333 1 0 0.666667 -0.571429 1
fplu.matrixU()
Returns the upper-triangular matrix U.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 5 fplu = mat;console;
U = 6 2 1 1 -4 0 2.33333 0.666667 -0.333333 0.333333 0 0 -0.285714 0.142857 -0.142857
fplu.determinant()
Returns the determinant of the matrix of which *this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the LU decomposition has already been computed.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = M fplu = mat det = fplu;console;console;
mat = 0.460707 -0.430882 -0.561277 -0.902957 0.15904 0.614972-0.00347658 0.980629 -0.170248 det = 0.27353337419849527
fplu.inverse()
Returns the inverse of the matrix of which *this is the LU decomposition.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = M fplu = mat inv = fplu;console;
true
fplu.isInvertible()
Returns true if the matrix of which *this is the LU decomposition is invertible.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 3 fplu = mat;console;
true
fplu.solve(mat)
fplu.solve(vec)
Returns a solution x to the equation Ax=b, where A is the matrix of which *this is the LU decomposition.
var Eigen = M = EigenMatrix V = EigenVector FPLU = EigenFullPivLU mat = 3 3 b = 1 2 3 fplu = mat;console;
x =-1 2-1
fplu.rank()
Returns the rank of the matrix of which *this is the LU decomposition.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = 3 4 fplu = mat;console;
2
fplu.dimensionOfKernel()
Returns the dimension of the kernel of the matrix of which *this is the LU decomposition.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = fplu = mat dim = fplu;console;
dim = 2
fplu.kernel()
Returns the kernel of the matrix, also called its null-space. The columns of the returned matrix will form a basis of the kernel.
var Eigen = M = EigenMatrix FPLU = EigenFullPivLU mat = fplu = mat ker = fplu;console;
ker = 1 0 1 0 0 1-1 -0
Complex Full Pivoting LU
This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is decomposed as PAQ = LU where L is unit-lower-triangular, U is upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any zeros are at the end.
This decomposition provides the generic approach to solving systems of linear equations, computing the rank, invertibility, inverse, kernel, and determinant.
This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix, working with the SVD allows to select the smallest singular values of the matrix, something that the LU decomposition doesn't see.
Complex Full Pivoting LU Class Methods
CFullPivLU(cmat)
CFullPivLU(cmblock)
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 5 cfplu = cmat P = cfplu L = cfplu U = cfplu Q = cfplu;console;
(1,0) (3,0) (0,0) (2,0) (-1,0) (0,0) (2.22045e-16,0) (1,0) (4,0) (-3,0) (1,0) (2,0) (1,0) (6,0) (-4,0)
Complex Full Pivoting LU Instance Methods
cfplu.permutationP()
Returns the permutation matrix P.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 5 cfplu = cmat;console;
P =(0,0) (0,0) (1,0)(1,0) (0,0) (0,0)(0,0) (1,0) (0,0)
cfplu.permutationQ()
Returns the permutation matrix Q.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 5 cfplu = cmat;console;
Q =(0,0) (0,0) (1,0) (0,0) (0,0)(0,0) (1,0) (0,0) (0,0) (0,0)(0,0) (0,0) (0,0) (1,0) (0,0)(1,0) (0,0) (0,0) (0,0) (0,0)(0,0) (0,0) (0,0) (0,0) (1,0)
cfplu.matrixL()
Returns the unit-lower-triangular matrix L.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 5 cfplu = cmat;console;
L = (1,0) (0,0) (0,0) (0.333333,0) (1,0) (0,0) (0.666667,0) (-0.571429,0) (1,0)
cfplu.matrixU()
Returns the upper-triangular matrix U.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 5 cfplu = cmat;console;
U = (6,0) (2,0) (1,0) (1,0) (-4,0) (0,0) (2.33333,0) (0.666667,0) (-0.333333,0) (0.333333,0) (0,0) (0,0) (-0.285714,0) (0.142857,0) (-0.142857,0)
cfplu.determinant()
Returns the determinant of the complex matrix of which *this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the complex square matrix) as the LU decomposition has already been computed.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = CM cfplu = cmat det = cfplu;console;console;
cmat = (-0.93669,-0.95681) (-0.640516,0.839641) (-0.418346,0.860162) (0.886216,0.637253) (-0.146449,0.632311) (0.73613,0.142591) (0.306307,0.100039) (-0.741677,0.642565) (0.534108,0.757001) det = (0.871298,0.0216014)
cfplu.inverse()
Returns the inverse of complex matrix of which *this is the LU decomposition.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = CM cfplu = cmat inv = cfplu;console;
true
cfplu.isInvertible()
Returns true if the complex matrix of which *this is the LU decomposition is invertible.
var Eigen = CM = EigenMatrix CFPLU = EigenCFullPivLU cmat = 3 3 cfplu = cmat;console;
true
cfplu.solve(cmat)
cfplu.solve(cvec)
Returns a solution x to the equation Ax=b, where A is the complex matrix of which *this is the LU decomposition.
var Eigen = CM = EigenCMatrix CV = EigenCVector CFPLU = EigenCFullPivLU cmat = 3 3 b = 4 5 6 cfplu = cmat;console;
x =(-7,-0) (8,0) (-4,0)
cfplu.rank()
Returns the rank of the complex matrix of which *this is the LU decomposition.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = 3 4 cfplu = cmat;console;
2
cfplu.dimensionOfKernel()
Returns the dimension of the kernel of the complex matrix of which *this is the LU decomposition.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = cfplu = cmat dim = cfplu;console;
dim = 2
cfplu.kernel()
Returns the kernel of the complex matrix, also called its null-space. The columns of the returned matrix will form a basis of the kernel.
var Eigen = CM = EigenCMatrix CFPLU = EigenCFullPivLU cmat = cfplu = cmat ker = cfplu;console;
ker = (1,0) (0,0) (1,0) (-0,0) (0,0) (1,0)(-1,-0) (-0,-0)