Class LTF::MaximaInputGenerator
In: lib/ltf/maxima_input_generator.rb
Parent: Object

MaximaInputGenerator generates Maxima code to determine a linear tranformation from vector input/output constraints.

Methods

Classes and Modules

Class LTF::MaximaInputGenerator::InvalidConstraint

Constants

DefaultSolsName = 'sols'

Public Class methods

Generate an array of formulas for a linear system.

  • factors: The factors to multiply each formula part by. Its size should be the size of input/output vectors (so pad with 1s if need be).

Create a new MaximaInputGenerator. Raises InvalidConstraint if any constraints are invalid.

  • constraints: An Enumerable of input/output constraint pairs (see add_constraint).

Return the number of transformation variables for a given input/output vector size. Raises ArgumentError if vector_size is less than zero.

  • vector_size: The size of input/output vectors.

Generate a Maxima input string that will attempt to solve the given system of equations.

  • system: An Enumerable of equations.
  • vars: The variables to solve for. If nil, solves for all unknowns.
  • sol_var: The name of a Maxima variable in which to store the solutions.

Return transformation variable names for a given input/output vector size. Raises ArgumentError if vector_size is less than zero.

  • vector_size: The size of input/output vectors.

Return the vector variable names for a given input/output vector size. Raises ArgumentError if vector_size is less than zero.

  • vector_size: The size of input/output vectors.

Public Instance methods

Add a number of constraints at the same time. Raises InvalidConstraint if any constraints are invalid.

  • constraints: An Enumerable of input/output constraint pairs (see add_constraint).

Add a constraint. A constraint is a pair of vectors (each of the same size, and also the same size as all previously-added constraints). This pair represents an input vector and the output vector the transformation should map it to.

  • input: An input vector
  • output: An output vector.

Return true if the given input/output vectors are a valid constraint to add, false otherwise. Constraints must have equally-sized inputs and outputs. This size must also be equal to all previously-entered constraints.

  • input: The input vector.
  • output: The output vector.

Generate a Maxima input string that will solve for the linear transformation variables and print out the resulting transformation piece by piece.

Generate a Maxima input string for listing the constant solutions.

  • sol_var: The name of the Maxima variable in which the solutions have been stored.

Generate a Maxima input string that will attempt to solve for the linear transformation variables, and store them in the given variable name.

  • sol_var: The name of a Maxima variable in which to store the solutions.

Generate a Maxima input string for nicely displaying the final transform.

  • sol_var: The name of the Maxima variable in which the solutions have been stored.

Private Instance methods

Get a linear system of the vector variables.

Return the number of transformation variables that need to be solved for.

Get an Enumerable of transform variable name strings.

Get an Enumerable of vector variable name strings.

[Validate]