Determinant Of 3x3 Matrix — Control Systems/Matrix Operations
Control_Systems/Matrix_Operations/Determinant_Of_3x3_Matrix · 1 input / 1 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Determinant of 3x3 Matrix
Control Systems / Matrix Operations
The determinant of a 3×3 matrix, in closed form:
- d = a₁₁a₂₂a₃₃ − a₁₁a₂₃a₃₂ − a₁₂a₂₁a₃₃ + a₁₂a₂₃a₃₁ + a₁₃a₂₁a₃₂ − a₁₃a₂₂a₃₁
Six products of three entries and five additions. There is no elimination, no pivoting and no division, so the block never fails and never branches: the same arithmetic runs on every sample whatever the matrix contains. A singular matrix is not an error here – it is the answer 0.
The determinant is what the companion Invert 3x3 Matrix divides by, and its sign tells you whether the matrix preserves or reverses orientation.
Ports
- A – the matrix, a [3,3] signal. The size is fixed: this is the 3×3 closed form and nothing else.
- d – the determinant, a [1,1] scalar, whatever the matrix contains.
Parameters
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. Nothing is exposed as a tunable parameter, because the block has no parameter at all – the matrix arrives on a port.
The six products are emitted in the order written above and accumulated left to right in every target. Floating-point addition is not associative, so that order is part of the answer rather than a matter of taste, and keeping it identical is what makes the ten cores agree with this block's own arithmetic to the last bit.
The three HDL targets are genuinely synthesizable Q16.16, not simulation-only: multiplies and adds, with no division, root or trigonometry. Verilog and SystemVerilog form each triple product in a double-width register and shift back once per factor pair; VHDL accumulates through the two shared Q16.16 process variables, so it rounds sooner and the three agree to within the low bits rather than bit-exactly.
⚠ Size the matrix before exporting to hardware. A determinant is cubic in its entries, so a matrix whose entries reach 30 already produces values near the top of the Q16.16 range (±32768) and anything beyond that saturates. The software targets have no such limit.
Simulink bridge
Both directions, onto
aerolibutil/Determinant of 3x3 Matrix in the Aerospace
Blockset. The block has no configuration, so no parameter pairs cross.
Its name is drawn on two lines, so the real library path carries an
embedded newline between of and 3x3; the
flattened one-line spelling resolves to nothing at all. And the block defines
no SampleTime parameter, so the rate stays on the ICore side
and a block configured with an explicit positive rate reports that the rate did
not cross.
Notes
- Algebraic and stateless: the output depends only on the current input, so the block cannot break an algebraic loop.
- Deliberately no state space. The map is cubic in the input, so there is no linear form to fabricate, and model reduction refuses a block whose feed-through is nonlinear.
- Insensitive to transposition, and it is the only block of its three siblings that is: det(A) = det(Aᵀ), so a core that read the matrix in column-major order still answers correctly here. Adjoint and Invert do not have that luxury.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Matrix_Operations/Determinant_Of_3x3_Matrix |
| family | Control_Systems/Matrix_Operations |
| solver environment class | ICoreBlock_0_Control_Systems_1_Matrix_Operations_2_Determinant_Of_3x3_Matrix |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Matrix_Operations/Determinant_Of_3x3_Matrix/ICoreBlock_0_Control_Systems_1_Matrix_Operations_2_Determinant_Of_3x3_Matrix.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Matrix_Operations/Determinant_Of_3x3_Matrix/ICoreBlock_0_Control_Systems_1_Matrix_Operations_2_Determinant_Of_3x3_Matrix.h |
| default size on canvas | 112 × 70 px |
| ports at insert | 1 in, 1 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | A |
| 2 | out | ICoreDouble | d |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
No config variable beyond the Sampling Time (s) every block carries.
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::Both |
| Simulink path | aerolibutil/Determinant of\n3x3 Matrix |
| port-count rule | PortsParam::None |
SampleTime parameter | no — the counterpart defines none; the rate stays on the ICore side |
Caveat (shown to the user): the Aerospace Blockset block is a masked subsystem with no dialog parameters, so nothing but the signal crosses. Its mask holds six Product blocks feeding one Sum, which is the six-term form this block emits. Note it defines no SampleTime parameter: an ICore rate set explicitly stays on this side and is reported
Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The checker has a blind spot here — it could not resolve something (a grouped port bullet, a computed config name), which is reported and never counted as a pass. A reader has to settle it:
B0every stimulus in the sample errored — cross-checks skipped
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Determinant of 3x3 Matrix -- d = det(A), the six-term closed form One [3,3] input, one [1,1] output. Algebraic and stateless: six triple products and five additions, with no loop, no pivoting and no division anywhere.
MEASURED against aerolibutil/Determinant of\n3x3 Matrix (R2026a, 2026-09-10). On A = [1 2 3; 4 -5 6; 7 8 -9] the Simulink block answers 354, which is det(A). Its mask was opened as well, and what is inside settles the ARRANGEMENT rather than merely the value: six Product blocks named a(1,1),a(2,2),a(3,3) ... a(1,3),a(2,2),a(3,1), all feeding one Sum. That is the six-term form, not a cofactor expansion, and this block spells it the same way for the same reason its siblings pin a summation order -- floating-point addition is not associative, so two groupings of the same nine numbers can differ in the last bit.
The order every one of the ten backends emits, left to right:
+a11*a22*a33 -a11*a23*a32 -a12*a21*a33 +a12*a23*a31 +a13*a21*a32 -a13*a22*a31
Invert 3x3 Matrix repeats this same expression instead of calling anything shared, so the two blocks agree bit for bit on the same input.
The three hardware targets are GENUINELY SYNTHESIZABLE Q16.16: multiplies and adds only. What they need care with is not the arithmetic but the RANGE -- a determinant is cubic, so a matrix of entries near 30 already reaches the top of the Q16.16 range. That is stated in the description rather than left for a user to discover from a saturated output.
Sample results#
No stimulus produced a sampled output in this rig — Invalid input size at Determinant of 3x3 Matrix block: ICore Blocks/Home/Determinant Of 3x3 Matrix. That is a fact about the single-block rig, not a verdict on the block: an offline batch fit, a block whose output only appears at onSolverFinish, or one that needs a driven environment cannot be exercised alone.
Category unsampled · sample time 0.1 · 60 steps · commit 7d7903fbad81ee6be6501ad2be0e1260e9995f8f · produced by docsSample --out <folder> --blocks Determinant_Of_3x3_Matrix Adjoint_Of_3x3_Matrix Invert_3x3_Matrix Create_3x3_Matrix --steps 60
Sample data: docs/generated/samples/Control_Systems__Matrix_Operations__Determinant_Of_3x3_Matrix.json