57 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
60
views
What's the OpenCL idiom for elementwise array-lookup / gather operation with vectorized types?
Consider the following OpenCL code in which each element in a vector-type variable gets its value via array lookup:
float* tbl = get_data();
int4 offsets = get_offsets();
float4 my_elements = {
...
0
votes
1
answer
123
views
Access a operator[] with [1,2,3] results in call to operator[](int)... Is this a bug? [duplicate]
I am attempting at access a class that is like a multidimensional array through the operator[].. only to discover that a comma separated set of parameters is reduced to the first parameter only.. This ...
2
votes
1
answer
264
views
How does a PHP interface actually change the behavior of a class
According to PHP documentation,
Object Interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are implemented.
Hence, an ...
4
votes
1
answer
27k
views
php 8.1 - return type deprecated in older script [duplicate]
Trying to update to php 8.1 and noticed this deprecated notice showing up in the error logs I'd like to take care of.
[14-Feb-2022 14:48:25 UTC] PHP Deprecated: Return type of TLDExtractResult::...
3
votes
2
answers
142
views
Why aren't array access and pointer arithmetic equivalent with full optimization?
Why doesn't this code produce the same assembly? (g++ -O3)
I know little of assembly but it seems case 2 accessing has less instructions, so should be preferred, right? I am asking this because I ...
0
votes
0
answers
49
views
array accesses in Radix Sort
I am studying radix sort and I can't understand why array accesses in radix sort is 11N+4R+1.
The following is radix sort code written in Java.
int n = a.length;
String[] aux = new String[n]; //N
int[]...
1
vote
2
answers
122
views
Accessing a large numpy array while preserving its order
I would like to access an numpy array data via an index idx, but still preserving the order in data. Below is an example where the array is accessed with an order different from the one in the ...
0
votes
0
answers
50
views
C++ why accessing elements outside of an array is allowed even though it is undefined? [duplicate]
I was wondering why accessing elements outside of array bound is allowed when it is clearly mentioned as undefined.
3
votes
1
answer
333
views
Julia For-loops used for accessing 1D Arrays
I am trying to run a 2 for loops to access 2 elements within an array, (e.g.)
x = 100
for i in eachindex(x-1)
for j in 2:x
doSomething = Array[i] + Array[j]
end
end
And often (not always) I ...
1
vote
2
answers
362
views
Multiple thread accessing and editing the same double array
I need to iterate through every double in an array to do the "Laplacian Smoothing", "mixing values" with neighbour doubles.
I'll keep stored values in a temp clone array update the original at the ...
3
votes
3
answers
962
views
Implement Iterator interface for ArrayAccess without container array
This is my attempt at implementing https://www.php.net/manual/en/class.iterator.php for an ArrayAccess. Many examples use a container array as a private member variable; but I do not want to use a ...
12
votes
1
answer
177
views
Is there subscript syntax to extract a diagonal from a 2D Array?
I mostly can follow the syntax to 'drill down/slice' into an array with multiple dimensions (and flattening) on the docs page. A very cool feature. For example given:
my @a=[[1,2,3],
[4,5,6],
...
4
votes
1
answer
939
views
PHP 5.6: ArrayAccess: Function isset calls offsetGet and causes undefined index notice
I wrote simple PHP class that implements ArrayAccess Interface:
class MyArray implements ArrayAccess
{
public $value;
public function __construct($value = null)
{
$this->value ...
1
vote
1
answer
523
views
PHP: Count an ArrayAccess object without Countable
So I'm working with some external PHP code that I don't have the full source for. I am using reflection to work out callable methods, etc.
They have a class like so:
class SpecialArray implments \...
2
votes
1
answer
1k
views
Why we use ArrayAccess::offsetUnset(), instead we can use unset() in php?
Why we use ArrayAccess::offsetUnset() instead i hope unset() is enough to use. But php.net stated that:
Note: This method will not be called when type-casting to (unset)
Can anyone tell how we use ...