91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 10KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-04
  • 語(yǔ)言: C/C++
  • 標(biāo)簽: HOSVD??源代碼??源碼??

資源簡(jiǎn)介

這是一個(gè)基于 C++的HOSVD源代碼,經(jīng)過(guò)測(cè)試,不過(guò)只能分解3階張量

資源截圖

代碼片段和文件信息

#include?“StdAfx.h“
#include?“HOSVD.h“
#include?
#include?“math.h“
CHOSVD::CHOSVD(void)
{
}

CHOSVD::~CHOSVD(void)
{
}



inline?void*?CHOSVD::AlignPtr(?const?void*?ptr?int?align=32?)
{
// assert(?(align?&?(align-1))?==?0?);
return?(void*)(?((size_t)ptr?+?align?-?1)?&?~(size_t)(align-1)?);
}
?inline?int?CHOSVD::Align(?int?size?int?align?)
?{
//?assert(?(align?&?(align-1))?==?0?&&?size? ?return?(size?+?align?-?1)?&?-align;
?}
?
?Matrix*?CHOSVD::CreateMatHeader(?int?rows?int?cols?int?type?)
?{
?Matrix*?arr?=?0;

?int?min_step;
?type?=?MAT_TYPE(type);

?min_step?=?ELEM_SIZE(type)*cols;
?arr?=?(Matrix*)malloc(?sizeof(*arr));

?arr->step?=?rows?==?1???0?:?Align(min_step?DEFAULT_MAT_ROW_ALIGN);
?arr->type?=?MAT_MAGIC_VAL?|?type?|
?(arr->step?==?0?||?arr->step?==?min_step???MAT_CONT_FLAG?:?0);
?arr->rows?=?rows;
?arr->cols?=?cols;
?arr->data.ptr?=?0;
?arr->refcount?=?0;
?arr->hdr_refcount?=?1;
?return?arr;
?}
?void?CHOSVD::CreateData(?CvArr*?arr?)
?{
?//if(?CV_IS_MAT_HDR(?arr?))
?//{
?size_t?step?total_size;
?Matrix*?mat?=?(Matrix*)arr;
?step?=?mat->step;

?//if(?mat->data.ptr?!=?0?)
//?CV_ERROR(?CV_StsError?“Data?is?already?allocated“?);

?if(?step?==?0?)
?step?=?ELEM_SIZE(mat->type)*mat->cols;

?total_size?=?step*mat->rows?+?sizeof(int)?+?MALLOC_ALIGN;
?mat->refcount?=?(int*)malloc(?(size_t)total_size?);
?mat->data.ptr?=?(uchar*)AlignPtr(?mat->refcount?+?1?MALLOC_ALIGN?);
?*mat->refcount?=?1;
?//}

?}
?Matrix*?CHOSVD::CreateMat(?int?height?int?width?int?type?)
?{
?Matrix*?arr?=?0;
?arr?=?CreateMatHeader(?height?width?type?);
?CreateData(?arr?);
?return?arr;
?}



/*?y[0:m0:n]?+=?diag(a[0:10:m])?*?x[0:m0:n]?*/
void?CHOSVD::iMatrAXPY_64f(?int?m?int?n?const?double*?x?int?dx
const?double*?a?double*?y?int?dy?)
{
int?i?j;

for(?i?=?0;?i? {
double?s?=?a[i];

for(?j?=?0;?j?<=?n?-?4;?j?+=?4?)
{
double?t0?=?y[j]???+?s*x[j];
double?t1?=?y[j+1]?+?s*x[j+1];
y[j]???=?t0;
y[j+1]?=?t1;
t0?=?y[j+2]?+?s*x[j+2];
t1?=?y[j+3]?+?s*x[j+3];
y[j+2]?=?t0;
y[j+3]?=?t1;
}

for(?;?j? }
}


/*?y[1:m-1]?=?h*y[1:m0:n]*x[0:10:n]‘*x[-1]??(this?is?used?for?U&V?reconstruction)
y[1:m0:n]?+=?h*y[1:m0:n]*x[0:10:n]‘*x[0:10:n]?*/
void?CHOSVD::iMatrAXPY3_64f(?int?m?int?n?const?double*?x?int?l?double*?y?double?h?)
{
int?i?j;

for(?i?=?1;?i? {
double?s?=?0;

y?+=?l;

for(?j?=?0;?j?<=?n?-?4;?j?+=?4?)
s?+=?x[j]*y[j]?+?x[j+1]*y[j+1]?+?x[j+2]*y[j+2]?+?x[j+3]*y[j+3];

for(?;?j?
s?*=?h;
y[-1]?=?s*x[-1];

for(?j?=?0;?j?<=?n?-?4;?j?+=?4?)
{
double?t0?=?y[j]???+?s*x[j];
double?t1?=?y[j+1]?+?s*x[j+1];
y[j]???=?t0;
y[j+1]?=?t1;
t0?=?y[j+2]?+?s*x[j+2];
t1?=?y[j+3]?+?s*x[j+3];
y[j+2]?=?t0;
y[j+3]?=

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????32739??2009-03-04?22:28??HOSVD.cpp

?????文件???????4343??2009-03-04?22:24??HOSVD.h

?????文件???????5315??2009-03-04?22:24??HosvdView.cpp

?????文件???????1140??2009-03-04?21:01??HosvdView.h

-----------?---------??----------?-----??----

????????????????43537????????????????????4


評(píng)論

共有 條評(píng)論