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

[dennou-ruby:000108] Re: NMDArray revised



In message "[dennou-ruby:000107] Re: NMDArray revised"
    on 99/10/05, Takeshi Horinouchi <horinout@xxxxxx> writes:
>>> ��̣���狼��ʤ��ΤǤ���������äơ�a,b ��������Ȥ����Ruby�Ǥ�
>>> 
>>> c = []
>>> a.each_indeces{|i| c[i] = a[i] * b[i] if a[i] > 0}
>>> a = c
>>> 
>>> �ߤ����ʴ����Ǥ���??
>
>�����Ǥ���
>������������ǥå������оݤ�Ʊ�ͤΥ᥽�åɤ���Ф�����Ǥ��͡�

�����������Ǥ���֥��å���� [i] ��4���ФƤ���Ȥ����鷺
��路���Ϥ���ޤ����㤨�С�������nil�ʤȤ�����self�Ǿ��
����᥽�å�over ��������ơ�

a
 ==> [1.2, -3.4, 56.7, -0.9]
a.mask{|elm| elm > 0}
 ==> [1.2, nil, 56.7, nil]
2*a
 ==> [2.4, -6.8, 113.4, -1.8]
a = (2*a).over a.mask{|e| e > 0}
 ==> [1.2, -6.8, 56.7, -1.8]

�ߤ����ʼ�⤢�뤫���Τ�ޤ���a*b �ʤ�

a = (a*b).over a.mask{|e| e>0}

ʬ����ˤ����Ǥ���?? �����������;ʬ�ʷ׻���¿����Ǥ���͡�

-- gotoken