semvec/pypi-packages huggingface dataset:
pindex 0.5.1
An awesome tool for indexing matrices. propose a new concept “single index” (as in matlab) to index the elements from matrices. exchange python-style index(begin with 0) with matlab-style index(begin with 1)
License: MIT
Keywords: Index,Matrix,Single Index,Style of Index

Introduction
=============

Abstract
----------
An awesome tool for indexing matrices. propose a new concept “single index” (as in matlab) to index the elements from matrices. exchange python-style index(begin with 0) with matlab-style index(begin with 1)

Keywords
----------
Index, Matrix, Single Index, Style of Index


New feature: 

    1. fix some bugs

Feature:

    1. propose single index
    2. change to (back from) matlab-style index
    3. arithmetic of the index


Content
=========

Classes::

    SingleIndex: wrapper of int, list, slice
    Index: array of SingleIndex


Interface::

    Arith: arithmetic of index


function::

    irange: interval-like index


Grammar
=========

Basic grammar
-------------

import::

    import pindex   # python for index

Example::

    ind = SingleIndex([1,2,3])  # construct a single index
    s = ind('helloworld')   # index(array) == array[index]
    print(s)
    
    A = np.array([[1,2,6],[3,4,5]])
    B = ind(A)
    print(B)    # index matrix with single index as in matlab

    ind.py2matlab()        # change to matlab style
    s = ind('helloworld')
    print(s)  # output: hel

    ind = Index([1,2,3])    # for 1dim array, Index == SingleIndex
    ss = ind('helloworld')
    print(ss)

    ind = Index(([1,2],[3,4]))  # construct multi-index
    try:
        ss = ind(['hello', 'world'])
        print(ss)
    except:
        ind.py2matlab()
        ss = ind(['hello', 'world'])
        print(ss)


Attention::

    ind = SingleIndex([1,2,3])
    A = [[1,2,6],[3,4,5]]
    B = ind(A)  # pindex.py thinks A is a list (of lists, with length 2) instead of matrix
    ind = Index(([0,1],[0,1]))   # this is ok, since you use multi-index
fcool 0.1.3
A cool tool for functional programming. Funtions can be operated directly with definition domain that can be used in type testing
License: MIT
Keywords: Functional Programming,Type Testing

Introduction
=============

Abstract
----------
A cool tool for functional programming. Operating Functions as in math. Type testing is implemented in an awsome way.

Keywords
----------
Functional Programming, Type Testing

Feature:

    1. function with domain, the domain can be used to type testing
    2. operator on functions, for example, f + g: x -> f(x) + g(x) where f, g,  f+g are functions
    3. to glue functions with glue function or method that can be used to define piecewise functions
    4. no 3rd part requirement 
    5. implement memoization in oo way.
    6. use MathFunction for math functions where keyword arguments are deprecated.  (new in this version)


Content
=========

Classes::

    BaseFunction -> Type (or Domain), Function
    BaseFunction: func: function (or number)
    Function: func,
              domain: Type, the definition domain of func

Functions::

    Interval(a:num, b:num) -> Type
    restrict(t:Type) -> decorator(f:function -> Function(f, t))

Constants::

    TURE, FALSE(Type) represent universal set, empty set

Grammar
=========

Basic grammar
-------------

import::

    import fcool (or from fcool import *)

Define Function with domain::

    F = Function(lambda x:x, Type(lambda x:x>2))
    F(3)

Operators on Functions::

    (F + F)(3)
    (F * F)(4)
    (2 * F)(3)

2D Functions and Types::

    f = 3     # or lambda x,y: 3
    g = lambda x,y: 2/x
    t = Type(lambda x:x<5 and isinstance(x, int)) * TRUE  # define type(domain) and functions on it
        <=> Type(lambda x, y:x<5) & Type(lambda x, y:isinstance(x, int))
    G = Function(g, t)
    F = Function(f, t)

Memoize::

   
   f.memoize()    # f is the object of BaseFunction
   f.unmemoize()  # prohibit to use memo (memo is not deleted)
   f.del_memo()   # just clear the memo, will update the memo in next time
   f.forget()     # f.del_memo() and f.unmemoize()


Advanced Grammar
----------------

Glue Functions::

    print(G.glue(F)(3,4), glue(G, F)(3,4))    # glue functions

    ID = Function(lambda x:x)
    print(ID.compose(F)(3,4))      # composition

Type testing with restrict decorator::

    @restrict(Interval(1,2))       # restriction decorator
    def f(x):
        return x

    print(f(1))
    try:
        print(f(3))
    except Exception as ex:
        print(ex)

    G=Function(lambda x:x)
    print(G(3))
    G = G | Interval(1,2)           # restriction method   
    print(G(3))