Numerical Ruby (NArray)

Hello,
I am interested to know how to compile and install Narray for
ruby181-11 (MS Windows version) with Microsoft Visual C++ (version 6
or higher).

Thanks.

Regards,
Srijit

srijit@yahoo.com wrote in message

I am interested to know how to compile and install Narray for
ruby181-11 (MS Windows version) with Microsoft Visual C++ (version 6
or higher).

See transcript below (assuming that you downloaded from RAA, the file
narray-0.5.7p1.tar.gz and extracted it in a folder. Llike in my case
C:\extract_ruby\narray-0.5.7p1>

HTH,
– shanko

···

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\extract_ruby\narray-0.5.7p1>ruby extconf.rb
checking for sys/types.h… yes
checking for u_int8_t… no
checking for int16_t… no
checking for int32_t… no
checking for u_int32_t… no
checking for asinh()… no
checking for fftw.h… no
creating narray_config.h
creating Makefile

C:\extract_ruby\narray-0.5.7p1>nmake

Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcnarray.c
narray.c
narray.c(21) : warning C4273: ‘cNArray’ : inconsistent dll linkage.
dllexport assumed.
narray.c(33) : warning C4273: ‘na_sizeof’ : inconsistent dll linkage.
dllexport assumed.
narray.c(984) : warning C4028: formal parameter 2 different from declaration

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_array.c
na_array.c
na_array.c(348) : warning C4700: local variable ‘type’ used without having
been initialized

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_func.c
na_func.c
na_func.c(1441) : warning C4113: ‘int (__cdecl *)()’ differs in parameter
lists from ‘int (__cdecl *)(const void *,const void *)’
na_func.c(1468) : warning C4113: ‘int (__cdecl *)()’ differs in parameter
lists from ‘int (__cdecl *)(const void *,const void *)’
na_func.c(1507) : warning C4113: ‘int (__cdecl *)()’ differs in parameter
lists from ‘int (__cdecl *)(const void *,const void *)’

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_index.c
na_index.c

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_random.c
na_random.c
ruby -I. ./mkop.rb

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_op.c
na_op.c
ruby -I. ./mkmath.rb

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_math.c
na_math.c

cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:
/ruby/lib/ruby/1.8/i386-mswin32 -I. -DHAVE_SYS_TYPES_H -I. -I./… -I./…/mis
sing -c -Tcna_linalg.c
na_linalg.c
cl -nologo -LD -Fenarray.so narray.obj na_array.obj na_func.obj
na_index.obj na_random.obj na_op.obj na_math.obj na_linalg.obj
msvcrt-ruby18.lib oldnames.lib user32.lib advapi32.lib
wsock32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:“c
:/ruby/lib” -def:./narray.def
Creating library narray.lib and object narray.exp
LINK : warning LNK4049: locally defined symbol “_cNArray” imported
LINK : warning LNK4049: locally defined symbol “_na_sizeof” imported

C:\extract_ruby\narray-0.5.7p1>nmake site-install

Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

install -c -p -m 0755 narray.so c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
install -c -p -m 0644 ./lib/narray_ext.rb c:/ruby/lib/ruby/site_ruby/1.8
install -c -p -m 0644 ./lib/nmatrix.rb c:/ruby/lib/ruby/site_ruby/1.8
install -c -p -m 0644 ./narray.h c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
install -c -p -m 0644 narray_config.h
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt

C:\extract_ruby\narray-0.5.7p1>
C:\extract_ruby\narray-0.5.7p1>cd test

C:\extract_ruby\narray-0.5.7p1\test>
C:\extract_ruby\narray-0.5.7p1\test>ruby testbit.rb
a #=>
NArray.byte(10):
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
a & 1 #=>
NArray.byte(10):
[ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ]
a & 2 #=>
NArray.byte(10):
[ 0, 0, 2, 2, 0, 0, 2, 2, 0, 0 ]
a & -1 #=>
NArray.byte(10):
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
a | 1 #=>
NArray.byte(10):
[ 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 ]
a | 2 #=>
NArray.byte(10):
[ 2, 3, 2, 3, 6, 7, 6, 7, 10, 11 ]
a | -1 #=>
NArray.byte(10):
[ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ]
a ^ 1 #=>
NArray.byte(10):
[ 1, 0, 3, 2, 5, 4, 7, 6, 9, 8 ]
a ^ 2 #=>
NArray.byte(10):
[ 2, 3, 0, 1, 6, 7, 4, 5, 10, 11 ]
a ^ -1 #=>
NArray.byte(10):
[ 255, 254, 253, 252, 251, 250, 249, 248, 247, 246 ]
~a #=>
NArray.byte(10):
[ 255, 254, 253, 252, 251, 250, 249, 248, 247, 246 ]
a #=>
NArray.int(10):
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
~a #=>
NArray.int(10):
[ -1, -2, -3, -4, -5, -6, -7, -8, -9, -10 ]

C:\extract_ruby\narray-0.5.7p1\test>ruby testmatrix3.rb
m #=>
NMatrix.object(5,5):
[ [ 4/1, 9/1, 7/1, 9/1, 0/1 ],
[ 1/1, 3/1, 9/1, 1/1, 2/1 ],
[ 0/1, 3/1, 1/1, 3/1, 3/1 ],
[ 6/1, 3/1, 9/1, 5/1, 8/1 ],
[ 4/1, 3/1, 6/1, 5/1, 2/1 ] ]
m/m #=>
NMatrix.object(5,5):
[ [ 1/1, 0/1, 0/1, 0/1, 0/1 ],
[ 0/1, 1/1, 0/1, 0/1, 0/1 ],
[ 0/1, 0/1, 1/1, 0/1, 0/1 ],
[ 0/1, 0/1, 0/1, 1/1, 0/1 ],
[ 0/1, 0/1, 0/1, 0/1, 1/1 ] ]

C:\extract_ruby\narray-0.5.7p1\test>