FC_MatrixDeterminant

 

FC_MatrixDeterminant - General Information

Overview

Type:

Function

Available as of:

V1.0.3.0

Versions:

Current version

Task

Calculates the determinant of a quadratic matrix.

Description

Returns the determinant of a quadratic matrix of the dimension i_diDim x i_diDim. The pointer i_plrMatrix must point to the start of the memory area in which the matrix is stored.

By means of the determinant of a matrix, it is for example, possible to make the following statement on the underlying equation system:

oIf the determinant of the coefficient matrix is not equal to zero, the equation system is clearly solvable.

Interface

Input

Data type

Description

i_diDim

DINT

Line-/ column value of the quadratic matrix. Must be >= 2 .

i_lrZeroLimit

LREAL

Numeric zero limit. Matrix elements that are much smaller than this value are considered as zero. Used to limit the rounding error reproduction. The best value depends on the numeric properties of the matrix. Must be > 0.0. A common value is, e.g. 1E-12.

i_plrMatrix

POINTER TO LREAL

Pointer on the beginning of the memory area in which the matrix is stored, whose determinant has to be calculated.

Output

Data type

Description

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic.

A value not equal to ET_Diag.Ok corresponds to an diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = ET_Diag.Ok -> Status message

q_etDiag <> ET_Diag.Ok -> Diagnostic message

q_lrDeterminant

LREAL

Determinant of the quadratic matrix i_plrMatrix.

Notes

oThis function block requires i_diDim * i_diDim * SIZEOF(LREAL) bytes of dynamic memory. Therefore, it must be ensured that the parameter LMCx00C\C\Configuration\Program\DynIECDataSize (total available dynamic memory) is set to an adequate value.

oThe correct size of the storage space that the pointer i_plrMatrix is pointing to (at least i_diDim * i_diDim LREALs) must be carefully checked otherwise the function block causes memory access errors.

oThe function FC_SetMatrixElement() is available for allocating elements of the matrix.

oIf the matrix is give by an array, this can also be allocated directly (without using the previously specified help function). The first index of the array is then the line index of the matrix and the second the gap index.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

ControllerConditionInvalid

DynIecDataSizeTooSmall

75

There is not enough dynamic memory reserved.

InputParameterInvalid

DimRange

72

Dim is outside the valid range.

InputParameterInvalid

PointerMatrixInvalid

69

The pointer Matrix is invalid.

InputParameterInvalid

ZeroLimitRange

74

ZeroLimit is outside the valid range.

UnexpectedProgramBehavior

UnexpectedFeedback

1

An unintended detected error occurred during execution.

DimRange

Enumeration name:

DimRange

Enumeration value:

72

Description:

Dim is outside the valid range.

Issue

Cause

Solution

-

At the input i_diDim, an invalid value has been transferred.

The following must hold: i_diDim > 1

DynIecDataSizeTooSmall

Enumeration name:

DynIecDataSizeTooSmall

Enumeration value:

75

Description:

There is not enough dynamic memory reserved.

Issue

Cause

Solution

-

There is no or not enough dynamic memory available.

Increase the available dynamic memory Controller > Configuration > IEC-Program > DynIECDataSize.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The determinant has been calculated successfully

PointerMatrixInvalid

Enumeration name:

PointerMatrixInvalid

Enumeration value:

69

Description:

The pointer Matrix is invalid.

Issue

Cause

Solution

-

At the input i_plrXMatrix, a null pointer has been transferred.

At the input i_plrXMatrix, the address of the memory containing the matrix must be transferred.

UnexpectedFeedback

Enumeration name:

UnexpectedFeedback

Enumeration value:

1

Description:

An unintended detected error occurred during execution.

Issue

Cause

Solution

-

An error occurred in the internal execution.

Please inform the support team about this error.

ZeroLimitRange

Enumeration name:

ZeroLimitRange

Enumeration value:

74

Description:

ZeroLimit is outside the valid range.

Issue

Cause

Solution

-

At the input i_lrZeroLimit, a number <= 0 has been applied.

i_lrZeroLimit must be greater than 0.