Submatrices in MTL
Mark Hymers <[email protected]>
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Organization | None at all |
| Message-ID | <[email protected]> |
Please note that I'm not subscribed to the list list and so a CC would
be appreciated.
We're attempting to develop a neural network class on top of the MTL
framework and have ran into two problems.
First, is it possible to easily 'cut+paste' sections from and to
matrices. For example:
A = [ 0 1 2 3 ] B = [10 11 12 13]
[ 4 5 6 7 ] [14 15 16 17]
Can we easily take [1 2] from A and paste it over part of B such that:
[5 6]
B = [10 1 2 13]
[14 5 6 17]
We've tried using sub_matrix to pull it out but can't get it to work:
#include <iostream>
#include "mtl/mtl.h"
using namespace mtl;
typedef matrix< double,
rectangle<>,
array< dense<> >,
row_major>::type mlp2d;
int main()
{
mlp2d a(6,6);
mlp2d b(2,2);
double counter=0;
int i,j;
for(i=0;i<6;i++)
{
for(j=0;j<6;j++)
{
a(i,j)=counter;
counter++;
}
}
b=a.sub_matrix(0,2,0,2);
print_all_matrix(a);
print_all_matrix(b);
return 0;
}
Second, what is the most efficient way to implement simple 3d matrix
operations -- basically we want to be able to cut and paste submatrices
as above but in 3d (although there is the possiblity of just doing it as
a set of 2d matrices if there is no alternative).
Thanks for any help you can offer.
Mark Hymers,
Sensory Systems Research Group, Newcastle University
--
Mark Hymers, University of Newcastle Medical School
Intercalating Medical Student (BMedSci)
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/