由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 请问怎样让一m长的向量和一mxn的矩阵相乘,仍为mxn
相关主题
请问matlab矩阵和向量对应元素相乘该怎么做?Matlab中计算特征值如何保持原始特征值顺序不变?
请问怎么让m阶矩阵的每个元素减n阶矩阵的每个元素而不用for循环问个matlab的eigs的问题
BLAS 矩阵相乘问题请教如何根据矩阵元素值找到矩阵的行号?
windows 下如何编译使用cblas请问怎么把这个一维向量复制成三维数组
请教Matlab中矩阵求逆问题关于poisson方程的,特征向量
Matlab矩阵运算一个matrix问题
[合集] 简单问题简单问,matlab一个简单的矩阵函数问题 (转载)
[合集] Matlab 求助:如何把一个高维矩阵中的一维赋值给一个向量求矩阵逆的算法
相关话题的讨论汇总
话题: matlab话题: 矩阵话题: loop话题: 向量话题: blas
进入Computation版参与讨论
1 (共1页)
g******s
发帖数: 733
1
比如要一个 1*3的向量,乘一个3*100的矩阵.
向量的第i个元素乘矩阵的第i行,结果为3*100的矩阵. 请问不用for循环matlab能行吗?`
g***i
发帖数: 90
2
many ways. one:
diag(v)*A

【在 g******s 的大作中提到】
: 比如要一个 1*3的向量,乘一个3*100的矩阵.
: 向量的第i个元素乘矩阵的第i行,结果为3*100的矩阵. 请问不用for循环matlab能行吗?`

g******s
发帖数: 733
3
you are really an expert! Thank you so much!

吗?`

【在 g***i 的大作中提到】
: many ways. one:
: diag(v)*A

g******s
发帖数: 733
4
请问怎样从一个3*100 的矩阵的第 i 行减去一个长度为3的向量的第i个元素? 好象这个
不用循环是不行了.



【在 g******s 的大作中提到】
: you are really an expert! Thank you so much!
:
: 吗?`

l*****i
发帖数: 3929
5
A=A-diag(v)*ones(size(A))

【在 g******s 的大作中提到】
: 请问怎样从一个3*100 的矩阵的第 i 行减去一个长度为3的向量的第i个元素? 好象这个
: 不用循环是不行了.
:
: 行

r****y
发帖数: 1437
6

Let a is your vector, and B is the matrix,
repmat(a', 1, 100) .* B

【在 g******s 的大作中提到】
: 比如要一个 1*3的向量,乘一个3*100的矩阵.
: 向量的第i个元素乘矩阵的第i行,结果为3*100的矩阵. 请问不用for循环matlab能行吗?`

r****y
发帖数: 1437
7

B - repmat(a', 1, 100)
You really need to learn some basic about matlab ah.

【在 g******s 的大作中提到】
: 请问怎样从一个3*100 的矩阵的第 i 行减去一个长度为3的向量的第i个元素? 好象这个
: 不用循环是不行了.
:
: 行

w**d
发帖数: 2334
8
why bother? In the new version of Matlab, for loop won't slow your program
down.

【在 g******s 的大作中提到】
: 请问怎样从一个3*100 的矩阵的第 i 行减去一个长度为3的向量的第i个元素? 好象这个
: 不用循环是不行了.
:
: 行

s***t
发帖数: 195
9
explain more?

【在 w**d 的大作中提到】
: why bother? In the new version of Matlab, for loop won't slow your program
: down.

w**d
发帖数: 2334
10
i need to dig out my notes. It might be related to the issue of memory.
A senior engineer from mathworks once gave
several lectures on Matlab. He told us so.

【在 s***t 的大作中提到】
: explain more?
s***t
发帖数: 195
11
as far as i know, the matrix operations in matlab are implemented with BLAS.
plus matlab is an intepreter, not a compiler (i know you can compile matlab
code, but it's another story). these two reasons make it hard to believe
for loops are as fast as matrix operations in matlab.
i would certainly want to know any new development in matlab.

【在 w**d 的大作中提到】
: i need to dig out my notes. It might be related to the issue of memory.
: A senior engineer from mathworks once gave
: several lectures on Matlab. He told us so.

w**d
发帖数: 2334
12
i know it is hard to beat BLAS. In my understanding, the for-loop might be not
as effecient as BLAS, but won't be slower than the standard for-loop in C or
Fortran.
But the main reason for the slow speed of for-loop is because during
the for-loop, lots of intermediate variables are generated.
In the new version, it is not done in that way if the matrix variable
has been initialized.
Mathworks has done something to improve the speed. You can go to the website of mathworks, and search with
keywor

【在 s***t 的大作中提到】
: as far as i know, the matrix operations in matlab are implemented with BLAS.
: plus matlab is an intepreter, not a compiler (i know you can compile matlab
: code, but it's another story). these two reasons make it hard to believe
: for loops are as fast as matrix operations in matlab.
: i would certainly want to know any new development in matlab.

s***t
发帖数: 195
13
sorry, just read my post again. it seems i always left some critical words
in my sentences. i meant to say "i would certainly WANT TO know any new
development" :)
anyways, why search for "jitter"? isn't it variation in sampling time? i
searched and didn't see many relavant results. can you give some links?

【在 w**d 的大作中提到】
: i know it is hard to beat BLAS. In my understanding, the for-loop might be not
: as effecient as BLAS, but won't be slower than the standard for-loop in C or
: Fortran.
: But the main reason for the slow speed of for-loop is because during
: the for-loop, lots of intermediate variables are generated.
: In the new version, it is not done in that way if the matrix variable
: has been initialized.
: Mathworks has done something to improve the speed. You can go to the website of mathworks, and search with
: keywor

1 (共1页)
进入Computation版参与讨论
相关主题
求矩阵逆的算法请教Matlab中矩阵求逆问题
请教矩阵特征值问题Matlab矩阵运算
请帮忙一个矩阵处理的问题[合集] 简单问题简单问,matlab
VF6.6中矩阵计算有哪些函数啊?[合集] Matlab 求助:如何把一个高维矩阵中的一维赋值给一个向量
请问matlab矩阵和向量对应元素相乘该怎么做?Matlab中计算特征值如何保持原始特征值顺序不变?
请问怎么让m阶矩阵的每个元素减n阶矩阵的每个元素而不用for循环问个matlab的eigs的问题
BLAS 矩阵相乘问题请教如何根据矩阵元素值找到矩阵的行号?
windows 下如何编译使用cblas请问怎么把这个一维向量复制成三维数组
相关话题的讨论汇总
话题: matlab话题: 矩阵话题: loop话题: 向量话题: blas