{"id":17495742,"url":"https://github.com/iraikov/tensor","last_synced_at":"2026-01-06T02:35:15.099Z","repository":{"id":8001651,"uuid":"9409101","full_name":"iraikov/tensor","owner":"iraikov","description":"Standard ML tensor/multidimensional array library","archived":false,"fork":false,"pushed_at":"2020-05-27T17:03:19.000Z","size":172,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T16:28:30.700Z","etag":null,"topics":["linear-algebra","matrix-library","mlton","sparse-matrix","standard-ml","tensor"],"latest_commit_sha":null,"homepage":null,"language":"Standard ML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iraikov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-13T05:23:13.000Z","updated_at":"2024-03-28T21:31:32.000Z","dependencies_parsed_at":"2022-07-11T04:46:07.446Z","dependency_job_id":null,"html_url":"https://github.com/iraikov/tensor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Ftensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Ftensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Ftensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Ftensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iraikov","download_url":"https://codeload.github.com/iraikov/tensor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245525820,"owners_count":20629832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linear-algebra","matrix-library","mlton","sparse-matrix","standard-ml","tensor"],"created_at":"2024-10-19T14:26:30.020Z","updated_at":"2026-01-06T02:35:15.057Z","avatar_url":"https://github.com/iraikov.png","language":"Standard ML","funding_links":[],"categories":[],"sub_categories":[],"readme":"tensor\n======\n\nStandard ML tensor/multidimensional array library.\n\nINDEX         -Signature-\n\nIndices are a enumerable finite set of data with an order and a map to\na continous nonnegative interval of integers.  In this implementation\neach index is a list of integers,\n\n        [i1,...,in]\n\nand each set of indices is defined by a shape, which has the same\nshape of an index but with each integer incremented by one\n\n        shape = [k1,...,kn]\n        0 \u003c i1 \u003c k1\n\ntype storage = RowMajor | ColumnMajor\norder : storage\n\n        Identifies:\n                1) the underlying algorithms for this structure\n                2) the most significant index\n                3) the index that varies more slowly\n                4) the total order\n        RowMajor means that first index is most significant and varies\n        more slowly, while ColumnMajor means that last index is the most\n        significant and varies more slowly. For instance\n                RowMajor =\u003e [0,0]\u003c[0,1]\u003c[1,0]\u003c[1,1] (C, C++, Pascal)\n                ColumnMajor =\u003e [0,0]\u003e[1,0]\u003e[0,1]\u003e[1,1] (Fortran)\n\nlast shape\nfirst shape\n        Returns the last/first index that belongs to the sed defined by\n        'shape'.\n\ninBounds shape index\n        Checkes whether 'index' belongs to the set defined by 'shape'.\n\ntoInt shape index\n        As we said, indices can be sorted and mapped to a finite set of\n        integers. 'toInt' obtaines the integer number that corresponds to\n        a certain index.\n\nindexer shape\n        It is equivalent to the partial evaluation 'toInt shape' but\n        optimized for 'shape'.\n\nnext shape index\nprev shape index\nnext' shape index\nprev' shape index\n        Obtain the following or previous index to the one we supply.\n        next and prev return an object of type 'index option' so that\n        if there is no such following/previous, the output is NONE.\n        On the other hand, next'/prev' raise an exception when the\n        output is not well defined and their output is always of type\n        index. next/prev/next'/prev' raise an exception if 'index'\n        does not belong to the set of 'shape'.\n\nall shape f\nany shape f\napp shape f\n        Iterates 'f' over every index of the set defined by 'shape'.\n        'all' stops when 'f' first returns false, 'any' stops when\n        'f' first returns true and 'app' does not stop and discards the\n        output of 'f'.\n\ncompare(a,b)\n        Returns LESS/GREATER/EQUAL according to the total order which\n        is defined in the set of all indices.\n  \u003c,\u003e,eq,\u003c=,\u003e=,\u003c\u003e\n        Reduced comparisons which are defined in terms of 'compare'.\n\n+,-\n        Index addition and subtraction\nincr,decr\n        Index increment and decrement by a constant\n\nvalidShape t\nvalidIndex t\n        Checks whether 't' conforms a valid shape or index.\n\niteri shape f\n\n\nTENSOR         -Signature-      \n\nPolymorphic tensors of any type. With 'tensor' we denote a (mutable)\narray of any rank, with as many indices as one wishes, and that may\nbe traversed (map, fold, etc) according to any of those indices.\n\ntype 'a tensor\n        Polymorphic tensor whose elements are all of type 'a.\n\nval storage = RowMajor | ColumnMajor\n        RowMajor = data is stored in consecutive cells, first index\n        varying fastest (FORTRAN convention)\n        ColumnMajor = data is stored in consecutive cells, last\n        index varying fastest (C,C++,Pascal,CommonLisp convention)\n\nnew ([i1,...,in],init)\n        Build a new tensor with n indices, each of sizes i1...in,\n        filled with 'init'.\n\nfromArray (shape,data)\nfromList (shape,data)\n        Use 'data' to fill a tensor of that shape. An exception is\n        raised if 'data' is too large or too small to properly\n        fill the vector. Later use of a 'data' array is disregarded\n        -- one must think that the tensor now owns the array.\n\nlength tensor\nrank tensor\nshape tensor\n        Return the number of elements, the number of indices and\n        the shape (size of each index) of the tensor.\n\ntoArray tensor\n        Return the data of the tensor in the form of an array.\n        Mutation of this array may lead to unexpected behavior.\n\nsub (tensor,[i1,...,in])\nupdate (tensor,[i1,...,in],new_value)\n        Access the element that is indexed by the numbers [i1,..,in]\n\napp f a\nappi f a\n        The same as 'map' and 'mapi' but the function 'f' outputs\n        nothing and no new array is produced, i.e. one only seeks\n        the side effect that 'f' may produce.\n\nmap2 operation a b\n        Apply function 'f' to pairs of elements of 'a' and 'b'\n        and build a new tensor with the output. Both operands\n        must have the same shape or an exception is raised.\n        The procedure is sequential, as specified by 'storage'.\n\nfoldl operation a n\n        Fold-left the elements of tensor 'a' along the n-th\n        index.\n\nall test a\nany test a\n        Folded boolean tests on the elements of the tensor.\n\ninsert a b index\n        Inserts b into a starting at the given index\n        a and b must be of the same rank, with b smaller than a\n\ncat a b int\n        Concatenates a and b along the given axis\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Ftensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firaikov%2Ftensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Ftensor/lists"}