[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ND arrays again
From: |
David Bateman |
Subject: |
Re: ND arrays again |
Date: |
Tue, 01 Feb 2005 17:11:59 +0100 |
User-agent: |
Mozilla Thunderbird 0.8 (X11/20040923) |
Brian Blais wrote:
Hello,
I've been trying to decypher the octave class code for this, but I am
having trouble. Would someone be able to send me a simple example of
C++ code to do the following:
pass in a 3 dimensional matrix, and return a 2-dimensional matrix with
the value comparable to the octave line: var(5:15,3:8,3)
this would help me a lot!
thanks in advance,
Brian Blais
With no testing whatsoever, I believe something like
NDArray m = args(0).array_value();
Array<idx_vector> idx (3);
idx(0) =idx_vector (Range (5., 15.))
idx(1) = idx_vector (Range (3., 8.));
idx(2) = idx_vector (3);
NDArray ret = m.index (idx, 0);
is probably what you want.
D.
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
-------------------------------------------------------------
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
-------------------------------------------------------------
- ND arrays again, Brian Blais, 2005/02/01
- Re: ND arrays again,
David Bateman <=