[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dennou-ruby:000090] NMDArray



��Ƿ��Ǥ���

���ͷ�¿��������ν���� ruby �Ǻ�äƤߤޤ�����¿���ѤʤȤ�����
���뤫���Τ�ޤ��󤬡�ruby �˴���뤳�Ȥ��ͤ�����Ȥ������Ȥ�
�����Ʋ������������񤤤������ɤ��Ȥ����ä����ɥХ������ޤ��ޤ���
�ʤ����� ruby �ǽ񤤤Ƥޤ��Τǡ�������������Ū�˰������󤸤�
�ʤ��Ǥ���ư��Υƥ��ȤϤ��ޤ��ΤǥХ��Ϸ빽���뤫�⡣�ƥ᥽�å�
�����ϤΥ����å��ϴŤ��Ǥ���(���顼�ˤʤ�Хȥ졼���Хå��Ф뤷��)

�־��

ftp://dennou-t.ms.u-tokyo.ac.jp/arch/davis/ex/1999-09-08-horinout/

�Ǥ���

�褺�ϣ������� Array ���饹�� inherit ���ƿ��ͥǡ����Ѥ��Ѥ��� 
NArray ���饹(Numerical Array)���ꡢ"+"��­�����˺���������ꡢ
Math�򥤥󥯥롼�ɤ����ꤷ�ޤ����������� NArray �Υ��֥������Ȥ�
�����˻��ķ���¿�������� NMDArray �������ޤ������ե����� 
NMDArray.rb �ˤϡ����饹����Τ��Ȥ˥ƥ����ѤΥ�����ץȤ�Ĥ���
�ޤ��Τǡ�ruby NMDArray.rb �Ǽ¹Ԥ��Ʋ�������

�� NMDArray �� NArray �λ�¹�ˤ��褦���¤ä����ɡ����������
  initialize ������Ǥ��ʤ��ΤǤ�᤿(��Array.new�Ϻ�����Բ�)��

����ˤʤäƤޤ������֥��åȻ���ˡ�Ǥ�����-1:�Ǹ�, -2:�Ǹ夫����
����,..�Ϻ��Ѥ��Ƥޤ���cyclic/��cyclic °���Ϥ���ޤ���(����д�
�����Ȥϻפ��ޤ������Ȥꤢ���������̡פ�������äƤߤ����ä�...
�������̤Ȼפ����Ͽͤˤ�äư㤦�Ǥ��礦����)���ϰϤ˲ä��ƥ��ƥ�
�פ�������ޤ���������������� a[{0..-1,2},1..3,0] �Ȥ��� 
Fortran90ɽ���Ǥ� a[::2,1:3,0] ���б����ޤ�(�����Ǥ�Fotran90����
��ź����0����Ϥޤ�Ȥ��ޤ���)���ޤ��������Ƥޤ��󤬡�����ǥå�
��������ǻ��ꤹ����ˡ���С������������줿���ȻפäƤ��ޤ���
��С��� '..' ����ǧ�����䤹���ΤǤ���������Ǥ� parse ���顼��
�ʤ�ޤ��Τ� Fill �Ȥ�Ŭ����̾�դ��������Ȥ����ȻפäƤ��ޤ���
(a[0,0,..] ��Ȥ� a[0,0,Fill] �� a ���������ʤ� a[0,0,0..-1,0..-1]
���б����롣Fill�ʳ�����ʸ���ǻϤޤ뤤��̾��̵�����ʡ�)

����ʤդ��� ruby �Ȥ������������Ǽ��ߤ�����λ��ͤ����Τ�
�������ȴ������ޤ�������ä�ɽ��ˡ�ˤĤ����Ŷ�����ɬ�פϤ���ޤ�
�����������⼫ʬ�Ǹ���λ��ͤ���礹��Υ�ǥץ�����ߥ󥰤Ǥ���
�Τϴ򤷤��Ǥ���

���ʤߤ� NMDArray �λ��ͤϰʲ��Τ褦�ʴ����Ǥ�(����������ΰ���)��
���������Τä������ߥɥ������(=begin...=end)�ˤ���٤�����
�����Ǥ� mule�� ruby-mode �ϲ�᤻���˿��Ĥ����㤦����...


# class methods
#
#   NMDArray.new(l1,l2,...)     l? is the lengths of ?-th dimension;
#                      The # of the arguments determines the # of dimensions
#
# methods
#
#   [],[]=     : subset making and subset alternation, respectively
#                Example 1 (when 3D): [1..2,2,-4] [10..-9]
#                    The # of arguments must be either equal to the rank of
#                    the array (the former case) or one (the latter case).
#                    If the former, the rank of the result of [] is the same
#                    as that of the original array. Use "trim" or "tirm!" to
#                    trim the dimensions of length 1.
#                    If the latter, the array is treated as if it were 1D.
#                    Then, the result of [] becomes 1D.
#                Example 2: [{0..-1,2},{-1..0,-1},0]
#                    A step can be specified by using a hash of length 1.
#                    Note that {0..-1,2} is equivalent to {0..-1=>2}.
#                    Specify a range as the key (here, 0..-1), and a step
#                    as the value (here, 2). Negative steps are accepted.
#                    In that case, range.first must be larger than range.last.
#
#   dup        : duplication (deep)
#   clone      : same as dup
#
#   trim trim!    :    eliminate the dimensions of length 1.
#                      trim creates another object; trim! transforms "self".
#                      (Example: a 3*1*2*1 4D array becomes 2D of 3*2)
#
#   length size       : total # of elements (length as a 1D array)
#   + - * / **        : numeric operators
#   abs               : absolute values
#   span_fill         : as in NArray (1D numeric array)
#
#   to_a       : into NArray (To get an Array, apply to_a again)
#
#   shape      : shape of the array (lengths of dimensions)
#
#   sin cos tan exp log log10 sqrt ldexp atan2   :  from Math module


��Ƿ�� ��                 horinout@xxxxxx
�������Ķ�������ȸ��楻�󥿡�    611-0011 �����Ըޥ���
phone:0774-38-3812                     fax:0774-31-8463