GithubHelp home page GithubHelp logo

zephyrproject-rtos / zscilib Goto Github PK

View Code? Open in Web Editor NEW
123.0 13.0 23.0 2.88 MB

An open-source scientific computing library for embedded systems running Zephyr OS or standalone.

Home Page: https://zephyrproject-rtos.github.io/zscilib/

License: Apache License 2.0

CMake 0.27% C 99.73%
zephyr embedded arm module

zscilib's People

Contributors

gmarull avatar marti-riba-pons avatar microbuilder avatar nashif avatar nordicjm avatar xenuiswatching avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zscilib's Issues

Vector API

The following core vector functions should be added, inline documented, with basic unit test coverage and used in at least one sample application.

Initialisation

  • zsl_vec_init
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_from_arr
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_get_subset
    • Documentation
    • Unit tests
    • Sample

Mathematical functions

  • zsl_vec_add
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_sub
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_neg
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_sum
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_magn
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_scalar_add
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_scalar_mult
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_scalar_div
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_dist
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_dot
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_norm
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_to_unit
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_cross
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_sum_of_sqrs
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_mean (component-wise mean of array of vectors)
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_ar_mean (arithmetic mean of a single vector)
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_rev
    • Documentation
    • Unit tests
    • Sample

Checks and comparisons

  • zsl_vec_is_equal
    • Documentation
    • Unit tests
    • Sample
  • zsl_vec_is_nonneg
    • Documentation
    • Unit tests
    • Sample

Matrix API

The following core matrix functions should be added, inline documented, with basic unit test coverage and used in at least one sample application.

Initialisation

  • zsl_mtx_init
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_from_arr
    • Documentation
    • Unit tests
    • Sample

Access functions

  • zsl_mtx_get
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_set
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_get_row
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_set_row
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_get_col
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_set_col
    • Documentation
    • Unit tests
    • Sample

Mathematical functions

  • zsl_mtx_unary_op
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_unary_func
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_binary_op
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_binary_func
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_add
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_add_d
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_sub
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_sub_d
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_mult
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_scalar_mult
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_trans
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_adjoint
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_deter
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_inv
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_eigen
    • Documentation
    • Unit tests
    • Sample

Checks and comparisons

  • zsl_mtx_min
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_max
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_min_idx
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_max_idx
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_is_equal
    • Documentation
    • Unit tests
    • Sample
  • zsl_mtx_is_nonneg
    • Documentation
    • Unit tests
    • Sample

Physics API: Misc

Misc. (misc.c)

  • Percent error (statistics?)
  • Efficiency
  • Quadratic formula

Probability API

  • Uniform probability density function (PDF)
  • Uniform distribution mean
  • Uniform distribution variance
  • Uniform cumulative distribution function (CDF)
  • Normal probability density function (PDF)
  • Normal cumulative distribution function (CDF)
  • Inverse Error function
  • Inverse normal cumulative distribution function
  • Binomial coefficients
  • Binomial probability density function (PDF)
  • Binomial distribution mean
  • Binomial distribution variance
  • Binomial cumulative distribution function (CDF)
  • Information entropy
  • Bayes' Theorem

Follow up on the zscilib blog post

Hi @microbuilder,

This is not an issue and I'm basically just hijacking this communication channel so feel free to disregard.

I read your blog post on the zephyr web page and I'm sort of walking on your footsteps trying to get a microcontroller to calculate the color temperature. I actually thought this was going to be a quick project before reading your post.

I'm not up to speed yet here but I'll risk a couple questions.

I'm trying to get a feel for what kind of sensor I would need to get a good light temperature measurement and so be able to match a studio light to the sun.

You mention that an RGB sensors is not precise enough to get a good temperature calculation.

  1. I'm guessing a sensor with XYZ output like the TCS3430 would be as bad as a sensor with RGB output right?

One of the critic you have with RGB sensors is that the response of the individual 3 channels is too wide frequency wise and also the fact that they overlap.

  1. Based on your experience, would 8 channels instead of 3 like the AS7341 be enough to get a decent temperature reading so that our eyes would not see the difference between a light that we sensed the temperature and another light we set to the same sensed values?

  2. If you were so guess the lowest cost sensor that could give a precise temperature reading what would it be?

Thank you if you get time through this and give some thoughts, if not, thank you for the blog post and the zephyr library.

Measurements: Proof of Concept

There is a desire to introduce a standard mechanism to represent measurements in zscilib, where the following information can be specified for one or more measurement values of the same 'type':

  • The specific measurement type (consisting of a base and extended type indicator)
  • The SI unit and scale that this measurement uses
  • The C type used to represent this measurement in memory
  • Any key meta-data required to accurately interpret the measurement value(s)

