Libbarrett  1.2.4
Functions
include/barrett/cdlbt/gsl.h File Reference
#include <libconfig.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>

Go to the source code of this file.

Functions

int bt_gsl_cross (gsl_vector *a, gsl_vector *b, gsl_vector *res)
char * bt_gsl_vector_sprintf (char *buffer, gsl_vector *vector)
int bt_gsl_config_get_double (config_setting_t *setting, double *result)
int bt_gsl_config_double_from_group (config_setting_t *grp, char *name, double *result)
int bt_gsl_fill_vector_cfggroup (gsl_vector *vec, config_setting_t *parent, const char *name)
int bt_gsl_fill_vector_cfgarray (gsl_vector *vec, config_setting_t *array)
int bt_gsl_fill_vector (gsl_vector *vec,...)
int bt_gsl_fill_matrix (gsl_matrix *mat, config_setting_t *parent, const char *name)

Detailed Description

Definition of a set of GSL helper functions, including the cross-product vector formatting, and libconfig parsing functions.

Author:
Christopher Dellin
Date:
2008-2009

Function Documentation

int bt_gsl_config_double_from_group ( config_setting_t *  grp,
char *  name,
double *  result 
)

Retrieve a double from a named setting in a libconfig group.

Parameters:
[in]grpThe group to use
[in]nameThe name of the setting to find
[out]resultThe location into which to save the value
Return values:
0Success
-1The named setting does not exist
-2The setting's value is not convertable to double
int bt_gsl_config_get_double ( config_setting_t *  setting,
double *  result 
)

Retrieve a double from a libconfig setting.

Parameters:
[in]settingThe setting to use
[out]resultThe location into which to save the value
Return values:
0Success
-1The setting does not exist
-2The setting's value is not convertable to double
int bt_gsl_cross ( gsl_vector *  a,
gsl_vector *  b,
gsl_vector *  res 
)

Copyright 2009-2014 Barrett Technology <support@barrett.com>

This file is part of libbarrett.

This version of libbarrett is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This version of libbarrett is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this version of libbarrett. If not, see <http://www.gnu.org/licenses/>.

Barrett Technology Inc. 73 Chapel Street Newton, MA 02458 Perform a vector cross-product, res += a x b.

Note:
This function will add the result to the vector specified by res. Therefore, make sure to set the output vector to zero if you want the result explicitly!
Parameters:
[in]aFirst vector
[in]bSecond vector (to be crossed into a)
[out]resResult vector to add to
Return values:
0Success

Copyright 2009-2014 Barrett Technology <support@barrett.com>

This file is part of libbarrett.

This version of libbarrett is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This version of libbarrett is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this version of libbarrett. If not, see <http://www.gnu.org/licenses/>.

Barrett Technology Inc. 73 Chapel Street Newton, MA 02458

int bt_gsl_fill_matrix ( gsl_matrix *  mat,
config_setting_t *  parent,
const char *  name 
)

Fill a matrix from a libconfig list of arrays or lists.

Note:
The matrix must already be allocated.
Parameters:
[out]matThe matrix to fill
[in]parentThe group to use
[in]nameThe name of the array or list in the parent
Return values:
0Success
-1The named setting does not exist, or is not a list of arrays or lists with the same dimensions as the matrix
-2At least one of the read values is not convertable to double
int bt_gsl_fill_vector_cfggroup ( gsl_vector *  vec,
config_setting_t *  parent,
const char *  name 
)

Fill a vector from a libconfig array or list.

Note:
The vector must already be allocated.
Parameters:
[out]vecThe vector to fill
[in]parentThe group to use
[in]nameThe name of the array or list in the parent
Return values:
0Success
-1The named setting does not exist, or is not an array or list with the same length as the vector
-2At least one of the array or list's values is not convertable to double
char* bt_gsl_vector_sprintf ( char *  buffer,
gsl_vector *  vector 
)

Format the vector into the buffer.

The format used is "<aaa.aaaa,bbb.bbbb,ccc.cccc>", with vector values specified by the format string %8.4f.

Note:
This function assumes the buffer is sufficiently large to hold the string.
Parameters:
[out]bufferThe character buffer to write the result to
[in]vectorThe vector to format
Returns:
The value of buffer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines