问题标签 [reduction]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
1968 浏览

lookup - Lookup table size reduction

I have an application in which I have to store a couple of millions of integers, I have to store them in a Look up table, obviously I cannot store such amount of data in memory and in my requirements I am very limited I have to store the data in an embebedded system so I am very limited in the space, so I would like to ask you about recommended methods that I can use for the reduction of the look up table. I cannot use function approximation such as neural networks, the values needs to be in a table. The range of the integers is not known at the moment. When I say integers I mean a 32 bit value.

Basically the idea is use some copmpression method to reduce the amount of memory but without losing many precision. This thing needs to run in hardware so the computation overhead cannot be very high.

In my algorithm I have to access to one value of the table do some operations with it and after update the value. In the end what I should have is a function which I pass an index to it and then I get a value, and after I have to use another function to write a value in the table.

I found one called tile coding http://www.cs.ualberta.ca/~sutton/book/8/node6.html, this one is based on several look up tables, does anyone know any other method?.

Thanks.

0 投票
4 回答
4169 浏览

debugging - 查看 Haskell 中的缩减步骤

有没有办法查看haskell 中的减少步骤,即跟踪所做的递归函数调用?例如,chez 方案为我们提供了 trace-lambda。Haskell 中是否有等价的形式?

0 投票
4 回答
657 浏览

visual-studio - 在 Visual Studio 2008 中执行表达式求值/归约

是否可以让 Visual Studio 进行数学表达式评估/简化?

例如,如果我输入“-0.005 + -0.345”,我如何让 Visual Studio 减少它(即用减少量替换它)?我必须写一个宏吗?如果是这样,是否有任何预先存在的宏来执行这种类型的表达式减少?

为了清楚起见,我希望能够突出显示一个表达式并将其替换为缩减的结果。许多人建议立即窗口,但我看不出这如何足够?

编辑我应该指出,这是在编辑未运行或调试时。即时窗口几乎没有用处。我也认为这是一个语言中立的问题。我当然有兴趣看到我发布的宏的替代宏。

编辑一次......去两次......(即在我考虑接受我自己的答案之前有任何其他建议吗?)

0 投票
8 回答
18493 浏览

sql - 简化 SQL 语句的一般规则

我正在寻找一些“推理规则”(类似于集合操作规则或逻辑规则),我可以使用它们来减少 SQL 查询的复杂性或大小。有没有这样的东西?任何文件,任何工具?您自己找到的任何等效项?它在某种程度上类似于查询优化,但在性能方面不同。

换一种说法:使用 JOIN、SUBSELECT、UNION 进行(复杂)查询是否可以(或不)通过使用一些转换规则将其简化为产生相同结果的更简单、等效的 SQL 语句?

因此,我正在寻找 SQL 语句的等效转换,例如大多数 SUBSELECT 可以重写为 JOIN。

0 投票
4 回答
899 浏览

css - CSS 缩减工具

我想知道是否有人知道任何可用的工具可以执行分析一个或多个 CSS 文件的任务,确定文件中各种规则之间的相似性,并向用户提供合并和减少规则集的选项。

我问这个是因为我正在做的一个项目已经到了它有太多 CSS 的程度,以至于 Internet Explorer(我害怕仍然是底线)在页面加载后阻塞 CSS,导致 3-5 秒锁定在交互中,直到扼流圈被处理。

如果您想知道:是的,我确信是 CSS 导致了这个问题。

0 投票
2 回答
1472 浏览

php - Reduce size of numeric array by averaging values in PHP: 20 values => X values

In PHP I have an array containing 20 elements or more. The keys have been assigned automatically. The values are random numbers from 1 to 50.

Now I want to plot this array into a line chart. Unfortunately, I can only use 5 points for the graph. So I must reduce the number of elements in the array. But I don't want the look of the chart to be changed. So I need a function like this:

To make it clearer: When I want to reduce the size of an array from 6 elements to 3 elements, I can just sum up pairs of two elements each and take the average:

array(1, 8, 3, 6, 9, 5) => array(4.5, 6, 7)

My function should do this with variable sizes (for input and output).

I hope you can help me. Thanks in advance!

0 投票
1 回答
1238 浏览

shortest-path - 简单归约(NP 完备性)

我正在寻找一种方法来证明 bicriteria 最短路径问题是 np 完备的。也就是说,给定一个具有长度和权重的图,我需要知道图中是否存在从 s 到 t 的总长度 <= L 且重量 <= W 的路径。

我知道我必须解决一个 NP 完全问题并将其简化为这个问题。我们有以下问题可供选择:3-SAT、独立集、顶点覆盖、汉密尔顿循环和 3 维匹配。

任何可能可行的想法?

谢谢

0 投票
2 回答
103 浏览

.net - 是否有 .NET 库可以进行括号或表达式减少和优化?

是否有 .NET 库可以进行括号或表达式减少和优化?可以采用诸如 (A & (((B) | (C)) | D))) 之类的表达式并返回的东西

A & (B | C | D)

但也要取 (A & A) 并返回 A

0 投票
3 回答
374 浏览

algorithm - 如何减少(x,y)数据中的点数

我有一组数据点:

(x1, y1) (x2, y2) (x3, y3) ... (xn, yn)

样本点的数量可以是数千个。我想用最少的(假设 30 个)点集尽可能准确地表示相同的曲线。我想捕捉尽可能多的拐点。但是,我对表示数据的允许点数有硬性限制。

实现相同目标的最佳算法是什么?有没有可以提供帮助的免费软件库?

PS:我已经尝试实现基于点消除的相对斜率差异,但这并不总能产生最佳的数据表示。

0 投票
2 回答
549 浏览

haskell - Haskell“资源缩减”

我正在为即将到来的 Haskell 考试进行复习,但我不理解过去论文中的一个问题。谷歌没有发现任何有用的东西

i) Source reduce,使用 Haskells 惰性求值,表达式:

ii) Source reduce,使用严格的评估,相同的表达式

iii) 说明惰性求值的优点和严格求值的优点

我不明白的是什么源减少?