C# 클래스 GeometryClassLibrary.Matrix

파일 보기 프로젝트 열기: ParagonTruss/GeometryClassLibrary 1 사용 예제들

공개 메소드들

메소드 설명
AbsoluteValue ( ) : Matrix

Returns a matrix that is this matrix with the absolute value function applied to each element

AddTo ( Matrix passedMatrix ) : Matrix

Returns the sum of this matrix and the passed matrix

AddToAt ( int row, int col, Matrix matrix ) : void

Adds the passed matrix to the larger matrix starting at the specified row,col entry.

As1DArray ( EnumerationOrder order = EnumerationOrder.ByRow ) : double[]
CanBeAddedTo ( Matrix passedMatrix ) : bool

Checks to see if this matrix and the passed matrix can be added together. In order to be able to add two matrices, they must have the same Distances.

CanBeMultipliedBy ( Matrix passedMatrix ) : bool

Checks to see if this matrix can be multiplied by the passed matrix IN THAT ORDER. In order to multiply two matrices, the number of columns in the first matrix must equal the number of rows in the second matrix.

Columns ( ) : List
ConvertRotationMatrixToQuaternion ( ) : Matrix

Converts the given rotation Matrix into a Quaternion, which also represents orientation but in a more mathematically unique way since only two quaternions represent the same orientation, and they have the following relation to each other: q = -q

Decompose ( int &permutationArray, int &toggle ) : Matrix

Performs Doolittle decomposition with partial pivoting and returns a combined LU matrix

Determinant ( ) : double

Computes the determinant of a matrix

Equals ( object obj ) : bool

Does the same thing as == if the passed-in object is an identical matrix

EulerAngles ( ) : List

Returns the euler angles (for rotations in x, y,z order) assuming the upper left 3x3 submatrix is a rotation matrix.

ExtractLower ( ) : Matrix

Returns Matrix with only the values in the lower triangle (below main diagonal) intact. Puts 1.0's on diagonal and 0.0's in upper triangle

ExtractUpper ( ) : Matrix

Returns Matrix with only the values in the main diagonal and upper triangle (above main diagonal) intact. Has 0.0's in lower triangle

GenerateCofactorMatrix ( ) : Matrix

Creates the cofactor matrix corresponding to this matrix

GetCofactor ( int rowIndex, int columnIndex ) : double

Returns the cofactor for the specified element of a square matrix

GetColumn ( int passedColumnIndex ) : double[]

Returns the specified column of the matrix

GetElement ( int rowIndex, int columnIndex ) : double

Returns the element at row "rowIndex" and column "columnIndex"

