## Autofocus – How do fixed lenses "focus" objects at different distances?

Think of a tiny part of a view, maybe the gleam in the eyes of a pretty girl. When this object is far away, the light of this tiny object strikes the lens as parallel rays. The shape of the glass lenses and their density change the path of this incident light. It leaves the lens to transform rays. A trace of these rays resembles a cone of light. The vertex of this cone forms 50 mm downstream of the lens (assuming the source was far away (infinity ∞)) and the lens has a focal length of 50 mm. Since this 50 mm fixed lens has limited ability to change the angle of the beam exit. If the object is closer than ∞, the tip of the cone forms farther downstream. If you focus on the lens barrel by turning the focus ring, adjust the distance lens to image sensor / film to kiss the tip of the cone of imaging light on the film or sensor.

In short, all objects in a view can consist of innumerable tiny points. Each will be the origin of the rays of light. If the object is a distance, these rays enter the parallel rays of the lens. If the object is near the camera, the rays impinging on the lens are not parallel, but diverge. The lens redirects all these rays. There is a new way a beam of light. The tip of the light cone of each object has a finite length. The shortest distance from the lens to the vertex is a trace of a distant object. Nearby objects have longer distances from lens to tip. When turning the ring, adjust the distance between the lens and the image sensor. An object is focused only when the tip of the cone of imaging rays kisses the image sensor. In this case, the object is displayed as a tiny circle of light. This small circle has indistinct edges; We call them confusion circles. The whole picture of a view consists of countless such circles. Objects in focus reproduce as tiny circles. Blurred objects are reproduced as larger circles. To be sharp, the confusion circles must be very small, so small that they are perceived at points of light and not at circles of light.

The depth of field is the zone in front of and behind the actual focused distance where objects appear to be reasonably sharp. This zone is reduced and enlarged depending on the diameter of the aperture setting of the camera. Tiny opening diameters expand the zone. The depth of field has many elements: aperture, subject distance, visual acuity of the observer, illuminance of the viewed image, contrast of the viewed image and distance of the observer to the viewed image. The depth of field complexity is too large for these few paragraphs. Why not study on the topic. In short, when the confusion circles are regarded as points of light, the image is declared sharp. If the circles are visible to the viewer as circles and dimensionless dots, the viewer explains the image as out of focus.

## The fixed menu does not work if it is included in iframe

I have a menu that I have included in web page with an iframe. The menu works fine if it is not an include, but when loaded with an iframe, the fixed part of the menu does not work. Can someone help me please? Here is the demo: http://project-smac.orgfree.com

## Beware of nocix.net: Disk Errors in RAID1 can not be fixed

Hello,

This is an automatically generated e-mail message from mdadm
keep running

On md device / dev / md1 a DegradedArray event was detected.

Sincerely, etc.

P.S. The / proc / mdstat file currently contains the following:

Personalities: (raid1)
md1: active raid1 sdb2 (1)
952053568 blocked Super 1.1 (2/1) (_U)
Bitmap: 8/8 pages (32 KB), 65536 KB Chunk

md0: active raid1 sdc1 (0) sdb1 (1)
24559488 Blocks Super 1.1 (2/2) (UU)

unused devices:

Then I contacted the support.

You said that the hard drive needs to be replaced.

We do not handle RAID arrays, it's up to you.

I said that

Raid was installed by your staff when setting up the server.

We first set it up, then we gave it to you. Because these are completely unmanaged services, all software aspects are covered by you, the customer.

Before you upgrade a disk-scanning server:

Personalities: (raid1)
md1: active raid1 sdb2 (1)
952053568 blocked Super 1.1 (2/1) (_U)
Bitmap: 8/8 pages (32 KB), 65536 KB Chunk

md0: active raid1 sdc1 (0) sdb1 (1)
24559488 Blocks Super 1.1 (2/2) (UU)

After disk check:
Personalities: (raid1)
md1: active raid1 sdc2 (1)
952053568 blocked Super 1.1 (2/1) (_U)
Bitmap: 8/8 pages (32 KB), 65536 KB Chunk

md0: active raid1 sdb1 (0) sdc1 (1)
24559488 Blocks Super 1.1 (2/2) (UU)

