a2nath / a2nath/Linear-Phased-Array

Improve the color_span function to handle zeros and infinite values

未關閉
#4 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement good first issue help wanted Visuals
主要語言
C++
星號
1
分支
1
PR 合併指標
30 天內沒有已合併 PR

描述

It is good that we're ignoring heavy calculations in Update() and Init() functions that are at "holes" or at divided by zero errors or Infinite values, otherwise.

But we're also interpolating the closet value into these holes so that it doesn't throw off the color_span recalculate function. Now re-design the function so that it is not thrown off by zero and inf. That way we don't have to interpolate in the Update() and Init() which are very expensive subroutines.

```
indices_with_inf
indices_with_z
```

:(

```c
/*update the antenna array from updated power and scan angle */
void AAntenna::update(
const size_t& malloc_size,
double* phee_minus_alpha_list,
double* gain_RX_grid,
double* pathloss_list,
double* dummy,
double* host_hmatrix)
{
/* update the antenna gain Gtx */
indices_with_inf.clear();
indices_with_z.clear();

for (long long idx = 0; idx < malloc_size; ++idx)
{
if (pathloss_list[idx] == 0)
{ // this is going to be a inf
indices_with_inf.emplace_back(idx);
continue;
}
else if (gain_RX_grid[idx] == 0)
{ // this is going to be a zero
indices_with_z.emplace_back(idx);
continue;
}

double phee = (phee_minus_alpha_list[idx] + current.alpha) / 2;

double sin_term = current.panel_count * sin(phee);
double gain_factor_antenna_system = gain_RX_grid[idx]; // xN antennas already

if (sin_term != 0)
{
gain_factor_antenna_system *= cached::pow_2(cached::sin(current.panel_count * phee) / sin_term);
}

/* update the channel matrix */
host_hmatrix[idx] = gain_factor_antenna_system / pathloss_list[idx];
}

for (long i = 0; i < indices_with_inf.size(); ++i)
{
auto& problem_index = indices_with_inf[i];

if (0 <= problem_index - 1)
{
host_hmatrix[problem_index] = host_hmatrix[problem_index - 1];
}
else if (problem_index + 1 < malloc_size)
{
host_hmatrix[problem_index] = host_hmatrix[problem_index + 1];
}
// else all of them are infinity
}

for (long i = 0; i < indices_with_z.size(); ++i)
{
auto& problem_index = indices_with_z[i];

if (0 <= problem_index - 1)
{
host_hmatrix[problem_index] = host_hmatrix[problem_index - 1];
}
else if (problem_index + 1 < malloc_size)
{
host_hmatrix[problem_index] = host_hmatrix[problem_index + 1];
}
}
}

```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

The issue references a color_span function not shown in the provided code snippet. Look for this function in the codebase, likely related to visualization or data processing. Examine how it currently handles zeros and infinite values, and understand the interpolation logic in the AAntenna::update method. The goal is to modify color_span to be robust to these values, eliminating the need for the expensive interpolation loops in update and init.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp
領域
backend
Issue 類型
重構
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。