简单的 3x3 矩阵逆代码 (C++)

2023-04-10C/C++开发问题
3

本文介绍了简单的 3x3 矩阵逆代码 (C++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

计算 3x3 矩阵逆的最简单方法是什么?

我只是在寻找一个简短的代码片段,它可以解决非奇异矩阵的问题,可能会使用 Cramer 规则.它不需要高度优化.我更喜欢简单而不是速度.我宁愿不链接其他库.

解决方案

为什么不尝试自己编写代码?把它当作一个挑战.:)

对于 3×3 矩阵


(来源:
(来源:wolfram.com)

我假设你知道矩阵的行列式 |A|是.

<块引用>

图像 (c) Wolfram|Alpha 和mathworld.wolfram (06-11-09,22.06)

What's the easiest way to compute a 3x3 matrix inverse?

I'm just looking for a short code snippet that'll do the trick for non-singular matrices, possibly using Cramer's rule. It doesn't need to be highly optimized. I'd prefer simplicity over speed. I'd rather not link in additional libraries.

解决方案

Why don't you try to code it yourself? Take it as a challenge. :)

For a 3×3 matrix


(source: wolfram.com)

the matrix inverse is


(source: wolfram.com)

I'm assuming you know what the determinant of a matrix |A| is.

Images (c) Wolfram|Alpha and mathworld.wolfram (06-11-09, 22.06)

这篇关于简单的 3x3 矩阵逆代码 (C++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&amp;()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6