Why
sdb2
has changed too
sdc2

And
sdb1
has changed too
sdc1
?

And get

I think it was the way the drives were labeled. The failed drive is the drive with the serial number Z2UV5AZUS, which has the physical name drive 2. As such, I put it as the second drive in the server.

After the restart, the server was placed in emergency maintenance shell mode and read-only.

It seems that the operating system is read-only. I can not do anything to edit or call ssh for you.
Even if I'm logged in, I can not edit or start anything, it's just readable. We can reload the SSD on CentOS 6 if you want or give you a KVM.

Also note that you need to install cpanel.

The former cpanel was installed by your staff.

We do not install third-party applications. We can provide you with a link to the installation.

Problem not solved.
I restore data from backup on another server.
I have requested a money refund. The server was paid for 6 months in advance (server was set up on 29.06.2014).

Many thanks.

## Fixed the error: Remote upload failed: 503 Service not available

Bug Fix: Remote Upload Failed: 503 Service Unavailable | Web Hosting Talk

& # 39);
var sidebar_align = & right; & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;);
// ->

1. ## Fixed the error: Remote upload failed: 503 Service not available

Hello
When I try to upload a file remotely (from the direct download URL) to my file host account, I get the following:

Error: Remote upload failed: Error message "503 Service not available"

How do you repair?

#### Publish permissions

• You not allowed post new topics
• You not allowed Post answers
• You not allowed Post attachments
• You not allowed Edit your posts

## Python – Fixed Content Necklace Generator

I've written a class that generates combinatory hard-chain necklaces to Sawada: a fast algorithm to generate solid-content necklaces. The class is instantiated with an input list indicating the occurrence of each value to appear in the chain. The execute method is called to execute either the simple or the fast algorithm of Sawada.

Some definitions:

• `letter`: A value that can appear in the necklace. Is a non-negative integer
• `occurrence`: indicates how many of each `letter` must appear in the chain. `letter` can be used to index `occurrence`,
• `word`: a full configuration of `letters` that can be a necklace. Has a size of `sum(occurrence)`,
• `alphabet`: (used only for fast algorithms) contains a list of all unique ones `letters`, As `occurrence` For a `letter` falls to 0, that `letter` is removed `alphabet`, and vice versa.
• `k-1`: the last `letter` in the `alphabet`
• `run`: (used only for fast algorithms) This tracks the longest chain of `k-1` starting from each index.

The simple algorithm goes through each index in `word`and repeats itself `letters` they stay in `occurrence` until it can find one `word` that fulfills the necklace condition.

The fast algorithm shortens part of it by checking whether certain conditions allow it to return before assigning a `letter` explicitly to every single index in `word`, It will initialize `word` to the last value in `alphabet` and track downhill. Connections:

1. If only the values ​​are to be assigned `0`, then it is not a chain, and skip.
2. If only the values ​​are to be assigned `k-1`, then it's a necklace, if that `occurrence` from `k-1` is> the current run (or = under certain conditions).

Some joins may occur before the algorithm starts:

1. `occurrence` can have values ​​= 0 (states that a given `letter` does not occur in the chain). In this case it is useful to remove these letters as well `alphabet` and `occurrence`,
2. A necklace with solid content must always start with the lowest `letter` that has `occurrence` greater than 0.
``````class Fixed_content_necklace:
def __init__(self, n):
# n is a list of integers

# force negative numbers to zero
for i in range(len(n)):
if n(i) < 0:
n(i) = 0

# initialized as number and type of letters to be found in necklace
# ('(n0, n1, n2, ... nk-1)' in paper)
self.n_init = n
# number of letters in word ('n' in paper)
self.N = sum(n)
# number of different letters to be used
self.k = len(n)

self.initialize()

def initialize(self, method='simple'):
# used as the number and type of letters STILL TO BE ADDED to word
self.occurrence = self.n_init.copy()
# current word of letters ('a' in paper)
self.word = (0)*self.N

# only used in 'fast' algorithm
self.alphabet = (*range(self.k))
# number of the largest letter from each index to the end
self.run = (0)*self.N

# assume that the first letter in the word will be 0,
# and last letter will be k-1,
# unless they get changed by set_letter_bounds
self.first_letter = 0
self.last_letter = self.k-1
self.__set_letter_bounds(method)

