|
563 | 563 | )
|
564 | 564 |
|
565 | 565 | # U22: ==== LOG2 (x)
|
566 |
| -# FIXME: implement U22 |
| 566 | +_log2_docstring_ = """ |
| 567 | +log2(x, out=None, order='K') |
| 568 | +
|
| 569 | +Computes the base-2 logarithm for each element `x_i` of input array `x`. |
| 570 | +
|
| 571 | +Args: |
| 572 | + x (usm_ndarray): |
| 573 | + Input array, expected to have numeric data type. |
| 574 | + out ({None, usm_ndarray}, optional): |
| 575 | + Output array to populate. |
| 576 | + Array have the correct shape and the expected data type. |
| 577 | + order ("C","F","A","K", optional): |
| 578 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 579 | + Default: "K". |
| 580 | +Returns: |
| 581 | + usm_narray: |
| 582 | + An array containing the base-2 logarithm of `x`. |
| 583 | + The data type of the returned array is determined by the |
| 584 | + Type Promotion Rules. |
| 585 | +""" |
| 586 | + |
| 587 | +log2 = UnaryElementwiseFunc( |
| 588 | + "log2", ti._log2_result_type, ti._log2, _log2_docstring_ |
| 589 | +) |
567 | 590 |
|
568 | 591 | # U23: ==== LOG10 (x)
|
569 |
| -# FIXME: implement U23 |
| 592 | +_log10_docstring_ = """ |
| 593 | +log10(x, out=None, order='K') |
| 594 | +
|
| 595 | +Computes the base-10 logarithm for each element `x_i` of input array `x`. |
| 596 | +
|
| 597 | +Args: |
| 598 | + x (usm_ndarray): |
| 599 | + Input array, expected to have numeric data type. |
| 600 | + out ({None, usm_ndarray}, optional): |
| 601 | + Output array to populate. |
| 602 | + Array have the correct shape and the expected data type. |
| 603 | + order ("C","F","A","K", optional): |
| 604 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 605 | + Default: "K". |
| 606 | +Returns: |
| 607 | + usm_narray: |
| 608 | + An array containing the base-1- logarithm of `x`. |
| 609 | + The data type of the returned array is determined by the |
| 610 | + Type Promotion Rules. |
| 611 | +""" |
| 612 | + |
| 613 | +log10 = UnaryElementwiseFunc( |
| 614 | + "log10", ti._log10_result_type, ti._log10, _log10_docstring_ |
| 615 | +) |
570 | 616 |
|
571 | 617 | # B15: ==== LOGADDEXP (x1, x2)
|
572 | 618 | # FIXME: implement B15
|
573 | 619 |
|
574 | 620 | # B16: ==== LOGICAL_AND (x1, x2)
|
575 |
| -# FIXME: implement B16 |
| 621 | +_logical_and_docstring_ = """ |
| 622 | +logical_and(x1, x2, out=None, order='K') |
| 623 | +
|
| 624 | +Computes the logical AND for each element `x1_i` of the input array `x1` |
| 625 | +with the respective element `x2_i` of the input array `x2`. |
| 626 | +
|
| 627 | +Args: |
| 628 | + x1 (usm_ndarray): |
| 629 | + First input array. |
| 630 | + x2 (usm_ndarray): |
| 631 | + Second input array. |
| 632 | + out ({None, usm_ndarray}, optional): |
| 633 | + Output array to populate. |
| 634 | + Array have the correct shape and the expected data type. |
| 635 | + order ("C","F","A","K", optional): |
| 636 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 637 | + Default: "K". |
| 638 | +Returns: |
| 639 | + usm_narray: |
| 640 | + An array containing the element-wise logical AND results. |
| 641 | +""" |
| 642 | +logical_and = BinaryElementwiseFunc( |
| 643 | + "logical_and", |
| 644 | + ti._logical_and_result_type, |
| 645 | + ti._logical_and, |
| 646 | + _logical_and_docstring_, |
| 647 | +) |
576 | 648 |
|
577 | 649 | # U24: ==== LOGICAL_NOT (x)
|
578 |
| -# FIXME: implement U24 |
| 650 | +_logical_not_docstring = """ |
| 651 | +logical_not(x, out=None, order='K') |
| 652 | +Computes the logical NOT for each element `x_i` of input array `x`. |
| 653 | +Args: |
| 654 | + x (usm_ndarray): |
| 655 | + Input array. |
| 656 | + out (usm_ndarray): |
| 657 | + Output array to populate. Array must have the correct |
| 658 | + shape and the expected data type. |
| 659 | + order ("C","F","A","K", optional): memory layout of the new |
| 660 | + output array, if parameter `out` is `None`. |
| 661 | + Default: "K". |
| 662 | +Return: |
| 663 | + usm_ndarray: |
| 664 | + An array containing the element-wise logical NOT results. |
| 665 | +""" |
| 666 | + |
| 667 | +logical_not = UnaryElementwiseFunc( |
| 668 | + "logical_not", |
| 669 | + ti._logical_not_result_type, |
| 670 | + ti._logical_not, |
| 671 | + _logical_not_docstring, |
| 672 | +) |
579 | 673 |
|
580 | 674 | # B17: ==== LOGICAL_OR (x1, x2)
|
581 |
| -# FIXME: implement B17 |
| 675 | +_logical_or_docstring_ = """ |
| 676 | +logical_or(x1, x2, out=None, order='K') |
| 677 | +
|
| 678 | +Computes the logical OR for each element `x1_i` of the input array `x1` |
| 679 | +with the respective element `x2_i` of the input array `x2`. |
| 680 | +
|
| 681 | +Args: |
| 682 | + x1 (usm_ndarray): |
| 683 | + First input array. |
| 684 | + x2 (usm_ndarray): |
| 685 | + Second input array. |
| 686 | + out ({None, usm_ndarray}, optional): |
| 687 | + Output array to populate. |
| 688 | + Array have the correct shape and the expected data type. |
| 689 | + order ("C","F","A","K", optional): |
| 690 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 691 | + Default: "K". |
| 692 | +Returns: |
| 693 | + usm_narray: |
| 694 | + An array containing the element-wise logical OR results. |
| 695 | +""" |
| 696 | +logical_or = BinaryElementwiseFunc( |
| 697 | + "logical_or", |
| 698 | + ti._logical_or_result_type, |
| 699 | + ti._logical_or, |
| 700 | + _logical_or_docstring_, |
| 701 | +) |
582 | 702 |
|
583 | 703 | # B18: ==== LOGICAL_XOR (x1, x2)
|
584 |
| -# FIXME: implement B18 |
| 704 | +_logical_xor_docstring_ = """ |
| 705 | +logical_xor(x1, x2, out=None, order='K') |
| 706 | +
|
| 707 | +Computes the logical XOR for each element `x1_i` of the input array `x1` |
| 708 | +with the respective element `x2_i` of the input array `x2`. |
| 709 | +
|
| 710 | +Args: |
| 711 | + x1 (usm_ndarray): |
| 712 | + First input array. |
| 713 | + x2 (usm_ndarray): |
| 714 | + Second input array. |
| 715 | + out ({None, usm_ndarray}, optional): |
| 716 | + Output array to populate. |
| 717 | + Array have the correct shape and the expected data type. |
| 718 | + order ("C","F","A","K", optional): |
| 719 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 720 | + Default: "K". |
| 721 | +Returns: |
| 722 | + usm_narray: |
| 723 | + An array containing the element-wise logical XOR results. |
| 724 | +""" |
| 725 | +logical_xor = BinaryElementwiseFunc( |
| 726 | + "logical_xor", |
| 727 | + ti._logical_xor_result_type, |
| 728 | + ti._logical_xor, |
| 729 | + _logical_xor_docstring_, |
| 730 | +) |
585 | 731 |
|
586 | 732 | # B19: ==== MULTIPLY (x1, x2)
|
587 | 733 | _multiply_docstring_ = """
|
|
615 | 761 | )
|
616 | 762 |
|
617 | 763 | # U25: ==== NEGATIVE (x)
|
618 |
| -# FIXME: implement U25 |
| 764 | +_negative_docstring_ = """ |
| 765 | +negative(x, out=None, order='K') |
| 766 | +
|
| 767 | +Computes the numerical negative for each element `x_i` of input array `x`. |
| 768 | +Args: |
| 769 | + x (usm_ndarray): |
| 770 | + Input array, expected to have numeric data type. |
| 771 | + out (usm_ndarray): |
| 772 | + Output array to populate. Array must have the correct |
| 773 | + shape and the expected data type. |
| 774 | + order ("C","F","A","K", optional): memory layout of the new |
| 775 | + output array, if parameter `out` is `None`. |
| 776 | + Default: "K". |
| 777 | +Return: |
| 778 | + usm_ndarray: |
| 779 | + An array containing the negative of `x`. |
| 780 | +""" |
| 781 | + |
| 782 | +negative = UnaryElementwiseFunc( |
| 783 | + "negative", ti._negative_result_type, ti._negative, _negative_docstring_ |
| 784 | +) |
619 | 785 |
|
620 | 786 | # B20: ==== NOT_EQUAL (x1, x2)
|
621 | 787 | _not_equal_docstring_ = """
|
|
647 | 813 | )
|
648 | 814 |
|
649 | 815 | # U26: ==== POSITIVE (x)
|
650 |
| -# FIXME: implement U26 |
| 816 | +_positive_docstring_ = """ |
| 817 | +positive(x, out=None, order='K') |
| 818 | +
|
| 819 | +Computes the numerical positive for each element `x_i` of input array `x`. |
| 820 | +Args: |
| 821 | + x (usm_ndarray): |
| 822 | + Input array, expected to have numeric data type. |
| 823 | + out (usm_ndarray): |
| 824 | + Output array to populate. Array must have the correct |
| 825 | + shape and the expected data type. |
| 826 | + order ("C","F","A","K", optional): memory layout of the new |
| 827 | + output array, if parameter `out` is `None`. |
| 828 | + Default: "K". |
| 829 | +Return: |
| 830 | + usm_ndarray: |
| 831 | + An array containing the values of `x`. |
| 832 | +""" |
| 833 | + |
| 834 | +positive = UnaryElementwiseFunc( |
| 835 | + "positive", ti._positive_result_type, ti._positive, _positive_docstring_ |
| 836 | +) |
651 | 837 |
|
652 | 838 | # B21: ==== POW (x1, x2)
|
653 |
| -# FIXME: implement B21 |
| 839 | +_pow_docstring_ = """ |
| 840 | +pow(x1, x2, out=None, order='K') |
| 841 | +
|
| 842 | +Calculates `x1_i` raised to `x2_i` for each element `x1_i` of the input array |
| 843 | +`x1` with the respective element `x2_i` of the input array `x2`. |
| 844 | +
|
| 845 | +Args: |
| 846 | + x1 (usm_ndarray): |
| 847 | + First input array, expected to have a numeric data type. |
| 848 | + x2 (usm_ndarray): |
| 849 | + Second input array, also expected to have a numeric data type. |
| 850 | +Returns: |
| 851 | + usm_ndarray: |
| 852 | + an array containing the element-wise result. The data type of |
| 853 | + the returned array is determined by the Type Promotion Rules. |
| 854 | +""" |
| 855 | +pow = BinaryElementwiseFunc( |
| 856 | + "pow", ti._pow_result_type, ti._pow, _pow_docstring_ |
| 857 | +) |
654 | 858 |
|
655 | 859 | # U??: ==== PROJ (x)
|
656 | 860 | _proj_docstring = """
|
|
738 | 942 | # FIXME: implement U31
|
739 | 943 |
|
740 | 944 | # U32: ==== SQUARE (x)
|
741 |
| -# FIXME: implement U32 |
| 945 | +_square_docstring_ = """ |
| 946 | +square(x, out=None, order='K') |
| 947 | +
|
| 948 | +Computes `x_i**2` (or `x_i*x_i`) for each element `x_i` of input array `x`. |
| 949 | +Args: |
| 950 | + x (usm_ndarray): |
| 951 | + Input array, expected to have numeric data type. |
| 952 | + out ({None, usm_ndarray}, optional): |
| 953 | + Output array to populate. |
| 954 | + Array have the correct shape and the expected data type. |
| 955 | + order ("C","F","A","K", optional): |
| 956 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 957 | + Default: "K". |
| 958 | +Returns: |
| 959 | + usm_ndarray: |
| 960 | + An array containing the square `x`. |
| 961 | + The data type of the returned array is determined by |
| 962 | + the Type Promotion Rules. |
| 963 | +""" |
| 964 | + |
| 965 | +square = UnaryElementwiseFunc( |
| 966 | + "square", ti._square_result_type, ti._square, _square_docstring_ |
| 967 | +) |
742 | 968 |
|
743 | 969 | # U33: ==== SQRT (x)
|
744 | 970 | _sqrt_docstring_ = """
|
|
0 commit comments