Skip to main content

Digital Soul

Unified Compute Platform - CPU, GPU, FPGA, Quantum Computing

DigitalSoul is a Python module designed to bridge the gap between classical, quantum, and potentially hardware-accelerated computation. It provides flexible data structures and a node-based execution model, allowing you to express computations that can be seamlessly executed across CPU, GPU, quantum simulators, and potentially FPGAs.

Key Features

  • Customizable Data Types: Define Boolean (Bool), integer (Int, UInt), floating-point (Float), quantum states (Qudit), quantum gates (QuantumGate), and multidimensional tensors (Tensor) to suit your computational needs.
  • Node-Based Computation: Build computational graphs using nodes that represent operations (e.g., LogicalAnd, LogicalOr). Nodes manage input/output data through "Edges".
  • Multi-Backend Execution: Execute computations using NumPy, Cupy (for GPU), TensorFlow, and internal quantum simulator
  • VHDL Transpilation: Translate computational graphs into VHDL code, opening the door for hardware synthesis on FPGAs.

Installation

From PyPI

pip install setuptools wheel pybind11
pip install DigitalSoul

Also download numpy, cupy and tensorflow if you want to access richer executors

Quick Example

import DigitalSoul as ds

e1=ds.Edge(ds.Bool(False))
e2=ds.Edge(ds.Bool(False))
e3=ds.Edge(ds.Bool(None))
e4=ds.Edge(ds.Bool(True))
e5=ds.Edge(ds.Bool(None))
e6=ds.Edge(ds.Bool(True))
e7=ds.Edge(ds.Bool(None))
e8=ds.Edge(ds.Bool(None))

print("\n"*4)
or_gate=ds.LogicalOr((e1,e2), e3)
xor_gate=ds.LogicalXor((e3,e4), e8)
not_gate=ds.LogicalNot(e8,e5)
and_gate1=ds.LogicalAnd((e5,e6), e7)
print(e7)
print("Executing function")
and_gate1.execute("cp")
print(e7)
and_gate1.q_stream()
print("\n",e7.sv)
print("\n"*3)
print(and_gate1.transpile("vhdl"))

output:

Edge_6 holding Bool_6 value=None entropy=1
Executing function
Edge_6 holding Bool_6 value=False entropy=0

 2-levelQudit_3 value=[1. 0.] entropy=0




library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity main is
Port(
	Bool_1:in std_logic;
	Bool_0:in std_logic;
	Bool_3:in std_logic;
	Bool_5:in std_logic;
	Bool_6:out std_logic
);
end main;
architecture Behavioral of main is
	signal Bool_2:std_logic;
	signal Bool_4:std_logic;
	signal Bool_7:std_logic;
begin
	Bool_7<=Bool_2 xor Bool_3;
	Bool_2<=Bool_0 or Bool_1;
	Bool_4<=not(Bool_7);
	Bool_6<=Bool_4 and Bool_5;
end architecture Behavioral;

As you can see from output, the value of output edge(e7, shown as Edge_6) is uncertain before computation. Hence, it has maximum entropy. As soon as value is computed and certainly known, the entropy is zero. Then, program is capable of generating VHDL code of corresponding computational graph. Additionally, it simulated quantum equivalent of the computaitonal graph with Non-Hermetian Gates

Tree

|----Bool-------------------|
|                           |---__init__(value=None)
|                           |---entropy()
|                           |---name()
|                           |---__repr__()
|
|
|----Int--------------------|
|                           |---__init__(value=None,depth=32)
|                           |---bounds()
|                           |---entropy()
|                           |---name()
|                           |---__repr__()
|
|
|----UInt-------------------|
|                           |---__init__(value=None,depth=32)
|                           |---entropy()
|                           |---name()
|                           |---__repr__()
|
|
|----Float------------------|
|                           |---__init__(value=None,exponent=8,mantissa=23)
|                           |---float_info()
|                           |---entropy()
|                           |---name()
|                           |---__repr__()
|
|
|----Qudit------------------|
|                           |---__init__(value,num_levels=None,utol=1e-9)
|                           |---num_levels()
|                           |---entropy()
|                           |---name()
|                           |---__repr__()
|                           |---__and__(other)
|
|
|----QuantumGate(object)----|
|                           |---__init__(data,utol=1e-8)
|                           |---__repr__()
|                           |---data()
|                           |---value()
|                           |---set_data(data,utol)
|                           |---num_levels()
|                           |---entropy()
|                           |---name()
|                           |---__and__(other)
|                           |---__call__(sv)
|
|
|----NonHermitianGate-------|
|                           |---__init__(data)
|                           |---value()
|                           |---name()
|                           |---__call__(sv)
|                           |---__repr__()
|
|
|----Tensor(object)---------|
|                           |---__init__(value,dtype=Float(0),shape=(1,))
|                           |---entropy()
|                           |---__repr__()
|                           |---name()
|
|
|----Edge(object)-----------|
|                           |---__init__(sculk)
|                           |---vhdl()
|                           |---twoscpl(x
|                           |---name()
|                           |---__repr__()
|                           |---entropy()
|                           |---set_predecessor(node)
|                           |---unpack(executor="np")
|                           |---q_info()
|
|
|----Node(object)-----------|
|                           |---__init__(in_terminals,out_terminals,ops)
|                           |---execute(executor="np")
|                           |---edge_accumulator()
|                           |---input_accumulator()
|                           |---node_accumulator()
|                           |---transpile(target="vhdl")
|                           |---qv_contemplate()
|                           |---q_stream()
|
|
|----LogicalAnd(Node)-------|
|                           |---__init__(in_terminals,out_terminals,ops)
|
|----LogicalOr(Node)--------|
|                           |---__init__(in_terminals,out_terminals,ops)
|
|----LogicalXor(Node)--------|
|                            |---__init__(in_terminals,out_terminals,ops)
|
|----LogicalNot(Node)--------|
|                            |---__init__(in_terminals,out_terminals,ops)
|
|----QN---------------------|
                            |---i
                            |---x
                            |---y
                            |---z
                            |---h
                            |---cx
                            |---ccx

  

Roadmap

  • Implementing more nodes
  • Improved hardware synthesis flow with VHDL transpilation.
  • Custom node creation guide.

Contributing

We welcome contributions to DigitalSoul!

License

DigitalSoul is distributed under the MIT License (see LICENSE.md).

Release files for DigitalSoul 1.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DigitalSoul 1.1.9
File Size Uploaded
DigitalSoul-1.1.9.tar.gz 13.8 kB Details

Release files / DigitalSoul-1.1.9.tar.gz

Download URL DigitalSoul-1.1.9.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1e9d7568546c2b0c6a497fab093f3a4643d251fab08367bc78b7e63286d791cb
BLAKE2b-256 checksum
How to use checksums
901519cf417568ba02a30888330c5348182f0d92ff79f6a9f048d1eac05c48e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.1.9 This release

1 release file

1.1.8

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page