typedlinearalgebra

Typed Linear Algebra

https://github.com/francoiscarouge/typedlinearalgebra

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.2%) to scientific vocabulary

Keywords

cpp cpp-library cpp23 cpp26 library linear-algebra
Last synced: 4 months ago · JSON representation ·

Repository

Typed Linear Algebra

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • Open Issues: 2
  • Releases: 0
Topics
cpp cpp-library cpp23 cpp26 library linear-algebra
Created 8 months ago · Last pushed 4 months ago
Metadata Files
Readme Contributing Funding License Code of conduct Citation Security Support

README.md

Typed Linear Algebra

This library provides a C++ strongly-typed facade to a matrix linear algebra backend.

Examples

```cpp state x{3. * m, 2. * m / s, 1. * m / s2};

std::println("{}", x * transposed(x));

// [[9 m², 6 m²/s, 3 m²/s²], // [6 m²/s, 4 m²/s², 2 m²/s³], // [3 m²/s², 2 m²/s³, 1 m²/s⁴]] ```

Installation

Example of installation commands in Shell:

shell git clone --depth 1 "https://github.com/FrancoisCarouge/TypedLinearAlgebra" cmake -S "TypedLinearAlgebra" -B "build" cmake --build "build" --parallel sudo cmake --install "build"

Another variation for your CMake infrastructure via fetch content:

```cmake include(FetchContent)

FetchContentDeclare( fcarouge-typed-linear-algebra GITREPOSITORY "https://github.com/FrancoisCarouge/TypedLinearAlgebra" FINDPACKAGEARGS NAMES fcarouge-typed-linear-algebra) FetchContent_MakeAvailable(fcarouge-typed-linear-algebra)

targetlinklibraries(your_target PRIVATE fcarouge-typed-linear-algebra::linalg) ```

For more, see installation instructions.

Reference

Class Typed Matrix

Strongly typed matrix. Compose a linear algebra backend matrix into a typed matrix. Row and column indexes provide each element's index type.

Also documented in the fcarouge/typedlinearalgebra.hpp header.

Declaration

cpp template <typename Matrix, typename RowIndexes, typename ColumnIndexes> class typed_matrix

Template Parameters

| Template Parameter | Definition | | --- | --- | | Matrix | The underlying linear algebra matrix. | | RowIndexes | The tuple type of the row indexes. | | ColumnIndexes | The tuple type of the row indexes. |

Member Types

| Member Type | Definition | | --- | --- | | matrix | The type of the composed matrix. | | underlying | The type of the element's underlying storage. | | row_indexes | The tuple with the row components of the indexes. | | column_indexes | The tuple with the column components of the indexes. | | element<i, j> | The type of the element at the given matrix indexes position. |

Member Variables

| Member Variable | Definition | | --- | --- | | rows | The count of rows. | | columns | The count of columns. |

Member Functions

| Member Function | Definition | | --- | --- | | (default constructor) | Construct a default typed matrix. | | (default copy constructor) | Copy construct the typed matrix. | | (default copy assignment operator) | Copy assign a typed matrix. | | (default move constructor) | Move construct a typed matrix. | | (default move assignment operator) | Move construct a typed matrix. | | (conversion copy constructor) | Copy construct generalization of a compatible typed matrix. | | (conversion copy assignment operator) | Copy assign generalization of a compatible typed matrix. | | (conversion move constructor) | Move construct generalization of a compatible typed matrix. | | (conversion move assignment operator) | Move assign generalization of a compatible typed matrix. | | (conversion copy constructor) | Convert construct a typed matrix from an underlying matrix. | | (conversion copy constructor) | Convert construct a one-dimension uniformly typed matrix from array. | | (conversion copy constructor) | Convert construct a uniformly typed matrix from list-initializers. | | (conversion copy constructor) | Convert construct a row or column typed vector from elements. | | (conversion copy constructor) | Convert construct a singleton typed matrix from a single value. | | operator[i, j] | Access the specified element. | | operator(i, j) | Access the specified element. | | at<i, j>() | Access the specified element. | | (conversion operator) | Access the singleton typed matrix element. | | (destructor) | Destruct a default typed matrix. |

Operations

The following useful operations are supported. This library attempts to align its nomenclature aligned with that of the primitives provided by std::linalg. This library attempts some compatibility with other C++ standard library primitives, ranges, and iterators.

| Operation | Definition | | --- | --- | | + | Addition where the terms are of identical shapes and addable types. | | - | Substraction where the terms are of identical shapes and substractable types. | | * | Multiplication where the factors are of multipliable shapes and multipliable types. | | / | Solution, if there exists one, to the inverse multiplication, where the factor are of compatible shapes and types. | | == | Direct, strict equality comparison, with traditional floating-point comparison pitfalls. | | transposed | Transpose the input matrix. |

Aliases

```cpp template typedrowvector;

template typedcolumnvector; ```

Format

A specialization of the standard formatter is provided for the typed matrix. Use std::format to store a formatted representation of the matrix. Standard format parameters to be supported.

Concepts

| Concept | Definition | | --- | --- | | is_typed_matrix | Concept of a typed matrix type. | | is_singleton_typed_matrix | Concept of a singleton, one-element typed matrix type. | | is_uniform_typed_matrix | Concept of a typed matrix in which all element types are the same. | | is_one_dimension_typed_matrix | Concept of a typed matrix with only one dimension, row, or column. | | is_row_typed_matrix | Concept of a row typed matrix, vector. | | is_column_typed_matrix | Concept of a column typed matrix, vector. |

Structure Element Caster