if method != 'simple':
self.word(1:) = (self.last_letter)*(self.N-1)

def __set_letter_bounds(self, method):
# assign the first letter with nonzero occurrence to word(0)
# short-circuiting the search to the letter to put there during the algorithm
# find the last nonzero letter
found_first_nonzero = False
for letter in range(self.k):
found_first_nonzero = True
self.occurrence(letter) -= 1
self.word(0) = letter
self.first_letter = letter
# remove any letters with zero occurrence from the alphabet so that
# we automatically skip them
if method != 'simple':
if self.occurrence(letter) == 0:
self.__remove_letter(letter)
if not self.alphabet:
self.last_letter = 0
else:
self.last_letter = max(self.alphabet)

# the algorithm starts at 2 (the second letter in 'word') because we've
# already assigned the first letter during initialize
def execute(self, method='simple'):
self.initialize(method)
if method == 'simple':
yield from self._simple_fixed_content(2, 1)
elif method == 'fast':
yield from self._fast_fixed_content(2, 1, 2)

def _simple_fixed_content(self, t, p):
if t > self.N: # if the prenecklace is complete
if self.N % p == 0: # if the prenecklace word is a necklace
yield self.word.copy()
else:
for letter in range(self.word(t-p-1), self.k):
if self.occurrence(letter) > 0:
self.word(t-1) = letter
self.occurrence(letter) -= 1
if letter == self.word(t-p-1):
yield from self._simple_fixed_content(t+1, p)
else:
yield from self._simple_fixed_content(t+1, t)
self.occurrence(letter) += 1

def _fast_fixed_content(self, t, p, s):
# discard any prenecklace that ends in 0 (except for 0^N)
# and any prenecklace that ends in (k-1)^n < (k-1)^m that occurs earlier
if self.occurrence(self.last_letter) == self.N - t + 1:
if self.occurrence(self.last_letter) == self.run(t-p-1):
if self.N % p == 0:
yield self.word.copy()
elif self.occurrence(self.last_letter) > self.run(t-p-1):
yield self.word.copy()
# If the only values left to assign are `0`, then it's not a necklace
elif self.occurrence(self.first_letter) != self.N - t + 1:
letter = max(self.alphabet) # get largest letter from letter list
i = len(self.alphabet)-1 # reset position in letter list
s_current = s
while letter >= self.word(t-p-1):
self.run(s-1) = t - s
self.word(t-1) = letter
self.occurrence(letter) -= 1
if not self.occurrence(letter):
i_removed = self.__remove_letter(letter)
if letter != self.last_letter:
s_current = t+1
if letter == self.word(t-p-1):
yield from self._fast_fixed_content(t+1, p, s_current)
else:
yield from self._fast_fixed_content(t+1, t, s_current)
if not self.occurrence(letter):
self.occurrence(letter) += 1
i -= 1
letter = self.__get_letter(i)
# reset to initial state
self.word(t-1) = self.last_letter

def __remove_letter(self, letter):
i = self.alphabet.index(letter)
self.alphabet.remove(letter)
return i

self.alphabet.insert(index,letter)

def __get_letter(self, i):
if i < 0:
return -1
else:
return self.alphabet(i)
``````

Each method indicates what I expect (though in reverse order). However, the "fast" method, which uses the fast algorithm described by Sawada, almost always takes longer, though it is set up so that several branches are skipped during recursion. The only time I've noticed that the "fast" algorithm is faster, is if `occurrence` from `k-1` is more than twice the size of everyone else.

Example Code:

``````import numpy as np

n = (2, 1, 3, 10) # or n = (0, 1, 2, 1, 3, 14)
mynecklace = Fixed_content_necklace(n)
print('Simple Fixed Content:')
sfc = np.array(list(mynecklace.execute()))
print(sfc)
print('---------------------')
print('Fast Fixed Content:')
ffc = np.array(list(mynecklace.execute('fast')))
print(ffc)
print('---------------------')
print('Are the arrays equivalent?: ', (ffc == np.flipud(sfc)).all())
``````

## nt.number theory – Calculating the Core of a Vector Space with Fixed Field of Field Automorphisms