It should be as concise as possible, due to memory limitations on small embedded systems, but expressive enough to communicate all essential information about the measurement value(s).

Base and Extended Measurement Types

A system of 'base' and 'extended' data types have been added via: measurement/base.h. The base groupings in enum zsl_mes_type should be reviewed for clarity and coherence.

SI Units

A first pass at representing base, derived and compound SI units has been implemented via measurement/unit.h. This list requires further review and analysis.

How to implement void polyfit(const double *xvals, const double *yvals, int n, int order, double *coeffs) in zsclib

Hello, guys!
I'm currently porting an algorithm library to an MCU , which is implemented based on GSL (GNU Scientific Library).
The library includes a function

void polyfit(const double *xvals, const double *yvals, int n, int order, double *coeffs)

commonly found in NumPy and MATLAB. I'm not very familiar with ZSCLib and GSL.
I would like to know how to proceed step by step to use polyfit in ZSCLib.
Could you provide me with a rough idea or guidance?

Physics API

Physics APIs

  • Create headers and empty source files per 'group'

Functions Required

Atomic (atomic.c)

  • Nuclear radius
  • Radioactive decay
  • Bohr orbital radius
  • Bohr orbital velocity
  • Bohr orbital energy
  • Bragg's law

Dynamics (dynamics.c)

  • Newton's second law
  • Friction (Fn, uK/s)
  • Normal force on an incline (in newtons based on mass, gravity, angle)
  • Period of a simple pendulum
  • Maximum speed of a simple pendulum
  • Tension force
  • Lever physics

Electrical Components (eleccomp.c)

  • Capacitance
    • Charge, voltage
    • Area, distance
  • Energy stored in capacitor
  • Energy stored in inductor
  • Transformer voltage to turns
  • Resistor/inductor/capacitor voltage relationship
  • Resistor/capacitor charge/discharge
    • Current during charge
    • Current during discharge
    • Charge (in coulombs) during charge
    • Charge (in coulombs) during discharge
  • Inductor/resistor current

Electric (electric.c)

  • Charge density
  • Coulomb's law
  • Electric force from a charge
  • Electric field
  • Potential energy
  • Coulombs potential
  • Electric flux

Energy (energy.c) ++

  • Kinetic energy
  • Rotational kinetic energy
  • Gravitational potential energy
  • Elastic potential energy
  • Power (work/energy over time)
  • Energy lost to friction
  • Mechanical energy
  • Final energy
  • Energy of a photon (via frequency)
  • Energy of a photon (via wavelenght)

Fluids (fluids.c)

  • Density (of substance in Kg/m^2)
  • Simple pressure (force, area)
  • Pressure in a fluid (at a certain height/depth, gravity, density, surf. pres.)
  • Archimede's Principle or bouyant force
  • Fluid flow rate proportion
  • Fluid force rate proportion
  • Bernoulli's equation
  • Volume flow rate

Gases (gases.c)

  • Average velocity of a gas
  • Ideal gas law
  • Boyle's law (relationship of pressure, volume)
  • Charles/Gay-Lussac law (relationship of pressure, volume)

Gravitation (gravitation.c) +++

  • Orbital period
  • Escape velocity
  • Gravitational acceleration
  • Orbital velocity
  • Gravitational force
  • Gravitational potential energy

Kinematics (kinematics.c) +++

  • Change in distance (initial velocity, time, acceleration)
  • Initial position (final position, initial velocity, acceleration, time)
  • Initial position 2 (final position, initial velocity, final velocity, acceleration)
  • Change in time (initial and final velocity, acceleration)
  • Instantaneous velocity (initial velocity, time, acceleration)
  • Velocity (initial velocity, distance, acceleration)
  • Initial velocity (final velocity, acceleration, time)
  • Initial velocity 2 (distance, acceleration, time)
  • Initial velocity 3 (final velocity, acceleration, distance)
  • Average velocity (distance, time)
  • Acceleration (initial and final velocity, time)
  • Kinetic energy

Magnetics (magnetics.c) ++

  • Magnetic force
  • Force on current carrying wire
  • Torque on current loop
  • Potential energy from a dipole
  • Orbital radius in magnetic field
  • Magnetic flux
  • Magnetic moment

Mass (Center) (mass.c)

  • Calculate the CoM of a group of objects based on their mass and distance from
    an arbitrary point

Momentum (momentum.c) ++

  • Calculate momentum (mass, velocity)
  • Impulse (force, time)
  • Change in momentum/force (mass, initial and final velocity)
  • Elastic collision (when two objects collide and bounce)
  • Inelastic collision (when two objects collide and stick)

