AgsFunction

AgsFunction — Function to translate values

Functions

Properties

gchar * normalized-function Read / Write
gpointer pivot-table Read / Write
gchar * source-function Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── AgsConversion
        ╰── AgsFunction

Includes

#include <ags/lib/ags_function.h>

Description

The AgsFunction translates values from linear math to a given function.

Functions

AGS_FUNCTION_GET_OBJ_MUTEX()

#define AGS_FUNCTION_GET_OBJ_MUTEX(obj) (&(((AgsFunction *) obj)->obj_mutex))

ags_function_collapse_parantheses ()

gchar **
ags_function_collapse_parantheses (AgsFunction *function,
                                   guint *function_count);

Collapse parantheses by respecting many possibilities.

Parameters

function

the AgsFunction

 

function_count

return location of count of possible functions

 

Returns

the one-dimensional array of possible functions as strings

Since: 3.0.0


ags_function_find_literals ()

gchar **
ags_function_find_literals (AgsFunction *function,
                            guint *symbol_count);

Find literal symbols i.e. variable names.

Parameters

function

The AgsFunction

 

symbol_count

return location of symbols count

 

Returns

The string vector containing symbols

Since: 3.0.0


ags_function_literal_solve ()

void
ags_function_literal_solve (AgsFunction *function);

Solves :source-function literally, allocates the pivot table and creates the normalized function.

Parameters

function

the AgsFunction

 

Since: 3.0.0


ags_function_push_equation ()

gboolean
ags_function_push_equation (AgsFunction *function,
                            gchar *equation);

Push an equation to the solver stack.

Parameters

function

the AgsFunction

 

equation

an equation as string

 

Returns

TRUE on success, otherwise FALSE

Since: 3.0.0


ags_function_pop_equation ()

void
ags_function_pop_equation (AgsFunction *function,
                           GError **error);

Pops the functions of the equation stack. Call this function as you're finished with pushing equations.

Parameters

function

the AgsFunction

 

error

a GError

 

Since: 3.0.0


ags_function_get_expanded ()

gchar *
ags_function_get_expanded (AgsFunction *function,
                           gchar **symbol,
                           guint symbol_count);

Expands symbols to normalized form.

Parameters

function

the AgsFunction

 

symbol

the symbols to compute

 

symbol_count

the count of symbols

 

Returns

the normalized form as string

Since: 3.0.0


ags_function_get_normalized ()

gchar *
ags_function_get_normalized (AgsFunction *function);

Get internal normalized string.

Parameters

function

the AgsFunction

 

Returns

the normalized string

Since: 3.0.0


ags_function_compute_term ()

AgsComplex *
ags_function_compute_term (gchar *term,
                           gchar *substitute_symbol,
                           AgsComplex *substitute_value);

Compute term by substituting substitute_symbol with substitue_value and do basic solving.

Parameters

term

the term as string to compute

 

substitute_symbol

a variable to substitute

 

substitute_value

the AgsComplex value representing substitute_symbol

 

Returns

the AgsComplex value resulted by substitution

Since: 3.0.0


ags_function_symbolic_translate_value ()

AgsComplex **
ags_function_symbolic_translate_value (AgsFunction *function,
                                       gchar *symbol,
                                       AgsComplex *value);

Symbolic translate to value for symbol and compute resulting vector.

Parameters

function

the AgsFunction

 

symbol

the symbol to translate

 

value

the value to substitute

 

Returns

the new AgsComplex vector

Since: 3.0.0


ags_function_substitute_values ()

gboolean
ags_function_substitute_values (AgsFunction *function,
                                gchar *symbol,
                                ...);

Verify :source-function to be TRUE or FALSE by substitution.

Parameters

function

the AgsFunction

 

symbol

the first symbol as string, or NULL if no more symbol and value pair.

 

...

NULL terminated symbol and value pairs of list.

 

Returns

TRUE if function evaluates, otherwise FALSE

Since: 3.0.0


ags_function_translate_value ()

AgsComplex *
ags_function_translate_value (AgsFunction *function,
                              AgsComplex *value);

Translates value by source function.

Parameters

function

the AgsFunction

 

value

the AgsComplex value to translate

 

Returns

the solution as AgsComplex boxed-type.

Since: 3.0.0


ags_function_new ()

AgsFunction *
ags_function_new (gchar *source_function);

Instantiate a new AgsFunction.

Parameters

source_function

the source function

 

Returns

the new instance

Since: 3.0.0


AGS_FUNCTION()

#define AGS_FUNCTION(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_FUNCTION, AgsFunction))

AGS_FUNCTION_CLASS()

#define AGS_FUNCTION_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_FUNCTION, AgsFunctionClass))

AGS_FUNCTION_GET_CLASS()

#define AGS_FUNCTION_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS (obj, AGS_TYPE_FUNCTION, AgsFunctionClass))

AGS_IS_FUNCTION()

#define AGS_IS_FUNCTION(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_FUNCTION))

ags_function_get_type ()

GType
ags_function_get_type (void);

Types and Values

AGS_SYMBOLIC_EULER

#define AGS_SYMBOLIC_EULER "ℯ"

AGS_SYMBOLIC_PI

#define AGS_SYMBOLIC_PI "𝜋"

AGS_SYMBOLIC_INFINIT

#define AGS_SYMBOLIC_INFINIT "∞"

AGS_SYMBOLIC_COMPLEX_UNIT

#define AGS_SYMBOLIC_COMPLEX_UNIT "𝑖"

enum AgsFunctionFlags

Enum values to control the behavior or indicate internal state of AgsFunction by enable/disable as flags.

Members

AGS_FUNCTION_LINEAR

the function is linear

 

AGS_FUNCTION_EXPONENTIAL

the function is exponential

 

AGS_FUNCTION_LOGARITHMIC

the function is logarithmic

 

AGS_FUNCTION_IS_UNIQUE

the function is unique

 

AGS_FUNCTION_SOLVE_PIVOT_TABLE

do solve using pivot table

 

AGS_FUNCTION_SOLVE_MAXIMUM_COLON

solve using maximum colon strategy

 

AGS_FUNCTION_SOLVE_GAUSS

solve using gauss strategy

 

AGS_TYPE_FUNCTION

#define AGS_TYPE_FUNCTION                (ags_function_get_type())

struct AgsFunction

struct AgsFunction;

struct AgsFunctionClass

struct AgsFunctionClass {
  AgsConversionClass conversion;

  void (*literal_solve)(AgsFunction *function);
};

Property Details

The “normalized-function” property

  “normalized-function”      gchar *

The normalized function.

Owner: AgsFunction

Flags: Read / Write

Default value: NULL

Since: 3.0.0


The “pivot-table” property

  “pivot-table”              gpointer

The pivot table.

Owner: AgsFunction

Flags: Read / Write

Since: 3.0.0


The “source-function” property

  “source-function”          gchar *

The source function.

Owner: AgsFunction

Flags: Read / Write

Default value: NULL

Since: 3.0.0