IF/OR Function Excel 2010 - if-statement

I have been searching for an answer and can't seem to find one. I have multiple OR conditions within an IF statement.
What I need is:
If L3 OR M3 OR N3 or O3 OR P3 OR Q3 >0 then X3=Past
If R3 >0 then X3=Present
If S3 OR T3 or U3 or V3 > 0 then X3=Future
The problem is the following are also true:
If L3 OR M3 OR N3 or O3 OR P3 OR Q3 OR R3 > 0 then X3=Past, Present
If L3 OR M3 OR N3 or O3 OR P3 OR Q3 OR S3 OR T3 or U3 or V3 >0 then X3=Past, Future
If L3 OR M3 OR N3 or O3 OR P3 OR Q3 OR R3 OR S3 OR T3 or U3 or V3 >0 then X3=Past, Present, Future
This is my non-working code thus far:
=(IF(OR($L3>0, $M3>0, $N3>0, $O3>0, $P3>0, $Q3>0),"Past"), IF(OR($R3=0),”Present”),IF(OR($S105>0,$T105>0,$U105>0,$V105>0),"Future" ,NoDate)))
Any help is greatly appreciated!!

I think the correct answer is
=IF(OR($L3>0,$M3>0,$N3>0,$O3>0,$P3>0,$Q3>0),"Past",IF(OR($R3=0),"Present",IF(OR($S105>0,$T105>0,$U105>0,$V105>0),"Future","NoDate")))
Check your parentesis, quote "NoDate".
The trick is
=IF(conditions,"Past",IF(conditions,"Present",IF(conditions,"Future","NoDate")))

Related

Concurrent programming: synchronization of three theads using semaphores

We have three processes, which run concurrently and consist of the following statements:
P
Q
R
p1 p2 p3
q1 q2 q3
r1 r2 r3
Synchronize P, Q and R, fullfilling all of the conditions
simulatenously:
p1 must execute before q2
q1 must execute before r2
r1 must execute before p2
r3 must execute after p2 and q2
First I tried this:
pCompleted = Semaphore(0)
qCompleted = Semaphore(0)
rCompleted = Semaphore(0)
bothCompleted = Semaphore(0)
P:
Q:
R:
p1 pCompleted.signal() rCompleted.wait() p2 bothCompleted.signal() p3
q1 qCompleted.signal() pCompleted.wait() q2 bothCompleted.signal() q3
r1 rCompleted.signal() qCompleted.wait() r2 bothCompleted.wait() bothCompleted.wait() r3
It is needless to say this is extremely ineffective, maybe even wrong.
I think I can drop at least one semaphore without causing a deadlock:
P:
Q:
R:
p1 pCompleted.signal() rCompleted.wait() p2 pCompleted.signal() p3
q1 qCompleted.signal() pCompleted.wait() q2 qCompleted.signal() q3
r1 rCompleted.signal() qCompleted.wait() r2 pCompleted.wait() qCompleted.wait() r3
Still, I highly doubt this is a good solution.
Could somebody suggest an optimal solution?
I think this can be achieved quite easily with four CountDownLatches. For example,
CountDownLatch p1q2 = new CountDownLatch(1);
controls the synchronization between threads P and Q for the first bullet. Q waits on p1q2 before entering q2, and P countdowns p1q2 after exiting p1. And so on.
Note that the r3p2q2 would have to wait for two countdowns.
(And, obviously, you also need a thread D, with statements d1 and d2, where d2 must execute after r2 ;) )

Big point cloud file reading optimization windows

I'm on windows, and I'll work only with windows.
I have a question about opening big files (PTX).
On each line, I will have the coordinates of a points X Y Z I {R G B} ({R, G, B} are not forced to be present).
Since my files are huge (sometimes > 100Go), I would like to read them fastly using memory map (I never did that before), or at least read chunck of memory instead of reading it line by line.
My question is : if I read chunck of memory using
ifstream bigFile("mybigfile.dat");
constexpr size_t bufferSize = 1024 * 1024;
unique_ptr<char[]> buffer(new char[bufferSize]);
while (bigFile)
{
bigFile.read(buffer.get(), bufferSize);
// process data in buffer
}
for example, is there a way to be sure that my buffer won't stop in the middle of a line?
For example, my files is
x1 y1 z1 i1 r1 g1 b1
x2 y2 z2 i2 r2 g2 b2
x3 y3 z3 i3 r3 g3 b3
x4 y4 z4 i4 r4 g4 b4
x5 y5 z5 i5 r5 g5 b5
and I want to create a std::vector<Point>. So I read a buffer size of this file, put it in the buffer, and then I take data from buffer to create my points. But how can I be sure that the buffer won't stop at r3?
If the buffer contains x1 y1 z1 i1 r1 g1 b1 x2 y2 z2 i2 r2 g2 b2 x3 y3 z3 i3 r3 I can't create a point using only x3, y3, z3, i3, r3. I would need g3 and b3 too.
Is there a way to take care of that? I hope that it is understandable, English isn't my native language and I'm not sure I explained it well...

Predict data values given history and constraints

