Python:矩阵乘法

2024-04-26 00:14:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我用scipy.sparse.diags函数找到了两个矩阵(质量和刚度),并将其中一个从另一个(质量-刚度)中拿走。当尝试用一个向量U0乘以这个新矩阵时,我得到了以下结果

[ <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>
 <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>
 <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>
 <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>
 <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>
 <6x6 sparse matrix of type '<type 'numpy.float64'>'
with 16 stored elements in Compressed Sparse Row format>]

我真的不明白这个结果-我得到的是一个由6个矩阵组成的一维数组吗?如果是这样,为什么我得到这个而不是一个简单的向量?在

下面是创建质量/刚度矩阵的代码,找到U0,然后得到点积

^{pr2}$

我会很感激你的帮助,因为我已经被困在这几个小时了。在

编辑:一些附加信息

顶部的6x6矩阵在我打电话后收到 时间步进([0,0.2,0.5,0.6,0.9,1],1,1,5)

也就是说,x0只是域0到1的一个分区。θ,T和m都是无关的,因为我还没有把它添加到函数中。在


Tags: ofinnumpyformattypewith矩阵elements