是否有逆 np.dot 函数? [英] Is there any inverse np.dot function?

查看:64
本文介绍了是否有逆 np.dot 函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有两个矩阵 a 和 b,是否有任何函数可以找到矩阵 x,当点乘以 a 时得到 b?寻找python解决方案,用于numpy数组形式的矩阵.

If I have two matrices a and b, is there any function I can find the matrix x, that when dot multiplied by a makes b? Looking for python solutions, for matrices in the form of numpy arrays.

推荐答案

这个求X如A*X=B的问题等价于搜索A的逆",即一个矩阵如X = Ainverse * B.

This problem of finding X such as A*X=B is equivalent to search the "inverse of A", i.e. a matrix such as X = Ainverse * B.

有关信息,在数学 Ainverse 中注明 A^(-1)(A 的幂 -1",但您可以说A 逆"; 代替).

For information, in math Ainverse is noted A^(-1) ("A to the power -1", but you can say "A inverse" instead).

在 numpy 中,这是一个内置函数,用于求矩阵的逆a:

In numpy, this is a builtin function to find the inverse of a matrix a:

import numpy as np

ainv = np.linalg.inv(a)

例如参见本教程了解说明.

您需要注意一些矩阵不是可逆的",最明显的例子(大致)是:

You need to be aware that some matrices are not "invertible", most obvious examples (roughly) are:

  • 非方阵
  • 表示投影的矩阵

numpy 在某些情况下仍然可以近似某个值.

numpy can still approximate some value in certain cases.

这篇关于是否有逆 np.dot 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