1.0.3 • Published 2 years ago

protom v1.0.3

Weekly downloads
-
License
Creative Commons ...
Repository
gitlab
Last release
2 years ago

logo Protom

license version

Abstract

Protom is mathematical base to work with modern concept such like Machine Learning, Deep Learning, Quantum machine, 3D render or Data Analyze. The goal is to teach one language for many applications with an identical process. Behind your jobs, Protom can optimize the algorithms with the same solutions: balance between CPU / GPU / RAM, compression and standardization of data, easy import / export and compatibility.

The core of Protom is developed in Javascript. You can use it in your web and/or desktop applications. The Gitlab deposit is open source, you can fork or contribute. I will ask you to create units tests and comment your code.

Prerequisites

You should have to install Node.js on your computer (Windows / Linux / Mac / ARM systems).

Download here

Install

You can clone the project and install the node modules:

git clone https://gitlab.com/Yarflam/protom.git &&\
cd protom &&\
npm install

How to use it?

I write some papers in the /docs/papers folder:

Explore

Tree view

  • core
    • bayes
      • Bayes.js: first test to apply Bayes' theorem
    • helpers
      • gentools.js: access to random tools
        • Lack of clarity -> refactoring is required
    • quantum
      • Qubit: simple quantum unit.
      • Qureg: Quantum Register (aka Q-System or Q-Space) - manipulate entranglement, quantum gates and measure.
    • struct
      • controllers
        • Activation.js: activation functions
          • { Machine Learning }
        • Caller.js
          • Role: call a specific function in data type classes
          • Example: convert to another type
        • Operation.js
          • Role: perform a mathematical operation
        • Optimizer.js: use loss functions to minimize the errors
          • Example: Gradient descent
          • { Machine Learning }
      • datatypes
        • Complex.js: define a complex number
          • Example: 4 + 2i
        • Matrix.js: define a matrix
          • Notice: division is not supported
          • Example: [ 2, 5, 11 ]
        • Num.js: define a number
          • Example: 133.7
        • Quaternion.js: define a quaternion
          • Example: 20 + 21i + 7j + 8k
        • Tensor.js: define a tensor
          • Example: [ <vect1>, <vect2> ... <vectN> ]
        • Vector.js: define a vector
          • Example: < 3.1, 4.15, 1, 0, 1 >
      • nodes
        • Const: constants
        • Placeholder: dynamic values
        • Var: variables
    • Protom.js: main application.
      • Role: manage the structures and orchestrates the operations
    • index.js & web.js: different entry points (Node.js or web front)
  • docs
    • draft
      • zun3D: 3D engine
    • papers
      • DevelopmentPaper.ipynb: general
      • Quantum Programming.ipynb: quantum mechanics application
  • public: front pages (web)
  • sandbox:
    • dev-playground.js: my tests on the Protom core (Yarflam)
    • search-bayes: Test in application of Bayes' theorem
    • search-map.js & search-map2.js: generate maps in command line (just for fun)
  • test: automated tests with Jest
    • protom-func.spec.js: check the Protom core
    • struct-datatypes.spec.js: check the data types (num, complex, quaternion, vector, matrix, tensor)
    • struct-nodes.spec.js: check the nodes (const, var, placeholder)

Data types

TypeAboutRefers toExample
NumSimple number2.75
ComplexComplex number (real + imaginary)Num4 + 2i
QuaternionQuaternion (w, i, j, k)Num20 + 21i + 7j + 8k
VectorOne dimension DNum, Complex, Quaternion<0.73, 0.12>
MatrixTwo dimensions DxDNum, Complex, Quaternion[[ 1, 2 ], [ 3, 4 ]]
TensorMultiple dimensions DxDx...DNum, Complex, Quaternion, Vector, Matrix[[ 1, 2 ], [ 3, 4 ]]

Nodes

NodeAbout
ConstConstant value
VarDynamic value, it can evolve by optimizer algorithms
PlaceholderFree space to have fill by inputs

Controllers

ControllerAboutElements
ActivationActivation functionGaussHeavisideLeaky-ReluReLUSigmoid / LogisticSoftmax N.I.Softplus N.I.Softsign N.I.SwishTanh
OptimizerAlgorithm to optimize learningAdadeltaAdagradAdamAdamaxFtrlGradient DescentMomentumProximal AdagradProximal Gradient DescentRMS PropSDCASyncReplicas
LossLoss function
CallerCall a specific method of node
OperationCalculate node in the graph

Engines

Summary

NameAbout
Neural NetworkMultilayer perceptron
Quantum SystemSimulation of a quantum computer
3D renderOrthogonal projections
Data toolsStatistics

Quantum System

In development...

Standards

Sequence of Q-bytes:

All gates are written in big-endian - an easy-to-use common representation - but they are executed in little-endian.

Compatibility with numbers:

You can use Number (or Num object) and Complex number.

Gates

GatesCodeParamsMatrix
PauliX / SigmaXX1[[ 0, 1 ], [ 1, 0 ]]
PauliY / SigmaYY1[[ 0, -i ], [ i, 0 ]]
PauliZ / SigmaZZ1[[ 1, 0 ], [ 0, -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 1, 0, 0, 0 ],
 [ 0, 0, 0, 0, 0, 0, 1, 0 ],
 [ 0, 0, 0, 0, 0, 1, 0, 0 ],
 [ 0, 0, 0, 0, 0, 0, 0, 1 ]]

Authors

  • Yarflam - initial work

License

The project is licensed under Creative Commons (BY-NC-SA) - see the LICENSE.md file for details.

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago