GSL复杂的矩阵*复向量 [英] gsl complex matrix * complex vector

查看:357
本文介绍了GSL复杂的矩阵*复向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我找出如何做到这一点的操作。我在看的文件,但它这么久,因为我已经做任何线性代数类型的东西,我有点失落。

我有一个名为y一个14×14的矩阵复杂和复杂的矢量叫我。我需要相乘,结果设​​置为一个名为IL复向量。

到目前为止,我已经想通了,我需要使用:

  gsl_blas_zgemv(CBLAS_TRANSPOSE_t TransA,常量gsl_complexα,常量
                 gsl_matrix_complex * A,常量gsl_vector_complex * X,常量
                 gsl_complex公测,gsl_vector_complex * Y)

但我不知道去哪里。不知道去哪里。像这样的事情?但什么是α和β?

  gsl_blas_zgemv(CblasNoTrans,???,及放大器; Y,功放;我,???,IL);


解决方案

在没有看到你实际上是在做什么,它看起来像您还没有正确的头。由于没有错误了以下工作对我来说:

 的#include<&stdio.h中GT;
#包括LT&;&stdlib.h中GT;
#包括LT&;&math.h中GT;#包括LT&; GSL / gsl_blas.h>
#包括LT&; GSL / gsl_complex_math.h>INT
主(INT ARGC,字符** argv的)
{    INT大小= 14;
    gsl_matrix_complex *一个= NULL;
    gsl_vector_complex * X = NULL;
    gsl_vector_complex * Y = NULL;    A = gsl_matrix_complex_alloc(尺寸,大小);
    X = gsl_vector_complex_alloc(大小);
    Y = gsl_vector_complex_alloc(大小);    gsl_matrix_complex_set_all(A,GSL_COMPLEX_ONE);
    gsl_vector_complex_set_all(X,GSL_COMPLEX_ONE);
    gsl_vector_complex_set_all(Y,GSL_COMPLEX_ZERO);    gsl_blas_zgemv(CblasNoTrans,GSL_COMPLEX_ONE,A,X,
            GSL_COMPLEX_ZERO,Y);    回报(EXIT_SUCCESS);}

和与编译

 的gcc -o测试-I /选择/本地/包括/ GSL -L /选择/ local / lib目录-lgsl -lgslcblas test.c的

(是的,我用MacPorts的Mac上)。

Can somebody help me figure out how to do this operation. I'm looking at the documentation, but its been so long since I've had to do any linear algebra type stuff I'm a little lost.

I have a 14x14 complex matrix called Y and a complex vector called I. I need to multiply them and set the result to a complex vector named IL.

So far I have figured out that I need to use:

gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, const gsl_complex alpha, const 
                 gsl_matrix_complex * A, const gsl_vector_complex * x, const  
                 gsl_complex beta, gsl_vector_complex * y)

But I'm not sure what goes where. Not sure what goes where. Something like this? but what are the alpha and beta?

gsl_blas_zgemv(CblasNoTrans, ???, &Y, &I, ???, IL); 

解决方案

Without seeing what you are actually doing, it looks like you haven't included the right headers. As the following works without errors for me:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <gsl/gsl_blas.h>
#include <gsl/gsl_complex_math.h>

int
main(int argc, char **argv)
{

    int size = 14;
    gsl_matrix_complex *A = NULL;
    gsl_vector_complex *x = NULL;
    gsl_vector_complex *y = NULL;

    A = gsl_matrix_complex_alloc(size, size);
    x = gsl_vector_complex_alloc(size);
    y = gsl_vector_complex_alloc(size);

    gsl_matrix_complex_set_all(A, GSL_COMPLEX_ONE);
    gsl_vector_complex_set_all(x, GSL_COMPLEX_ONE);
    gsl_vector_complex_set_all(y, GSL_COMPLEX_ZERO);

    gsl_blas_zgemv(CblasNoTrans, GSL_COMPLEX_ONE, A, x,
            GSL_COMPLEX_ZERO, y);

    return(EXIT_SUCCESS);

}

And compiling with

gcc -o test -I/opt/local/include/gsl -L/opt/local/lib -lgsl -lgslcblas test.c

(yes, I am on a Mac using MacPorts).

这篇关于GSL复杂的矩阵*复向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