Skip to content

Add Utils module from CTModels.jl #445

Description

@ocots

Summary

This issue tracks the addition of the Utils module from CTModels.jl to CTBase.jl.

Rationale

The Utils module contains general-purpose utility functions (interpolation, matrix operations, function transformations) that are not specific to optimal control problems. These utilities are better placed in CTBase.jl as they can be reused across the entire control-toolbox ecosystem.

Scope

Files to add:

  • src/Utils/Utils.jl (main module)
  • src/Utils/function_utils.jl (private utilities)
  • src/Utils/macros.jl (private utilities)
  • src/Utils/interpolation.jl (public utilities)
  • src/Utils/matrix_utils.jl (public utilities)

Tests to add:

  • test/suite/utils/test_function_utils.jl
  • test/suite/utils/test_interpolation.jl
  • test/suite/utils/test_macros.jl
  • test/suite/utils/test_matrix_utils.jl

Public API

The following functions will be added and accessible via CTBase.function_name():

  • ctinterpolate: Linear interpolation for data
  • ctinterpolate_constant: Piecewise-constant interpolation for data
  • matrix2vec: Convert matrices to vectors

Implementation Plan

  1. Create branch for the addition
  2. Add Utils module to CTBase.jl
  3. Add tests to CTBase.jl
  4. Update documentation
  5. Ensure compatibility with CTBase dependencies

Dependencies

  • DocStringExtensions (already in CTBase)
  • No additional dependencies required

Related Issues

  • CTModels.jl: #319

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions