# Multiply Numpy n x 2 array by n x 1 array

Assuming I have a Numpy n x 2 array y: array([[1, 1], [2, 3], [1, 4], …]) and a Numpy n x 1 array x: array([2, 4, 5, …]), how can I efficiently obtain the following result, n x 2 array: array([2, 2], [8, 12], [5, 20], …]), where each element (array) of the y… Read More Multiply Numpy n x 2 array by n x 1 array

# Multiplication Table Based On BOTH User Inputs

I am trying to create a multiplication table that is based on BOTH user inputs. I want to ask the user the first and second integer and then to print out the first integer by the second integer that amount of times. For example, if I choose 5 for first integer and 10 for second… Read More Multiplication Table Based On BOTH User Inputs

# Multiplying elements in arrays using the forEach function

I’m currently learning about arrays and the different ways to manipulate them. I was asked to: "multiply 5 to the given array using the forEach function" Here is my code so far. It looks as if everything works when I console.log in the forEach function, but when I log the console for the array it’s… Read More Multiplying elements in arrays using the forEach function

# Mutiplying dataframe by -1 loses data

I have an issue and I have no idea what is causing it.. I have a very very simply dataframe which looks like the following; A B 01/01/2022 -34 -102.34 02/01/2022 -4 -89.23 03/01/2022 -78 -43.2 . . . 31/12/2022 -32 -34.21 I simply need to convert this dataframe to positive numbers. When I do… Read More Mutiplying dataframe by -1 loses data

# Multiply Array position Swift

I need to fix this code in Swift language. I don’t know how can I to multiply array positions mut1 and mut2 values. The result is 8. var mut1 = [7,-4,5] var mut2 = [3,2,-1] var multiply = mut1[0] * mut2[0] + mut1[1] * mut2[1] + mut1[2] * mut2[2] print(multiply) >Solution : If you want… Read More Multiply Array position Swift

# Input any mathematical table without using loops

I need to print mathematical table without using any loop (for, while, do while, etc.). Can anyone help me out, the easiest example I could find was writing console.writeline 10times for each line. This is my code! using System; using System.Linq; class Question4 { int product, i=1; public static void Main(string[] args) { int num;… Read More Input any mathematical table without using loops

# Java multiplication table, Writer writes in second line instead of first

It’s supposed to be a multiplication table in the shape of a square, but the writer doesn’t write the numbers in the first line and the first column. try { File file = new File("multi.txt"); // FileWriter Writer = new FileWriter("multi.txt"); BufferedWriter Writer = new BufferedWriter(new FileWriter(file)); for (int o = 1; o <= n;… Read More Java multiplication table, Writer writes in second line instead of first

# overflow instead of saturation on 16bit add AVX2

I want to add 2 unsigned vectors using AVX2 __m256i i1 = _mm256_loadu_si256((__m256i *) si1); __m256i i2 = _mm256_loadu_si256((__m256i *) si2); __m256i result = _mm256_adds_epu16(i2, i1); however I need to have overflow instead of saturation that _mm256_adds_epu16 does to be identical with the non-vectorized code, is there any solution for that? >Solution : Use normal… Read More overflow instead of saturation on 16bit add AVX2

# MSVC – expression must have pointer-to-object type but it has type "float" on generic array?

MSVC on Visual Studio 2019 says "expression must have pointer-to-object type but it has type "float" on generic array" here: void _stdcall sample::Eff_Render(PWAV32FS SourceBuffer, PWAV32FS DestBuffer, int Length) { float gain = _gain; for (int ii = 0; ii < Length; ii++) { (*DestBuffer)[ii][0] = (*SourceBuffer)[ii][0] * gain; (*DestBuffer)[ii][1] = (*SourceBuffer)[ii][1] * gain; } }… Read More MSVC – expression must have pointer-to-object type but it has type "float" on generic array?

# Set acitve classname to multiple items in react js (map)

I need to set the active classname to multiple onclick items inside a .map I have implemented by it only keeps track of current click active index I need the list of active items that were clicked. const [activeIndex, setActiveIndex] = useState(-1); return ( <> {data?.map((item, index) => { return ( <Col className={`mb-3 \${ index… Read More Set acitve classname to multiple items in react js (map)