Optics (optics.c)

  • Index of refraction
  • Snell's law
  • Focal length
  • Critical angle
  • Lens power
  • Lens magnification
  • Distance between objects via difraction of light

Projectiles (projectiles.c) +++

  • Horizontal and vertical velocity components (initial velocity, theta)
  • Total time of flight
    • Using gravity, y2, y1, Vy
      • First time
      • Second time
    • Using initial and final vertical velocity and gravity
  • Vertical motion: position at time (Vy, gravity, time, initial height)
  • Horizontal motion: horizontal change of distance at time
  • Trajectory: height at any horizontal position
  • Velocity (overall velocity from vertical and horizontal components)
  • Theta (and between vertical and horizontal velocity)
  • Range (distance travelled from ground using initial velocity, gravity, angle)

Rotation (rotation.c) +++

  • Change in theta (analog to distance in kinematics)
  • Change in distance
  • Turns (number of rotations)
  • Change in time (analog to time in kinematics)
  • Instantaneous angular velocity
  • Angular velocity
  • Average angular velocity
  • Tangencial velocity
  • Angular acceleration
  • Tangencial acceleration
  • Rotational kinetic energy
  • Period
  • Frequency
  • Centripetal acceleration (via radius and speed)
  • Centripetal acceleration (via radius and period)
  • Total acceleration
  • Power (torque multiplied by angular velocity)

Sound (sound.c) ++

  • Pressure amplitude
  • Decibels (sound level between two intensities of the same frequency)
  • Intensity (pressure amplitude, bulk modulus, density)
  • Shock wave angle (speed of sound and velocity through medium)
  • Doppler effect
  • Beats (frequency resulting from overlap of two similar frequencies)

Thermodynamics (thermo.c) ++

  • Temperature conversion (fahrenheit, celsius, kelvin)
  • Latent heat of fusion/vaporisation
  • Heat (in joules of a material based on mass, specific heat and delta temp)
  • Linear expansion of metal (length, alpha constant, change in temperature)
  • Mean free path
  • Efficiency of a heat engine (based on energy of hot and cold chambers)
  • Carnot engine proportion

Waves (waves.c)

TBD

Work (work.c)

  • Work done over an interval of distance and constant applied force
  • Work done cosine (as above but with x-component or on an incline)
  • Work done sine (as above but with y-component or on an incline)
  • Work-KE theorem

vectors: if statement always true

