⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsldstreamquantilerow.c

📁 使用INTEL矢量统计类库的程序,包括以下功能: &#61623 Raw and central moments up to 4th order &#61623 Kurtosis and
💻 C
字号:
/*******************************************************************************!                             INTEL CONFIDENTIAL!  Copyright(C) 2007-2008 Intel Corporation. All Rights Reserved.!  The source code contained  or  described herein and all documents related to!  the source code ("Material") are owned by Intel Corporation or its suppliers!  or licensors.  Title to the  Material remains with  Intel Corporation or its!  suppliers and licensors. The Material contains trade secrets and proprietary!  and  confidential  information of  Intel or its suppliers and licensors. The!  Material  is  protected  by  worldwide  copyright  and trade secret laws and!  treaty  provisions. No part of the Material may be used, copied, reproduced,!  modified, published, uploaded, posted, transmitted, distributed or disclosed!  in any way without Intel's prior express written permission.!  No license  under any  patent, copyright, trade secret or other intellectual!  property right is granted to or conferred upon you by disclosure or delivery!  of the Materials,  either expressly, by implication, inducement, estoppel or!  otherwise.  Any  license  under  such  intellectual property  rights must be!  express and approved by Intel in writing.!!*******************************************************************************!  Content:!    Calculation of quantiles, streaming data case  Example Program Text!******************************************************************************/#include "mkl.h"#include "vsl_ss.h"#include <stdio.h>#define SEED    777#define BRNG    VSL_BRNG_MCG31#define METHOD  0#define DIM 3      /* dimension of the task */ #define N   1000   /* number of observations */#define M   11#define EPS 0.01   /* accuracy of quantile computation */ int main(){    int i, j, status, errcode;    VSLSSTaskPtr task;    double x[DIM][N];  /* matrix of observations */    double quant_order[M], quantiles[M*DIM];    double params;    VSLStreamStatePtr stream;    double a=0.0,sigma=1.0;    MKL_INT quant_order_n;    MKL_INT x_storage;    MKL_INT p, n, params_n;    int fail=0;    int indices[DIM]={1,0,0}; /* 1st component of the vector is processed */    /***** Initialize *****/    errcode = vslNewStream( &stream, BRNG,  SEED );    if(errcode < 0) {printf("Error in VSL\n");return(0);}    /***** Call RNG *****/    errcode = vdRngGaussian( METHOD, stream, N*DIM, (double*)x, a, sigma );    if(errcode < 0) {printf("Error in VSL\n");return(0);}    /***** Deinitialize *****/    errcode = vslDeleteStream( &stream );    if(errcode < 0) {printf("Error in VSL\n");return(0);}        /* parameters of the task and initialization */    p = DIM;    n = N;    quant_order_n = M;    x_storage = VSL_SS_MATRIX_ROWS_STORAGE;    params = EPS;    params_n = VSL_SS_STREAM_QUANTILES_ZW_PARAMS_N;    /* Computation of deciles */    for ( i = 0; i < M; i++ ) quant_order[i] = (double)i / (double)(M-1);       /* creation of the task */    status = vsldSSNewTask( &task, &p, &n, &x_storage, x, 0, indices );    /* initialization of the task parameters */    status =  vsldSSEditStreamQuantiles( task, &quant_order_n, quant_order, quantiles, &params_n, &params );    /* Computation of deciles with accuracy eps */    status = vsldSSCompute( task,                         VSL_SS_STREAM_QUANTILES, VSL_SS_STREAM_QUANTILES_ZW_METHOD );    /* deallocation of task resources */    status = vslSSDeleteTask( &task );    printf("1st 4 and last 4 observations in source matrix\n");    for ( j = 0; j < DIM; j++ )     {        for ( i = 0; i < 4; i++ )        {            printf("%+.3f ", x[j][i] );        }        printf("     ...      ");        for ( i = N-5; i < N; i++ )        {            printf("%+.3f ", x[j][i] );        }        printf("\n");    }    printf("Deciles of the observations for all variables:\n   ");    for ( i = 0; i < M; i++ ) printf("D%i     ", i );    printf("\n");    for ( j = 0; j < DIM; j++ )     {        if(indices[j])        {            for ( i = 0; i < M; i++ ) printf("%+.3f ", quantiles[j*M + i] );        }        printf("\n");    }    if(fail)    {        printf("\nTEST FAILED\n");    }    else    {        printf("\nTEST PASSED\n");    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -