<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!/usr/bin/perl5.10 -w
+#!/usr/bin/perl -w
 use Math::GSL::Matrix;
 use strict;
 my $matrix = Math::GSL::Matrix-&gt;new(2,2)</diff>
      <filename>examples/matrix/nonsymmetric_eigen</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!/usr/bin/perl5.10 -w
+#!/usr/bin/perl -w
 use Math::GSL          qw/:all/;
 use Math::GSL::Eigen   qw/:all/;
 use Math::GSL::Matrix  qw/:all/;</diff>
      <filename>examples/matrix/nonsymmetric_eigen_old</filename>
    </modified>
    <modified>
      <diff>@@ -561,14 +561,12 @@ sub col
     croak (__PACKAGE__.&quot;::\$matrix-&gt;col(\$col) - $col not a valid column&quot;)
         unless ($col &lt; $self-&gt;cols and $col &gt;= 0);
 
-    my $colvec = Math::GSL::Vector-&gt;new($self-&gt;cols);
     my $colmat = Math::GSL::Matrix-&gt;new($self-&gt;rows, 1);
 
-   my @got;
-   for my $n (0 .. $self-&gt;rows-1) {
-        push (@got, gsl_matrix_get($self-&gt;raw, $n, $col));
-   }
-   map { gsl_matrix_set($colmat-&gt;raw, $_, 0, $got[$_]) } (0 .. $self-&gt;rows-1);
+   map { gsl_matrix_set($colmat-&gt;raw, $_, 0,
+           gsl_matrix_get($self-&gt;raw, $_, $col),
+           )
+       } (0 .. $self-&gt;rows-1);
 
    return $colmat;
 }</diff>
      <filename>pod/Matrix.pod</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,11 @@