To let $$E$$ Be a vector space over the field $$K$$, from where $$K$$ is a number field (finite extension of $$mathbb {Q}$$). Consider $$Fix_K ( phi)$$ as a fixed field of automorphism $$phi$$, Is it possible to calculate the core of the vector space? $$E$$ With $$Fix_K$$ or is there any relationship of $$Fix_K$$ to the $$Ker (E)$$?

## 2d – Verlet chain with two fixed points does not converge properly

I'm trying to create a simple chain between two fixed endpoints. The problem is that I can not apparently bring the chain into a stable state. Furthermore, the chain is always biased towards one of the end points.

Here are my constants and variables:

``````const NUMBER_OF_LINKS = 100
const CHAIN_LENGTH = 400
const ITERATIONS = 20 # number of times we iterate through constraints each frame
const GRAVITY = Vector2(0, 300)

var anchor1
var anchor2

``````

I do the following at initialization:

``````create_links(NUMBER_OF_LINKS)

``````

And here are the adjustments I make for each frame:

``````links(0).global_position = anchor1.global_position

var acceleration = GRAVITY
acceleration *= delta * delta
if not i in (0, NUMBER_OF_LINKS - 1):

for iteration in range (ITERATIONS):

if i == 0 or i == NUMBER_OF_LINKS - 1:
else:

if i == 0 or i == NUMBER_OF_LINKS - 1:
else:

``````

When I let that happen, I get almost what I want, except that the chain warps and never reaches a steady state. Also, it's biased in the first direction I take in solving the restrictions.

It looks like this:

What am I doing wrong? How can I get a chain that stabilizes with evenly distributed links?

## Convert c ++ floating point algorithm to fixed point

After reading a lot about fixed-point arithmetic, I think I understood all the basics. Unfortunately, I do not yet know how to convert routines that include sin / cos / sqrt functions. For example, consider this simple mcve:

``````#include
#include
#include
#include

typedef char S8;
typedef short S16;
typedef int S32;
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
typedef float F32;
typedef double F64;

const F32 PI = 3.141592653589793f;
const F32 pi = 3.141592653589793f;
const U32 WIDTH = 256;
const U32 HEIGHT = 256;

unsigned char clamp(F32 valor) {
return valor > 255 ? 255 : (valor < 0 ? 0 : (unsigned char)valor);
}

struct Pbits {
U32 width;
U32 height;
U8 *data;

Pbits(U32 width, U32 height, U8 *data) {
this->width = width;
this->height = height;
this->data = data;
}

void getPixel(U32 y, U32 x, U8 &r, U8 &g, U8 &b, U8 &a) {
U32 offset = (y * height << 2) + (x << 2);
r = this->data(offset + 0);
g = this->data(offset + 1);
b = this->data(offset + 2);
a = this->data(offset + 3);
}

void setPixel(U32 y, U32 x, U8 c1, U8 c2, U8 c3, U8 c4) {
unsigned int offset = (y * height << 2) + (x << 2);

data(offset) = c1;
data(offset + 1) = c2;
data(offset + 2) = c3;
data(offset + 3) = c4;
}
};

void fx1_plasma(Pbits *dst, F32 t, F32 k1, F32 k2, F32 k3, F32 k4, F32 k5, F32 k6) {
U32 height = dst->height;
U32 width = dst->width;

for (U32 y = 0; y < height; y++) {
float uv_y = (float)y / height;
for (U32 x = 0; x < width; x++) {
float uv_x = (float)x / width;

float v1 = sin(uv_x * k1 + t);
float v2 = sin(k1 * (uv_x * sin(t) + uv_y * cos(t / k2)) + t);
float cx = uv_x + sin(t / k1) * k1;
float cy = uv_y + sin(t / k2) * k1;
float v3 = sin(sqrt(k3 * (cx * cx + cy * cy)) + t);
float vf = v1 + v2 + v3;

U8 r = (U8)clamp(255 * cos(vf * pi));
U8 g = (U8)clamp(255 * sin(vf * pi + k4 * pi / k2));
U8 b = (U8)clamp(255 * cos(vf * pi + k5 * pi / k2));
U8 a = (U8)255;

dst->setPixel(y, x, r, g, b, a);
}
}
}