if (v->data[j] >= 1E-5 || v->data[j] <= 1E-5) {

The if statement will return always true if (x>=1E-5 || x<=1E-5) and as no logical effect

the correct code might be:
if (v->data[j] >= 1E-5 || v->data[j] <= -1E-5)
to ensure v->data[j] is not smaller then the epsilon range.

Physics API: Relativity

Relativity (relativity.c)

  • Time dilatation
  • Lorentz contraction
  • Relativistic momentum
  • Kinetic energy
  • Mass to energy
  • Lorenz velocity transformation
  • Relativistic doppler affect

Define an extensible data processing pipeline

Define a basic pipeline where raw sensor data can be pooled, processed via a number of specialized processing nodes, and then output as actionable data.

Exact architecture TBD. Filing this issue to track the task as it gets further defined.

Example A

  • Collect n synchronized samples (~same sample time) from an accelerometer, magnetometer and gyroscope
  • Run data through cleanup and normalization processing nodes
  • Run sanitized and normalized data through a specialized sensor fusion algorithm to output quaternions
  • Convert quaternions to Euler angles for human display

Example B

  • Configure an analog to digital converter
  • Normalize incoming sample values
  • Buffer n samples at the start of the pipeline
  • Run samples through a simple moving average filter processing node
  • Analyze normalized and averaged data with domain-specific processing node (analog data to rotation speed, saturation level, etc.)
  • Output final results to update a state machine, etc.

Statistics API

Functions

Each function requires proper documentation, and a corresponding unit test to test for normal and abnormal parameters and operating conditions, such as ensuring that correct error codes are returned for faulty inputs, etc.

  • Mean
  • Trimmed Mean
  • Weighted Mean
  • De-mean
  • Percentile
  • Median (ToDo: Ensure w/even number of samples, median = average of two center values)
  • Weighted Median
  • Quartile
  • Interquartile range
  • Mode
  • Data range
  • Mean Absolute Deviation
  • Median Absolute Deviation from the Median (more robust estimate of variability)
  • Variance
  • Standard deviation
  • Covariance
  • Covariance Matrix
  • Linear Regression (slope, intercept, correlation coefficient)
  • Multiple Linear Regression
  • Weighted Linear Regression
  • Absolute error
  • Relative error
  • Standard error

Sample Application

A sample application should be implemented, based on a realistic use case of working with a small dataset and deriving various information from the dataset using the statistics API functions.

Various free datasets are available at: https://guides.emich.edu/data/free-data

Possible example dataset: https://www.openml.org/d/55 (see also: https://datahub.io/machine-learning/hepatitis#resource-hepatitis)

OOB write in zsl_mtx_eigenvectors

I'm not sure I'm understanding this block of code, but there's definitely an unchecked out-of-bounds write here which is crashing my code:

int
zsl_mtx_eigenvectors(struct zsl_mtx *m, struct zsl_mtx *mev, size_t iter,
		     bool orthonormal)
{
	<...>

	/* Since 'b' is the number of eigenvectors, reduce 'mev' (of size
	 * m->sz_rows times b) to erase columns of zeros. */
	mev->sz_cols = b;

	for (size_t s = 0; s < b; s++) {
		zsl_mtx_get_col(&mev2, s, f.data);
		zsl_mtx_set_col(mev, s, f.data);
	}

	<...>
}

I'm unclear why the number of eigenvectors would be greater than the number of columns. However, when it is, this code manipulates memory well outside the allocated space.

zsl_mtx_eigenvectors is used as I would expect by zsl_mtx_svd - allocating only enough space for eigenvectors matching the number of columns - but if that's not true, then there's an OOB write even within the same file.

int
zsl_mtx_svd(struct zsl_mtx *m, struct zsl_mtx *u, struct zsl_mtx *e,
	    struct zsl_mtx *v, size_t iter)
{
    ZSL_MATRIX_DEF(aat, m->sz_rows, m->sz_rows);
    ZSL_MATRIX_DEF(upri, m->sz_rows, m->sz_rows);

    <...>

    zsl_mtx_eigenvectors(&aat, &upri, iter, true);

Here, aat and upri are allocated the same size, but if it's true that there can be more eigenvectors than rows, then upri doesn't have enough memory allocated.

Most other math libraries I work with tend to return orthogonal eigenvectors, and therefore limit themselves to the number of columns.

What am I missing?

Physics API: Electricity

  • Current (charge per second)
  • Resistors in series
  • Resistors in parallel
  • Capacitors in series
  • Capacitors in parallel
  • Resistivity of wire
    • Include constants like aluminium, copper, steel, silicon, etc.
  • Ohm's law
  • Power
    • Current, voltage
    • Voltage, resistance
    • Current, resistance

Add benchmarking sample app

A basic benchmarking sample application should be added to provide repeatable performance testing on individual functions or critical groups of functions to determine:

  • Performance across different architectures and compilers
  • Performance of C versus optimised ASM function implementations
  • Performance with/without various HW device options (M4F VFP instruction, etc.)
  • Single versus double precision comparisons

Output

The benchmarking sample should:

  • Indicate basic architectural and config settings
  • Provider performance figures on a per function and per function group basis
  • If possible, be importable into an analysis package where data can be plotted

Issue with using zsl in esp32

I am trying to perform matrix operations using zsl in eps32 using Zephyr OS.

This is my main.c file
'#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zsl/zsl.h>
#include <zsl/matrices.h>
#include "zsl/vectors.h"

int main()
{
zsl_real_t W1, W, val;
val = 0;
//W = 0.0;
//W1 = 0.200;
//W = sqrt(W1);
// define a matrix
ZSL_MATRIX_DEF(SigmaX, 5, 5);
zsl_mtx_entry_fn_empty(&SigmaX, 5, 5);
// Print matrices
for(size_t i = 0;i < SigmaX.sz_rows; i++){
for(size_t j = 0;j <SigmaX.sz_cols; j++){
zsl_mtx_get(&SigmaX, i, j, &val);
printf("%f\t", (float)val);
}
printf("\n");
}

return 0;

}'
Using the espressif monitor I am displaying the matrix.
The expected output is a matrix whose elements are all 0.
The output I am getting is:
image

Log:
(.venv) ananya@ananya-Latitude-7480:~/my-workspace2/example-application/app$ west build -p always -b esp32
-- west build: making build dir /home/ananya/my-workspace2/example-application/app/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/ananya/my-workspace2/example-application/app
-- CMake version: 3.26.3
-- Found Python3: /home/ananya/zephyrproject/.venv/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter
-- Cache files will be written to: /home/ananya/.cache/zephyr
-- Zephyr version: 3.3.99 (/home/ananya/my-workspace2/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.14.0")
-- Board: esp32
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.15.2 (/home/ananya/zephyr-sdk-0.15.2)
-- Found toolchain: zephyr 0.15.2 (/home/ananya/zephyr-sdk-0.15.2)
-- Found Dtc: /home/ananya/zephyr-sdk-0.15.2/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/ananya/my-workspace2/zephyr/boards/xtensa/esp32/esp32.dts
-- Generated zephyr.dts: /home/ananya/my-workspace2/example-application/app/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/ananya/my-workspace2/example-application/app/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/ananya/my-workspace2/example-application/app/build/zephyr/dts.cmake
Parsing /home/ananya/my-workspace2/example-application/app/Kconfig
Loaded configuration '/home/ananya/my-workspace2/zephyr/boards/xtensa/esp32/esp32_defconfig'
Merged configuration '/home/ananya/my-workspace2/example-application/app/prj.conf'
Configuration saved to '/home/ananya/my-workspace2/example-application/app/build/zephyr/.config'
Kconfig header saved to '/home/ananya/my-workspace2/example-application/app/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/ananya/zephyr-sdk-0.15.2/xtensa-espressif_esp32_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32_zephyr-elf/12.1.0/../../../../xtensa-espressif_esp32_zephyr-elf/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/ananya/zephyr-sdk-0.15.2/xtensa-espressif_esp32_zephyr-elf/bin/xtensa-espressif_esp32_zephyr-elf-gcc
-- Configuring done (11.5s)
-- Generating done (0.3s)
-- Build files have been written to: /home/ananya/my-workspace2/example-application/app/build
-- west build: building application
[2/247] Preparing syscall dependency handling

[13/247] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (/home/ananya/my-workspace2/zephyr), build: zephyr-v3.3.0-4181-gb0688eaf470f
[57/247] Performing configure step for 'EspIdfBootloader'
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/ananya/zephyr-sdk-0.15.2/xtensa-espressif_esp32_zephyr-elf/bin/xtensa-espressif_esp32_zephyr-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/ananya/zephyr-sdk-0.15.2/xtensa-espressif_esp32_zephyr-elf/bin/xtensa-espressif_esp32_zephyr-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/ananya/zephyr-sdk-0.15.2/xtensa-espressif_esp32_zephyr-elf/bin/xtensa-espressif_esp32_zephyr-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/ananya/my-workspace2/example-application/app/build/esp-idf/build/sdkconfig
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/soc/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader_support /home/ananya/my-workspace2/modules/hal/espressif/components/efuse /home/ananya/my-workspace2/modules/hal/espressif/components/esp32 /home/ananya/my-workspace2/modules/hal/espressif/components/esp_common /home/ananya/my-workspace2/modules/hal/espressif/components/esp_hw_support /home/ananya/my-workspace2/modules/hal/espressif/components/esp_rom /home/ananya/my-workspace2/modules/hal/espressif/components/esp_system /home/ananya/my-workspace2/modules/hal/espressif/components/esptool_py /home/ananya/my-workspace2/modules/hal/espressif/components/freertos /home/ananya/my-workspace2/modules/hal/espressif/components/hal /home/ananya/my-workspace2/modules/hal/espressif/components/log /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader/subproject/main /home/ananya/my-workspace2/modules/hal/espressif/components/bootloader/subproject/components/micro-ecc /home/ananya/my-workspace2/modules/hal/espressif/components/newlib /home/ananya/my-workspace2/modules/hal/espressif/components/partition_table /home/ananya/my-workspace2/modules/hal/espressif/components/soc /home/ananya/my-workspace2/modules/hal/espressif/components/spi_flash /home/ananya/my-workspace2/modules/hal/espressif/components/xtensa
-- Configuring done (8.6s)
-- Generating done (0.3s)
-- Build files have been written to: /home/ananya/my-workspace2/example-application/app/build/esp-idf/build/bootloader
[197/247] Performing build step for 'EspIdfBootloader'
[1/97] Generating project_elf_src_esp32.c
[2/97] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[3/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[4/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[5/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[6/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[7/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[8/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/cpu_hal.c.obj
[9/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[10/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[11/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[12/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[13/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[14/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[15/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/lcd_periph.c.obj
[16/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[17/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/mcpwm_periph.c.obj
[18/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[19/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[20/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[21/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[22/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sigmadelta_periph.c.obj
[23/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[24/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[25/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[26/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[27/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[28/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[29/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[30/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[31/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[32/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[33/97] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/esp32/spi_flash_rom_patch.c.obj
[34/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[35/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[36/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[37/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash.c.obj
[38/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[39/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[40/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_qio_mode.c.obj
[41/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse_esp32.c.obj
[42/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[43/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[44/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[45/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash_config_esp32.c.obj
[46/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[47/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[48/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_soc.c.obj
[49/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[50/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[51/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[52/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_fields.c.obj
[53/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[54/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_utility.c.obj
[55/97] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[56/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[57/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[58/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[59/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[60/97] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[61/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api_key_esp32.c.obj
[62/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[63/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[64/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_pm.c.obj
[65/97] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj
[66/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/chip_info.c.obj
[67/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[68/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[69/97] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xt_trax.c.obj
[70/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[71/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_wdt.c.obj
[72/97] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[73/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[74/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_tjpgd.c.obj
[75/97] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[76/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[77/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[78/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[79/97] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[80/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[81/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[82/97] Linking C static library esp-idf/log/liblog.a
[83/97] Linking C static library esp-idf/esp_rom/libesp_rom.a
[84/97] Linking C static library esp-idf/esp_common/libesp_common.a
[85/97] Linking C static library esp-idf/xtensa/libxtensa.a
[86/97] Linking C static library esp-idf/esp_hw_support/libesp_hw_support.a
[87/97] Linking C static library esp-idf/esp_system/libesp_system.a
[88/97] Linking C static library esp-idf/efuse/libefuse.a
[89/97] Linking C static library esp-idf/bootloader_support/libbootloader_support.a
[90/97] Linking C static library esp-idf/spi_flash/libspi_flash.a
[91/97] Linking C static library esp-idf/micro-ecc/libmicro-ecc.a
[92/97] Linking C static library esp-idf/soc/libsoc.a
[93/97] Linking C static library esp-idf/hal/libhal.a
[94/97] Linking C static library esp-idf/main/libmain.a
[95/97] Linking C executable bootloader.elf
[96/97] Generating binary image from built executable
esptool.py v4.5
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/ananya/my-workspace2/example-application/app/build/esp-idf/build/bootloader/bootloader.bin
[97/97] cd /home/ananya/my-workspace2/example-application/app/build/esp-idf/build/bootloader/esp-idf/esptool_py && /home/ananya/zephyrproject/.venv/bin/python3.10 /home/ananya/my-workspace2/modules/hal/espressif/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/ananya/my-workspace2/example-application/app/build/esp-idf/build/bootloader/bootloader.bin
Bootloader binary size 0x6500 bytes. 0xb00 bytes (10%) free.
[237/247] Linking C executable zephyr/zephyr_pre0.elf

[241/247] Linking C executable zephyr/zephyr_pre1.elf

[247/247] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
mcuboot_hdr: 32 B 32 B 100.00%
metadata: 28 B 32 B 87.50%
ROM: 74640 B 4194240 B 1.78%
iram0_0_seg: 47272 B 128 KB 36.07%
irom0_0_seg: 16008 B 3342304 B 0.48%
dram0_0_seg: 6072 B 180736 B 3.36%
dram0_1_seg: 55776 B 110032 B 50.69%
drom0_0_seg: 6812 B 4194240 B 0.16%
rtc_iram_seg: 0 GB 8 KB 0.00%
rtc_slow_seg: 0 GB 4 KB 0.00%
IDT_LIST: 0 GB 8 KB 0.00%
esptool.py v4.5
Creating esp32 image...
Merged 9 ELF sections
Successfully created esp32 image.
(.venv) ananya@ananya-Latitude-7480:~/my-workspace2/example-application/app$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner esp32
-- runners.esp32: Flashing esp32 chip on None (921600bps)
esptool.py v4.5
Found 1 serial ports
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WD (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 0c:8b:95:76:08:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00033fff...
Flash params set to 0x0220
Wrote 32768 bytes at 0x00001000 in 0.6 seconds (425.4 kbit/s)...
Hash of data verified.
Wrote 16384 bytes at 0x00008000 in 0.2 seconds (585.1 kbit/s)...
Hash of data verified.
Wrote 147456 bytes at 0x00010000 in 1.9 seconds (609.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin.
(.venv) ananya@ananya-Latitude-7480:~/my-workspace2/example-application/app$ west espressif monitor
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
--- idf_monitor on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6596
load:0x40078000,len:15216
ho 0 tail 12 room 4
load:0x40080400,len:3992
entry 0x40080634
I (29) boot: ESP-IDF 075894ed2 2nd stage bootloader
I (29) boot: compile time 18:44:35
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: End of partition table
I (96) boot_comm: chip revision: 1, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=00010020 vaddr=00000020 size=0001ch ( 28)
I (111) esp_image: segment 1: paddr=00010044 vaddr=3ffb0000 size=00fb0h ( 4016) load
I (121) esp_image: segment 2: paddr=00010ffc vaddr=3ffb0fb0 size=00214h ( 532) load
I (128) esp_image: segment 3: paddr=00011218 vaddr=40080000 size=0b8a8h ( 47272) load
I (156) esp_image: segment 4: paddr=0001cac8 vaddr=00000000 size=03570h ( 13680)
I (162) esp_image: segment 5: paddr=00020040 vaddr=3f400040 size=01a9ch ( 6812) map
I (164) esp_image: segment 6: paddr=00021ae4 vaddr=00000000 size=0e534h ( 58676)
I (191) esp_image: segment 7: paddr=00030020 vaddr=400d0020 size=03e88h ( 16008) map
I (203) boot: Loaded app from partition at offset 0x10000
I (203) boot: Disabling RNG early entropy source...
*** Booting Zephyr OS build zephyr-v3.3.0-4181-gb0688eaf470f ***
0.000000 0.000491 3.018754 0.000000 1.899811
0.000000 1.899796 0.000000 1.899765 1.899948
3.018753 -nan 1.899827 0.000000 0.000000
1.691883 1.899872 0.000491 1.899811 1.691883
0.000000 1.889374 0.000000 0.000000 1.889374

Digital Signal Processing API

DSP-related functions and features

Moving Average Filters

  • Simple moving average filter
  • Windowed moving average filter
  • Weighted moving average filter

IIR Filters

TBD

FIR Filters

TBD

matrices.c: 0 not ignored when inverting diagonals in pseudoinverse

zscilib/src/matrices.c

Lines 1785 to 1791 in 34c3432

/* Invert the diagonal values in 'e'. If a value is zero, do
* nothing to it. */
zsl_mtx_get(&e, g, g, &x);
if ((x < epsilon) || (x > -epsilon)) {
x = 1 / x;
zsl_mtx_set(&e, g, g, x);
}

In the if statement on line 1788, x > -epsilon always evaluates to true when x is 0 because epsilon is equal to 1e-6 and 0 is always bigger than -1e-6. This causes an incorrect output matrix with infinity values since 0 should be ignored.

I changed line 1788 to the below code to fix this issue:
if (((x < epsilon) || (x > -epsilon)) && x != 0) {

Calibration API

This is a placeholder for the idea of a Calibration API, covering things like:

The most common calibration coefficients to account for are bias error and scale factor / sensitivity error, where:

output = scale_factor * (input + bias)

Colorimetry API

Colorimetry

Core Types/Structs

  • CIE 1931 XYZ tristimulus
  • CIE 1931 xyY chromaticity
  • CIE 1960 UCS chromaticity
  • CIE 1976 UCS chromaticity
  • RGBA color using floating-space notation (0.0 .. 1.0)
  • RGBA color using 8-bit values
  • RGBA color using 16-bit values
  • CIE 1960 CCT, Duv value pair
  • CIE 1931 XYZ tristimulus values for a standard illuminant
  • CIE 1931 XYZ tristimulus values for a standard observer model

Conversion

  • Spectral power distribution (SPD) to XYZ tristimulus
  • SPD normalisation
  • Luminous efficiency function (LEF) to SPD
  • CIE 1931 xyY chromaticity to XYZ tristimulus
  • CIE 1931 XYZ tristimulus values to xyY chromaticity
  • CIE 1931 xyY chromaticity to CIE 1960 uv
  • CIE 1931 XYZ tristimulus to CIE 1960 uv
  • CIE 1960 uv to CIE 1931 XYZ tristimulus
  • CIE 1960 uv to CIE 1931 xyY chromaticity
  • CIE 1960 uv to CIE 1976 u'v'
  • CIE 1976 u'v' value to CIE 1960 uv
  • Color temperature to (u,v) chromaticity
  • CIE 1960 CCT (Duv = 0.0) to CIE 1931 XYZ tristimulus
  • CIE 1960 CCT (Duv = 0.0) to 8-bit RGBA (supplied XYZ to RGB color space correlation matrix)
  • CIE 1960 CCT (Duv = 0.0) to float RGBA (supplied XYZ to RGB color space correlation matrix)
  • CIE 1960 CCT and Duv pair to CIE 1931 xyY chromaticity
  • CIE 1960 CCT and Duv pair to CIE 1931 XYZ tristimulus
  • CIE 1960 (u, v) pair to CIE 1960 CCT and Duv pair using:
    • McCamy
    • Ohno 2014
  • CIE 1931 XYZ tristimulus to 8-bit RGBA (supplied XYZ to RGB color space correlation matrix)
  • CIE 1931 XYZ tristimulus to float RGBA (supplied XYZ to RGB color space correlation matrix)

Color Data

Illuminants

  • A
  • B
  • C
  • D50
  • D55
  • D65
  • E
  • ICC

CIE Standard Observer Models

  • CIE 1931 2 degree standard observer color matching functions
  • CIE 1964 10 degree standard observer color matching functions

CIE Luminous Efficiency Functions

  • CIE 1988 Photopic
  • CIE LERP interpolation helper function

3x3 XYZ to RGB Correlation Matrices

  • XYZ to sRGB (D65)
  • XYZ to sRGB (D50)
  • Adobe RGB 98
  • Sony S-Gamut3.cine D65

Optimised functions infrastructure

Add the ability to optionally include optimised architecture-specific versions of functions as inline assembly (or other inline codes).

For initial releases, plumbing for ARM Thumb and ARM Thumb2 should be included as a proof of concept.

Documentation

Some initial notes on the use of inline assembly with the GNU toolchain. Work in progress.

Implementation

The following preprocessor check can be included in the core C source file:

/* Enable optimised ARM Thumb/Thumb2 functions if available. */
#if (CONFIG_ZSL_PLATFORM_OPT == 1 || CONFIG_ZSL_PLATFORM_OPT == 2)
    #include <zsl/asm/arm/asm_arm_vectors.h>
#endif

The catch-all C function implementation can be wrapped in a preprocessor check:

#if !asm_vec_scalar_mult
int
zsl_vec_scalar_mult(struct zsl_vec *v, zsl_real_t s)
{
    for (size_t i = 0; i < v->sz; i++) {
        v->data[i] *= s;
    }

    return 0;
}
#endif

And the optimised inline assembly version can be implemented in the referenced header file, where the preprocessor value that will override the C implementation can be enabled:

#if !asm_vec_scalar_mult
int zsl_vec_scalar_mult(struct zsl_vec *v, zsl_real_t s)
{
    /* Inline ASM implementation. */
}
#define asm_vec_scalar_mult 1
#endif

Motion and Orientation API(s)

Current status of orientation APIs

AHRS/Attitude (Degrees)

Intended as a final step, to convert Eulers (in radians) to degrees, which are more human-friendly.

  • Basic struct definitions
  • Conversion
    • To vector (access vector API)
    • To Euler (degrees to radian)
    • From Euler (radians to degrees)
    • From Accel + Mag (roll, pitch, yaw)
    • From Accel (roll, pitch)
  • Misc Helpers
    • Angle between two accelerometers (imagine one in a keyboard, and one in the laptop screen, calculating the angle that the screen is tilted open as an output relative to the keyboard).

Euler Angles (Radians)

Since zsl_euler can easily be converted to a zsl_vector, the vector API should cover most requirements here.

  • Basic struct definitions
  • Conversion
    • To vector (access vector API)
  • Print

Quaternions

  • Basic struct definitions
  • Magnitude
  • Scaling
  • Multiplication
  • Conjugate
  • Inverse
  • Difference
  • Exp
  • Log
  • Exponentiation
  • Rotate
  • Interpolation
    • Lerp
    • Slerp
  • Integration
    • Angular velocity (rad/s + time + current value)
    • Angular momentum (Same as above, plus rotational mass)
  • Conversion
  • Special Forms
    • Identity
  • Apply a rotation matrix: Sensors have X/Y/Z in a specific direction based on how the sensor is physically place and oriented on the hardware device. Design requirements may force chips to be placed in a non-ideal orientation, and the 'axis' need to be rotated to reflect the correct directions. A helper function should be provided to correct for this case, such as rotating the output 90° around the Z axis, etc.
  • Print

Sensor Fusion

  • Define generic fusion interface/struct (accel+mag+gyro -> quaternion)
  • Implementations
    • Madgwick (Accel + Mag + Gyro)
    • Mahoney (Accel + Mag + Gyro)
    • SAAM (Accel + Mag)
    • Complementary
    • AQUA
    • Extended Kalman Filter

Misc

Least-Squares Fitting API(s)

Least-squares fitting(and family) is often used to calibrate certain types of sensors (for example, magnetometers to fit an ellipse to a sphere).

Support for the following should be added:

References

Use Case

A good explanation of a use case for this API is described here: https://electronics.stackexchange.com/a/22271

Complex Number Support

Add support for complex numbers, using some variation of:

typedef struct zsl_complex {
    zsl_real_t real;
    zsl_real_t imag;
} zsl_complex_t;

ToDo: Analyse if it's appropriate to use complex.h (c99) versus something distinct to zscilib? For single precision we can map f functions like crealf, for double-precision we can map double functions like creal.

Issue with zsl_mtx_mult() function

When multiplying 3 matrices of sizes 1x5, 5x5 and 5x1 respectively using the zsl_mtx_mult() function this is the answer: 1.000002000003723766352603519181e-02

When multiplying these matrices using the zephyr RTOS by writing them as arrays and using loops and multiplication operator this is the answer: 1.000000000003723778230213525831e-02

I am not able to figure out why this issue is happening.

The impact of this issue is I am not able to zsl_mtx_mult function which is heavily needed as part of the project.

The version of zephyr I am using is 3.4.99.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.