<commit_before>/*******************************************************************************
FILE : api/cmiss_function_gradient.cpp

LAST MODIFIED : 26 August 2004

DESCRIPTION :
The public interface to the Cmiss_function gradient object.
==============================================================================*/

#include <new>
#include "api/cmiss_function_gradient.h"
#include "computed_variable/function_gradient.hpp"

/*
Global functions
----------------
*/

Cmiss_function_id Cmiss_function_gradient_create(
	Cmiss_function_variable_id dependent_variable,
	Cmiss_function_variable_id independent_variable)
/*******************************************************************************
LAST MODIFIED : 26 August 2004

DESCRIPTION :
Creates a Cmiss_function gradient with the supplied <dependent_variable> and
<independent_variable>.
==============================================================================*/
{
	Cmiss_function_id result;
	Function_variable_handle *dependent_variable_handle_address,
		*independent_variable_handle_address;

	result=0;
	if ((dependent_variable_handle_address=reinterpret_cast<
		Function_variable_handle *>(dependent_variable))&&
		(independent_variable_handle_address=reinterpret_cast<
		Function_variable_handle *>(independent_variable)))
	{
		result=reinterpret_cast<Cmiss_function_id>(
			new Function_gradient_handle(new Function_gradient(
			*dependent_variable_handle_address,
			*independent_variable_handle_address)));
	}<commit_msg>Fixed so that now calculating gradient<commit_after>/*******************************************************************************
FILE : api/cmiss_function_gradient.cpp

LAST MODIFIED : 21 October 2004

DESCRIPTION :
The public interface to the Cmiss_function gradient object - composition of
derivative and transpose.
==============================================================================*/

#include <new>
#include "api/cmiss_function_derivative.h"
#include "api/cmiss_function_gradient.h"
#include "api/cmiss_function_matrix_transpose.h"

/*
Global functions
----------------
*/

Cmiss_function_id Cmiss_function_gradient_create(
	Cmiss_function_variable_id dependent_variable,
	Cmiss_function_variable_id independent_variable)
/*******************************************************************************
LAST MODIFIED : 21 October 2004

DESCRIPTION :
Creates a Cmiss_function gradient with the supplied <dependent_variable> and
<independent_variable>.
==============================================================================*/
{
	Cmiss_function_id derivative,result;
	Cmiss_function_variable_list_id independent_variables;

	result=0;
	independent_variables=Cmiss_function_variable_list_create();
	if (independent_variables&&Cmiss_function_variable_list_add(
		independent_variables,independent_variable))
	{
		if (derivative=Cmiss_function_derivative_create(dependent_variable,
			independent_variables))
		{
			if (!(result=Cmiss_function_matrix_transpose_create(Cmiss_function_output(
				derivative))))
			{
				Cmiss_function_destroy(&derivative);
			}
		}
	}
	Cmiss_function_variable_list_destroy(&independent_variables);
{'fraction_non_alphanumeric': 0.2668360864040661, 'fraction_numerical': 0.008259212198221092, 'mean_word_length': 8.965189873417721, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7044056', 'n_tokens_mistral': 884, 'n_tokens_neox': 767, 'n_words': 142}