void dump_bits(Pbits *dst, char *filename) {
std::ofstream file(filename, std::ofstream::trunc);
if (!file.is_open()) {
std::cout << "yep! file is not open" << std::endl;
}
file << "P3n" << dst->width << " " << dst->height << "n255n";

U8 r, g, b, a;
for (U32 y = 0; y < dst->height; y++) {
for (U32 x = 0; x < dst->width; x++) {
dst->getPixel(y, x, r, g, b, a);
file << (int)r << " " << (int)g << " " << (int)b << "n";
}
}
}

int main() {
Pbits dst(WIDTH, HEIGHT, new U8(WIDTH * HEIGHT * 4));

clock_t begin = clock();
fx1_plasma(&dst, 0, 8, 36, 54, 51, 48, 4);
clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;

std::cout << "Generated plasma in " << elapsed_secs << "s" << std::endl;

dump_bits(&dst, "plasma.ppm");
}
``````

This code generates this image:

I want to learn how to convert the floating-point routine `fx1_plasma` to the fixed point. For this purpose I have created this file which contains some utilities:

lut.h

``````#pragma once

#include
#include

/// Fixed-point Format 4.28 (32bit)
typedef int FP32;

// const float PI = 3.141592653589793f;

#define LUT_SIZE_BITS 9  // 0xffffffff>>(32-9)=511; 32-23=9; 2^9=512
#define LUT_SIZE 512

#define FRACT_BITS 28        // Number fractional bits
#define M (1 << FRACT_BITS)  // Scaling factor

inline float Q2F(FP32 X) { return ((float)X / (float)(M)); }
inline FP32 F2Q(float X) { return (FP32)(X * (M)); }