-%perlcode %{ 
+%perlcode %{
 
 use Carp qw/croak/;
 use Math::GSL qw/:all/;
+use Math::GSL::Complex qw/:all/;
 use Math::GSL::Errno qw/:all/;
 use Math::Complex;
+use Data::Dumper;
 
 @EXPORT_OK = qw/
                 gsl_matrix_complex_alloc
@@ -182,12 +184,11 @@ sub row
 
    my $rowmat = Math::GSL::MatrixComplex-&gt;new(1,$self-&gt;cols);
 
-   my @got; 
    for my $n (0 .. $self-&gt;cols-1) {
-    push (@got, gsl_matrix_complex_get($self-&gt;raw, $row, $n)); 
+        gsl_matrix_complex_set( $rowmat-&gt;raw, 0, $n,
+            gsl_matrix_complex_get($self-&gt;raw, $row, $n)
+        );
    }
-    for my $n (0 .. $self-&gt;cols-1) {
-	gsl_matrix_complex_set($rowmat-&gt;raw, 0, $n, $got[$n]); }	
 
     return $rowmat;
 }
@@ -202,21 +203,18 @@ Returns a col matrix of the column you enter.
 
 =cut
 
-sub col 
+sub col
 {
     my ($self, $col) = @_;
-    croak (__PACKAGE__.&quot;::\$matrix-&gt;col(\$col) - $col not a valid column&quot;) 
-        unless ($col &lt; $self-&gt;cols and $col &gt;= 0);  
+    croak (__PACKAGE__.&quot;::\$matrix-&gt;col(\$col) - $col not a valid column&quot;)
+        unless ($col &lt; $self-&gt;cols and $col &gt;= 0);
 
-    my $colvec = Math::GSL::Vector-&gt;new($self-&gt;cols);
     my $colmat = Math::GSL::MatrixComplex-&gt;new($self-&gt;rows, 1);
 
-   my @got; 
-   for my $n (0 .. $self-&gt;rows-1) {
-    push (@got, gsl_matrix_complex_get($self-&gt;raw, $n, $col)); 
-   }
-    for my $n (0 .. $self-&gt;rows-1) {
-	gsl_matrix_complex_set($colmat-&gt;raw, $n, 0, $got[$n]); }	
+    map { gsl_matrix_complex_set($colmat-&gt;raw, $_, 0,
+            gsl_matrix_complex_get($self-&gt;raw, $_, $col),
+            )
+        } (0 .. $self-&gt;rows-1);
 
     return $colmat;
 }
@@ -237,13 +235,16 @@ You can also set multiple rows at once with chained calls:
 =cut
 
 sub set_row {
- my ($self, $row, $values) = @_;
- my $length = $#$values;
- die __PACKAGE__.'::new($x, $values) - $values must be a nonempty array reference' if $length == -1;
- die __PACKAGE__.'::set_row($x, $values) - $x must be a valid row number' if ($row &lt; 0 || $row &gt;= $self-&gt;rows);
- die __PACKAGE__.'::set_row($x, $values) - $values must contains the same number of elements as there is columns in the matrix' if($length != $self-&gt;cols-1);
- map { gsl_matrix_complex_set($self-&gt;raw, $row, $_, $values-&gt;[$_]) } (0..$length);
- return $self;
+    my ($self, $row, $values) = @_;
+    my $length = $#$values;
+    die __PACKAGE__.'::set_row($x, $values) - $values must be a nonempty array reference' if $length == -1;
+    die __PACKAGE__.'::set_row($x, $values) - $x must be a valid row number' if ($row &lt; 0 || $row &gt;= $self-&gt;rows);
+    die __PACKAGE__.'::set_row($x, $values) - $values must contains the same number of elements as there is columns in the matrix' if($length != $self-&gt;cols-1);
+    # $values may have Math::Complex objects
+    @$values = map { Math::GSL::Complex::gsl_complex_rect(Re($_), Im($_)) } @$values;
+    # warn Dumper [ @$values ];
+    map { gsl_matrix_complex_set($self-&gt;raw, $row, $_, $values-&gt;[$_]) } (0..$length);
+    return $self;
 }
 
 =head2 set_col()
@@ -262,19 +263,19 @@ You can also set multiple columns at once with chained calls:
 =cut
 
 sub set_col {
- my ($self, $col, $values) = @_;
- my $length = $#$values;
- die __PACKAGE__.'::new($x, $values) - $values must be a nonempty array reference' if $length == -1;
- die __PACKAGE__.'::set_row($x, $values) - $x must be a valid column number' if ($col &lt; 0 || $col &gt;= $self-&gt;cols);
- die __PACKAGE__.'::set_row($x, $values) - $values must contains the same number of elements as there is rowss in the matrix' if($length != $self-&gt;rows-1);
- map { gsl_matrix_complex_set($self-&gt;raw, $_, $col, $values-&gt;[$_]) } (0..$length);
- return $self;
+    my ($self, $col, $values) = @_;
+    my $length = $#$values;
+    die __PACKAGE__.'::set_col($x, $values) - $values must be a nonempty array reference' if $length == -1;
+    die __PACKAGE__.'::set_col($x, $values) - $x must be a valid column number' if ($col &lt; 0 || $col &gt;= $self-&gt;cols);
+    die __PACKAGE__.'::set_col($x, $values) - $values must contains the same number of elements as there is rowss in the matrix' if($length != $self-&gt;rows-1);
+    # $values may have Math::Complex objects
+    @$values = map { gsl_complex_rect(Re($_), Im($_)) } @$values;
+    map { gsl_matrix_complex_set($self-&gt;raw, $_, $col, $values-&gt;[$_]) } (0..$length);
+    return $self;
 }
 
 =head1 DESCRIPTION
 
-The following functions are specific to matrices containing complex numbers : 
-
 =over 1
 
 =item C&lt;gsl_matrix_complex_alloc &gt;</diff>
      <filename>pod/MatrixComplex.pod</filename>
    </modified>
    <modified>
      <diff>@@ -74,7 +74,7 @@ sub new {
     my $this = {};
     my $vector;
 
-    # we expected $values to have Math::Complex objects
+    # we expect $values to have Math::Complex objects
     @$values = map { gsl_complex_rect(Re($_), Im($_)) } @$values;
 
     if ( ref $values eq 'ARRAY' ){</diff>
      <filename>pod/VectorComplex.pod</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,11 @@
 package Math::GSL::MatrixComplex::Test;
 use base q{Test::Class};
-use Test::More tests =&gt; 3;
+use Test::More tests =&gt; 5;
 use Math::GSL                qw/:all/;
 use Math::GSL::Test          qw/:all/;
 use Math::GSL::Errno         qw/:all/;
 use Math::GSL::MatrixComplex qw/:all/;
+use Math::Complex;
 use Data::Dumper;
 use strict;
 
@@ -18,11 +19,19 @@ sub teardown : Test(teardown) {
     unlink 'matrix' if -f 'matrix';
 }
 
-sub GSL_MATRIX_COMPLEX_NEW: Tests {
+sub GSL_MATRIX_COMPLEX_NEW: Tests(3) {
     my $u = Math::GSL::MatrixComplex-&gt;new(10,20);
     isa_ok($u, 'Math::GSL::MatrixComplex');
     ok( $u-&gt;rows ==  10, 'rows');
     ok( $u-&gt;cols ==  20, 'cols');
 }
 
+sub GSL_MATRIX_COMPLEX_SET : Tests(2) {
+    my $u = Math::GSL::MatrixComplex-&gt;new(2,2);
+    $u-&gt;set_row(0, [ 1+7*i, 2*i ] )
+      -&gt;set_row(1, [ 3*i, -4  ] );
+    ok_similar( [ map { Re $_ } $u-&gt;as_list ], [ 1, 0, 0, -4 ] );
+    ok_similar( [ map { Im $_ } $u-&gt;as_list ], [ 7, 2, 3, 0  ] );
+}
+
 Test::Class-&gt;runtests;</diff>
      <filename>t/MatrixComplex.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e8062b074d592d68e83f274df9c8ffc1e582af4c</id>
    </parent>
  </parents>
  <author>
    <name>Duke Leto</name>
    <email>jonathan@leto.net</email>
  </author>
  <url>http://github.com/leto/math--gsl/commit/f67a116c2c8978b8a450efec788e785e8e7a9703</url>
  <id>f67a116c2c8978b8a450efec788e785e8e7a9703</id>
  <committed-date>2008-12-21T14:47:38-08:00</committed-date>
  <authored-date>2008-12-21T14:47:38-08:00</authored-date>
  <message>Refactoring row()/col() in Matrix/MatrixComplex as well trying to get set_row to work on MatrixComplex</message>
  <tree>451a188292721ff26cb0413ea3aa1a41fa021bfe</tree>
  <committer>
    <name>Duke Leto</name>
    <email>jonathan@leto.net</email>
  </committer>
</commit>