GetHashCode ( ) : int
GetPseudoInverse ( double a ) : ].double[
GetRow ( int passedrowIndex ) : double[]

Returns the specified row of the matrix

GetSubMatrix ( int indexOfRowToLeaveOut, int indexOfColumnToLeaveOut ) : Matrix

Returns a matrix with the specified row and column removed

IdentityMatrix ( int passedNumberOfRowsAndColumns ) : Matrix

Returns an Identity Matrix of the specified size. That is, a square matrix with 1's on the diagonal and 0's everywhere else.

InsertMatrixAt ( Matrix passedMatrix, int destinationRow, int destinationColumn ) : Matrix

Inserts the passed Matrix into this Matrix starting at the specified index

Invert ( ) : Matrix

Returns the inverse of this matrix

IsAllZeros ( ) : bool

Returns true if every element in this matrix is zero, false otherwise

IsInvertible ( ) : bool

Returns true if this matrix has an inverse, false otherwise

IsSquare ( ) : bool

Checks to see if this matrix is square

LUDecomp ( double a, double &lower, double &upper ) : void
LUSolve ( double l, double u, double b ) : double[]
Matrix ( Matrix passedMatrix ) : System

Makes a copy of the passed matrix

Matrix ( double array ) : System

Creates a matrix with a single column from the array.

Matrix ( double array, int numRows, int numCols, EnumerationOrder order = EnumerationOrder.ByColumn ) : System

Construct a matrix from a 1 Dimensional array either building row by row, or column by column.

Matrix ( int numRowsAndColumns ) : System

Creates a square matrix with the passed number of rows and columns

Matrix ( int numRows, int numCols ) : System

Creates a matrix of the desired number of rows and columns, with all entries initialized to zero.

MultiplyBy ( Matrix passedMatrix ) : Matrix

Returns the product matrix of this matrix multiplied by the passed matrix, in that order.

NullSpace ( ) : List
PointAsProjectiveColumnVector ( Point point ) : Matrix
ProjectiveMatrixToRotationMatrix ( Matrix matrix ) : Matrix
PseudoInvSolve ( double p, double b ) : double[]
RemoveColumn ( int columnIndexToDelete ) : Matrix

Returns a matrix with the specified column removed

RemoveColumns ( int passedIndicesOfColumnsToRemove ) : Matrix

Returns a new matrix with all of the specified columns removed

RemoveRow ( int rowIndexToDelete ) : Matrix

Returns a matrix with the specified row removed

RemoveRows ( int passedIndicesOfRowsToRemove ) : Matrix

Returns a new matrix with all of the specified rows removed

RotationMatrixAboutOrigin ( Rotation passedRotation ) : Matrix

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the passed axis line by the specified angle

RotationMatrixAboutX ( System.Angle rotationAngle ) : Matrix

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the X axis by the specified angle

RotationMatrixAboutY ( System.Angle rotationAngle ) : Matrix

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the Y axis by the specified angle

RotationMatrixAboutZ ( System.Angle rotationAngle ) : Matrix

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the Z axis by the specified angle

Rows ( ) : List
SetColumn ( int passedColumnIndex, double passedColumn ) : void

Replaces the specified column of the matrix with the passed column

SetElement ( int rowIndex, int columnIndex, double element ) : void

SetRow ( int passedrowIndex, double passedRow ) : void

Replaces the specified row of the matrix with the passed row

ShiftPoint ( Point point, Matrix matrix ) : Point
SolveMatrix ( double augmentedMatrix ) : double[]

Turns an augmented matrix into Reduced Row Echelon form, by modifying the matrix in place. Then returns the last column.

SystemSolve ( Matrix columnMatrix ) : Matrix

Solves for the column matrix x, where Ax = b.

ToString ( ) : string
Transpose ( ) : Matrix

Returns the transpose of a given matrix. The transpose is found by swapping the rows and columns (i.e. reflecting all the elements across the main diagonal)

operator ( ) : Matrix

Returns the sum of 2 matrices of equal size

operator ( ) : bool

Not a perfect equality operator, is only accurate up to difference of 0.00000001 in any two elements

this ( int i ) : double

For setting and accessing column vectors

this ( int i, int j ) : double

비공개 메소드들

메소드 설명
Matrix ( ) : System

Private constructor for the benefit of data frameworks like Entity Framework and Json.NET

Matrix ( Matrix passedMatrix ) : System

Makes a copy of the passed matrix

_enumerateByColumn ( ) : double[]
_enumerateByRow ( ) : double[]
_pointFromProjectiveColumnVector ( Matrix projectiveVector ) : Point
_vectorOfDoublesToVectorOfInches ( Vector vector ) : Vector

메소드 상세

AbsoluteValue() 공개 메소드

Returns a matrix that is this matrix with the absolute value function applied to each element
public AbsoluteValue ( ) : Matrix
리턴 Matrix

AddTo() 공개 메소드

Returns the sum of this matrix and the passed matrix
public AddTo ( Matrix passedMatrix ) : Matrix
passedMatrix Matrix
리턴 Matrix

AddToAt() 공개 메소드

Adds the passed matrix to the larger matrix starting at the specified row,col entry.
public AddToAt ( int row, int col, Matrix matrix ) : void
row int
col int
matrix Matrix
리턴 void

As1DArray() 공개 메소드

public As1DArray ( EnumerationOrder order = EnumerationOrder.ByRow ) : double[]
order EnumerationOrder
리턴 double[]

CanBeAddedTo() 공개 메소드

Checks to see if this matrix and the passed matrix can be added together. In order to be able to add two matrices, they must have the same Distances.
public CanBeAddedTo ( Matrix passedMatrix ) : bool
passedMatrix Matrix
리턴 bool

CanBeMultipliedBy() 공개 메소드

Checks to see if this matrix can be multiplied by the passed matrix IN THAT ORDER. In order to multiply two matrices, the number of columns in the first matrix must equal the number of rows in the second matrix.
public CanBeMultipliedBy ( Matrix passedMatrix ) : bool
passedMatrix Matrix
리턴 bool

Columns() 공개 메소드

public Columns ( ) : List
리턴 List

ConvertRotationMatrixToQuaternion() 공개 메소드

Converts the given rotation Matrix into a Quaternion, which also represents orientation but in a more mathematically unique way since only two quaternions represent the same orientation, and they have the following relation to each other: q = -q
public ConvertRotationMatrixToQuaternion ( ) : Matrix
리턴 Matrix

Decompose() 공개 메소드

Performs Doolittle decomposition with partial pivoting and returns a combined LU matrix
public Decompose ( int &permutationArray, int &toggle ) : Matrix
permutationArray int Keeps track of how the matrices have been rearranged during the calculation
toggle int is +1 or -1 (even or odd)
리턴 Matrix

Determinant() 공개 메소드

Computes the determinant of a matrix
public Determinant ( ) : double
리턴 double

Equals() 공개 메소드

Does the same thing as == if the passed-in object is an identical matrix
public Equals ( object obj ) : bool
obj object
리턴 bool

EulerAngles() 공개 메소드

Returns the euler angles (for rotations in x, y,z order) assuming the upper left 3x3 submatrix is a rotation matrix.
public EulerAngles ( ) : List
리턴 List

ExtractLower() 공개 메소드

Returns Matrix with only the values in the lower triangle (below main diagonal) intact. Puts 1.0's on diagonal and 0.0's in upper triangle
public ExtractLower ( ) : Matrix
리턴 Matrix

ExtractUpper() 공개 메소드

Returns Matrix with only the values in the main diagonal and upper triangle (above main diagonal) intact. Has 0.0's in lower triangle
public ExtractUpper ( ) : Matrix
리턴 Matrix

GenerateCofactorMatrix() 공개 메소드

Creates the cofactor matrix corresponding to this matrix
public GenerateCofactorMatrix ( ) : Matrix
리턴 Matrix

GetCofactor() 공개 메소드

Returns the cofactor for the specified element of a square matrix
public GetCofactor ( int rowIndex, int columnIndex ) : double
rowIndex int
columnIndex int
리턴 double

GetColumn() 공개 메소드

Returns the specified column of the matrix
public GetColumn ( int passedColumnIndex ) : double[]
passedColumnIndex int
리턴 double[]

GetElement() 공개 메소드

Returns the element at row "rowIndex" and column "columnIndex"
public GetElement ( int rowIndex, int columnIndex ) : double
rowIndex int The row number of the desired element
columnIndex int The column number of the desired element
리턴 double

GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int

GetPseudoInverse() 공개 정적인 메소드

public static GetPseudoInverse ( double a ) : ].double[
a double
리턴 ].double[

GetRow() 공개 메소드

Returns the specified row of the matrix
public GetRow ( int passedrowIndex ) : double[]
passedrowIndex int
리턴 double[]

GetSubMatrix() 공개 메소드

Returns a matrix with the specified row and column removed
public GetSubMatrix ( int indexOfRowToLeaveOut, int indexOfColumnToLeaveOut ) : Matrix
indexOfRowToLeaveOut int
indexOfColumnToLeaveOut int
리턴 Matrix

IdentityMatrix() 공개 정적인 메소드

Returns an Identity Matrix of the specified size. That is, a square matrix with 1's on the diagonal and 0's everywhere else.
public static IdentityMatrix ( int passedNumberOfRowsAndColumns ) : Matrix
passedNumberOfRowsAndColumns int
리턴 Matrix

InsertMatrixAt() 공개 메소드

Inserts the passed Matrix into this Matrix starting at the specified index
public InsertMatrixAt ( Matrix passedMatrix, int destinationRow, int destinationColumn ) : Matrix
passedMatrix Matrix
destinationRow int
destinationColumn int
리턴 Matrix

Invert() 공개 메소드

Returns the inverse of this matrix
public Invert ( ) : Matrix
리턴 Matrix

IsAllZeros() 공개 메소드

Returns true if every element in this matrix is zero, false otherwise
public IsAllZeros ( ) : bool
리턴 bool

IsInvertible() 공개 메소드

Returns true if this matrix has an inverse, false otherwise
public IsInvertible ( ) : bool
리턴 bool

IsSquare() 공개 메소드

Checks to see if this matrix is square
public IsSquare ( ) : bool
리턴 bool

LUDecomp() 공개 정적인 메소드

public static LUDecomp ( double a, double &lower, double &upper ) : void
a double
lower double
upper double
리턴 void

LUSolve() 공개 정적인 메소드

public static LUSolve ( double l, double u, double b ) : double[]
l double
u double
b double
리턴 double[]

Matrix() 공개 메소드

Makes a copy of the passed matrix
public Matrix ( Matrix passedMatrix ) : System
passedMatrix Matrix
리턴 System

Matrix() 공개 메소드

Creates a matrix with a single column from the array.
public Matrix ( double array ) : System
array double
리턴 System

Matrix() 공개 메소드

Construct a matrix from a 1 Dimensional array either building row by row, or column by column.
public Matrix ( double array, int numRows, int numCols, EnumerationOrder order = EnumerationOrder.ByColumn ) : System
array double
numRows int
numCols int
order EnumerationOrder
리턴 System

Matrix() 공개 메소드

Creates a square matrix with the passed number of rows and columns
public Matrix ( int numRowsAndColumns ) : System
numRowsAndColumns int
리턴 System

Matrix() 공개 메소드

Creates a matrix of the desired number of rows and columns, with all entries initialized to zero.
public Matrix ( int numRows, int numCols ) : System
numRows int
numCols int
리턴 System

MultiplyBy() 공개 메소드

Returns the product matrix of this matrix multiplied by the passed matrix, in that order.
public MultiplyBy ( Matrix passedMatrix ) : Matrix
passedMatrix Matrix
리턴 Matrix

NullSpace() 공개 메소드

public NullSpace ( ) : List
리턴 List

PointAsProjectiveColumnVector() 공개 정적인 메소드

public static PointAsProjectiveColumnVector ( Point point ) : Matrix
point Point
리턴 Matrix

ProjectiveMatrixToRotationMatrix() 공개 정적인 메소드

public static ProjectiveMatrixToRotationMatrix ( Matrix matrix ) : Matrix
matrix Matrix
리턴 Matrix

PseudoInvSolve() 공개 정적인 메소드

public static PseudoInvSolve ( double p, double b ) : double[]
p double
b double
리턴 double[]

RemoveColumn() 공개 메소드

Returns a matrix with the specified column removed
public RemoveColumn ( int columnIndexToDelete ) : Matrix
columnIndexToDelete int
리턴 Matrix

RemoveColumns() 공개 메소드

Returns a new matrix with all of the specified columns removed
public RemoveColumns ( int passedIndicesOfColumnsToRemove ) : Matrix
passedIndicesOfColumnsToRemove int
리턴 Matrix

RemoveRow() 공개 메소드

Returns a matrix with the specified row removed
public RemoveRow ( int rowIndexToDelete ) : Matrix
rowIndexToDelete int
리턴 Matrix

RemoveRows() 공개 메소드

Returns a new matrix with all of the specified rows removed
public RemoveRows ( int passedIndicesOfRowsToRemove ) : Matrix
passedIndicesOfRowsToRemove int
리턴 Matrix

RotationMatrixAboutOrigin() 공개 정적인 메소드

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the passed axis line by the specified angle
public static RotationMatrixAboutOrigin ( Rotation passedRotation ) : Matrix
passedRotation Rotation
리턴 Matrix

RotationMatrixAboutX() 공개 정적인 메소드

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the X axis by the specified angle
public static RotationMatrixAboutX ( System.Angle rotationAngle ) : Matrix
rotationAngle System.Angle
리턴 Matrix

RotationMatrixAboutY() 공개 정적인 메소드

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the Y axis by the specified angle
public static RotationMatrixAboutY ( System.Angle rotationAngle ) : Matrix
rotationAngle System.Angle
리턴 Matrix

RotationMatrixAboutZ() 공개 정적인 메소드

Returns a matrix that can be multiplied by another matrix to represent a rotation of that matrix about the Z axis by the specified angle
public static RotationMatrixAboutZ ( System.Angle rotationAngle ) : Matrix
rotationAngle System.Angle
리턴 Matrix

Rows() 공개 메소드

public Rows ( ) : List
리턴 List

SetColumn() 공개 메소드

Replaces the specified column of the matrix with the passed column
public SetColumn ( int passedColumnIndex, double passedColumn ) : void
passedColumnIndex int
passedColumn double
리턴 void

SetElement() 공개 메소드

public SetElement ( int rowIndex, int columnIndex, double element ) : void
rowIndex int The number of the row where the element will be added
columnIndex int The number of the column where the element will be added
element double
리턴 void

SetRow() 공개 메소드

Replaces the specified row of the matrix with the passed row
public SetRow ( int passedrowIndex, double passedRow ) : void
passedrowIndex int
passedRow double
리턴 void

ShiftPoint() 공개 정적인 메소드

public static ShiftPoint ( Point point, Matrix matrix ) : Point
point Point
matrix Matrix
리턴 Point

SolveMatrix() 공개 정적인 메소드

Turns an augmented matrix into Reduced Row Echelon form, by modifying the matrix in place. Then returns the last column.
public static SolveMatrix ( double augmentedMatrix ) : double[]
augmentedMatrix double
리턴 double[]

SystemSolve() 공개 메소드

Solves for the column matrix x, where Ax = b.
public SystemSolve ( Matrix columnMatrix ) : Matrix
columnMatrix Matrix
리턴 Matrix

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

Transpose() 공개 메소드

Returns the transpose of a given matrix. The transpose is found by swapping the rows and columns (i.e. reflecting all the elements across the main diagonal)
public Transpose ( ) : Matrix
리턴 Matrix

operator() 공개 정적인 메소드

Returns the sum of 2 matrices of equal size
public static operator ( ) : Matrix
리턴 Matrix

operator() 공개 정적인 메소드

Not a perfect equality operator, is only accurate up to difference of 0.00000001 in any two elements
public static operator ( ) : bool
리턴 bool

this() 공개 메소드

For setting and accessing column vectors
public this ( int i ) : double
i int
리턴 double

this() 공개 메소드

public this ( int i, int j ) : double
i int
j int
리턴 double