FP32 cos_table(LUT_SIZE) = {
65536,      65531,      65516,      65491,      65457,      65412,      65358,      65294,      65220,      65136,      65043,      64939,      64826,      64703,      64571,      64428,
64276,      64115,      63943,      63762,      63571,      63371,      63162,      62942,      62714,      62475,      62228,      61971,      61705,      61429,      61144,      60850,
60547,      60235,      59913,      59583,      59243,      58895,      58538,      58172,      57797,      57414,      57022,      56621,      56212,      55794,      55368,      54934,
54491,      54040,      53581,      53114,      52639,      52156,      51665,      51166,      50660,      50146,      49624,      49095,      48559,      48015,      47464,      46906,
46341,      45768,      45189,      44604,      44011,      43412,      42806,      42194,      41575,      40951,      40320,      39683,      39040,      38391,      37736,      37076,
36410,      35738,      35061,      34379,      33692,      33000,      32302,      31600,      30893,      30182,      29466,      28745,      28020,      27291,      26558,      25821,
25079,      24335,      23586,      22834,      22078,      21319,      20557,      19792,      19024,      18253,      17479,      16703,      15924,      15143,      14359,      13573,
12785,      11996,      11204,      10411,       9616,       8820,       8022,       7224,       6424,       5623,       4821,       4019,       3216,       2412,       1608,        804,
0,       -803,      -1607,      -2411,      -3215,      -4018,      -4820,      -5622,      -6423,      -7222,      -8021,      -8819,      -9615,     -10410,     -11203,     -11995,
-12784,     -13572,     -14358,     -15142,     -15923,     -16702,     -17478,     -18252,     -19023,     -19791,     -20556,     -21318,     -22077,     -22833,     -23585,     -24334,
-25078,     -25820,     -26557,     -27290,     -28019,     -28744,     -29465,     -30181,     -30892,     -31599,     -32301,     -32999,     -33691,     -34378,     -35060,     -35737,
-36409,     -37075,     -37735,     -38390,     -39039,     -39682,     -40319,     -40950,     -41574,     -42193,     -42805,     -43411,     -44010,     -44603,     -45189,     -45768,
-46340,     -46905,     -47463,     -48014,     -48558,     -49094,     -49623,     -50145,     -50659,     -51165,     -51664,     -52155,     -52638,     -53113,     -53580,     -54039,
-54490,     -54933,     -55367,     -55793,     -56211,     -56620,     -57021,     -57413,     -57797,     -58171,     -58537,     -58895,     -59243,     -59582,     -59913,     -60234,
-60547,     -60850,     -61144,     -61429,     -61704,     -61971,     -62227,     -62475,     -62713,     -62942,     -63161,     -63371,     -63571,     -63762,     -63943,     -64114,
-64276,     -64428,     -64570,     -64703,     -64826,     -64939,     -65043,     -65136,     -65220,     -65294,     -65358,     -65412,     -65457,     -65491,     -65516,     -65531,
-65536,     -65531,     -65516,     -65491,     -65457,     -65412,     -65358,     -65294,     -65220,     -65136,     -65043,     -64939,     -64826,     -64703,     -64571,     -64429,
-64276,     -64115,     -63943,     -63762,     -63572,     -63372,     -63162,     -62943,     -62714,     -62476,     -62228,     -61971,     -61705,     -61429,     -61145,     -60851,
-60547,     -60235,     -59914,     -59583,     -59244,     -58896,     -58538,     -58172,     -57798,     -57414,     -57022,     -56621,     -56212,     -55795,     -55369,     -54934,
-54491,     -54041,     -53581,     -53114,     -52639,     -52156,     -51665,     -51167,     -50660,     -50146,     -49625,     -49096,     -48559,     -48016,     -47465,     -46907,
-46341,     -45769,     -45190,     -44604,     -44012,     -43413,     -42807,     -42195,     -41576,     -40951,     -40320,     -39683,     -39040,     -38392,     -37737,     -37076,
-36411,     -35739,     -35062,     -34380,     -33693,     -33001,     -32303,     -31601,     -30894,     -30183,     -29467,     -28746,     -28021,     -27292,     -26559,     -25822,
-25080,     -24336,     -23587,     -22835,     -22079,     -21320,     -20558,     -19793,     -19025,     -18254,     -17480,     -16704,     -15925,     -15144,     -14360,     -13574,
-12786,     -11997,     -11205,     -10412,      -9617,      -8821,      -8023,      -7225,      -6425,      -5624,      -4822,      -4020,      -3217,      -2413,      -1609,       -805,
-1,        802,       1606,       2410,       3214,       4017,       4819,       5621,       6421,       7221,       8020,       8818,       9614,      10409,      11202,      11994,
12783,      13571,      14357,      15140,      15922,      16701,      17477,      18251,      19022,      19790,      20555,      21317,      22076,      22832,      23584,      24332,
25077,      25819,      26556,      27289,      28018,      28743,      29464,      30180,      30891,      31598,      32301,      32998,      33690,      34377,      35060,      35736,
36408,      37074,      37734,      38389,      39038,      39681,      40318,      40949,      41574,      42192,      42804,      43410,      44009,      44602,      45188,      45767,
46339,      46904,      47462,      48013,      48557,      49094,      49623,      50144,      50658,      51165,      51663,      52154,      52637,      53112,      53580,      54039,
54490,      54932,      55367,      55793,      56211,      56620,      57021,      57413,      57796,      58171,      58537,      58894,      59242,      59582,      59912,      60234,
60546,      60849,      61143,      61428,      61704,      61970,      62227,      62475,      62713,      62942,      63161,      63371,      63571,      63762,      63943,      64114,
64276,      64428,      64570,      64703,      64826,      64939,      65042,      65136,      65220,      65294,      65358,      65412,      65456,      65491,      65516,      65531
};
FP32 sin_table(LUT_SIZE) = {
0,        804,       1608,       2412,       3215,       4018,       4821,       5622,       6423,       7223,       8022,       8819,       9616,      10410,      11204,      11995,
12785,      13573,      14358,      15142,      15923,      16702,      17479,      18252,      19024,      19792,      20557,      21319,      22078,      22833,      23585,      24334,
25079,      25820,      26557,      27290,      28020,      28745,      29465,      30181,      30893,      31600,      32302,      32999,      33692,      34379,      35061,      35738,
36409,      37075,      37735,      38390,      39039,      39682,      40319,      40950,      41575,      42193,      42806,      43411,      44011,      44603,      45189,      45768,
46340,      46905,      47464,      48015,      48558,      49095,      49624,      50145,      50659,      51166,      51664,      52155,      52638,      53113,      53581,      54040,
54491,      54933,      55368,      55794,      56211,      56621,      57021,      57413,      57797,      58172,      58538,      58895,      59243,      59583,      59913,      60234,
60547,      60850,      61144,      61429,      61704,      61971,      62228,      62475,      62713,      62942,      63161,      63371,      63571,      63762,      63943,      64114,
64276,      64428,      64571,      64703,      64826,      64939,      65043,      65136,      65220,      65294,      65358,      65412,      65457,      65491,      65516,      65531,
65536,      65531,      65516,      65491,      65457,      65412,      65358,      65294,      65220,      65136,      65043,      64939,      64826,      64703,      64571,      64428,
64276,      64115,      63943,      63762,      63572,      63371,      63162,      62942,      62714,      62476,      62228,      61971,      61705,      61429,      61144,      60850,
60547,      60235,      59913,      59583,      59244,      58895,      58538,      58172,      57797,      57414,      57022,      56621,      56212,      55794,      55368,      54934,
54491,      54040,      53581,      53114,      52639,      52156,      51665,      51166,      50660,      50146,      49624,      49095,      48559,      48015,      47464,      46906,
46341,      45769,      45190,      44604,      44011,      43412,      42806,      42194,      41576,      40951,      40320,      39683,      39040,      38391,      37736,      37076,
36410,      35739,      35062,      34380,      33693,      33000,      32303,      31601,      30894,      30182,      29466,      28745,      28021,      27291,      26558,      25821,
25080,      24335,      23586,      22834,      22079,      21320,      20558,      19793,      19025,      18254,      17480,      16703,      15924,      15143,      14360,      13574,
12786,      11996,      11205,      10411,       9617,       8820,       8023,       7224,       6424,       5623,       4822,       4019,       3216,       2413,       1609,        805,
1,       -803,      -1607,      -2411,      -3214,      -4017,      -4820,      -5621,      -6422,      -7222,      -8021,      -8818,      -9615,     -10409,     -11203,     -11994,
-12784,     -13572,     -14357,     -15141,     -15922,     -16701,     -17478,     -18251,     -19022,     -19791,     -20556,     -21318,     -22077,     -22832,     -23584,     -24333,
-25078,     -25819,     -26556,     -27289,     -28019,     -28744,     -29464,     -30180,     -30892,     -31599,     -32301,     -32998,     -33691,     -34378,     -35060,     -35737,
-36408,     -37074,     -37735,     -38389,     -39038,     -39681,     -40318,     -40949,     -41574,     -42193,     -42805,     -43411,     -44010,     -44602,     -45188,     -45767,
-46339,     -46905,     -47463,     -48014,     -48558,     -49094,     -49623,     -50145,     -50659,     -51165,     -51664,     -52155,     -52638,     -53113,     -53580,     -54039,
-54490,     -54933,     -55367,     -55793,     -56211,     -56620,     -57021,     -57413,     -57796,     -58171,     -58537,     -58894,     -59243,     -59582,     -59913,     -60234,
-60546,     -60850,     -61144,     -61428,     -61704,     -61970,     -62227,     -62475,     -62713,     -62942,     -63161,     -63371,     -63571,     -63762,     -63943,     -64114,
-64276,     -64428,     -64570,     -64703,     -64826,     -64939,     -65042,     -65136,     -65220,     -65294,     -65358,     -65412,     -65456,     -65491,     -65516,     -65531,
-65536,     -65531,     -65516,     -65491,     -65457,     -65412,     -65358,     -65294,     -65220,     -65136,     -65043,     -64940,     -64826,     -64704,     -64571,     -64429,
-64277,     -64115,     -63943,     -63762,     -63572,     -63372,     -63162,     -62943,     -62714,     -62476,     -62228,     -61971,     -61705,     -61430,     -61145,     -60851,
-60548,     -60235,     -59914,     -59583,     -59244,     -58896,     -58539,     -58173,     -57798,     -57415,     -57022,     -56622,     -56213,     -55795,     -55369,     -54934,
-54492,     -54041,     -53582,     -53115,     -52640,     -52157,     -51666,     -51167,     -50661,     -50147,     -49625,     -49096,     -48560,     -48016,     -47465,     -46907,
-46342,     -45770,     -45191,     -44605,     -44012,     -43413,     -42807,     -42195,     -41577,     -40952,     -40321,     -39684,     -39041,     -38392,     -37737,     -37077,
-36411,     -35740,     -35063,     -34381,     -33693,     -33001,     -32304,     -31602,     -30895,     -30183,     -29467,     -28746,     -28022,     -27292,     -26559,     -25822,
-25081,     -24336,     -23588,     -22835,     -22080,     -21321,     -20559,     -19794,     -19026,     -18255,     -17481,     -16704,     -15925,     -15144,     -14361,     -13575,
-12787,     -11997,     -11206,     -10413,      -9618,      -8822,      -8024,      -7225,      -6425,      -5624,      -4823,      -4020,      -3217,      -2414,      -1610,       -806
};
``````