Typed matrix element conversions customization point. Specialize this template to allow conversion of element's type and underlying type.

cpp template <typename To, typename From> struct element_caster;

Considerations

Lessons Learned

Type safety cannot be guaranteed at compilation time without index safety. The indexes can either be non-type template parameters or strong types overloadings. Converting a runtime index to a dependent template type is not possible in C++. A proxy reference could be used to allow traditional assignment syntax but the runtime check and extra indirection are not interesting tradeoffs. A template call operator can be used for getting a type safe value but impractical syntax for setting. Without index safety, the accepted tradeoff is a templated index at<i, j>() method.

Performance

Projects

The library is used in projects:

  • Kalman: A Kalman filter library.

Your project link here!

Resources

Third Party Acknowledgement

The library is designed, developed, and tested with the help of third-party tools and services acknowledged and thanked here:

  • actions-gh-pages to upload the documentation to GitHub pages.
  • Clang for compilation and code sanitizers.
  • CMake for build automation.
  • cmakelang for pretty CMake list files.
  • cppcheck for static analysis.
  • Doxygen for documentation generation.
  • Doxygen Awesome for pretty documentation.
  • Eigen for linear algebra.
  • GCC for compilation and code sanitizers.
  • lcov to process coverage information.
  • mp-units the quantities and units library for C++.
  • MSVC for compilation and code sanitizers.
  • Valgrind to check for correct memory management.

Sponsors

Become a sponsor today! Support this project with coffee and infrastructure!

Sponsor

Corporations & Institutions

Your group logo and link here!

Individuals

Your name and link here!

Thanks everyone!

Continuous Integration & Deployment Actions

Code Repository

Pipeline

Sanitizer
Format
ClangTidy
CppCheck
Doxygen
Valgrind

Public Domain
License Scan
OpenSSF Best Practices

Deploy Unit Test Code Coverage
Deploy Doxygen

Sponsor

License

TypedLinearAlgebra is public domain:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org

Owner

  • Name: François Carouge
  • Login: FrancoisCarouge
  • Kind: user
  • Location: Union City, CA, USA
  • Company: Cerise Software

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it using these metadata."
title: "Typed Linear Algebra"
abstract: >-
  A C++ library that provides typed linear algebra.
authors:
  - given-names: François
    family-names: Carouge
    email: francois.carouge@gmail.com
contact:
  - email: francois.carouge@gmail.com
    given-names: François
    family-names: Carouge
type: software
license: Unlicense
repository-code: "https://github.com/FrancoisCarouge/TypedLinearAlgebra"
url: "https://francoiscarouge.github.io/TypedLinearAlgebra/"
version: 0.1.0
keywords:
  - c++
  - linear
  - algebra
  - library

GitHub Events

Total
  • Watch event: 2
  • Delete event: 54
  • Issue comment event: 317
  • Push event: 666
  • Pull request event: 120
  • Fork event: 1
  • Create event: 53
Last Year
  • Watch event: 2
  • Delete event: 54
  • Issue comment event: 317
  • Push event: 666
  • Pull request event: 120
  • Fork event: 1
  • Create event: 53

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 1
  • Total pull requests: 65
  • Average time to close issues: 18 minutes
  • Average time to close pull requests: 3 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.66
  • Merged pull requests: 41
  • Bot issues: 0
  • Bot pull requests: 13
Past Year
  • Issues: 1
  • Pull requests: 65
  • Average time to close issues: 18 minutes
  • Average time to close pull requests: 3 days
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.66
  • Merged pull requests: 41
  • Bot issues: 0
  • Bot pull requests: 13
Top Authors
Issue Authors
  • FrancoisCarouge (1)
Pull Request Authors
  • FrancoisCarouge (51)
  • dependabot[bot] (13)
  • fossabot (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (13) github_actions (13)

Dependencies

.github/workflows/citation.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • dieghernan/cff-validator 114aae53e1850c3757733beb60036941900e3dc3 composite
.github/workflows/clang_tidy.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/codeql.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • github/codeql-action/analyze 60168efe1c415ce0f5521ea06d5c2062adbeed1b composite
  • github/codeql-action/init 60168efe1c415ce0f5521ea06d5c2062adbeed1b composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/coverage.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • mshick/add-pr-comment b8f338c590a895d50bcbfa6c5859251edc8952fc composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/cppcheck.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/dependency_review.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/dependency-review-action 38ecb5b593bf0eb19e335c03f97670f792489a8b composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/deploy_coverage.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • peaceiris/actions-gh-pages 4f9cc6602d3f66b9c108549d475ec49e8ef4d45e composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/deploy_doxygen.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • mattnotmitt/doxygen-action b84fe17600245bb5db3d6c247cc274ea98c15a3b composite
  • peaceiris/actions-gh-pages 4f9cc6602d3f66b9c108549d475ec49e8ef4d45e composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/doxygen.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • mattnotmitt/doxygen-action b84fe17600245bb5db3d6c247cc274ea98c15a3b composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/format.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/memory_valgrind.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/openssf_scorecard.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/upload-artifact ea165f8d65b6e75b540449e92b4886f43607fa02 composite
  • github/codeql-action/upload-sarif 60168efe1c415ce0f5521ea06d5c2062adbeed1b composite
  • ossf/scorecard-action f49aabe0b5af0936a0987cfb85d86b75731b0186 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/pipeline.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • ilammy/msvc-dev-cmd 0b201ec74fa43914dc39ae48a89fd1d8cb592756 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite
.github/workflows/sanitizer.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner 0634a2670c59f64b4a01f0f96f84700a4088b9f0 composite