multiplication Questions

2

Solved

I'm wondering if there is a more condensed way of doing the following in Java 8 with streams: public static double[] multiply(double[][] matrix, double[] vector) { int rows = matrix.length; int ...
Sedum asked 29/12, 2015 at 22:15

1

Solved

Floating point numbers are not exact due to its limited precision. My question is: is multiplication commutative in floating number computer calculation? For example double a = ..; double b...
Butterball asked 1/12, 2015 at 18:34

5

I have two arrays of 2-by-2 complex matrices, and I was wondering what would be the fastest method of multiplying them. (I want to do matrix multiplication on the elements of the matrix arrays.) At...
Dyl asked 7/9, 2011 at 19:22

2

Solved

I am interested in calculating a large NumPy array. I have a large array A which contains a bunch of numbers. I want to calculate the sum of different combinations of these numbers. The structure o...
Readable asked 25/10, 2015 at 20:19

4

Solved

I have the methods that do both the multiplication and addition, but I'm just not able to get my head around them. Both of them are from external websites and not my own: public static void bitwis...

2

Solved

I have a DataFrame (df), with the following columns: cols = ['A','B','C','D'] How can I multiply the values in these columns to form a single column called 'VAL'? I can do this: df['VAL'] = df...
Guadiana asked 5/10, 2015 at 20:46

1

I'm trying to perform a multiplication of polynomials of degree 4096 using ZZ_pEX class from NTL. However, it returns the error "Polynomial too big for FFT", and I couldn't find a way to make it wo...
Refluent asked 10/7, 2015 at 16:33

3

Suppose I have two size_t variables and I need to multiply them and get result as size_t. size_t first = ...; size_t second = ...; size_t result = first * second; They might overflow so I need t...
Orta asked 31/8, 2015 at 12:8

2

Solved

My input is a<-c(1,2,3,4) b<-c(1,2,4,8) df<-data.frame(cbind(a,b)) My output should be a<-c(1,2,3,4) b<-c(1,2,4,8) d<-c(1,4,12,32) df<-data.frame(cbind(a,b,c)) can ...
Dedrick asked 5/8, 2015 at 6:25

1

Created two series: s1 and s2 from df. Each have same length but differing indices. s1.multiply(s2) unions the mismatched indices instead of multiplying against them. I just want to multiply entr...
Fortran asked 29/7, 2015 at 19:0

4

Solved

Suppose I have: A = rand(1,10,3); B = rand(10,16); And I want to get: C(:,1) = A(:,:,1)*B; C(:,2) = A(:,:,2)*B; C(:,3) = A(:,:,3)*B; Can I somehow multiply this in a single line so that it is...

3

Solved

Let's say that you are using <cstdint> and types like std::uint8_t and std::uint16_t, and want to do operations like += and *= on them. You'd like arithmetic on these numbers to wrap around...
Shortcircuit asked 17/7, 2014 at 5:39

1

Solved

Looking at x86 assembly produced by a compiler, I noticed that (unsigned) integer divisions are sometimes implemented as integer multiplications. These optimizations seem to follow the form ...

2

Solved

I'm a designer looking into learning Swift and I'm a beginner. I have no experience whatsoever. I'm trying to create a tip calculator using basic code in Xcode's playground. Here is what I have ...
Virescence asked 5/6, 2015 at 22:29

6

Solved

long m = 24 * 60 * 60 * 1000 * 1000; The above code creates overflow and doesn't print the correct result. long m2 = 24L * 60 * 60 * 1000 * 1000; long m3 = 24 * 60 * 60 * 1000 * 1000L; The abo...
Rosinweed asked 2/6, 2015 at 20:52

2

Solved

Code example: float f = 123.456; int i = 12345; // negate by changing sign i = -i; f = -f; // negate by multiplying with -1 i *= -1; f *= -1.0f; Apart from aesthetics, is there any factual reaso...
Clubbable asked 27/5, 2015 at 13:12

1

Solved

Recently when I used cuSparse and cuBLAS in CUDA TOOLKIT 6.5 to do sparse matrix multiplication, I find cuSPARSE is much slower than cuBLAS in all cases! In all my experiments, I used cusparseScsr...
Instil asked 8/5, 2015 at 7:55

10

Solved

"Faster than avr200b.asm"? The mpy8u-routine from avr200b.asm for those processors of Atmel's AVR family that do not implement any of the MUL instructions seems pretty generic, but mpy16u loo...
Eigenvalue asked 29/4, 2015 at 5:28

1

Solved

I'm trying to convert an open source library from .Net 4.0 to 3.5 and cannot easily convert the following long multiplication code: /// <summary> /// Calculate the most significant 64 bits...
Solemnize asked 18/4, 2015 at 19:56

6

Solved

Is it possible to multiply a char by an int? For example, I am trying to make a graph, with *'s for each time a number occurs. So something like, but this doesn't work char star = "*"; int num =...
Incompliant asked 8/4, 2010 at 1:14

4

Solved

I want to multiply 2 cells for each row and put the value of that in the last column called Total. Can this be done by a normal query? Example: Pieces | Price | Total 6 | 4 | null // should be 2...
Katzir asked 17/4, 2011 at 11:35

2

Solved

Alright, so the assignment I have to do is to multiply a signed integer by 2 and return the value. If the value overflows then saturate it by returning Tmin or Tmax instead. The challenge is using ...
Choanocyte asked 26/3, 2015 at 4:7

3

Solved

Take the two following snippets: int main() { unsigned long int start = utime(); __int128_t n = 128; for(__int128_t i=1; i<1000000000; i++) n = (n * i); unsigned long int end = utime();...
Haase asked 6/3, 2015 at 16:40

5

The C standard is quite unclear about the uint_fast*_t family of types. On a gcc-4.4.4 linux x86_64 system, the types uint_fast16_t and uint_fast32_t are both 8 bytes in size. However, multiplicati...
Banns asked 7/11, 2010 at 2:48

6

Solved

Wonder why. C# .Net 3.5 int a = 256 * 1024 * 1024; int b = 8; long c = b * a; Console.WriteLine(c);//<-- result is -2147483648 Where does this minus from?
Fake asked 26/1, 2015 at 17:36

© 2022 - 2024 — McMap. All rights reserved.