These tables were generated with this code:

``````void gen_cos_table() {
int k = 0;
printf("FP32 cos_table(LUT_SIZE) = {");
for (int i = 0; i < LUT_SIZE; i++) {
float rad = ((float)i * 0.703125) * 0.0174532;
cos_table(i) = F2Q(x);
if(k==0)
printf("n   ");
if(i==LUT_SIZE-1)
printf("%10dn", cos_table(i));
else
printf("%10d, ", cos_table(i));

k++;
k&=0xF;
}
printf("};n");
}

void gen_sin_table() {
int k = 0;
printf("FP32 sin_table(LUT_SIZE) = {");
for (int i = 0; i < LUT_SIZE; i++) {
float rad = ((float)i * 0.703125) * 0.0174532;
sin_table(i) = F2Q(x);
if(k==0)
printf("n   ");
if(i==LUT_SIZE-1)
printf("%10dn", sin_table(i));
else
printf("%10d, ", sin_table(i));

k++;
k&=0xF;
}
printf("};n");
}
``````

QUESTION: Can you provide a fixed-point version of the floating-point routine? `fx1_plasma`?

## Transform a fixed binary tree without recursion

I fight in this case. I have a binary decision diagram that is pretty tree-like. Each node has a Hi and Lo node. I have to go back to the tree and, if some conditions apply, replace the node with a new node. Knots are invariable. So, when I come across something I need to change, I have to return the new version of the node all the way up. Ultimately, the root changes. In particular, I am trying to implement the RESTRICT algorithm for ROBDDs.

