| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 
 | use strict;
use Test;
BEGIN {
           plan(tests => 4) ;
}
use Data::Dumper;
$Data::Dumper::Terse= 1;
$Data::Dumper::Indent= 0;
sub structeq {
   return (Dumper($_[0]) eq Dumper($_[1])) +0;
}   
         
use Inline Octave => "DATA";
my $c= new Inline::Octave::Matrix([ [1.5,2,3],[4.5,1,-1] ]);
   
my ($b, $t)= jnk2( $c, [4,4],[5,6] );
ok ( structeq( [$t->as_list()], ["6"] ) );
ok ( structeq( $b->as_matrix(),
              [['46.5','47','48'],['49.5','46','44']]
             ));
ok ( structeq( $c->sub_matrix([2,1],[2,3]) ,
              [['1','-1'],['2','3']]
             ));
my $idx= new Inline::Octave::Matrix( [ 1 .. 3 ] );
ok ( structeq( $c->sub_matrix([2,1], $idx->transpose() ),
              [['4.5','1','-1'],['1.5','2','3']]
             ));
__DATA__
__Octave__
   function [b,t]=jnk2(x,a,b);
      b=x+1+a'*b;
      t=6;
   endfunction
 |