[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
no way for simple matrix lookup ?
From: |
D. Goel |
Subject: |
no way for simple matrix lookup ? |
Date: |
Wed, 16 Jun 2004 10:56:17 -0400 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux) |
Hi
[1] Suppose A is a nxn matrix. And b and are vectors. How do i
return elements of A specified by b and c?
i.e. Want to return a vector D, such that
D(i) = A(b(i), c(i))
Is the only way to do that a for loop? Is that inefficient?
This "simple lookup" seems too fundamental that there should be a way
to do it. Am I missing something? Else, should this be a feature
request?
[2] if (1) above is not possible, is it possible if b = c ?
[3] More generally, the problem i am struggling with is:
A is a nxmxl matrix. b and c are vectors.
I am looking for a vector D, such that D(i,:)= A(b(i), :, c(i)).
Any way to do that?
[4] A simple generalization of (1) to 3 D's possible?
D(i)=A(b(i), c(i), d(i)) ?
[5] BTW, i might be able to do (2) using the diag function, but is
there a way to use diag for 3 Dimensions? or use diag such that it
acts only on 2 of the indices? So one can implement (3), which is my
actual problem?
[6] Is there a way to transpose the 2nd and 3rd indices of a 3D
vector? transpose() complains that it is implemented only for
2D's... I am trying 2.1.57.
Thanks, please CC if you can..
DG http://gnufans.net/
--
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- no way for simple matrix lookup ?,
D. Goel <=
- Re: no way for simple matrix lookup ?, Mike Miller, 2004/06/16
- Re: no way for simple matrix lookup ?, D. Goel, 2004/06/16
- Re: no way for simple matrix lookup ?, Mike Miller, 2004/06/16
- Re: no way for simple matrix lookup ?, Quentin Spencer, 2004/06/16
- Re: no way for simple matrix lookup ?, Julius Smith, 2004/06/18
- Re: no way for simple matrix lookup ?, Julius Smith, 2004/06/18
- Re: no way for simple matrix lookup ?, Mike Miller, 2004/06/18
- Re: no way for simple matrix lookup ?, Julius Smith, 2004/06/18
- Re: no way for simple matrix lookup ?, Etienne Grossmann, 2004/06/16
- Re: no way for simple matrix lookup ?, Jonathan C. Webster, 2004/06/16