Copyright | (c) Esa Pulkkinen 2018 |
---|---|
License | LGPL |
Maintainer | esa.pulkkinen@iki.fi |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
This module implements lazy infinite streams, stream generating functions and lots of operations on the lazy streams. some examples for use of this module:
fib = 1 `div` (1 - s_z - s_z*s_z)
pascal_triangle = Matrix $ 1 `div` (1 - s_z - s_z2*s_z)
take 4 fib == [1,1,2,3]
alternating_bits = cycle [0,1]
Synopsis
- (!) :: Stream a -> Integer -> a
- stail_stream :: Stream a -> Stream a
- shead_strict :: Stream a -> a
- matrix_powers :: (SupportsMatrixMultiplication g g g a, Diagonalizable g a, LinearTransform g g a) => (g :*: g) a -> Stream ((g :*: g) a)
- power_series_powers :: Num a => Stream a -> (Stream :*: Stream) a
- compose_power_series :: (Closed a, Num a) => Stream a -> Stream a -> Stream a
- power_series_exp :: (Fractional a, Closed a) => Stream a -> Stream a
- matrix_exponential_stream :: (Fractional (Scalar ((g :*: g) a)), Diagonalizable g a, LinearTransform g g a, SupportsMatrixMultiplication g g g a, InnerProductSpace (g a), VectorSpace ((g :*: g) a), Num ((g :*: g) a), Scalar (g (g a)) ~ Scalar (g a), Scalar (g a) ~ a, Scalar a ~ a) => (g :*: g) a -> Stream ((g :*: g) a)
- matrix_exponential :: (Fractional (Scalar ((g :*: g) a)), SupportsMatrixMultiplication g g g a, Diagonalizable g a, LinearTransform g g a, InnerProductSpace (g a), VectorSpace ((g :*: g) a), Num ((g :*: g) a), Scalar (g (g a)) ~ Scalar (g a), Scalar (g a) ~ a, Scalar a ~ a) => (g :*: g) a -> (g :*: g) a
- constantIntegerClosure :: Integer -> Closure Stream Integer
- infiniteInteger :: Closure Stream Integer
- negativeInfiniteInteger :: Closure Stream Integer
- limiting_iso :: (BiArrow arr, Limiting Stream a) => arr (Stream a) (Closure Stream a)
- vec_stream :: Stream a -> Integer -> a
- cmap :: (Limiting s a, Limiting s b) => (a -> b) -> Closure s a -> Closure s b
- cliftA2 :: (Limiting s a, Limiting s b, Limiting s c) => (a -> b -> c) -> Closure s a -> Closure s b -> Closure s c
- close :: Limiting Stream a => a -> Closure Stream a
- closure_limit :: (Num a, Closed a, Limiting Stream a) => Stream (Closure Stream a) -> Closure Stream a
- (.>>=.) :: (Limiting s a, Limiting s b) => Closure s a -> (a -> Closure s b) -> Closure s b
- eigenvector_by_power_iteration :: (Fractional (Scalar (m a)), NormedSpace (m a), LinearTransform m m a) => (m :*: m) a -> m a -> Stream (m a)
- stream_distance_count :: Eq a => Stream a -> Stream a -> Integer
- stream_distance :: Eq a => Stream a -> Stream a -> Rational
- taylor :: (Fractional a, DifferentiallyClosed a) => (a -> a) -> a -> (Stream :*: Stream) a
- stream_identity_matrix :: Integral a => (Stream :*: Stream) a
- stream_diagonal :: (Closed a, ConjugateSymmetric a, Num a) => (Stream a :-> Stream a) -> Stream a
- ssum :: (Closed a, Num a) => Stream a -> a
- svsum :: (Closed a, VectorSpace a) => Stream a -> a
- increasing_substream :: Ord a => Stream a -> Stream a
- sub_member :: Ord a => Stream a -> a -> Bool
- bind_matrix :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> (a -> Stream a -> Stream a -> Stream b) -> Stream b
- stream_as_diagonal :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a
- add_row :: f a -> (Stream :*: f) a -> (Stream :*: f) a
- first_row :: (Stream :*: g) a -> g a
- first_column :: Functor f => (f :*: Stream) a -> f a
- remove_row :: (Stream :*: f) a -> (Stream :*: f) a
- remove_row_endo :: Endo ((Stream :*: f) a)
- add_column :: Applicative f => f a -> (f :*: Stream) a -> (f :*: Stream) a
- add_column_endo :: Applicative f => f a -> Endo ((f :*: Stream) a)
- remove_column :: Functor f => (f :*: Stream) a -> (f :*: Stream) a
- remove_column_endo :: Functor f => Endo ((f :*: Stream) a)
- join3 :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream (a, a, a)
- tails :: Stream a -> (Stream :*: Stream) a
- skippers :: Stream a -> (Stream :*: Stream) a
- fromComplex :: RealFloat a => Complex a -> Stream (Complex a)
- adjusted_sequence_product :: Fractional a => Stream a -> Stream a -> Stream a
- average_seq :: Fractional a => Seq a -> a
- convolution_product_matrix :: (Functor m, Functor n, Num a) => (m :*: Stream) a -> (n :*: Stream) a -> (m :*: n) (Stream a)
- sum_seq :: Num a => Seq a -> a
- stream_powers :: Num a => Stream a -> (Stream :*: Stream) a
- compose :: (ConjugateSymmetric a, Num a, Eq a) => Stream a -> Stream a -> Stream a
- matrix_convolution :: (SupportsMatrixMultiplication f g h a, VectorSpace ((f :*: h) a)) => Stream ((f :*: g) a) -> Stream ((g :*: h) a) -> Stream ((f :*: h) a)
- matrix_convolution_linear :: (SupportsMatrixMultiplication f g h a, Linearizable LinearMap (:*:) g h a, Linearizable LinearMap (:*:) f g a, Linearizable LinearMap (:*:) f h a, VectorSpace ((f :*: h) a)) => Stream (f a :-> g a) -> Stream (g a :-> h a) -> Stream (f a :-> h a)
- matrix_convolution_product_linear :: (Closed a, Fractional a, ConjugateSymmetric a) => (Stream a :-> Stream a) -> (Stream a :-> Stream a) -> Stream a :-> Stream a
- matrix_convolution_product :: (ConjugateSymmetric a, Fractional a) => (Stream :*: Stream) a -> (Stream :*: Stream) a -> (Stream :*: Stream) a
- distance_product :: (Floating a, ConjugateSymmetric a) => Stream a -> Stream a -> Stream a
- nonzero_permutation :: (Num a, Eq a) => Stream a -> (Stream a, Stream Integer)
- prefix_matrix :: a -> Stream a -> Stream a -> (Stream :*: Stream) a -> (Stream :*: Stream) a
- compose_permutation :: Stream Integer -> Stream Integer -> Stream Integer
- permutation_matrix_from_indices :: Num a => Stream Integer -> (Stream :*: Stream) a
- lu_decomposition_stream_matrix :: (Floating a, Eq a) => (Stream :*: Stream) a -> ((Stream :*: Stream) a, (Stream :*: Stream) a, Stream Integer)
- min_convolution :: (Num a, Ord a) => Stream a -> Stream a -> Stream a
- and_stream :: Stream Bool -> Stream Bool -> Stream Bool
- or_stream :: Stream Bool -> Stream Bool -> Stream Bool
- fromNum :: Num a => a -> Stream a
- cycleQueueBy :: (a -> b -> b) -> Queue a -> b
- cycleQueue :: Queue a -> Stream a
- convolve_with :: Num a => ([a] -> b) -> (c -> d -> a) -> Stream c -> Stream d -> Stream b
- convolve_with_seq :: Num a => (Seq a -> b) -> (c -> d -> a) -> Stream c -> Stream d -> Stream b
- data StreamIndex a = StreamIndex {
- sindex_position :: Integer
- sindex_element :: a
- streamfold :: (a -> b -> b) -> Fold (Stream a) b
- fold_codiagonals :: Num a => ([a] -> b -> b) -> (Stream :*: Stream) a -> b
- streamfold2 :: (a -> c -> b) -> (a -> b -> c) -> Fold (Stream a) b
- streamfold_lst :: [a -> b -> b] -> Fold (Stream a) b
- streamfold_stream :: Stream (a -> b -> b) -> Fold (Stream a) b
- rotate_prefix :: Integer -> Stream a -> Stream a
- threeNplusOne :: Integer -> Integer
- collatz :: Integer -> [Integer]
- toNatSeq :: Stream a -> Rec Maybe -> a
- fromIntegerSeq :: (Integer -> a) -> Stream a
- sumSeq :: (Num b, Num a, Ord a) => (a -> b) -> a -> Stream b
- boolValue :: Num a => Bool -> a
- fromBoolSeq :: Num a => (Integer -> Bool) -> Stream a
- streamIndexFold :: Fold (Stream a) (Integer -> a)
- streamindex :: Integer -> Stream a -> a
- streamindex2 :: (Integer, Integer) -> (Stream :*: Stream) a -> a
- map_indices :: (Integer -> Integer) -> Stream a -> Stream a
- limit_fold :: (a -> a -> a) -> Fold (Stream a) (Integer -> a)
- limit_fold_gen :: (a -> b -> b) -> (a -> b) -> Fold (Stream a) (Integer -> b)
- stream_differences :: Num a => Stream a -> Stream a
- stream_quotients :: Fractional a => Stream a -> Stream a
- fixpoint :: Limiting str a => (a -> a) -> a -> Closure str a
- matrix_inverse :: (ConjugateSymmetric (g2 a), LinearTransform (f2 :*: g1) (f2 :*: g1) (g2 a), FunctorArrow (f2 :*: g1) LinearMap LinearMap, InnerProductSpace (f2 (g2 a)), InnerProductSpace (g1 (g2 a)), Transposable f2 g1 (g2 a), Transposable g1 f2 (g2 a), Linearizable LinearMap (:*:) g1 f2 (g2 a), Linearizable LinearMap (:*:) f2 g1 (g2 a), Linearizable LinearMap (:*:) f2 g1 (g2 a), VectorSpace ((:*:) f2 g1 (g2 a)), Scalar (f2 (g2 a)) ~ g2 a, Scalar (g1 (g2 a)) ~ g2 a, Linearizable LinearMap (:*:) g2 g2 a, VectorSpace ((:*:) g2 g2 a), Diagonalizable g2 a) => (g1 (g2 a) :-> f2 (g2 a)) -> (f2 (g2 a) :-> g1 (g2 a)) -> Stream (f2 (g2 a) :-> g1 (g2 a))
- stream_min :: Ord a => Fold (Stream a) (Integer -> a)
- stream_max :: Ord a => Fold (Stream a) (Integer -> a)
- liftStream2 :: (a -> a -> a) -> Stream a -> Stream a
- min_stream :: Ord a => Stream a -> Stream a
- max_stream :: Ord a => Stream a -> Stream a
- stream_product :: Num a => Fold (Stream a) (Integer -> a)
- stream_sum :: Num a => Fold (Stream a) (Integer -> a)
- product_stream :: Num a => Stream a -> Stream a
- sum_stream :: Num a => Stream a -> Stream a
- vsum_stream :: VectorSpace a => Stream a -> Stream a
- sum_stream_integral :: Integral a => Stream a -> Stream a
- sum_stream_fractional :: Fractional a => Stream a -> Stream a
- cobind :: (ConjugateSymmetric a, Num a, Closed a) => (a -> b) -> (Stream a :-> Stream a) -> Stream b
- indexed_lookup :: Stream Integer -> Stream a -> Stream a
- topleft :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> a
- stream_codiagonal :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream (Stream a, Stream a)
- zero_codiagonal :: Num a => Codiagonal Stream a
- stream_diagonal_matrix :: Num a => Stream a -> (Stream :*: Stream) a
- stream_matrix :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream (Stream a, Stream a) -> Stream a :-> Stream a
- from_triangular_matrices :: Num a => Stream a -> (Stream :*: Stream) a -> (Stream :*: Stream) a -> (Stream :*: Stream) a
- triangular_matrix_iso :: Num a => (Stream :*: Stream) a :==: ((Stream :*: Stream) a, Stream a, (Stream :*: Stream) a)
- first_row_iso :: (Stream :*: Stream) a :==: (Stream a, (Stream :*: Stream) a)
- first_col_iso :: (Stream :*: Stream) a :==: (Stream a, (Stream :*: Stream) a)
- triangular_order_matrix :: Num a => (Stream :*: Stream) a
- prefix_stream_matrix :: (ConjugateSymmetric a, Num a, Closed a) => a -> (Stream a, Stream a) -> (Stream a :-> Stream a) -> Stream a :-> Stream a
- pseudo_codiagonal :: (Stream :*: Stream) a -> Codiagonal Stream a
- pseudo_matrix :: Stream a -> Stream (Stream a, Stream a) -> (Stream :*: Stream) a
- map_matrix :: (Num a, Num b) => (a -> b) -> ((Stream a, Stream a) -> (Stream b, Stream b)) -> (Stream :*: Stream) a -> (Stream :*: Stream) b
- map_diagonal :: Num a => (a -> a) -> (Stream :*: Stream) a -> (Stream :*: Stream) a
- joinWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c
- shead_index :: Stream a :==: I a
- stail_index :: Num a => (Stream a :==: I a) -> Stream a :==: I a
- zipList :: ([a] -> b) -> [Stream a] -> Stream b
- sequence :: [Stream a] -> Stream [a]
- unzipList :: Stream [a] -> [Stream a]
- zipStream :: Functor f => (f b -> a) -> f (Stream b) -> Stream a
- sequenceStream :: Functor f => f (Stream a) -> Stream (f a)
- apply3 :: Stream (a -> b -> c) -> Stream a -> Stream b -> Stream c
- applyA :: Arrow arr => Stream (arr a b) -> arr (Stream a) (Stream b)
- dematrix :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> (a, (Stream a, Stream a), Stream a :-> Stream a)
- dematrix_impl :: (Stream :*: Stream) a -> (a, (Stream a, Stream a), (Stream :*: Stream) a)
- codiagonals_linear :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream [a]
- codiagonals_list :: Num a => (Stream :*: Stream) a -> Stream [a]
- codiagonals_seq :: (Stream :*: Stream) a -> Stream (Seq a)
- codiagonals :: (Stream :*: Stream) a -> Stream [a]
- uncodiagonals :: (ConjugateSymmetric a, Closed a, Num a) => Stream [a] -> Stream a :-> Stream a
- uncodiagonals_impl :: Num a => Stream [a] -> (Stream :*: Stream) a
- takes :: Stream Integer -> Stream a -> Stream [a]
- split_dimension :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a
- split_planar :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a
- codiagonalsIso :: (ConjugateSymmetric a, Num a, Closed a, BiArrow arr) => arr (Stream a :-> Stream a) (Stream [a])
- lower_triangle :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream a :-> Stream a
- lower_triangle_impl :: Num a => (Stream :*: Stream) a -> (Stream :*: Stream) a
- upper_triangle :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream a :-> Stream a
- upper_triangle_impl :: Num a => (Stream :*: Stream) a -> (Stream :*: Stream) a
- pairing_matrix :: Fractional a => (Stream :*: Stream) a
- concatenate :: Stream [a] -> Stream a
- diagonalize :: Stream [a] -> Stream a
- skip_even :: Stream a -> Stream a
- nice_tail :: [a] -> [a]
- diagonal_differences :: (ConjugateSymmetric a, Num a, Closed a) => (a -> b) -> (Stream a :-> Stream a) -> Stream b
- find_equal :: Eq a => Stream a -> Stream a -> a
- fixedpoint :: (ConjugateSymmetric a, Num a, Closed a, Eq a) => (a -> a) -> (Stream a :-> Stream a) -> a
- sum_join :: Num a => (Stream :*: Stream) a -> Stream a
- sum_bind :: Num b => Stream a -> (a -> Stream b) -> Stream b
- cojoin :: (Stream :*: Stream) a -> Stream a
- (|*|) :: Closed a => Stream a -> Stream a -> Stream (Vector2 a)
- (>>!=) :: Num b => Stream a -> (a -> Stream b) -> Stream b
- (>!=) :: Num b => Stream a -> (a -> Stream b) -> Stream [b]
- integers :: Num a => Stream a
- integers_stream :: Stream Integer
- naturals :: Num a => Stream a
- naturals_starting_from :: (Num a, Ord a) => a -> Stream a
- nonzero_naturals :: Num a => Stream a
- integral_nonzero_naturals :: Integral a => Stream a
- integral_naturals :: Integral a => Stream a
- s_z :: Num a => Stream a
- s_z2 :: Num a => Stream (Stream a)
- z2_matrix :: Num a => (Stream :*: Stream) a
- s_z3 :: Num a => Stream (Stream (Stream a))
- s_z4 :: Num a => Stream (Stream (Stream (Stream a)))
- z3_matrix :: Num a => ((Stream :*: Stream) :*: Stream) a
- log_stream :: Num a => (Stream :*: Stream) a
- stream_logarithm :: Fractional a => Stream a -> Stream a
- stream_log :: Integral a => Stream a -> Stream a
- approximate_sums :: Fractional a => Stream a -> Stream a -> Stream a
- exponential_stream :: Fractional a => Stream a
- exponential :: (ConjugateSymmetric a, Closed a, Eq a, Fractional a) => Stream a -> Stream a
- log_generating_function :: Fractional a => Stream a
- cos_stream :: (Closed a, Fractional a) => Stream a -> Stream a
- sin_stream :: (Closed a, Fractional a) => Stream a -> Stream a
- sin_generating_function :: Fractional a => Stream a
- cos_generating_function :: Fractional a => Stream a
- factorial :: Num a => Stream a
- reciprocal :: Fractional a => Stream a -> Stream a
- inversion :: Integral a => Stream a -> Stream a
- quotient_invert :: Integral a => Stream a -> Stream a
- unit_product :: Num a => Stream a
- zero :: Num a => Stream a
- stream_if :: Stream Bool -> Stream a -> Stream a -> Stream a
- either :: (a -> c) -> (b -> c) -> Stream (Either a b) -> Stream c
- split_either :: Stream (Either a b) -> (Stream a, Stream b)
- split_either_bool :: Stream (Either a b) -> (Stream Bool, Stream a, Stream b)
- join_either :: Stream Bool -> Stream a -> Stream b -> Stream (Either a b)
- subtract :: Num a => Stream a -> Stream a -> Stream a
- prefix :: [a] -> Stream a -> Stream a
- fromList :: Num a => [a] -> Stream a
- toList :: Stream a -> [a]
- filter :: (a -> Bool) -> Stream a -> Stream a
- remove :: Eq a => [a] -> Stream a -> Stream a
- interleave_count :: Integer -> Stream a -> Stream a -> Stream a
- uninterleave_index :: Integer -> Stream a -> Stream a
- interleave_stream :: Stream a -> Stream a -> Stream a
- interleave_either :: Stream a -> Stream b -> Stream (Either a b)
- uninterleave :: Stream a -> (Stream a, Stream a)
- interleave3 :: Stream a -> Stream a -> Stream a -> Stream a
- uninterleave3 :: Stream a -> (Stream a, Stream a, Stream a)
- uninterleave_indices :: Integer -> Integer -> Stream a -> Stream a
- interleave_lst :: [Stream a] -> Stream a
- uninterleave_lst :: Integer -> Stream a -> [Stream a]
- interleave_queue :: (Queue :*: Stream) a -> Stream a
- uninterleave_queue :: Integer -> Stream a -> (Queue :*: Stream) a
- square :: Num a => [[a]] -> (Stream :*: Stream) a
- drop :: Integer -> Stream a -> Stream a
- take :: Integer -> Stream a -> [a]
- splitAt :: Integer -> Stream a -> ([a], Stream a)
- take2d :: (Integer, Integer) -> (Stream :*: Stream) a -> (List :*: List) a
- drop2d :: (Integer, Integer) -> (Stream :*: Stream) a -> (Stream :*: Stream) a
- countWhile :: (a -> Bool) -> Stream a -> Integer
- takeWhile :: (a -> Bool) -> Stream a -> [a]
- dropWhile :: (a -> Bool) -> Stream a -> Stream a
- span :: (a -> Bool) -> Stream a -> ([a], Stream a)
- cycle :: [a] -> Stream a
- cycle_queue :: Queue a -> Stream a
- stirling_numbers :: Num a => (Stream :*: Stream) a
- negative_stirling_numbers :: Num a => (Stream :*: Stream) a
- natural_prefixes :: Num a => Stream [a]
- toSquare :: (Stream :*: Stream) a -> [[a]]
- print_square :: PpShow a => (Stream :*: Stream) a -> Doc
- power :: Fractional a => Integer -> Stream a
- power_uniform_fractional :: Fractional a => a -> Stream a
- power_integral :: Integral a => Integer -> Stream a
- power_uniform_integral :: Integral a => a -> Stream a
- index_powers :: Num a => Stream a -> Stream a
- substitute :: Num a => Stream a -> Stream a -> Stream a
- fourier_ :: RealFloat a => Complex a -> Stream (Complex a) -> Stream (Complex a)
- exp_generating_function :: (ConjugateSymmetric a, Closed a, Floating a, Eq a) => Stream a
- exponential_generating_function :: Fractional a => Stream a -> Stream a
- poisson_generating_function :: (ConjugateSymmetric a, Closed a, Eq a, Floating a) => Stream a -> Stream a
- pre_subst :: Num a => Stream a -> Stream a -> Stream [a]
- subst :: (Closed a, Num a) => Stream a -> Stream a -> Stream a
- multiply :: Num a => a -> Stream a -> Stream a
- powers :: Num a => Stream a -> (Stream :*: Stream) a
- cauchy_powers :: Num a => a -> Stream a
- binomial_coefficient :: Integral a => Integer -> Integer -> a
- catalan_numbers :: Integral a => Stream a
- catalan_numbers_floating :: (ConjugateSymmetric a, Closed a, Eq a, Floating a) => Stream a
- pascal_triangle :: Integral a => (Stream :*: Stream) a
- pascal_triangle_diag :: Integral a => (Stream :*: Stream) a
- pascal_triangle_diag_fractional :: Fractional a => (Stream :*: Stream) a
- binomial_coefficients :: Integral a => Stream [a]
- binomial_coefficients_seq :: Integral a => Stream (Seq a)
- exp_approx :: Fractional a => a -> Stream a
- polynomial_powers :: Integral a => a -> a -> Stream a
- polynomial_powers_fractional :: Fractional a => a -> a -> Stream a
- fib :: Integral a => Stream a
- triangular_numbers :: Integral a => Stream a
- squares :: Integral a => Stream a
- alternating_signs :: Fractional a => Stream a
- alternating_bits :: Fractional a => Stream a
- alternating_possibly_negative_bits :: Fractional a => Stream a
- odd_integers :: Integral a => Stream a
- odd_integers_ :: Integral a => Stream a
- integers_divisible_by :: Integer -> Stream Integer
- positive_residue_class_modulo :: Integer -> Integer -> Stream Integer
- negative_residue_class_modulo :: Integer -> Integer -> Stream Integer
- residue_class_modulo :: Integer -> Integer -> Stream Integer
- peirces_triangle_func :: (Num a, Ord a) => a -> a -> a
- peirces_triangle :: (Num a, Ord a) => (Stream :*: Stream) a
- peirces_triangle_list :: (Num a, Ord a) => Stream [a]
- falling_factorial_powers_diag :: (ConjugateSymmetric a, Integral a, Closed a) => Stream a :-> Stream a
- falling_factorial_powers :: (Eq a, Num a) => (Stream :*: Stream) a
- rising_factorial_powers :: (Eq a, Num a) => (Stream :*: Stream) a
- bell_numbers :: (Num a, Ord a) => Stream a
- integer_partitions_with_parts :: Integral a => Integer -> Stream a
- square_root :: Integral a => a -> Stream a
- fractional_square_root :: (Fractional a, Eq a) => a -> Stream a
- detect_cycle :: Eq a => Stream a -> [a]
- integer_partitions :: Integral a => (Stream :*: Stream) a
- primes :: Integral t => Stream t
- derivative :: Num a => Stream a -> Stream a
- subtract_ordered :: Ord a => Stream a -> Stream a -> Stream a
- join_ordered :: Ord a => Stream a -> Stream a -> Stream a
- monotonic_membership :: Ord a => Stream a -> Stream a -> Stream Bool
- sqrt_stream :: (Floating a, Closed a) => Stream a -> Stream a
- stream_epsilon :: (ConjugateSymmetric a, Closed a, Fractional a) => Stream a :-> Stream a
- another_epsilon :: (ConjugateSymmetric a, Closed a, Fractional a) => Stream a :-> Stream a
- stream_derivate :: (Fractional a, Closed a, Infinitesimal str (Stream a)) => (Stream a -> Stream a) -> Stream a -> Closure str (Stream a)
- stream_integral :: (Closed b, Infinitesimal str (Stream b), Fractional b, Enum b) => (Stream b -> Stream b) -> (Stream b, Stream b) -> Closure str (Stream b)
- stream_pi :: (Infinitesimal str (Stream a), ConjugateSymmetric a, Closed a, Fractional a, Enum a, Eq a, Floating a) => Closure str (Stream a)
- complex_pi :: (Closed a, RealFloat a) => Stream (Complex a)
- twin_primes :: Integral a => Stream a
- gcd_primes_diff :: Integral a => Stream a
- gcd_primes :: Integral a => Stream a
- gcd_prime_gen :: Integral a => a -> a
- vector_epsilon :: Infinitesimal Stream a => Stream (Vector3 a)
- derivative_coefficients :: Integral a => (Stream :*: Stream) a
- derivative_coefficients_fractional :: Fractional a => (Stream :*: Stream) a
- derivative_linear_map :: (ConjugateSymmetric a, Closed a) => Stream a :-> Stream a
- bernoulli_minus :: Fractional a => Integer -> a
- bernoulli_plus :: Fractional a => Integer -> a
- bernoulli :: Fractional a => Stream a
- bernoulli_polynomial :: Fractional b => b -> Integer -> b
- bernoulli_polynomials :: Fractional a => (Stream :*: Stream) a
- bernoulli_polynomial_coefficients :: Fractional a => Stream [a]
- legendre_polynomials :: (Closed a, Eq a, ConjugateSymmetric a, Floating a) => (Stream :*: Stream) a
- legendre_polynomial_lists :: (Closed a, Num a, Eq a, ConjugateSymmetric a, Floating a) => Stream [a]
- evaluate_polynomial :: Fractional a => [a] -> a -> a
- evaluate_legendre_polynomial :: (Fractional a, Closed a, Eq a, ConjugateSymmetric a, Floating a) => Integer -> a -> a
- evaluate_legendre_at :: (Fractional a, Closed a, Eq a, ConjugateSymmetric a, Floating a) => a -> Stream a
Documentation
stail_stream :: Stream a -> Stream a Source #
shead_strict :: Stream a -> a Source #
matrix_powers :: (SupportsMatrixMultiplication g g g a, Diagonalizable g a, LinearTransform g g a) => (g :*: g) a -> Stream ((g :*: g) a) Source #
power_series_exp :: (Fractional a, Closed a) => Stream a -> Stream a Source #
matrix_exponential_stream :: (Fractional (Scalar ((g :*: g) a)), Diagonalizable g a, LinearTransform g g a, SupportsMatrixMultiplication g g g a, InnerProductSpace (g a), VectorSpace ((g :*: g) a), Num ((g :*: g) a), Scalar (g (g a)) ~ Scalar (g a), Scalar (g a) ~ a, Scalar a ~ a) => (g :*: g) a -> Stream ((g :*: g) a) Source #
matrix_exponential :: (Fractional (Scalar ((g :*: g) a)), SupportsMatrixMultiplication g g g a, Diagonalizable g a, LinearTransform g g a, InnerProductSpace (g a), VectorSpace ((g :*: g) a), Num ((g :*: g) a), Scalar (g (g a)) ~ Scalar (g a), Scalar (g a) ~ a, Scalar a ~ a) => (g :*: g) a -> (g :*: g) a Source #
vec_stream :: Stream a -> Integer -> a Source #
cmap :: (Limiting s a, Limiting s b) => (a -> b) -> Closure s a -> Closure s b Source #
mapping operation for closures. Note we cannot make this a Functor instance due to constraint in the type.
cliftA2 :: (Limiting s a, Limiting s b, Limiting s c) => (a -> b -> c) -> Closure s a -> Closure s b -> Closure s c Source #
close :: Limiting Stream a => a -> Closure Stream a Source #
operation for producing a closure out of single element.
closure_limit :: (Num a, Closed a, Limiting Stream a) => Stream (Closure Stream a) -> Closure Stream a Source #
(.>>=.) :: (Limiting s a, Limiting s b) => Closure s a -> (a -> Closure s b) -> Closure s b Source #
Monadic bind operation for closures, again cannot be made instance of Monad.
eigenvector_by_power_iteration :: (Fractional (Scalar (m a)), NormedSpace (m a), LinearTransform m m a) => (m :*: m) a -> m a -> Stream (m a) Source #
taylor :: (Fractional a, DifferentiallyClosed a) => (a -> a) -> a -> (Stream :*: Stream) a Source #
stream_identity_matrix :: Integral a => (Stream :*: Stream) a Source #
This implementation of infinite identity matrix requires
Integral constraint.
it is not as efficient as identity
, but is implemented using
generating functions.
stream_diagonal :: (Closed a, ConjugateSymmetric a, Num a) => (Stream a :-> Stream a) -> Stream a Source #
stream_diagonal is the "depth-first" traversal over two-dimensional streams, where the choice always goes to diagonal elements.
stream_diagonal (matrix f x y) == liftA2 f x y
bind_matrix :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> (a -> Stream a -> Stream a -> Stream b) -> Stream b Source #
bind diagonal element and horizontal and vertical strip
stream_as_diagonal :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a Source #
stream matrix with a specified diagonal, other elements are zero.
add_column :: Applicative f => f a -> (f :*: Stream) a -> (f :*: Stream) a Source #
adding a column to a matrix.
add_column_endo :: Applicative f => f a -> Endo ((f :*: Stream) a) Source #
join3 :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream (a, a, a) Source #
adjusted_sequence_product :: Fractional a => Stream a -> Stream a -> Stream a Source #
average_seq :: Fractional a => Seq a -> a Source #
convolution_product_matrix :: (Functor m, Functor n, Num a) => (m :*: Stream) a -> (n :*: Stream) a -> (m :*: n) (Stream a) Source #
compose :: (ConjugateSymmetric a, Num a, Eq a) => Stream a -> Stream a -> Stream a Source #
For streams \(b = (b_i)_{i\in{\mathbf{N}}}\) and \(a = (a_i)_{i\in{\mathbf{N}}}\) representing generating functions \(g(z) = \sum_{i=0}^{\infty}{b_iz^i}\) and \(f(z) = \sum_{i=1}^{\infty}{a_iz^i}\) where \(a_0 = 0\), this computes: \[(g \circ f)(z) = g(f(z)) = \sum_{i=0}^{\infty}{b_i(f(z))^i} = \sum_{i=0}^{\infty}(b_i(\sum_{j=1}^{\infty}{a_jz^j})^i)\]
Note that identity of composition on the right is s_z
.
That is, \(s \circ s_z = s\).
https://en.wikipedia.org/wiki/Formal_power_series
matrix_convolution :: (SupportsMatrixMultiplication f g h a, VectorSpace ((f :*: h) a)) => Stream ((f :*: g) a) -> Stream ((g :*: h) a) -> Stream ((f :*: h) a) Source #
matrix_convolution_linear :: (SupportsMatrixMultiplication f g h a, Linearizable LinearMap (:*:) g h a, Linearizable LinearMap (:*:) f g a, Linearizable LinearMap (:*:) f h a, VectorSpace ((f :*: h) a)) => Stream (f a :-> g a) -> Stream (g a :-> h a) -> Stream (f a :-> h a) Source #
matrix_convolution_product_linear :: (Closed a, Fractional a, ConjugateSymmetric a) => (Stream a :-> Stream a) -> (Stream a :-> Stream a) -> Stream a :-> Stream a Source #
matrix_convolution_product :: (ConjugateSymmetric a, Fractional a) => (Stream :*: Stream) a -> (Stream :*: Stream) a -> (Stream :*: Stream) a Source #
computes average to normalize the matrix
distance_product :: (Floating a, ConjugateSymmetric a) => Stream a -> Stream a -> Stream a Source #
distance_product a b
computes \[l_k = \sqrt{\sum_{i+j=k}a_ib_j^{*}}\].
prefix_matrix :: a -> Stream a -> Stream a -> (Stream :*: Stream) a -> (Stream :*: Stream) a Source #
lu_decomposition_stream_matrix :: (Floating a, Eq a) => (Stream :*: Stream) a -> ((Stream :*: Stream) a, (Stream :*: Stream) a, Stream Integer) Source #
https://en.wikipedia.org/wiki/LU_decomposition This has some bug still, l_matrix computation gets stuck.
cycleQueueBy :: (a -> b -> b) -> Queue a -> b Source #
cycleQueue :: Queue a -> Stream a Source #
convolve_with_seq :: Num a => (Seq a -> b) -> (c -> d -> a) -> Stream c -> Stream d -> Stream b Source #
data StreamIndex a Source #
Instances
Functor StreamIndex Source # | |
Defined in Math.Number.Stream fmap :: (a -> b) -> StreamIndex a -> StreamIndex b # (<$) :: a -> StreamIndex b -> StreamIndex a # | |
Comonad StreamIndex Source # | |
Defined in Math.Number.Stream extract :: StreamIndex a -> a Source # duplicate :: StreamIndex a -> StreamIndex (StreamIndex a) Source # extend :: (StreamIndex a -> b) -> StreamIndex a -> StreamIndex b Source # (=>>) :: StreamIndex a -> (StreamIndex a -> b) -> StreamIndex b Source # (.>>) :: StreamIndex a -> b -> StreamIndex b Source # | |
Adjunction StreamIndex Stream Source # | |
Defined in Math.Number.Stream leftAdjunct :: (StreamIndex a -> b) -> a -> Stream b Source # unit :: a -> Stream (StreamIndex a) Source # rightAdjunct :: (a -> Stream b) -> StreamIndex a -> b Source # counit :: StreamIndex (Stream b) -> b Source # | |
Show a => Show (StreamIndex a) Source # | |
Defined in Math.Number.Stream showsPrec :: Int -> StreamIndex a -> ShowS # show :: StreamIndex a -> String # showList :: [StreamIndex a] -> ShowS # |
streamfold :: (a -> b -> b) -> Fold (Stream a) b Source #
fold over streams
streamfold2 :: (a -> c -> b) -> (a -> b -> c) -> Fold (Stream a) b Source #
streamfold_lst :: [a -> b -> b] -> Fold (Stream a) b Source #
threeNplusOne :: Integer -> Integer Source #
the function studied in the Collatz conjecture.
fromIntegerSeq :: (Integer -> a) -> Stream a Source #
sumSeq :: (Num b, Num a, Ord a) => (a -> b) -> a -> Stream b Source #
\[[sumSeq(f)(n)]_j = \sum_{i=n}^{n+j+1}f(i)\]
streamindex :: Integer -> Stream a -> a Source #
stream_quotients :: Fractional a => Stream a -> Stream a Source #
matrix_inverse :: (ConjugateSymmetric (g2 a), LinearTransform (f2 :*: g1) (f2 :*: g1) (g2 a), FunctorArrow (f2 :*: g1) LinearMap LinearMap, InnerProductSpace (f2 (g2 a)), InnerProductSpace (g1 (g2 a)), Transposable f2 g1 (g2 a), Transposable g1 f2 (g2 a), Linearizable LinearMap (:*:) g1 f2 (g2 a), Linearizable LinearMap (:*:) f2 g1 (g2 a), Linearizable LinearMap (:*:) f2 g1 (g2 a), VectorSpace ((:*:) f2 g1 (g2 a)), Scalar (f2 (g2 a)) ~ g2 a, Scalar (g1 (g2 a)) ~ g2 a, Linearizable LinearMap (:*:) g2 g2 a, VectorSpace ((:*:) g2 g2 a), Diagonalizable g2 a) => (g1 (g2 a) :-> f2 (g2 a)) -> (f2 (g2 a) :-> g1 (g2 a)) -> Stream (f2 (g2 a) :-> g1 (g2 a)) Source #
liftStream2 :: (a -> a -> a) -> Stream a -> Stream a Source #
product_stream :: Num a => Stream a -> Stream a Source #
product_stream produce from a stream \([a_0,a_1,a_2,...]\) a stream \([a_0,a_0a_1,a_0a_1a_2,a_0a_1a_2a_3,...]\)
sum_stream :: Num a => Stream a -> Stream a Source #
sum_stream will produce from a stream \([a_0,a_1,a_2,...]\) a stream \([a_0,a_0+a_1,a_0+a_1+a_2,...]\).
vsum_stream :: VectorSpace a => Stream a -> Stream a Source #
sum_stream_fractional :: Fractional a => Stream a -> Stream a Source #
cobind :: (ConjugateSymmetric a, Num a, Closed a) => (a -> b) -> (Stream a :-> Stream a) -> Stream b Source #
if f
in cobind is a fixed-point free function, then this will find a
stream that is not an element of any of the streams.
stream_codiagonal :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream (Stream a, Stream a) Source #
Everything but a diagonal
zero_codiagonal :: Num a => Codiagonal Stream a Source #
stream_matrix :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream (Stream a, Stream a) -> Stream a :-> Stream a Source #
stream_matrix creates matrix from a diagonal and a codiagonal
from_triangular_matrices :: Num a => Stream a -> (Stream :*: Stream) a -> (Stream :*: Stream) a -> (Stream :*: Stream) a Source #
this surprising function builds a two-dimensional infinite matrix from a diagonal, an upper triangular matrix and a lower triangular matrix. Notice the input matrices have no zero entries, rather indices for the triangular matrices are bijectively mapped to indices of the result matrix. This is only possible for infinite matrices. It's even more surprising once it's realised that two-dimensional infinite matrices can be bijectively described as an infinite binary tree of one-dimensional streams.
triangular_matrix_iso :: Num a => (Stream :*: Stream) a :==: ((Stream :*: Stream) a, Stream a, (Stream :*: Stream) a) Source #
isomorphism of infinite matrices that splits along diagonal.
triangular_order_matrix :: Num a => (Stream :*: Stream) a Source #
this matrix contains 0 on diagonal, 1 on diagonal of upper and lower triangular matrices and so on. Every element of the two-dimensional matrix gets an index.
prefix_stream_matrix :: (ConjugateSymmetric a, Num a, Closed a) => a -> (Stream a, Stream a) -> (Stream a :-> Stream a) -> Stream a :-> Stream a Source #
pseudo_codiagonal :: (Stream :*: Stream) a -> Codiagonal Stream a Source #
map_matrix :: (Num a, Num b) => (a -> b) -> ((Stream a, Stream a) -> (Stream b, Stream b)) -> (Stream :*: Stream) a -> (Stream :*: Stream) b Source #
dematrix :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> (a, (Stream a, Stream a), Stream a :-> Stream a) Source #
codiagonals_linear :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream [a] Source #
codiagonals_list :: Num a => (Stream :*: Stream) a -> Stream [a] Source #
codiagonals operation implemented natively on lists.
This is not efficient due to use of list append (++) operation,
which is linear-time operation. Use codiagonals
function instead.
codiagonals_seq :: (Stream :*: Stream) a -> Stream (Seq a) Source #
This is faster than the version for lists, because the suffix computation on Seq is constant time rather than linear. However, strictness seems to behave differently.
codiagonals :: (Stream :*: Stream) a -> Stream [a] Source #
The codiagonals
function will divide a two-dimensional
stream of streams (where elements are \(e_{(i,j)}\) into a stream of
lists
\(l_k\) where \(l_k = [e_{(i,j)} | i \leftarrow naturals, j \leftarrow naturals, i+j = k]\)
The indices in the streams are closely related to "Cantor pairing function" (which is a bijection)
f :: (N,N) -> N f(x,y) = (x+y)(x+y+1)/2 + x
Note that the list at each element of the resulting stream is of finite (but increasing) size. The order in each list is such that the diagonal elements are at the center of (the every second) list.
It is possible to think of this as "breadth-first" traversal over two-dimensional streams.
d x xr0 xr1 xr2 .. y d' x' xr0' xr1' .. yr0 y' yr1 yr0' yr2 yr1' ..
There is symmetry between primed and unprimed (e.g. d and d') towards the diagonal.
The resulting lists would be:
[d], [x,y], [xr0,d',yr0], [xr1,x',y',yr1],...
uncodiagonals :: (ConjugateSymmetric a, Closed a, Num a) => Stream [a] -> Stream a :-> Stream a Source #
for uncodiagonals, the i'th list element of the input stream must have length i
.
uncodiagonals ([a] `Pre` [b,c] `Pre` [d,e,f] ...)
== Pre (a `Pre` c `Pre` f ...) $
Pre (b `Pre` e `Pre` ...) $
Pre (d `Pre` ... ) $
...
split_dimension :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a Source #
split_planar :: (ConjugateSymmetric a, Num a, Closed a) => Stream a -> Stream a :-> Stream a Source #
codiagonalsIso :: (ConjugateSymmetric a, Num a, Closed a, BiArrow arr) => arr (Stream a :-> Stream a) (Stream [a]) Source #
lower_triangle :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream a :-> Stream a Source #
lower_triangle takes lower half of a two-dimensional stream split at diagonal.
upper_triangle :: (ConjugateSymmetric a, Num a, Closed a) => (Stream a :-> Stream a) -> Stream a :-> Stream a Source #
upper_triangle takes upper half of a two-dimensional stream split at diagonal.
pairing_matrix :: Fractional a => (Stream :*: Stream) a Source #
concatenate :: Stream [a] -> Stream a Source #
concatenate a stream of lists to a stream of elements
diagonalize :: Stream [a] -> Stream a Source #
diagonal_differences :: (ConjugateSymmetric a, Num a, Closed a) => (a -> b) -> (Stream a :-> Stream a) -> Stream b Source #
fixedpoint :: (ConjugateSymmetric a, Num a, Closed a, Eq a) => (a -> a) -> (Stream a :-> Stream a) -> a Source #
cojoin :: (Stream :*: Stream) a -> Stream a Source #
cojoin is "better" version of join for streams. cojoin does not satisfy monad laws (Right identity and associativity do not hold.). It eventually produces every element of the original two-dimensional stream. It first produces all elements \(e_{(i,j)}\) where \(i+j=k\) and \(k\) increasing.
(|*|) :: Closed a => Stream a -> Stream a -> Stream (Vector2 a) Source #
naturals |*| naturals == (0,0), [note sum=0] (0,1),(1,0), [note sum=1] (0,2),(2,0),(1,1), [note sum=2] (0,3),(3,0),(1,2),(2,1), [note sum=3] (0,4),(4,0),(1,3),(3,1),(2,2), [note sum=4] ...
(>>!=) :: Num b => Stream a -> (a -> Stream b) -> Stream b Source #
For a better "bind" operation, there exists (>>!=), which produces the following result (note duplicates):
naturals >>!= \x -> naturals >>!= \y -> return (x,y) == (0,0), (0,0),(1,0), (0,1),(1,0),(2,0), (0,0),(1,1),(2,0),(3,0), (0,1),(1,0),(2,1),(3,0),(4,0), (0,2),(1,1),(2,0),(3,1),(4,0),(5,0), (0,0),(1,2),(2,1),(3,0),(4,1),(5,0),(6,0), (0,1),(1,0),(2,2),(3,1),(4,0),(5,1),(6,0),(7,0), (0,2),(1,1),(2,0),(3,2),(4,1),(5,0),(6,1),(7,0),(8,0), (0,3),(1,2),(2,1),(3,0),(4,2),(5,1),(6,0),(7,1),(8,0),(9,0), ...
(>!=) :: Num b => Stream a -> (a -> Stream b) -> Stream [b] Source #
The (>!=) is like binding, but the results are packaged to a finite list. Again note duplicates.
naturals >!= \x -> naturals >!= \y -> return (x,y) == [[(0,0)] ], [[(0,0),(0,1)], [(1,0)] ], [[(0,0),(0,1),(0,2)], [(1,0),(1,1)], [(2,0)], ], [[(0,0),(0,1),(0,2),(0,3)], [(1,0),(1,1),(1,2)], [(2,0),(2,1)], [(3,0)] ], ...
integers_stream :: Stream Integer Source #
A stream of integers. This is specialized version of naturals for integers
naturals_starting_from :: (Num a, Ord a) => a -> Stream a Source #
A stream of increasing numbers starting from a given number.
nonzero_naturals :: Num a => Stream a Source #
A stream of increasing numbers starting from 1
integral_nonzero_naturals :: Integral a => Stream a Source #
integral_naturals :: Integral a => Stream a Source #
s_z :: Num a => Stream a Source #
This is the variable used in generating functions. Note that in multidimensional streams, this is the variable associated with the largest dimension.
s_z3 :: Num a => Stream (Stream (Stream a)) Source #
variable associated with third largest dimension
stream_logarithm :: Fractional a => Stream a -> Stream a Source #
approximate_sums :: Fractional a => Stream a -> Stream a -> Stream a Source #
For a stream of terms \(a=[a_0,a_1,a_2,...]\), and \(x=[x_0,x_1,x_2,...]\), 'approximate_sums a x' computes \[\sum_{i=0}^n{a_ix_i^i}\], where n is the index to the result stream.
exponential_stream :: Fractional a => Stream a Source #
exponential_stream computes \(s_{i} = {{1}\over{i!}}\).
notice that euler's constant \(e = \sum_{i=0}^{\infty}{1\over{i!}}\).
therefore "sum_stream exponential_stream" produces approximations to e
.
exponential :: (ConjugateSymmetric a, Closed a, Eq a, Fractional a) => Stream a -> Stream a Source #
log_generating_function :: Fractional a => Stream a Source #
cos_stream :: (Closed a, Fractional a) => Stream a -> Stream a Source #
sin_stream :: (Closed a, Fractional a) => Stream a -> Stream a Source #
sin_generating_function :: Fractional a => Stream a Source #
cos_generating_function :: Fractional a => Stream a Source #
reciprocal :: Fractional a => Stream a -> Stream a Source #
both reciprocal and inversion are the inverse of a Cauchy product. see http://en.wikipedia.org/wiki/Formal_power_series
reciprocal s * s == unit_product
inversion :: Integral a => Stream a -> Stream a Source #
see http://en.wikipedia.org/wiki/Formal_power_series
inversion s * s == unit_product
.
unit_product :: Num a => Stream a Source #
unit_product is the unit element of (*) for streams.
fromList :: Num a => [a] -> Stream a Source #
The cycle
operation is better than fromList
, if the list is infinite,
because it will ensure the result is infinite (and no Num constraint is needed).
filter :: (a -> Bool) -> Stream a -> Stream a Source #
filter f s
for streams does not terminate, if the input stream never
contains any elements e
for which f e == True
.
interleave_count :: Integer -> Stream a -> Stream a -> Stream a Source #
interleave_count
is like interleave
except that i
elements of each
stream are taken from each stream at each stream.
interleave_stream :: Stream a -> Stream a -> Stream a Source #
interleave two streams such that even indexed elements of result are from first input stream and odd indexed elements of result are from second stream.
interleave_either :: Stream a -> Stream b -> Stream (Either a b) Source #
version of interleave that produces either instances
uninterleave :: Stream a -> (Stream a, Stream a) Source #
split a stream, elements with even index go to first result stream, rest to second.
interleave_lst :: [Stream a] -> Stream a Source #
interleave a non-empty list of streams.
uninterleave_lst :: Integer -> Stream a -> [Stream a] Source #
uninterleave to an indicated number of streams.
uninterleave_queue :: Integer -> Stream a -> (Queue :*: Stream) a Source #
uninterleave to a queue of streams
drop :: Integer -> Stream a -> Stream a Source #
drop a specified number of elements from beginning of a stream.
take :: Integer -> Stream a -> [a] Source #
take a specified number of elements from the beginning of the stream.
countWhile :: (a -> Bool) -> Stream a -> Integer Source #
count how many elements from a beginning of a stream satisfy a predicate.
takeWhile :: (a -> Bool) -> Stream a -> [a] Source #
take elements from a stream while predicate is true.
dropWhile :: (a -> Bool) -> Stream a -> Stream a Source #
drop elements from a stream while predicate is true.
cycle :: [a] -> Stream a Source #
The cycle
operation is better than fromList for converting a list to stream,
if the list is infinite, because it will ensure the result is infinite.
cycle_queue :: Queue a -> Stream a Source #
use elements of a queue to produce an infinite stream.
stirling_numbers :: Num a => (Stream :*: Stream) a Source #
stirling numbers are the numbers obtained from \(z (z+1) ... (z+n)\)
natural_prefixes :: Num a => Stream [a] Source #
power :: Fractional a => Integer -> Stream a Source #
stream of powers of a given integer for fractional items
power_uniform_fractional :: Fractional a => a -> Stream a Source #
power_integral :: Integral a => Integer -> Stream a Source #
stream of powers of a given integer for integral items.
power_uniform_integral :: Integral a => a -> Stream a Source #
exp_generating_function :: (ConjugateSymmetric a, Closed a, Floating a, Eq a) => Stream a Source #
exponential_generating_function :: Fractional a => Stream a -> Stream a Source #
https://en.wikipedia.org/wiki/Generating_function. \[EGF(z \mapsto \sum_{k=0}^{\infty}{s_kz^k}) = z \mapsto \sum_{k=0}^{\infty}{{1\over{k!}}{s_kz^k}}\].
poisson_generating_function :: (ConjugateSymmetric a, Closed a, Eq a, Floating a) => Stream a -> Stream a Source #
powers :: Num a => Stream a -> (Stream :*: Stream) a Source #
input stream elements are raised to n'th power.
cauchy_powers :: Num a => a -> Stream a Source #
input element is raised to successive increasing powers (first element of the stream is \(n^1\))
binomial_coefficient :: Integral a => Integer -> Integer -> a Source #
The elements of pascal triangle are binomial coefficients.
catalan_numbers_floating :: (ConjugateSymmetric a, Closed a, Eq a, Floating a) => Stream a Source #
http://en.wikipedia.org/wiki/Catalan_number of floating elements.
pascal_triangle :: Integral a => (Stream :*: Stream) a Source #
pascal triangle, elements are binomial coefficients. https://en.wikipedia.org/wiki/Pascal%27s_triangle this expands "down" (leaving zero elements)
pascal_triangle_diag :: Integral a => (Stream :*: Stream) a Source #
pascal triangle which expands towards the diagonal
pascal_triangle_diag_fractional :: Fractional a => (Stream :*: Stream) a Source #
binomial_coefficients :: Integral a => Stream [a] Source #
exp_approx :: Fractional a => a -> Stream a Source #
polynomial_powers :: Integral a => a -> a -> Stream a Source #
computes \((a + b)^n\) for all n, using binomial coefficients.
Hint: use z
in one of the argument.
pascal_triangle == Matrix $ polynomial_powers 1 z
Note: stream_powers can sometimes be a more efficient alternative.
polynomial_powers_fractional :: Fractional a => a -> a -> Stream a Source #
fib :: Integral a => Stream a Source #
a stream of fibonacci numbers,
each element is a sum of two previous elements.
1,1,2,3,5,8,13,21,34,55,...
triangular_numbers :: Integral a => Stream a Source #
Triangular numbers. https://en.wikipedia.org/wiki/Generating_function
1,3,6,10,15,21,28,36,...
alternating_signs :: Fractional a => Stream a Source #
1.0,-1.0,1.0,-1.0,...
alternating_bits :: Fractional a => Stream a Source #
1.0,0.0,1.0,0.0,1.0,0.0,...
odd_integers :: Integral a => Stream a Source #
stream of odd integers
odd_integers_ :: Integral a => Stream a Source #
integers_divisible_by :: Integer -> Stream Integer Source #
This is an ideal of the set of positive integers, usually denoted \(nZ^+\),
e.g. set of positive integers divisible by n
.
residue_class_modulo :: Integer -> Integer -> Stream Integer Source #
This function produces the equivalence class of m mod n. The numbers produced by the stream are considered as equivalent by the equivalence class.
peirces_triangle_func :: (Num a, Ord a) => a -> a -> a Source #
peirces_triangle is the number of set partitions. From Knuth: The art of Computer Programming, Volume 4 "Generating all combinations and partitions", page 64.
peirces_triangle :: (Num a, Ord a) => (Stream :*: Stream) a Source #
peirces_triangle is the number of set partitions. From Knuth: The art of Computer Programming, Volume 4 "Generating all combinations and partitions", page 64.
falling_factorial_powers_diag :: (ConjugateSymmetric a, Integral a, Closed a) => Stream a :-> Stream a Source #
https://en.wikipedia.org/wiki/Injective_function?wprof=sfla1 falling factorial powers specify number of injective functions from domain with specified number of elements to codomain with specified number of elements. https://en.wikipedia.org/wiki/Falling_and_rising_factorials?wprof=sfla1
Be careful about indices here, could cause off-by-one error!
bell_numbers :: (Num a, Ord a) => Stream a Source #
bell numbers https://en.wikipedia.org/wiki/Bell_number. also see Knuth: The Art of Computer Programming, Volume 4.
square_root :: Integral a => a -> Stream a Source #
newton's method of computing square root approximations:
fractional_square_root :: (Fractional a, Eq a) => a -> Stream a Source #
detect_cycle :: Eq a => Stream a -> [a] Source #
This is an implementation of Floyd's cycle-finding algorithm http://en.wikipedia.org/wiki/Cycle_detection.
derivative :: Num a => Stream a -> Stream a Source #
derivative calculates the derivative of the generating function. https://en.wikipedia.org/wiki/Generating_function \[{\rm{derivative}}({\bf{a}})_i = {\bf{b}}_i = (i+1){\bf{a}}_{i+1}\] \[f(z) = \sum_{i=0}^{\infty}{\bf{a}}_iz^i\] \[f'(z) = \sum_{i=0}^{\infty}{\bf{b}}_iz^i = {d\over{dz}} \sum_{i=0}^{\infty}{\bf{a}}_iz^i = \sum_{i=0}^{\infty}(i+1){\bf{a}}_{i+1}z^i\]
monotonic_membership :: Ord a => Stream a -> Stream a -> Stream Bool Source #
for two monotone streams, compares whether all elements of the first stream
are also in the second stream. produces True
for every element of
the first stream, if that element is part of the second stream.
produces error if the streams are not monotone.
sqrt_stream :: (Floating a, Closed a) => Stream a -> Stream a Source #
Square root algorithm is from Simpson: Power Series, http://caps.gsfc.nasa.gov/simpson/ref/series.pdf
stream_epsilon :: (ConjugateSymmetric a, Closed a, Fractional a) => Stream a :-> Stream a Source #
another_epsilon :: (ConjugateSymmetric a, Closed a, Fractional a) => Stream a :-> Stream a Source #
stream_derivate :: (Fractional a, Closed a, Infinitesimal str (Stream a)) => (Stream a -> Stream a) -> Stream a -> Closure str (Stream a) Source #
derivate a stream function at a particular point.
stream_integral :: (Closed b, Infinitesimal str (Stream b), Fractional b, Enum b) => (Stream b -> Stream b) -> (Stream b, Stream b) -> Closure str (Stream b) Source #
stream_pi :: (Infinitesimal str (Stream a), ConjugateSymmetric a, Closed a, Fractional a, Enum a, Eq a, Floating a) => Closure str (Stream a) Source #
gcd_primes :: Integral a => Stream a Source #
gcd_prime_gen :: Integral a => a -> a Source #
vector_epsilon :: Infinitesimal Stream a => Stream (Vector3 a) Source #
derivative_coefficients_fractional :: Fractional a => (Stream :*: Stream) a Source #
derivative_linear_map :: (ConjugateSymmetric a, Closed a) => Stream a :-> Stream a Source #
bernoulli_minus :: Fractional a => Integer -> a Source #
bernoulli_plus :: Fractional a => Integer -> a Source #
bernoulli :: Fractional a => Stream a Source #
bernoulli_polynomial :: Fractional b => b -> Integer -> b Source #
bernoulli_polynomials :: Fractional a => (Stream :*: Stream) a Source #
bernoulli_polynomial_coefficients :: Fractional a => Stream [a] Source #
legendre_polynomials :: (Closed a, Eq a, ConjugateSymmetric a, Floating a) => (Stream :*: Stream) a Source #
legendre_polynomial_lists :: (Closed a, Num a, Eq a, ConjugateSymmetric a, Floating a) => Stream [a] Source #
evaluate_polynomial :: Fractional a => [a] -> a -> a Source #
evaluate_legendre_polynomial :: (Fractional a, Closed a, Eq a, ConjugateSymmetric a, Floating a) => Integer -> a -> a Source #
evaluate_legendre_at :: (Fractional a, Closed a, Eq a, ConjugateSymmetric a, Floating a) => a -> Stream a Source #