Anyone using NArray and 1.7.2? 
Author Message
 Anyone using NArray and 1.7.2?

While trying to port my application from 1.6.7 to 1.7.2, I've encountered some
odd errors that I've managed to boil down to a change in behavior due to loading
the NArray (v0.5.6p2) package, viz,

 irb(main):001:0> (-2)**2
 4

 irb(main):002:0> require 'narray'
 true

 irb(main):003:0> (-2)**2
 Complex(4, 0)

Turning on some warnings, I noticed that NArray appears to be clashing with
Complex,

 ruby -wrnarray -e'puts((-2)**2)'
 /usr/local/pkgs/ruby/lib/ruby/1.7/complex.rb:452: warning: method redefined; discarding old atan
 4+0i

Any ideas?

Thanks,
--
Bil Kleb
NASA Langley Research Center
Hampton, {*filter*}ia, USA



Tue, 09 Nov 2004 23:53:02 GMT  
 Anyone using NArray and 1.7.2?

Quote:

>Subject: Anyone using NArray and 1.7.2?
> While trying to port my application from 1.6.7 to 1.7.2, I've encountered some
> odd errors that I've managed to boil down to a change in behavior due to loading
> the NArray (v0.5.6p2) package, viz,

>  irb(main):001:0> (-2)**2
>  4

>  irb(main):002:0> require 'narray'
>  true

>  irb(main):003:0> (-2)**2
>  Complex(4, 0)

This is a problem in complex.rb, and I have requested bug fix
to the author before.  But not fixed yet.

Masa Tanaka



Wed, 10 Nov 2004 00:19:15 GMT  
 Anyone using NArray and 1.7.2?

Quote:


> >  irb(main):001:0> (-2)**2
> >  4

> >  irb(main):002:0> require 'narray'
> >  true

> >  irb(main):003:0> (-2)**2
> >  Complex(4, 0)

> This is a problem in complex.rb, and I have requested bug fix
> to the author before.  But not fixed yet.

Two questions:

 a) who's the current author?
 b) do you know the fix?

Thanks,
--
Bil Kleb
NASA Langley Research Center
Hampton, {*filter*}ia, USA



Mon, 15 Nov 2004 04:08:08 GMT  
 Anyone using NArray and 1.7.2?

Quote:
>From: Bil Kleb
> Two questions:

>  a) who's the current author?

See in lib/complex.rb.

Quote:
>  b) do you know the fix?

Here is a patch for ruby-1.7.

--- lib/complex.rb.~1.8.~       Mon Apr 29 21:25:24 2002

   if not defined? Rational
     alias power! **
   end
-  
-  def ** (other)
-    if self < 0
-      Complex.new(self) ** other
-    else
-      if defined? Rational
-       if other >= 0
-         self.power!(other)
-       else
-         Rational.new!(self,1)**other
-       end
-      else
-       self.power!(other)
-      end
-    end
-  end
 end


        Complex(0,sqrt!(-z))
       end
     else
-      z**Rational(1,2)
+      if z.image < 0
+       sqrt(z.conjugate).conjugate
+      else
+       r = z.abs
+       x = z.real
+       Complex(sqrt!((r+x)/2),sqrt!((r-x)/2))
+      end
     end
   end

--  
Masa Tanaka



Mon, 15 Nov 2004 10:40:10 GMT  
 Anyone using NArray and 1.7.2?

Quote:

> Here is a patch for ruby-1.7

Perfect.  Thanks.

My ap is finally running under 1.7.2.

--
Bil



Mon, 15 Nov 2004 11:58:13 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Modifying NArray's NVector dumps core?

2. NArray 0.5 bug and fix

3. ANNOUNCE: narray 0.10

4. ANNOUNCE: narray version 0.8

5. ANNOUNCE: narray-0.7

6. ANNOUNCE: narray, a numeric array extension for Tcl

7. Has anyone used Dolphin to do OPC stuff?

8. Anyone using the FPAT patch?

9. Is anyone using VisualWorks COM Connect?

10. Anyone out there using Envy with VisualWorks?

11. Anyone used jgawk for mac?

12. Looking for anyone who has used Smalltalk on the WEB

 

 
Powered by phpBB® Forum Software