|
609 | 609 | )
|
610 | 610 |
|
611 | 611 | # U22: ==== LOG2 (x)
|
612 |
| -# FIXME: implement U22 |
| 612 | +_log2_docstring_ = """ |
| 613 | +log2(x, out=None, order='K') |
| 614 | +
|
| 615 | +Computes the base-2 logarithm for each element `x_i` of input array `x`. |
| 616 | +
|
| 617 | +Args: |
| 618 | + x (usm_ndarray): |
| 619 | + Input array, expected to have numeric data type. |
| 620 | + out ({None, usm_ndarray}, optional): |
| 621 | + Output array to populate. |
| 622 | + Array have the correct shape and the expected data type. |
| 623 | + order ("C","F","A","K", optional): |
| 624 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 625 | + Default: "K". |
| 626 | +Returns: |
| 627 | + usm_narray: |
| 628 | + An array containing the base-2 logarithm of `x`. |
| 629 | + The data type of the returned array is determined by the |
| 630 | + Type Promotion Rules. |
| 631 | +""" |
| 632 | + |
| 633 | +log2 = UnaryElementwiseFunc( |
| 634 | + "log2", ti._log2_result_type, ti._log2, _log2_docstring_ |
| 635 | +) |
613 | 636 |
|
614 | 637 | # U23: ==== LOG10 (x)
|
615 |
| -# FIXME: implement U23 |
| 638 | +_log10_docstring_ = """ |
| 639 | +log10(x, out=None, order='K') |
| 640 | +
|
| 641 | +Computes the base-10 logarithm for each element `x_i` of input array `x`. |
| 642 | +
|
| 643 | +Args: |
| 644 | + x (usm_ndarray): |
| 645 | + Input array, expected to have numeric data type. |
| 646 | + out ({None, usm_ndarray}, optional): |
| 647 | + Output array to populate. |
| 648 | + Array have the correct shape and the expected data type. |
| 649 | + order ("C","F","A","K", optional): |
| 650 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 651 | + Default: "K". |
| 652 | +Returns: |
| 653 | + usm_narray: |
| 654 | + An array containing the base-1- logarithm of `x`. |
| 655 | + The data type of the returned array is determined by the |
| 656 | + Type Promotion Rules. |
| 657 | +""" |
| 658 | + |
| 659 | +log10 = UnaryElementwiseFunc( |
| 660 | + "log10", ti._log10_result_type, ti._log10, _log10_docstring_ |
| 661 | +) |
616 | 662 |
|
617 | 663 | # B15: ==== LOGADDEXP (x1, x2)
|
618 | 664 | # FIXME: implement B15
|
|
761 | 807 | )
|
762 | 808 |
|
763 | 809 | # U25: ==== NEGATIVE (x)
|
764 |
| -# FIXME: implement U25 |
| 810 | +_negative_docstring_ = """ |
| 811 | +negative(x, out=None, order='K') |
| 812 | +
|
| 813 | +Computes the numerical negative for each element `x_i` of input array `x`. |
| 814 | +Args: |
| 815 | + x (usm_ndarray): |
| 816 | + Input array, expected to have numeric data type. |
| 817 | + out (usm_ndarray): |
| 818 | + Output array to populate. Array must have the correct |
| 819 | + shape and the expected data type. |
| 820 | + order ("C","F","A","K", optional): memory layout of the new |
| 821 | + output array, if parameter `out` is `None`. |
| 822 | + Default: "K". |
| 823 | +Return: |
| 824 | + usm_ndarray: |
| 825 | + An array containing the negative of `x`. |
| 826 | +""" |
| 827 | + |
| 828 | +negative = UnaryElementwiseFunc( |
| 829 | + "negative", ti._negative_result_type, ti._negative, _negative_docstring_ |
| 830 | +) |
765 | 831 |
|
766 | 832 | # B20: ==== NOT_EQUAL (x1, x2)
|
767 | 833 | _not_equal_docstring_ = """
|
|
793 | 859 | )
|
794 | 860 |
|
795 | 861 | # U26: ==== POSITIVE (x)
|
796 |
| -# FIXME: implement U26 |
| 862 | +_positive_docstring_ = """ |
| 863 | +positive(x, out=None, order='K') |
| 864 | +
|
| 865 | +Computes the numerical positive for each element `x_i` of input array `x`. |
| 866 | +Args: |
| 867 | + x (usm_ndarray): |
| 868 | + Input array, expected to have numeric data type. |
| 869 | + out (usm_ndarray): |
| 870 | + Output array to populate. Array must have the correct |
| 871 | + shape and the expected data type. |
| 872 | + order ("C","F","A","K", optional): memory layout of the new |
| 873 | + output array, if parameter `out` is `None`. |
| 874 | + Default: "K". |
| 875 | +Return: |
| 876 | + usm_ndarray: |
| 877 | + An array containing the values of `x`. |
| 878 | +""" |
| 879 | + |
| 880 | +positive = UnaryElementwiseFunc( |
| 881 | + "positive", ti._positive_result_type, ti._positive, _positive_docstring_ |
| 882 | +) |
797 | 883 |
|
798 | 884 | # B21: ==== POW (x1, x2)
|
799 |
| -# FIXME: implement B21 |
| 885 | +_pow_docstring_ = """ |
| 886 | +pow(x1, x2, out=None, order='K') |
| 887 | +
|
| 888 | +Calculates `x1_i` raised to `x2_i` for each element `x1_i` of the input array |
| 889 | +`x1` with the respective element `x2_i` of the input array `x2`. |
| 890 | +
|
| 891 | +Args: |
| 892 | + x1 (usm_ndarray): |
| 893 | + First input array, expected to have a numeric data type. |
| 894 | + x2 (usm_ndarray): |
| 895 | + Second input array, also expected to have a numeric data type. |
| 896 | +Returns: |
| 897 | + usm_ndarray: |
| 898 | + an array containing the element-wise result. The data type of |
| 899 | + the returned array is determined by the Type Promotion Rules. |
| 900 | +""" |
| 901 | +pow = BinaryElementwiseFunc( |
| 902 | + "pow", ti._pow_result_type, ti._pow, _pow_docstring_ |
| 903 | +) |
800 | 904 |
|
801 | 905 | # U??: ==== PROJ (x)
|
802 | 906 | _proj_docstring = """
|
|
884 | 988 | # FIXME: implement U31
|
885 | 989 |
|
886 | 990 | # U32: ==== SQUARE (x)
|
887 |
| -# FIXME: implement U32 |
| 991 | +_square_docstring_ = """ |
| 992 | +square(x, out=None, order='K') |
| 993 | +
|
| 994 | +Computes `x_i**2` (or `x_i*x_i`) for each element `x_i` of input array `x`. |
| 995 | +Args: |
| 996 | + x (usm_ndarray): |
| 997 | + Input array, expected to have numeric data type. |
| 998 | + out ({None, usm_ndarray}, optional): |
| 999 | + Output array to populate. |
| 1000 | + Array have the correct shape and the expected data type. |
| 1001 | + order ("C","F","A","K", optional): |
| 1002 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 1003 | + Default: "K". |
| 1004 | +Returns: |
| 1005 | + usm_ndarray: |
| 1006 | + An array containing the square `x`. |
| 1007 | + The data type of the returned array is determined by |
| 1008 | + the Type Promotion Rules. |
| 1009 | +""" |
| 1010 | + |
| 1011 | +square = UnaryElementwiseFunc( |
| 1012 | + "square", ti._square_result_type, ti._square, _square_docstring_ |
| 1013 | +) |
888 | 1014 |
|
889 | 1015 | # U33: ==== SQRT (x)
|
890 | 1016 | _sqrt_docstring_ = """
|
|
0 commit comments