本文整理汇总了C++中real_set函数的典型用法代码示例。如果您正苦于以下问题:C++ real_set函数的具体用法?C++ real_set怎么用?C++ real_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了real_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cross_real_array
void cross_real_array(const real_array_t * x,const real_array_t * y, real_array_t* dest)
{
/* Assert x and y are vectors */
/* Assert x and y have size 3 */
/* Assert dest is a vector */
/* Assert that dest have size 3*/
real_set(dest, 0, (real_get(x,1) * real_get(y,2)) - (real_get(x,2) * real_get(y,1)));
real_set(dest, 1, (real_get(x,2) * real_get(y,0)) - (real_get(x,0) * real_get(y,2)));
real_set(dest, 2, (real_get(x,0) * real_get(y,1)) - (real_get(x,1) * real_get(y,0)));
}
示例2: cross_real_array
void cross_real_array(const real_array_t * x,const real_array_t * y, real_array_t* dest)
{
/* Assert x and y are vectors */
omc_assert_macro((x->ndims == 1) && (x->dim_size[0] == 3));
/* Assert y is vector of size 3 */
omc_assert_macro((y->ndims == 1) && (y->dim_size[0] == 3));
/* Assert dest is vector of size 3 */
omc_assert_macro((dest->ndims == 1) && (dest->dim_size[0] == 3));
real_set(dest, 0, (real_get(*x,1) * real_get(*y,2)) - (real_get(*x,2) * real_get(*y,1)));
real_set(dest, 1, (real_get(*x,2) * real_get(*y,0)) - (real_get(*x,0) * real_get(*y,2)));
real_set(dest, 2, (real_get(*x,0) * real_get(*y,1)) - (real_get(*x,1) * real_get(*y,0)));
}
示例3: matrix_real_scalar
void matrix_real_scalar(modelica_real a, real_array_t* dest)
{
dest->ndims = 2;
dest->dim_size[0] = 1;
dest->dim_size[1] = 1;
real_set(dest, 0, a);
}
示例4: put_real_matrix_element
void put_real_matrix_element(modelica_real value, int r, int c, real_array_t* dest)
{
/* Assert that dest hast correct dimension */
/* Assert that r and c are valid indices */
real_set(dest, (r * dest->dim_size[1]) + c, value);
/* printf("Index %d\n",r*dest->dim_size[1]+c); */
}
示例5: array_real_array
void array_real_array(real_array_t* dest,int n,real_array_t* first,...)
{
int i,j,c,m;
va_list ap;
real_array_t **elts = (real_array_t**)malloc(sizeof(real_array_t *) * n);
assert(elts);
/* collect all array ptrs to simplify traversal.*/
va_start(ap,first);
elts[0] = first;
for (i = 1; i < n; ++i) {
elts[i] = va_arg(ap, real_array_t*);
}
va_end(ap);
check_base_array_dim_sizes((const base_array_t **)elts,n);
for (i = 0, c = 0; i < n; ++i) {
m = base_array_nr_of_elements(elts[i]);
for (j = 0; j < m; ++j) {
real_set(dest, c, real_get(elts[i], j));
c++;
}
}
free(elts);
}
示例6: transpose_real_array
/* function: transpose_real_array
*
* Implementation of transpose(A) for matrix A.
*/
void transpose_real_array(const real_array_t * a, real_array_t* dest)
{
size_t i;
size_t j;
/* size_t k;*/
size_t n,m;
if (a->ndims == 1) {
copy_real_array_data(a,dest);
return;
}
assert(a->ndims==2 && dest->ndims==2);
n = a->dim_size[0];
m = a->dim_size[1];
assert(dest->dim_size[0] == m && dest->dim_size[1] == n);
for (i = 0; i < n; ++i) {
for (j = 0; j < m; ++j) {
real_set(dest, (j * n) + i, real_get(a, (i * m) + j));
}
}
}
示例7: mul_real_matrix_product
void mul_real_matrix_product(const real_array_t * a,const real_array_t * b,real_array_t* dest)
{
modelica_real tmp;
size_t i_size;
size_t j_size;
size_t k_size;
size_t i;
size_t j;
size_t k;
/* Assert that dest has correct size */
i_size = dest->dim_size[0];
j_size = dest->dim_size[1];
k_size = a->dim_size[1];
for (i = 0; i < i_size; ++i) {
for (j = 0; j < j_size; ++j) {
tmp = 0;
for (k = 0; k < k_size; ++k) {
tmp += real_get(a, (i * k_size) + k)*real_get(b, (k * j_size) + j);
}
real_set(dest, (i * j_size) + j, tmp);
}
}
}
示例8: simple_indexed_assign_real_array1
/* Zero based index */
void simple_indexed_assign_real_array1(const real_array_t * source,
int i1,
real_array_t* dest)
{
/* Assert that source has the correct dimension */
/* Assert that dest has the correct dimension */
real_set(dest, i1, real_get(source, i1));
}
示例9: range_real_array
void range_real_array(modelica_real start, modelica_real stop, modelica_real inc, real_array_t* dest)
{
int i;
/* Assert that dest has correct size */
for (i = 0; i < dest->dim_size[0]; ++i) {
real_set(dest, i, start + (i * inc));
}
}
示例10: skew_real_array
void skew_real_array(const real_array_t * x,real_array_t* dest)
{
/* Assert x vector*/
/* Assert x has size 3*/
/* Assert dest is 3x3*/
real_set(dest, 0, 0);
real_set(dest, 1, -real_get(x, 2));
real_set(dest, 2, real_get(x, 1));
real_set(dest, 3, real_get(x, 2));
real_set(dest, 4, 0);
real_set(dest, 5, -real_get(x, 0));
real_set(dest, 6, -real_get(x, 1));
real_set(dest, 7, real_get(x, 0));
real_set(dest, 8, 0);
}
示例11: mul_scalar_real_array
void mul_scalar_real_array(modelica_real a,const real_array_t * b,real_array_t* dest)
{
size_t nr_of_elements;
size_t i;
/* Assert that dest has correct size*/
nr_of_elements = base_array_nr_of_elements(b);
for (i=0; i < nr_of_elements; ++i) {
real_set(dest, i, a * real_get(b, i));
}
}
示例12: mul_real_array
void mul_real_array(const real_array_t *a,const real_array_t *b,real_array_t* dest)
{
size_t nr_of_elements;
size_t i;
/* Assert that a,b have same sizes? */
nr_of_elements = base_array_nr_of_elements(*a);
for(i=0; i < nr_of_elements; ++i) {
real_set(dest, i, real_get(*a, i) * real_get(*b, i));
}
}
示例13: simple_indexed_assign_real_array2
void simple_indexed_assign_real_array2(const real_array_t * source,
int i1, int i2,
real_array_t* dest)
{
size_t index;
/* Assert that source has correct dimension */
/* Assert that dest has correct dimension */
index = (i1 * source->dim_size[1]) + i2;
real_set(dest, index, real_get(source, index));
}
示例14: fill_real_array
void fill_real_array(real_array_t* dest,modelica_real s)
{
size_t nr_of_elements;
size_t i;
nr_of_elements = base_array_nr_of_elements(dest);
for (i = 0; i < nr_of_elements; ++i) {
real_set(dest, i, s);
}
}
示例15: mul_real_array_scalar
void mul_real_array_scalar(const real_array_t * a,modelica_real b,real_array_t* dest)
{
size_t nr_of_elements;
size_t i;
/* Assert that dest has correct size*/
nr_of_elements = base_array_nr_of_elements(a);
for (i=0; i < nr_of_elements; ++i) {
real_set(dest, i, real_get(a, i) * b);
}
}