If I have data series and a set of constraints and want to predict the most likely values, what is the right algorithm or approach? For example, given the data table as follows:
The first three rows illustrate typical data values. Imagine we have dozens or hundreds of such rows. The constraints on the system are as follows:
G1 + G2 + G3 + G4 == D1 + D2 + D3
G1 + G2 = D1 - C1
G3 = D2 + C1 - C2
G4 = D3 + C2
So, given D1, D2 and D3 we need to predict G1, G2, G3, G4, C1, and C2. Note that there may not necessarily be enough information to solve the system by linear programming alone and so some kind of trend analysis or probability distribution might need to be made.
What is the right algorithm or approach to solve a problem like this?

How to compare pose and position of two objects from rotation and translation matrix?

I have two 4*4 matrices representing the poses and positions of two objects in OpenGL.How to calculate the differences of orientation and origin of these objects.
Here is the matrix converted from OpenGL-Style matrix.
r1 r2 r3 t1
r4 r5 r6 t2
r7 r8 r9 t3
0 0 0 1
Let's say the two matrices are M1 and M2, which are applied to vectors from the right:
x1 = M1 * x
x2 = M2 * x
The "difference" between the two matrices can be defined as the matrix Md that needs to applied to x1 to get x2:
Md * x1 = x2
Md * (M1 * x) = M2 * x
To create this identity for all vectors x, Md needs to satisfy the equation:
Md * M1 = M2
To isolate Md in this equation, we multiply by the inverse of M1:
Md * M1 * inv(M1) = M2 * inv(M1)
Matrix multiplication is associative, so we can group the left side as:
Md * (M1 * inv(M1)) = M2 * inv(M1)
and the result for Md is:
Md = M2 * inv(M1)
So you can solve this with a 4x4 matrix inversion and a matrix multiplication.
An alternative is that you decompose the original matrixes into a rotation and a translation each, which are applied to vectors as:
x1 = R1 * x + t1
x2 = R2 * x + t2
where R1 and R2 are 3x3 matrices, t1 and t2 translation vectors. Following the same steps as before, but also writing the difference broken down into a rotation Rd and a translation td:
Rd * x1 + td = x2
Rd * (R1 * x + t1) + td = R2 * x + t2
Rd * R1 * x + Rd * t1 + td = R2 * x + t2
For the rotation parts of both sides to match, Rd needs to satisfy:
Rd * R1 = R2
Not surprisingly, the calculation of Rd looks very similar to Md above. As a simplification, we can take advantage of the fact that the inverse of a rotation is its transpose:
Rd = R2 * inv(R1)
Rd = R2 * transp(R1)
Now in the equation above, the translation parts also need to match, which gives us td:
Rd * t1 + td = t2
td = t2 - Rd * t1
In summary, you calculate the rotation matrix and translation vector of the difference as:
Rd = R2 * transp(R1)
td = t2 - Rd * t1

"initial values are not feasible" error message while running structural equation model in Stata?

I am working on a structural equation model (sem) model with 47 observed variables and 6 latent variables, of which 5 observed variables are endogenous and one latent variable is endogenous. Data has no missing values and sample size is 4,634.
I ran sem in Stata using the following command:
sem (I -> i1 i2 i3 i4 i5_1) ///
(N -> n1 n2 n3 n4) ///
(S -> s1 s2 s3 s4 s5 s6 s7 s8 s9) ///
(T -> t1 t2 t3 t4) ///
(SES -> se1 se2 se3 se4 se5 se6 se7 se8 se9 se10 ///
se11 se12 se13 se14 se15 se16 se17 se18 se19 se20) ///
(CS -> c1 c2 c3 c4 c5) ///
(CS <- I N S T SES)
It returned the following error message:
initial values are not feasible
Why am I receiving this message? How can I deal with this error?
I would start by looking at each measurement model separately, and see if there are problems there. i.e.:
sem ( i1 i2 i3 i4 i5_1 <- I)
sem ( i1 i2 i3 i4 i5_1 <- N)
etc.
My guess would be that the model for SES might prove to be the problem.
Edit:
Based on your comment we now know that the measurement models in isolation converge. Next step would be to check each of the measurement models to see whether they make sense: Do each of the loading have the expected sign? Are there loading that are unexpectedly large or small? If you see that, you need to figure out why that is the case. This just requires staring at your data, looking at graphs and correlation tables.
If there is no problem with your measurement model, then the next step would be to look at the structural part. Obviously you cannot do the same trick as with the measurement model, that is, you cannot estimate the structural part without the measurement models. The structural contains latent variables, and it is the measurement models that define what they are. So without measurement models, the structural model is not identified.
What I would do instead is simplify your model, and than add complication till you run into problems. For example I might start with:
sem (I -> i1 i2 i3 i4 i5_1) ///
(CS -> c1 c2 c3 c4 c5) ///
(CS <- I)
Than continue with:
sem (I -> i1 i2 i3 i4 i5_1) ///
(N -> n1 n2 n3 n4) ///
(CS -> c1 c2 c3 c4 c5) ///
(CS <- I N)
etc.
That way you can find which latent variable causes trouble. My first move would be to look at the measurement model of that variable and look at the scale of that variable. By default sem "borrows" the scale of one of the observed variables by setting the loading for that variable to 1. Is that variable in some sense "weird"? Similarly I would also look at the scale for your endogenous latent variable CS. If they are weird, you can choose to constrain the loading of another variable with a more reasonable scale to 1, or you can "standardize" your latent variable by constraining the variance of the latent variable to be 1.