Download the PHP package apollonin/numphp without Composer

On this page you can find all versions of the php package apollonin/numphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package numphp

Numphp

Build Status Latest Stable Version Total Downloads License codecov Maintainability Test Coverage

Numphp is a library for number manipulations. If you have an array of numbers, numphp gives you an ability to perform a wide range of useful operations.

Contributions are highly appreciated.

Installation

With composer

Available features

Arrays

np_array also has classical array behaviour. So you are able to iterate through it as usual.

Matrix

Matrix is a special case of arrays. At the moment, we only support 2d matrices. Full support for n-dimensional matrices is on the way.

You can perform all the same operations and comparisons as with arrays. Refer to Matrix section below in usage examples.

Dimensional Manipulation

You are able to change dimensions for existed array or matrix. Use flatten or reshape methods.

Random Module

Numphp also provides convenient ways to generate new np_arrays and populate them with random values. Available methods are

If size parameter is given, returns np_array with appropriate elements. Otherwise, it returns single random value.

Generators

For quick stub array creation you may use these convenient predefined methods

Usage Examples

Indexing

create new array

Get items by their indexes

To get item as single value - pass index as single value as well

Get items by condition

You may also access index by string representations of comparison.

Important note about conditional indexing: conditional operator returns masking array:

You also can pass another array as an argument. In this case the comparison will be applied for each element respectively.

Get items by conditions

b_and - "bitwise" and

Array-like behaviour

You may also iterate your np_array object as usual

Slicing

You may get slices of your np_array in a very convenient way. Just pass string formatted like start:[stop][:step] as index and you'll get result.

You can even skip stop and step values, which means: get all items from start to the end of array.

You may even skip start value; it will be considered as 0 in this case

Negative start or stop means indexes count from the end of array

Set item values

Set items by indexes

Set items by conditions

Set items by slice

Adding new items

Of course, you may add new items as usual

Math operations

You are able to apply certain math operations to the whole array. It will apply to each element.

You may also perform math operation under two np_arrays

Or event np_array and normal array!

Random module

Create array with random floats

Array with random integers

Generators module

create array full of zeros, ones or fill_value

Create array within a range and given interval

Generate N Fibonacci numbers

Generate numbers according to formula

Provide callable as a first argument. It must return value, that will be used in sequence.

Generate matrix with given diagonal

Matrix operations

Generally the syntax and features are the same as for arrays

Creation

Indexing

Indexing is done in respect to X-axis (rows)

Slicing

Comparisons

Keep in mind 'masking' feature

Changing values

Math operations

Get shape of matrix

And if you just need count of dimensions

Diagonal

or you can set offset for diagonal

Changing dimensions

Flatten matrix

You can get 1-D array from matrix.

Reshaping

You also can change current shape of matrix to any desired.

Concatenation

concatenate arrays

You can concatenate two or more arrays into one. Logic is similar to array_merge native php method

concatenate matrixes

The same logic can be applied to matrixes


All versions of numphp with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package apollonin/numphp contains the following files

Loading the files please wait ....