And I have! This works fine (C #, sorry?)

``````        Node Restrict(Node node, Func npoint)
{
if (node == context.Term0 || node == context.Term1)
return node;

// value has been restricted, replace with true or false path
if (npoint(node.Variable) is bool value)
return Restrict(value ? node.Hi : node.Lo, npoint);

var lo = Restrict(node.Lo, npoint);
var hi = Restrict(node.Hi, npoint);
return new Node(node.Variable, lo, hi);
}
``````

My chart is pretty big though. And I'm running out of the stack.

So I'm trying to find a way to do this without recursion. I've tried a few things, but found nothing that works. When I start to expand it gets quite complicated and I start losing track.

Can someone point me to a resource?

## 9.0 pie – Fixed issues that cause the CPU to be empty and the battery to be low

Phone: Nokia 7 Plus
Android version: 9

Intro:
My problem started a few months ago when battery life suddenly dropped. When Wifi and Bluetooth are off, the phone barely holds a day. Interestingly enough, the battery lasts for more than two days when the battery saver is switched on. I've continued to investigate: I've installed Gsam Battery Monitor and after a few weeks of experimenting, I can see that whenever my battery saver is not turned on, there is a constant CPU usage of about 20% and a 10% frequency. Without battery saver mode, there are still some unexplained rashes in CPU usage in strange times.

Nokia 7 Plus is pretty expensive, I bought it because I wanted a dual-SIM phone that lasted at least a couple of years, but this barely has two. I had much worse phones that lasted twice as long.

I tried to delete as many applications as possible, but that did not help, and the beginning of my issues is not a timely way to install a new app. So I suspect that Google has screwed something into an update.

The question:
What can I do to remedy this? Is there any way to find out what keeps the CPU running in crazy hours?